Commit a9c1e76b by Szeberényi Imre

Merge branch 'resize-via-qemu' into 'master'

resize add via qemu

See merge request !4
parents 2b5fe878 0794ccb1
......@@ -217,8 +217,14 @@ class Disk(object):
self.size = Disk.get(self.dir,
def resize(self, newsize):
file = self.get_path()
# can't resize an image which has snapchots
cmdline =[ 'qemu-img', 'resize', file, newsize]
self.size = Disk.get(self.dir,
def download(self, task, url, parent_id=None): # noqa
def download(self, task, url, parent_id=None, resize=None): # noqa
"""Download image from url."""
disk_path = self.get_path()"Downloading image from %s to %s", url, disk_path)
......@@ -267,6 +273,10 @@ class Disk(object):
self.size = Disk.get(self.dir,
logger.debug("Download finished %s (%s bytes)",, self.size)
if resize:
logger.debug("Resize finished %s (%s bytes)",, self.size)
except AbortException:
# Cleanup file:
......@@ -29,6 +29,12 @@ def create(disk_desc):
def resizeqemu(disk_desc, newsize):
disk = Disk.deserialize(disk_desc)
def create_ci_disk(disk_desc, meta_data, user_data, network_data):
disk = Disk.deserialize(disk_desc)
disk.create_ci_disk(meta_data=meta_data, user_data=user_data, network_data=network_data)
......@@ -44,8 +50,9 @@ class download(AbortableTask):
disk_desc = kwargs['disk']
url = kwargs['url']
parent_id = kwargs.get("parent_id", None)
resize = kwargs.get('resize', None)
disk = Disk.deserialize(disk_desc), url, parent_id), url, parent_id, resize)
return {'size': disk.size,
'type': disk.format,
'checksum': disk.checksum, }
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