def list(self, msg): ret = [] vms = Vms(msg) for _, val in vms.items(): vm = VM(val) vm._load() vm['uuid'] = vm.key if vm['ip'] == 'None': vm['ip'] = 'DHCP' ret.append(vm.data) return ret
def vm_edit(self, args): vm = VM(key=args['name']) vm._load() vm[args['key']] = args['value'] vm.save() vm.update_xml() return vm[args['key']]
def vm_delete(self, args): vm = VM(key=args['name']) return vm.delete()
def vm_restart(self, args): vm = VM(key=args['name']) return vm.restart()
def vm_destroy(self, args): vm = VM(key=args['name']) return vm.destroy()
def vm_stop(self, args): vm = VM(key=args['name']) return vm.stop()
def vm_create(self, args): vm = VM() return vm.create(name=args['name'], ram=args['ram'], cpus=args['cpus'], base=args['base'])
def vm_get(self, args): vm = VM(key=args['name']) vm._load() return vm.data