Пример #1
0
 def shutdown(self):
     """
     Shuts down this VM.
     """
     try:
         if virsh.domstate(self.name) != "shut off":
             virsh.shutdown(self.name, uri=self.connect_uri)
         if self.wait_for_shutdown():
             logging.debug("VM %s shut down", self.name)
             return True
         else:
             logging.error("VM %s failed to shut down", self.name)
             return False
     except error.CmdError:
         logging.error("VM %s failed to shut down", self.name)
         return False
Пример #2
0
 def shutdown(self):
     """
     Shuts down this VM.
     """
     if virsh.shutdown(self.name, uri=self.connect_uri):
         if self.wait_for_shutdown():
             logging.debug("VM %s shut down", self.name)
             return True
         else:
             logging.error("VM %s failed to shut down", self.name)
             return False
     else:
         logging.error("VM %s failed to shut down", self.name)
         return False