Exemplo n.º 1
0
 /**
  * Tests login into vc server
  *
  * @throws Exception
  */
 @Test
 public void testLoginVc() throws Exception {
   System.out.println("Service url is: " + vcService.getServiceUrl());
   Datacenter dc = getDatacenter(vcService);
   AuAssert.check(vcService.isConnected());
   System.out.println("VC server guid is: " + VcContext.getServerGuid());
   System.out.println("datacenter: " + dc);
 }
 /*
  * @return the VcSnapshot object.
  */
 protected static VcSnapshotImpl loadSnapshotFromMoRef(
     ManagedObjectReference moRef, VcVirtualMachineImpl parent, String name) throws Exception {
   AuAssert.check(VcContext.isInSession());
   VcSnapshotImpl obj = null;
   ManagedObject mo = MoUtil.getManagedObject(moRef);
   AuAssert.check(mo instanceof Snapshot);
   obj = new VcSnapshotImpl((Snapshot) mo, parent, name);
   Profiler.inc(StatsType.VC_LOAD_MO, obj);
   return obj;
 }
 /** @return the VcObject from ManagedObjectReference */
 public static VcObjectImpl loadFromMoRef(ManagedObjectReference moRef) throws Exception {
   AuAssert.check(VcContext.isInSession());
   VcObjectImpl obj = null;
   ManagedObject mo = MoUtil.getManagedObject(moRef);
   if (mo instanceof Datacenter) {
     obj = new VcDatacenterImpl((Datacenter) mo);
   } else if (mo instanceof ClusterComputeResource) {
     obj = new VcClusterImpl((ClusterComputeResource) mo);
   } else if (mo instanceof Network) {
     obj = new VcNetworkImpl((Network) mo);
   } else if (mo instanceof Datastore) {
     obj = new VcDatastoreImpl((Datastore) mo);
   } else if (mo instanceof ResourcePool) {
     obj = new VcResourcePoolImpl((ResourcePool) mo);
   } else if (mo instanceof VirtualMachine) {
     obj = new VcVirtualMachineImpl((VirtualMachine) mo);
   } else if (mo instanceof Snapshot) {
     AuAssert.unreachable();
   } else if (mo instanceof HostSystem) {
     obj = new VcHostImpl((HostSystem) mo);
   }
   Profiler.inc(StatsType.VC_LOAD_MO, obj);
   return obj;
 }