def VM_getInfo_Call(api, args): """ The VM object has no getInfo method. We use the method from 'Global' and pass arguments to get verbose information for only this one VM. """ vmId = api._UUID return API.Global().getVMList(True, [vmId], False)
def Host_getVMList_Call(api, args): """ This call is only interested in returning the VM UUIDs so pass False for the first argument in order to suppress verbose results. """ vmList = args.get('vmList', []) onlyUUID = args.get('onlyUUID', True) return API.Global().getVMList(False, vmList, onlyUUID)
def _createImage(self): # Required headers spUUID = self.headers.getheader(self.HEADER_POOL) sdUUID = self.headers.getheader(self.HEADER_DOMAIN) imgUUID = self.headers.getheader(self.HEADER_IMAGE) if not all((spUUID, sdUUID, imgUUID)): raise RequestException( httplib.BAD_REQUEST, "missing or empty required header(s):" " spUUID=%s sdUUID=%s imgUUID=%s" % (spUUID, sdUUID, imgUUID)) return API.Image(imgUUID, spUUID, sdUUID)
def testAllVmStats(self): with fake.VM(_VM_PARAMS) as testvm: with MonkeyPatchScope([(clientIF, 'getInstance', lambda _: testvm.cif)]): api = API.Global() # here is where clientIF will be used. response = api.getAllVmStats() self.assertEqual(response['status']['code'], 0) for stat in response['statsList']: self.assertVmStatsSchemaCompliancy('RunningVmStats', stat)
def setUp(self): self.uuid = API.VM.BLANK_UUID self.cif = FakeClientIF() self.vmParams = { 'vmId': self.uuid, 'vmName': 'TESTING', 'memSize': 8 * 1024, 'vmType': 'kvm', 'display': 'qxl', 'kvmEnable': 'true', 'smp': '1', } with MonkeyPatchScope([(API, 'clientIF', self.cif)]): self.vm = API.VM(self.uuid) # to make testing easier threadlocal.vars.context = api.Context("flow_id", "1.2.3.4", 5678)
def Host_getVMFullList_Call(api, args): """ This call is interested in returning full status. """ vmList = args.get('vmList', []) return API.Global().getVMList(True, vmList, False)