Beispiel #1
0
 def create_from_raw(self, base, size=None):
     self._assert_image_not_larger(base, size)
     utils.execute('qemu-img', 'create', '-f', 'qcow2', '-o',
         'cluster_size=2M,backing_file=%s' % base,
         self.path())
     if size:
         disk.extend(self.image_path, size)
Beispiel #2
0
 def create_from_raw(self, base, size=None):
     self._assert_image_not_larger(base, size)
     utils.execute('cp', base, self.image_path)
     if size:
         disk.extend(self.image_path, size)
Beispiel #3
0
def fetch_image(context, target, image_id, user_id, project_id,
                 size=None):
    """Grab image and optionally attempt to resize it"""
    images.fetch(context, image_id, target, user_id, project_id)
    if size:
        disk.extend(target, size)