VmInstanceInventory start() throws ApiSenderException { APIStartVmInstanceMsg msg = new APIStartVmInstanceMsg(); msg.setUuid(vmUuid); msg.setHostUuid(hostUuid); msg.setClusterUuid(clusterUuid); msg.setSession(api.getAdminSession()); ApiSender sender = new ApiSender(); APIStartVmInstanceEvent evt = sender.send(msg, APIStartVmInstanceEvent.class); return evt.getInventory(); }
@Test public void test() throws ApiSenderException { ImageInventory iminv = deployer.images.get("TestImage"); InstanceOfferingInventory ioinv = deployer.instanceOfferings.get("TestInstanceOffering"); L3NetworkInventory l3inv = deployer.l3Networks.get("TestL3Network2"); APICreateVmInstanceMsg msg = new APICreateVmInstanceMsg(); msg.setImageUuid(iminv.getUuid()); msg.setInstanceOfferingUuid(ioinv.getUuid()); List<String> l3uuids = new ArrayList<String>(); l3uuids.add(l3inv.getUuid()); msg.setL3NetworkUuids(l3uuids); msg.setName("TestVm"); msg.setSession(session); msg.setServiceId(ApiMediatorConstant.SERVICE_ID); msg.setType(VmInstanceConstant.USER_VM_TYPE); ApiSender sender = api.getApiSender(); sender.send(msg, APICreateVmInstanceEvent.class); }