public VirtualMachine getVm(UUID vmid) throws RemoteException { SearchIndex searchIndex = serviceInstance.getSearchIndex(); VirtualMachine vm = (VirtualMachine) searchIndex.findByUuid( null, vmid.toString(), true, true); if (vm == null) { throw new NotFound(); } return vm; }
public static void main(String[] args) throws Exception { if(args.length != 3) { System.out.println("Usage: java AddNIC <url> <username> <password>"); return; } ServiceInstance si = new ServiceInstance(new URL(args[0]), args[1], args[2], true); // find the data center called "pvlan" under the root of inventory Datacenter dc = (Datacenter) si.getSearchIndex().findByInventoryPath("pvlan"); DistributedVirtualSwitch dvs = createDVS(dc); if(dvs!=null) { createDVSPortGroup(dvs); } }
public static void main(String[] args) throws Exception { if(args.length != 3) { System.out.println("Usage: java AddNIC <url> <username> <password>"); return; } ServiceInstance si = new ServiceInstance(new URL(args[0]), args[1], args[2], true); // find the data center called "pvlan" under the root of inventory Datacenter dc = (Datacenter) si.getSearchIndex().findByInventoryPath("pvlan"); DistributedVirtualSwitch dvs = createDVS(dc); if(dvs!=null) { createDVSPortGroup(dvs); } }
public static void main(String [] args) throws Exception { CommandLineParser clp = new CommandLineParser(constructOptions(), args); String urlStr = clp.get_option("url"); String username = clp.get_option("username"); String password = clp.get_option("password"); String vmpath = clp.get_option("vmpath"); String taskname = clp.get_option("taskname"); ServiceInstance si = new ServiceInstance(new URL(urlStr), username, password, true); VirtualMachine vm = (VirtualMachine) si.getSearchIndex().findByInventoryPath(vmpath); ScheduledTaskSpec spec = createSchedulerSpec(taskname); ScheduledTaskManager stm = si.getScheduledTaskManager(); if(stm != null) { stm.createScheduledTask(vm, spec); System.out.println("Task: " + taskname + " has been successfully added."); } else { System.out.println("SchduledTaskManager is not available on this target."); } si.getServerConnection().logout(); } }
VirtualMachine vm = (VirtualMachine) si.getSearchIndex().findByInventoryPath(vmPath); Datacenter dc = (Datacenter) si.getSearchIndex().findByInventoryPath(datacenterName);
public static void main(String [] args) throws Exception { CommandLineParser clp = new CommandLineParser(constructOptions(), args); String urlStr = clp.get_option("url"); String username = clp.get_option("username"); String password = clp.get_option("password"); String vmpath = clp.get_option("vmpath"); String taskname = clp.get_option("taskname"); ServiceInstance si = new ServiceInstance(new URL(urlStr), username, password, true); VirtualMachine vm = (VirtualMachine) si.getSearchIndex().findByInventoryPath(vmpath); ScheduledTaskSpec spec = createSchedulerSpec(taskname); ScheduledTaskManager stm = si.getScheduledTaskManager(); if(stm != null) { stm.createScheduledTask(vm, spec); System.out.println("Task: " + taskname + " has been successfully added."); } else { System.out.println("SchduledTaskManager is not available on this target."); } si.getServerConnection().logout(); } }
VirtualMachine vm = (VirtualMachine) si.getSearchIndex().findByInventoryPath(vmPath); Datacenter dc = (Datacenter) si.getSearchIndex().findByInventoryPath(datacenterName);
String targetDir = args[6]; HostSystem host = (HostSystem) si.getSearchIndex().findByIp(null, hostip, false);
String targetDir = args[6]; HostSystem host = (HostSystem) si.getSearchIndex().findByIp(null, hostip, false);
String newVmName = args[5]; HostSystem host = (HostSystem) si.getSearchIndex().findByIp(null, hostip, false);
String newVmName = args[5]; HostSystem host = (HostSystem) si.getSearchIndex().findByIp(null, hostip, false);