Commit 73dd2d63 by Czémán Arnold

some small fix

parent 2dbb5cd4
...@@ -285,21 +285,17 @@ class Disk(object): ...@@ -285,21 +285,17 @@ class Disk(object):
disk_path) disk_path)
def common_snapshot_operation(self, cmdline): def common_snapshot_operation(self, cmdline):
# Check if file already exists
if not os.path.isfile(self.get_path()): if not os.path.isfile(self.get_path()):
raise Exception('Image does not exists: %s' % self.get_path()) raise Exception('Image does not exist: %s' % self.get_path())
# Build list of Strings as command parameters
if self.format == 'iso' or self.format == 'raw': if self.format == 'iso' or self.format == 'raw':
raise NotImplemented() raise NotImplemented()
else: try:
# Call subprocess return subprocess.check_output(cmdline)
try: except subprocess.CalledProcessError as e:
return subprocess.check_output(cmdline) logger.error(e)
except subprocess.CalledProcessError as e: raise Exception(unicode(e))
logger.error(e)
raise Exception(unicode(e))
def snapshot(self, snapshot_name): def create_snapshot(self, snapshot_name):
''' Creating qcow2 snapshot. ''' Creating qcow2 snapshot.
''' '''
cmdline = ['qemu-img', cmdline = ['qemu-img',
......
...@@ -60,9 +60,9 @@ def snapshot_from_base(json_data): ...@@ -60,9 +60,9 @@ def snapshot_from_base(json_data):
@celery.task() @celery.task()
def snapshot(disk_desc, snapshot_name): def create_snapshot(disk_desc, snapshot_name):
disk = Disk.deserialize(disk_desc) disk = Disk.deserialize(disk_desc)
disk.snapshot(snapshot_name) disk.create_snapshot(snapshot_name)
@celery.task() @celery.task()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment