protected ServiceInstance create(final String hostname, final String username, final String password) throws MalformedURLException, RemoteException { return new ServiceInstance(new URL("https://" + hostname + "/sdk"), username, password); }
public VirtualHost(String url, String user, String password) throws RemoteException, MalformedURLException { this.url = url; this.user = user; this.password = password; serviceInstance = new ServiceInstance(new URL(url), user, password, true); }
protected ServiceInstance create(final String hostname, final String username, final String password) throws MalformedURLException, RemoteException { return new ServiceInstance(new URL("https://" + hostname + "/sdk"), username, password); }
private VMotionTrigger() throws RemoteException, MalformedURLException { String url = "https://w2-gf-vc01.gemstone.com/sdk"; assert System.console() != null; String username = System.console().readLine("%s", "username: "); if (username == null || username.trim().equals("")) { writeToConsole("User cannot be empty."); System.exit(1); } String password = String.copyValueOf(System.console().readPassword("%s", "password: ")).trim(); if (password == null || password.trim().equals("")) { writeToConsole("Invalid password."); System.exit(1); } si = new ServiceInstance(new URL(url), username.trim(), password.trim(), true); }
public static ServiceInstance createServiceInstance() throws RemoteException, MalformedURLException { ServiceInstance si = new ServiceInstance(new URL("https://10.141.72.223/sdk"), "root", "vmware", true); si.getSessionManager().setLocale("zh-CN"); // set locale for the content of all API result. return si; }
@Override public void setIaasProperties(Map<String, String> iaasProperties) throws IaasException { this.iaasProperties = iaasProperties; this.machineImageId = iaasProperties.get("vmware.template"); this.vmwareDataCenter = iaasProperties.get("vmware.datacenter"); try { this.vmwareServiceInstance = new ServiceInstance( new URL(iaasProperties.get("vmware.url")), iaasProperties.get("vmware.user"), iaasProperties.get("vmware.password"), Boolean.parseBoolean(iaasProperties.get("vmware.ignorecert"))); this.vmwareComputeResource = (ComputeResource)( new InventoryNavigator( this.vmwareServiceInstance.getRootFolder()) .searchManagedEntity("ComputeResource", iaasProperties.get("vmware.cluster"))); } catch(Exception e) { throw new IaasException(e); } }
public static void main(String[] args) throws Exception { String session = "vmware_soap_session=\"5229c547-1342-47d1-e830-223d99a47fba\""; ServiceInstance si = new ServiceInstance(new URL("https://10.17.218.174/sdk"), session , true); UserSession userSession = si.getSessionManager().getCurrentSession(); System.out.println("username=" + userSession.getUserName()); System.out.println("fullname=" + userSession.getFullName()); }
@Override public InventoryNavigator create() throws IOException { ServiceInstance serviceInstance = new ServiceInstance(this.url, this.username, this.password, true); return new InventoryNavigator(serviceInstance.getRootFolder()); }
public static void main(String[] args) throws Exception { String session = "vmware_soap_session=\"5229c547-1342-47d1-e830-223d99a47fba\""; ServiceInstance si = new ServiceInstance(new URL("https://10.17.218.174/sdk"), session , true); UserSession userSession = si.getSessionManager().getCurrentSession(); System.out.println("username=" + userSession.getUserName()); System.out.println("fullname=" + userSession.getFullName()); }
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(new OptionSpec[]{}, args); String urlStr = clp.get_option("url"); String username = clp.get_option("username"); String password = clp.get_option("password"); ServiceInstance si = new ServiceInstance(new URL(urlStr), username, password, true); String sessionStr = si.getServerConnection().getSessionStr(); System.out.println("sessionStr=" + sessionStr); Thread.sleep(30*60*1000); si.getServerConnection().logout(); }
public static void main(String[] args) throws Exception { CommandLineParser clp = new CommandLineParser(new OptionSpec[]{}, args); String urlStr = clp.get_option("url"); String username = clp.get_option("username"); String password = clp.get_option("password"); ServiceInstance si = new ServiceInstance(new URL(urlStr), username, password, true); String sessionStr = si.getServerConnection().getSessionStr(); System.out.println("sessionStr=" + sessionStr); Thread.sleep(30*60*1000); si.getServerConnection().logout(); }
public static void main(String[] args) throws Exception { if(args.length != 3) { System.out.println("Usage: java PrintAlarmManager " + "<url> <username> <password>"); return; } ServiceInstance si = new ServiceInstance( new URL(args[0]), args[1], args[2], true); AlarmManager alarmMgr = si.getAlarmManager(); System.out.println("Alarm expressions:"); AlarmExpression[] defaultExps = alarmMgr.getDefaultExpression(); printAlarmExpressions(defaultExps); System.out.println("\n\nAlarm descriptions:"); AlarmDescription ad = alarmMgr.getDescription(); printAlarmDescription(ad); si.getServerConnection().logout(); }
private static boolean migrateVM(String targetVMName, String newHostName, boolean tryAnotherVM, boolean tryAnotherHost) throws Exception { ServiceInstance si = new ServiceInstance(new URL(url), username, password, true); try { Folder rootFolder = si.getRootFolder(); HostSystem newHost = (HostSystem)new InventoryNavigator(rootFolder) .searchManagedEntity("HostSystem", newHostName); return migrateVM(si, rootFolder, newHost, targetVMName, newHostName, tryAnotherVM, tryAnotherHost); } finally { si.getServerConnection().logout(); } }
public static void main(String [] args) throws Exception { CommandLineParser clp = new CommandLineParser(new OptionSpec[]{}, args); String urlStr = clp.get_option("url"); String username = clp.get_option("username"); String password = clp.get_option("password"); ServiceInstance si = new ServiceInstance(new URL(urlStr), username, password, true); TaskManager tm = si.getTaskManager(); Task[] tasks = tm.getRecentTasks(); displayTasks(tasks); } }
public static void main(String [] args) throws Exception { CommandLineParser clp = new CommandLineParser(new OptionSpec[]{}, args); String urlStr = clp.get_option("url"); String username = clp.get_option("username"); String password = clp.get_option("password"); ServiceInstance si = new ServiceInstance(new URL(urlStr), username, password, true); TaskManager tm = si.getTaskManager(); Task[] tasks = tm.getRecentTasks(); displayTasks(tasks); } }
private static synchronized boolean doMigrateVM(String targetVMName, String newHostName) throws Exception { ServiceInstance si = new ServiceInstance(new URL(url), username, password, true); try { Folder rootFolder = si.getRootFolder(); InventoryNavigator in = new InventoryNavigator(rootFolder); HostSystem newHost = (HostSystem)in.searchManagedEntity("HostSystem", newHostName); if (newHost == null) { throw new TestException("Could not find host " + newHostName + " as a target host for vMotion."); } return migrateVM(si, rootFolder, newHost, targetVMName, newHostName); } finally { si.getServerConnection().logout(); } }
public static void main(String[] args) throws Exception { clp = new CommandLineParser(constructOptions(), args); String urlStr = clp.get_option("url"); String username = clp.get_option("username"); String password = clp.get_option("password"); String vmname = clp.get_option("vmname"); ServiceInstance si = new ServiceInstance(new URL(urlStr), username, password, true); Folder rootFolder = si.getRootFolder(); VirtualMachine vm = (VirtualMachine) new InventoryNavigator(rootFolder).searchManagedEntity("VirtualMachine", vmname); boolean valid = customValidation(clp); if(valid) { reConfig(clp, vm); } else { System.out.println("Virtual Machine " + clp.get_option("vmname") + " Not Found"); } } }
public static void HydraTask_migrateNetDownVM() throws Exception { SharedMap sMap = VMotionBB.getBB().getSharedMap(); Boolean bool = (Boolean)sMap.get("connectionDropped"); if (bool == null || !bool) { return; } initializeParams(); if (!validateParams()) { return; } ServiceInstance si = new ServiceInstance(new URL(url), username, password, true); try { Folder rootFolder = si.getRootFolder(); HostSystem newHost = (HostSystem)new InventoryNavigator(rootFolder) .searchManagedEntity("HostSystem", hostNames[0]); migrateVM(si, rootFolder, newHost, vmNames[0], hostNames[0], false, false); } finally { si.getServerConnection().logout(); } }