public HostIpRouteConfig getConsoleIpRouteConfig() { return (HostIpRouteConfig) getCurrentProperty("consoleIpRouteConfig"); }
public String addVirtualNic(String portgroup, HostVirtualNicSpec nicSpec) throws HostConfigFault, AlreadyExists, RuntimeFault, RemoteException { return getVimService().addVirtualNic(getMOR(), portgroup, nicSpec); }
hns.addVirtualSwitch(switchName, spec); hpgs.setVswitchName(switchName); hpgs.setPolicy(new HostNetworkPolicy()); hns.addPortGroup(hpgs); hic.setSubnetMask("255.255.252.0"); hvns.setIp(hic); String result = hns.addVirtualNic("VMKernel", hvns); System.out.println(result);
networkSystem.addVirtualSwitch(newSwitchName, switchSpec); portGroupSpec.setVlanId(vlanId); portGroupSpec.setPolicy(new HostNetworkPolicy()); networkSystem.addPortGroup(portGroupSpec);
HostVirtualNic[] hvns = hns.getNetworkInfo().getVnic(); if(hvns==null) hns.removeVirtualNic(nic.getDevice()); System.out.println("Successful removing : " + portGroupName );
hns.removePortGroup(portGroupName); System.out.println("Successfully removed port group:" + portGroupName);
public static void removeVirtualSwitch(HostSystem host, String vswitchId) throws RemoteException { try { HostNetworkSystem hns = host.getHostNetworkSystem(); hns.removeVirtualSwitch(vswitchId); System.out.println("Successful removed: " + vswitchId); } catch (NotFound e) { System.out.println("Failed : virtual switch cannot be found. "); } catch (HostConfigFault e) { System.out.println("Failed : Configuration falilures. "); } catch (ResourceInUse e) { System.out.println("Failed removing switch "+ vswitchId); System.out.println("There are virtual network adapters " + "associated with the virtual switch."); } catch (Exception e) { System.out.println("Failed removing switch: "+ vswitchId +"\n" + e); } }
hns.addPortGroup(portgrp); System.out.println("Successful creating : " + vswitchId +"/" + portGroupName);
HostNetworkInfo hostNetworkInfo = hostNetworkSystem.getNetworkInfo(); if (hostNetworkInfo != null) { HostVirtualNic[] hostVirtualNics = hostNetworkInfo.getConsoleVnic();
try hns.addVirtualNic(portGroup, vNicSpec);
hns.addVirtualSwitch(switchName, spec); hpgs.setVswitchName(switchName); hpgs.setPolicy(new HostNetworkPolicy()); hns.addPortGroup(hpgs); hic.setSubnetMask("255.255.252.0"); hvns.setIp(hic); String result = hns.addVirtualNic("VMKernel", hvns); System.out.println(result);
HostVirtualNic[] hvns = hns.getNetworkInfo().getVnic(); if(hvns==null) hns.removeVirtualNic(nic.getDevice()); System.out.println("Successful removing : " + portGroupName );
hns.removePortGroup(portGroupName); System.out.println("Successfully removed port group:" + portGroupName);
public static void removeVirtualSwitch(HostSystem host, String vswitchId) throws RemoteException { try { HostNetworkSystem hns = host.getHostNetworkSystem(); hns.removeVirtualSwitch(vswitchId); System.out.println("Successful removed: " + vswitchId); } catch (NotFound e) { System.out.println("Failed : virtual switch cannot be found. "); } catch (HostConfigFault e) { System.out.println("Failed : Configuration falilures. "); } catch (ResourceInUse e) { System.out.println("Failed removing switch "+ vswitchId); System.out.println("There are virtual network adapters " + "associated with the virtual switch."); } catch (Exception e) { System.out.println("Failed removing switch: "+ vswitchId +"\n" + e); } }
hns.addPortGroup(portgrp); System.out.println("Successful creating : " + vswitchId +"/" + portGroupName);
HostNetworkInfo hostNetworkInfo = hostNetworkSystem.getNetworkInfo(); if (hostNetworkInfo != null) { HostVirtualNic[] hostVirtualNics = hostNetworkInfo.getConsoleVnic();
try hns.addVirtualNic(portGroup, vNicSpec);
hns.addVirtualSwitch(switchName, spec); hpgs.setVswitchName(switchName); hpgs.setPolicy(new HostNetworkPolicy()); hns.addPortGroup(hpgs); hic.setSubnetMask("255.255.252.0"); hvns.setIp(hic); String result = hns.addVirtualNic("VMKernel", hvns); System.out.println(result);
public void addVirtualSwitch(String vswitchName, HostVirtualSwitchSpec spec) throws HostConfigFault, ResourceInUse, AlreadyExists, RuntimeFault, RemoteException { getVimService().addVirtualSwitch(getMOR(), vswitchName, spec); }
public void removePortGroup(ServiceInstance si, String hostName, String portGroupName) throws IOException { HostSystem host = (HostSystem) (new InventoryNavigator(si.getRootFolder())).searchManagedEntity("HostSystem", hostName); if (host == null) { System.out.println("Not found host:" + hostName); return; } HostNetworkSystem network = host.getHostNetworkSystem(); network.removePortGroup(portGroupName); System.out.println("Remove port group:" + portGroupName + " successfully!"); }