예제 #1
0
파일: hbsd_common.py 프로젝트: Qeas/cinder
    def create_snapshot(self, snapshot):
        src_ref = self.get_volume(snapshot['volume_id'])
        pvol = self.get_ldev(src_ref)
        if pvol is None:
            msg = basic_lib.output_err(624, type='volume', id=src_ref['id'])
            raise exception.HBSDError(message=msg)

        self.add_volinfo(pvol, src_ref['id'])
        with self.volume_info[pvol]['in_use']:
            is_vvol = self.get_volume_is_vvol(src_ref)
            self.check_volume_status(src_ref, is_vvol)
            size = snapshot['volume_size']
            snap_metadata = self.get_snapshot_metadata(snapshot['id'])
            method = None if is_vvol else self.get_copy_method(src_ref)

            svol, type = self.copy_data(pvol, size, is_vvol, method)

        if type == 'V-VOL':
            snap_metadata['type'] = type
            snap_metadata['ldev'] = svol

        snapshot_metadata = api._metadata_refs(snap_metadata,
                                               models.SnapshotMetadata)
        return {'provider_location': svol,
                'snapshot_metadata': snapshot_metadata}
예제 #2
0
    def create_snapshot(self, snapshot):
        src_ref = self.get_volume(snapshot['volume_id'])
        pvol = self.get_ldev(src_ref)
        if pvol is None:
            msg = basic_lib.output_err(624, type='volume', id=src_ref['id'])
            raise exception.HBSDError(message=msg)

        self.add_volinfo(pvol, src_ref['id'])
        with self.volume_info[pvol]['in_use']:
            is_vvol = self.get_volume_is_vvol(src_ref)
            self.check_volume_status(src_ref, is_vvol)
            size = snapshot['volume_size']
            snap_metadata = self.get_snapshot_metadata(snapshot['id'])
            method = None if is_vvol else self.get_copy_method(src_ref)

            svol, type = self.copy_data(pvol, size, is_vvol, method)

        if type == 'V-VOL':
            snap_metadata['type'] = type
            snap_metadata['ldev'] = svol

        snapshot_metadata = api._metadata_refs(snap_metadata,
                                               models.SnapshotMetadata)
        return {'provider_location': svol,
                'snapshot_metadata': snapshot_metadata}