Пример #1
0
 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();
 }
Пример #2
0
 @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);
 }
 VmInstanceInventory create() throws ApiSenderException {
   APICreateVmInstanceMsg msg = new APICreateVmInstanceMsg();
   msg.setClusterUuid(clusterUUid);
   msg.setImageUuid(imageUuid);
   msg.setName(name);
   msg.setHostUuid(hostUuid);
   msg.setDataDiskOfferingUuids(diskOfferingUuids);
   msg.setInstanceOfferingUuid(instanceOfferingUuid);
   msg.setL3NetworkUuids(l3NetworkUuids);
   msg.setType(VmInstanceConstant.USER_VM_TYPE);
   msg.setZoneUuid(zoneUuid);
   msg.setHostUuid(hostUuid);
   msg.setServiceId(ApiMediatorConstant.SERVICE_ID);
   msg.setSession(api.getAdminSession());
   ApiSender sender = new ApiSender();
   APICreateVmInstanceEvent evt = sender.send(msg, APICreateVmInstanceEvent.class);
   return evt.getInventory();
 }