dom0/qvm-tools: check if VM is running before shutdown/kill

This commit is contained in:
Marek Marczykowski 2013-02-07 11:38:06 +01:00
parent fdd4078624
commit c94058cac4

View File

@ -1628,6 +1628,9 @@ class QubesVm(object):
if dry_run:
return
if not self.is_running():
raise QubesException ("VM already stopped!")
subprocess.call (['/usr/sbin/xl', 'shutdown', str(xid) if xid is not None else self.name])
#xc.domain_destroy(self.get_xid())
@ -1635,6 +1638,9 @@ class QubesVm(object):
if dry_run:
return
if not self.is_running() and not self.is_paused():
raise QubesException ("VM already stopped!")
subprocess.call (['/usr/sbin/xl', 'destroy', str(xid) if xid is not None else self.name])
def pause(self):