Skip to content
Snippets Groups Projects
Commit 5644c956 authored by Benziane Chakib's avatar Benziane Chakib
Browse files

Added error handling for suspend and resume vm

parent 6012fcd5
No related branches found
No related tags found
No related merge requests found
......@@ -173,10 +173,16 @@ class LibvirtVm(VM):
raise VMError('%s is already running !' % self.get_name())
def suspend(self):
self._domain.suspend()
try:
self._domain.suspend()
except libvirt.libvirtError:
raise VMError('%s is not running !' % self.get_name())
def resume(self):
self._domain.resume()
try:
self._domain.resume()
except libvirt.libvirtError:
raise VMError('%s is not running !' % self.get_name())
def get_uuid(self):
'''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment