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(self): try: zfs = ZFS() args = self.deleteParser.parse_args() self.deleteHandler(args) except (TypeError, ValueError, CommandError), e: return {'status': str(e)}, 501
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()
def deleteHandler(self, args): zfs = ZFS() zfs.destroy(args)
def postHandler(self, args): zfs = ZFS() zfs.create(args)
def get(self): zfs = ZFS() return jsonify(zfs.attributes)
def get(self): zfs = ZFS() return jsonify(zfs.filesystems)
def get(self): zfs = ZFS() return jsonify(zfs.volumes)
def get(self): zfs = ZFS() return jsonify(zfs.snapshots)
def postHandler(self, args): zfs = ZFS() zfs.clone(args)
def postHandler(self, args): zfs = ZFS() zfs.snapshot(args)