def create_clones(self, task): # Set up ZFS and Target management zfs = ZFS() mgr = TargetManager() num_created = 0 task.set_status_start_creating_clones() for arg in task.details['clones']: self.create_clone(zfs, arg) task.increment_num_clones() task.set_status_done_creating_clones() # Give udevd a chance to settle down and create associated devices task.set_status_start_waiting_udevd() zfs.udevd_settle_down() task.set_status_done_waiting_udevd() task.set_status_start_creating_targets() for arg in task.details['clones']: self.create_target(mgr, arg) task.increment_num_targets() task.increment_num_completed() task.set_status_done_creating_targets() mgr.save()
def delete_clones(self, task): # Set up ZFS and Target management zfs = ZFS() mgr = TargetManager() task.set_status_start_deleting_targets() for arg in task.details['clones']: self.remove_target(mgr, arg) task.increment_num_clones() task.set_status_done_deleting_targets() task.set_status_start_deleting_clones() for arg in task.details['clones']: self.remove_clone(task, zfs, arg) task.increment_num_targets() task.increment_num_completed() task.set_status_done_deleting_clones() mgr.save()