示例#1
0
    def convert_image_to_raw(self, image_build_path, target_path):
        # Se a imagem ja existe, remove
        if os.path.exists(target_path):
            os.unlink(target_path)

        images.convert_image(image_build_path, target_path, 'qcow2', 'raw')
        os.unlink(image_build_path)
示例#2
0
 def create_lvm_image(base, size):
     base_size = disk.get_disk_size(base)
     resize = size > base_size
     size = size if resize else base_size
     libvirt_utils.create_lvm_image(self.vg, self.lv, size, sparse=self.sparse)
     images.convert_image(base, self.path, "raw", run_as_root=True)
     if resize:
         disk.resize2fs(self.path, run_as_root=True)
示例#3
0
    def export_image(self, source, dest, out_format):
        """Export ScaleIO volume.

        :param source: Local attached ScaleIO volume path to export from
        :param dest: Target path
        :param out_format: Output format (raw, qcow2, etc)
        :return: Nothing
        """
        images.convert_image(source, dest, 'raw', out_format, run_as_root=True)
示例#4
0
 def create_lvm_image(base, size):
     base_size = disk.get_disk_size(base)
     self.verify_base_size(base, size, base_size=base_size)
     resize = size > base_size
     size = size if resize else base_size
     lvm.create_volume(self.vg, self.lv,
                                  size, sparse=self.sparse)
     images.convert_image(base, self.path, 'raw', run_as_root=True)
     if resize:
         disk.resize2fs(self.path, run_as_root=True)
示例#5
0
    def import_image(self, source, dest):
        """Import glance image onto actual ScaleIO block device.

        :param source: Glance image source
        :param dest: Target ScaleIO block device
        :return: Nothing
        """
        info = images.qemu_img_info(source)
        images.convert_image(source, dest, info.file_format, 'raw',
                             run_as_root=True)
示例#6
0
 def create_lvm_image(base, size):
     base_size = disk.get_disk_size(base)
     self.verify_base_size(base, size, base_size=base_size)
     resize = size > base_size
     size = size if resize else base_size
     lvm.create_volume(self.vg, self.lv, size, sparse=self.sparse)
     if self.ephemeral_key_uuid is not None:
         encrypt_lvm_image()
     images.convert_image(base, self.path, "raw", run_as_root=True)
     if resize:
         disk.resize2fs(self.path, run_as_root=True)
示例#7
0
文件: utils.py 项目: mahak/nova
def extract_snapshot(disk_path, source_fmt, out_path, dest_fmt):
    """Extract a snapshot from a disk image.
    Note that nobody should write to the disk image during this operation.

    :param disk_path: Path to disk image
    :param out_path: Desired path of extracted snapshot
    """
    # NOTE(markmc): ISO is just raw to qemu-img
    if dest_fmt == 'iso':
        dest_fmt = 'raw'
    if dest_fmt == 'ploop':
        dest_fmt = 'parallels'

    compress = CONF.libvirt.snapshot_compression and dest_fmt == "qcow2"
    images.convert_image(disk_path, out_path, source_fmt, dest_fmt,
                         compress=compress)
示例#8
0
 def snapshot_extract(self, target, out_format):
     images.convert_image(self.path, target, out_format)
示例#9
0
 def snapshot_extract(self, target, out_format):
     images.convert_image(self.path, target, out_format,
                          run_as_root=True)
 def snapshot_extract(self, target, out_format):
     snap = 'rbd:%s/%s' % (self.pool, self.rbd_name)
     images.convert_image(snap, target, out_format)
示例#11
0
 def snapshot_extract(self, target, out_format):
     images.convert_image(self.snapshot_path,
                          target,
                          out_format,
                          run_as_root=True)
示例#12
0
 def snapshot_extract(self, target, out_format):
     images.convert_image(self.path, target, out_format)
示例#13
0
 def snapshot_extract(self, target, out_format):
     snap = 'rbd:%s/%s' % (self.pool, self.rbd_name)
     images.convert_image(snap, target, out_format)