/** * Searches for a managed entity by a given type. * * @param type the type string to search for * @return the list of managed entities found * @throws RemoteException */ public ManagedEntity[] searchManagedEntities(String type) throws RemoteException { return (new InventoryNavigator(m_serviceInstance.getRootFolder())).searchManagedEntities(type); }
/** @since SDK4.1 */ public ManagedEntity getParentVApp() { ManagedObjectReference mor = (ManagedObjectReference) getCurrentProperty("parentVApp"); return new ManagedEntity(getServerConnection(), mor); }
public GuestFileManager getFileManager(VirtualMachine vm) { ManagedObjectReference mor = (ManagedObjectReference) getCurrentProperty("fileManager"); return new GuestFileManager(getServerConnection(), mor, vm); }
public void listPortGroupForCluster(ServiceInstance si, String clusterName) throws InvalidProperty, RuntimeFault, RemoteException { ClusterComputeResource cluster = (ClusterComputeResource) (new InventoryNavigator(si.getRootFolder())).searchManagedEntity("ClusterComputeResource", clusterName); if (cluster == null) { System.out.println("Not found cluster:" + cluster); return; } System.out.println("List port groups for cluster:" + clusterName); Network[] networks = cluster.getNetworks(); for (int i = 0; i < networks.length; i++) { System.out.println(i + ": " + networks[i].getName()); } }
@Override public InventoryNavigator create() throws IOException { ServiceInstance serviceInstance = new ServiceInstance(this.url, this.username, this.password, true); return new InventoryNavigator(serviceInstance.getRootFolder()); }
public Task migrateVM_Task(ResourcePool pool, HostSystem host, VirtualMachineMovePriority priority, VirtualMachinePowerState state) throws VmConfigFault, Timedout, FileFault, InvalidState, InsufficientResourcesFault, MigrationFault, RuntimeFault, RemoteException { ManagedObjectReference mor = getVimService().migrateVM_Task(getMOR(), pool==null? null : pool.getMOR(), host==null? null : host.getMOR(), priority, state); return new Task(getServerConnection(), mor); }
public Task checkCompatibility_Task(VirtualMachine vm, HostSystem host, ResourcePool pool, String[] testType) throws NoActiveHostInCluster, InvalidState, RuntimeFault, RemoteException { ManagedObjectReference taskMor = getVimService().checkCompatibility_Task(getMOR(), vm==null?null:vm.getMOR(), host==null?null:host.getMOR(), pool==null?null:pool.getMOR(), testType); return new Task(getServerConnection(), taskMor); } }
public Task checkMigrate_Task(VirtualMachine vm, HostSystem host, ResourcePool pool, VirtualMachinePowerState state, String[] testType) throws NoActiveHostInCluster, InvalidState, RuntimeFault, RemoteException { ManagedObjectReference taskMor = getVimService().checkMigrate_Task(getMOR(), vm.getMOR(), host==null?null : host.getMOR(), pool==null?null : pool.getMOR(), state, testType); return new Task(getServerConnection(), taskMor); }
public Task createVM_Task(VirtualMachineConfigSpec config, ResourcePool pool, HostSystem host) throws InvalidName, VmConfigFault, DuplicateName, FileFault, OutOfBounds, InsufficientResourcesFault, InvalidDatastore, RuntimeFault, RemoteException { return new Task(getServerConnection(), getVimService().createVM_Task(getMOR(), config, pool.getMOR(), host==null? null : host.getMOR()) ); }
/** @since SDK4.0 */ public HttpNfcLease importVApp(ImportSpec spec, Folder folder, HostSystem host) throws VmConfigFault, FileFault, OutOfBounds, DuplicateName, InvalidName, InvalidDatastore, InsufficientResourcesFault, RuntimeFault, RemoteException { ManagedObjectReference mor = getVimService().importVApp(getMOR(), spec, folder==null? null : folder.getMOR(), host==null? null : host.getMOR()); return new HttpNfcLease(getServerConnection(), mor); }
public HostSystem[] queryCompatibleHostForExistingDvs(ManagedEntity container, boolean recursive, DistributedVirtualSwitch dvs) throws RuntimeFault, RemoteException { ManagedObjectReference[] mors = getVimService().queryCompatibleHostForExistingDvs(getMOR(), container.getMOR(), recursive, dvs.getMOR()); HostSystem[] hosts = new HostSystem[mors.length]; for(int i=0; i<hosts.length; i++) { hosts[i] = new HostSystem(getServerConnection(), mors[i]); } return hosts; }
/** @since SDK4.0 */ public VirtualApp createVApp(String name, ResourceConfigSpec resSpec, VAppConfigSpec configSpec, Folder vmFolder) throws InvalidName, DuplicateName, InsufficientResourcesFault, InvalidState, VmConfigFault, RuntimeFault, RemoteException { ManagedObjectReference vaMor = getVimService().createVApp(getMOR(), name, resSpec, configSpec, vmFolder==null? null : vmFolder.getMOR()); return new VirtualApp(getServerConnection(), vaMor); }
protected boolean validate(final ServiceInstance serviceInstance) { if (serviceInstance == null || serviceInstance.getSessionManager() == null) { return false; } else { return serviceInstance.getSessionManager().getCurrentSession() != null; } }
public GuestProcessManager getProcessManager(VirtualMachine vm) { ManagedObjectReference mor = (ManagedObjectReference) getCurrentProperty("processManager"); return new GuestProcessManager(getServerConnection(), mor, vm); }
/** @since SDK4.1 */ public ManagedEntity getParentVApp() { ManagedObjectReference mor = (ManagedObjectReference) getCurrentProperty("parentVApp"); return new ManagedEntity(getServerConnection(), mor); }
public HostAuthenticationStore[] getSupportedStore() { ManagedObjectReference[] mors = (ManagedObjectReference[]) getCurrentProperty("supportedStore"); HostAuthenticationStore[] hass = new HostAuthenticationStore[mors.length]; for(int i=0; i<mors.length; i++) { hass[i] = new HostAuthenticationStore(getServerConnection(), mors[i]); } return hass; } }
public GuestAuthManager getAuthManager(VirtualMachine vm) { ManagedObjectReference mor = (ManagedObjectReference) getCurrentProperty("authManager"); return new GuestAuthManager(getServerConnection(), mor, vm); }
public Folder getParentFolder() { ManagedObjectReference mor = (ManagedObjectReference) getCurrentProperty("parentFolder"); return new Folder(getServerConnection(), mor); }
private Profile[] convert2Profiles(ManagedObjectReference[] mors) { Profile[] pfs = new Profile[mors.length]; for(int i=0; i<mors.length; i++) { pfs[i] = new Profile(getServerConnection(), mors[i]); } return pfs; }
public Task registerVM_Task(String path, String name, boolean asTemplate, ResourcePool pool, HostSystem host) throws VmConfigFault, InvalidName, DuplicateName, FileFault, OutOfBounds, InsufficientResourcesFault, InvalidDatastore, AlreadyExists, NotFound, RuntimeFault, RemoteException { return new Task( getServerConnection(), getVimService().registerVM_Task(getMOR(), path, name, asTemplate, pool==null? null : pool.getMOR(), host==null? null : host.getMOR()) ); }