Example #1
0
 def is_persistent(self):
     """
     Return True if VM is persistent.
     """
     try:
         return bool(
             re.search(r"^Persistent:\s+[Yy]es", virsh.dominfo(self.name, uri=self.connect_uri), re.MULTILINE)
         )
     except error.CmdError:
         return False
Example #2
0
 def is_persistent(self):
     """
     Return True if VM is persistent.
     """
     try:
         return bool(re.search(r"^Persistent:\s+[Yy]es",
                     virsh.dominfo(self.name, uri=self.connect_uri),
                     re.MULTILINE))
     except error.CmdError:
         return False
Example #3
0
 def dominfo(self):
     """
     Return a dict include vm's infomation.
     """
     output = virsh.dominfo(self.name, uri=self.connect_uri)
     # Key: word before ':' | value: content after ':' (stripped)
     dominfo_dict = {}
     for line in output.splitlines():
         key = line.split(":")[0].strip()
         value = line.split(":")[-1].strip()
         dominfo_dict[key] = value
     return dominfo_dict
Example #4
0
 def dominfo(self):
     """
     Return a dict include vm's infomation.
     """
     output = virsh.dominfo(self.name, uri=self.connect_uri)
     # Key: word before ':' | value: content after ':' (stripped)
     dominfo_dict = {}
     for line in output.splitlines():
         key = line.split(':')[0].strip()
         value = line.split(':')[-1].strip()
         dominfo_dict[key] = value
     return dominfo_dict