def take_snapshots_on_data_images(self): """take snapshots on data images""" snapshot_options = {} for idx, source_node in enumerate(self._source_nodes): backup_utils.blockdev_snapshot(self.main_vm, source_node, self._snap_nodes[idx], **snapshot_options)
def create_snapshot(self, source): snapshot_options = {} source_node = "drive_%s" % source source_params = self.params.object_params(source) snapshot_tag = source_params["snapshot"] snapshot_node = "drive_%s" % snapshot_tag snapshot_img = self.target_disk_define_by_params( self.params, snapshot_tag) snapshot_img.hotplug(self.main_vm) self.trash.append(snapshot_img) backup_utils.blockdev_snapshot(self.main_vm, source_node, snapshot_node, **snapshot_options)
def snapshot_test(self): """create one snapshot, create one new file""" self.generate_tempfile(self.disks_info[0][1], filename="base", size=self.params["tempfile_size"]) # data->sn1->sn2->sn3 chain = [self.base_tag] + self._snapshot_images for idx in range(1, len(chain)): backup_utils.blockdev_snapshot(self.main_vm, "drive_%s" % chain[idx - 1], "drive_%s" % chain[idx]) self.generate_tempfile(self.disks_info[0][1], filename=chain[idx], size=self.params["tempfile_size"])
def create_snapshot(self): error_context.context("do snaoshot on multi_disks", logging.info) assert len(self.target_disks) == len( self.source_disks), "No enough target disks define in cfg!" source_lst = list(map(lambda x: "drive_%s" % x, self.source_disks)) target_lst = list(map(lambda x: "drive_%s" % x, self.target_disks)) arguments = {} if len(source_lst) > 1: error_context.context("snapshot %s to %s " % (source_lst, target_lst)) backup_utils.blockdev_batch_snapshot(self.main_vm, source_lst, target_lst, **arguments) else: error_context.context("snapshot %s to %s" % (source_lst[0], target_lst[0])) backup_utils.blockdev_snapshot(self.main_vm, source_lst[0], target_lst[0])
def _blockdev_snapshot(self, nodes, overlays): snapshot_options = {} for idx, source_node in enumerate(nodes): backup_utils.blockdev_snapshot(self.main_vm, source_node, overlays[idx], **snapshot_options)
def create_snapshots(self): for idx, source in enumerate(self._source_images): backup_utils.blockdev_snapshot( self.main_vm, "drive_%s" % source, "drive_%s" % self._snapshot_images[idx])