Examples of VcDatacenter


Examples of com.vmware.aurora.vc.VcDatacenter

      init();
      System.out.println("upload VM template to " + myRP + d1 + net1 + net2);
      VcVirtualMachine vm = null, vm1 = null;
      String vmName = "junit-VcFileTest-VM-" + VcTestConfig.testPostfix;
      String vm1Name = "junit-VcFileTest-VM%1-" + VcTestConfig.testPostfix;
      VcDatacenter dc = d1.getDatacenter();
      try {
         /*
          * Always clean up VMs from previous runs.
          */
         if ((vm = dc.getVirtualMachine(vmName)) != null) {
            vm.destroy();
         }
         if ((vm1 = dc.getVirtualMachine(vm1Name)) != null) {
            vm1.destroy();
         }
         /*
          * Import a VM from OVF.
          */
         vm = VcFileManager.importVm(vmName, myRP, d1, net1, VcTestConfig.ovfPath);
         System.out.println(vm);
         vm = dc.getVirtualMachine(vmName);
         System.out.println(vm);
         vm.dumpDevices();
         System.out.println(VcFileManager.getDsPath(vm, ""));

         /* test device identification */
         DeviceId diskId = new DeviceId("VirtualLsiLogicController:0:0");
         VirtualDevice scsi1 = vm.getVirtualController(diskId);
         VirtualDevice disk1 = vm.getVirtualDevice(diskId);
         DeviceId genDiskId = new DeviceId(scsi1, disk1);
         if (!diskId.equals(genDiskId)) {
            throw new Exception("unmatched disk id " + diskId + " " + genDiskId);
         }

         VirtualDevice.BackingInfo disk1Bk = vm.getVirtualDevice(diskId).getBacking();
         System.out.println("Remove a disk");
         vm.detachVirtualDisk(diskId, false);
         vm.dumpDevices();

         System.out.println("Attach a new disk");
         vm.attachVirtualDisk(new DeviceId("VirtualLsiLogicController", 0, 2),
               VmConfigUtil.createVmdkBackingInfo(vm, "data.vmdk", DiskMode.persistent),
               true, DiskSize.sizeFromGB(8));
         vm.dumpDevices();

         /* test setting extra config */
         Map<String, String> map = new HashMap<String, String>();
         map.put("vmid", "junit-test-vm");
         vm.setDbvmConfig(map);
         map = vm.getDbvmConfig();
         System.out.println(map);

         if(VmConfigUtil.isDetachDiskEnabled()) {
            System.out.println("Attach a disk");
            vm.attachVirtualDisk(diskId, disk1Bk, false, null);
            vm.dumpDevices();
         }

         // create a snapshot so that we can do linked clone
         vm.createSnapshot("snap1", "snap1");
         // test finding snapshots
         vm.createSnapshot("snap2", "snap2");
         VcSnapshot snap1 = vm.getSnapshotByName("snap1");
         AuAssert.check(snap1 != null);
         VcSnapshot snap2 = vm.getSnapshotByName("snap2");
         AuAssert.check(snap2 != null);
         System.out.println("snap1: " + snap1 + " snap2: " + snap2);

         System.out.println("Mark the VM as template");
         vm.markAsTemplate();
         System.out.println(dc.getVirtualMachine(vmName).getInfo());

         /*
          * Test file operations using data.vmdk
          */
         System.out.println("data.vmdk uuid=" +
View Full Code Here

Examples of com.vmware.aurora.vc.VcDatacenter

   private void deleteFolders(BaseNode node) throws BddException {
      String path = node.getVmFolder();
      // path format: <serengeti...>/<cluster name>/<group name>
      String[] folderNames = path.split("/");
      AuAssert.check(folderNames.length == 3);
      VcDatacenter dc = templateVm.getDatacenter();
      List<String> deletedFolders = new ArrayList<String>();
      deletedFolders.add(folderNames[0]);
      deletedFolders.add(folderNames[1]);
      Folder folder = null;
      try {
View Full Code Here

Examples of com.vmware.aurora.vc.VcDatacenter

public class TestVMFolderSP extends AbstractTmTest {
   private List<Folder> folders;
   @Test
   public void testCreateFolder() throws Exception {
      VcDatacenter dc = VcInventory.getDatacenters().get(0);

      List<String> folderNames = Arrays.asList("a", "b", "c");

      CreateVMFolderSP sp1 = new CreateVMFolderSP(dc, null, folderNames);
      sp1.call();
View Full Code Here

Examples of com.vmware.aurora.vc.VcDatacenter

      }
   }

   public static Pair<VcDatacenter, VcResourcePool> getTestRPAndDC() throws Exception {
      VcResourcePool testRP = null;
      VcDatacenter testDC = null;

      for(VcDatacenter dc : VcInventory.getDatacenters()) {
         testDC = dc;
         for(VcCluster cluster : dc.getVcClusters()) {
            testRP = cluster.searchRP(VcTestConfig.testRpPath);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.