dom0/qvm-tools: check if VM is running before shutdown/kill
This commit is contained in:
		
							parent
							
								
									fdd4078624
								
							
						
					
					
						commit
						c94058cac4
					
				| @ -1628,6 +1628,9 @@ class QubesVm(object): | |||||||
|         if dry_run: |         if dry_run: | ||||||
|             return |             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]) |         subprocess.call (['/usr/sbin/xl', 'shutdown', str(xid) if xid is not None else self.name]) | ||||||
|         #xc.domain_destroy(self.get_xid()) |         #xc.domain_destroy(self.get_xid()) | ||||||
| 
 | 
 | ||||||
| @ -1635,6 +1638,9 @@ class QubesVm(object): | |||||||
|         if dry_run: |         if dry_run: | ||||||
|             return |             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]) |         subprocess.call (['/usr/sbin/xl', 'destroy', str(xid) if xid is not None else self.name]) | ||||||
| 
 | 
 | ||||||
|     def pause(self): |     def pause(self): | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Marek Marczykowski
						Marek Marczykowski