private DVPortgroupConfigSpec createDefaultPortgroupSpec() { DVPortgroupConfigSpec res = new DVPortgroupConfigSpec(); res.setName(this.subnetState.name); res.setDescription("Created from " + this.subnetState.documentSelfLink); res.setType(DistributedVirtualPortgroupPortgroupType.EPHEMERAL.value()); return res; }
public static DVPortgroupConfigSpec createDvPortGroupSpec(String dvPortGroupName, DVPortSetting portSetting, int numPorts, boolean autoExpandSupported) { DVPortgroupConfigSpec spec = new DVPortgroupConfigSpec(); spec.setName(dvPortGroupName); spec.setDefaultPortConfig(portSetting); spec.setPortNameFormat("vnic<portIndex>"); spec.setType("earlyBinding"); spec.setNumPorts(numPorts); spec.setAutoExpand(autoExpandSupported); return spec; }
public void updateDvPortGroup(ManagedObjectReference dvPortGroupMor, DVPortgroupConfigSpec dvPortGroupSpec) throws Exception { synchronized (dvPortGroupMor.getValue().intern()) { ManagedObjectReference task = _context.getService().reconfigureDVPortgroupTask(dvPortGroupMor, dvPortGroupSpec); if (!_context.getVimClient().waitForTask(task)) { throw new Exception("Failed to update dvPortGroup " + dvPortGroupMor.getValue()); } } }
public Task reconfigureDVPortgroup_Task(DVPortgroupConfigSpec spec) throws DvsFault, ConcurrentAccess, DuplicateName, InvalidName, RuntimeFault, RemoteException { ManagedObjectReference mor = getVimService().reconfigureDVPortgroup_Task(getMOR(), spec); return new Task(getServerConnection(), mor); }
public Task addDVPortgroup_Task(DVPortgroupConfigSpec[] spec) throws DvsFault, DuplicateName, InvalidName, RuntimeFault, RemoteException { ManagedObjectReference taskMor = getVimService().addDVPortgroup_Task(getMOR(), spec); return new Task(getServerConnection(), taskMor); }
/** @since SDK5.1 */ public Task createDVPortgroup_Task(DVPortgroupConfigSpec spec) throws DvsFault, DuplicateName, InvalidName, RuntimeFault, RemoteException { ManagedObjectReference taskMor = getVimService().createDVPortgroup_Task(getMOR(), spec); return new Task(getServerConnection(), taskMor); }
public void createDVPortGroup(DVPortgroupConfigSpec dvPortGroupSpec) throws Exception { List<DVPortgroupConfigSpec> dvPortGroupSpecArray = new ArrayList<DVPortgroupConfigSpec>(); dvPortGroupSpecArray.add(dvPortGroupSpec); boolean dvPortGroupExists = false; String dvSwitchInstance = _mor.getValue(); String dvPortGroupName = dvPortGroupSpec.getName(); String uniquedvPortGroupPerDvs = dvSwitchInstance + dvPortGroupName; List<String> dvPortGroupList = null; synchronized (uniquedvPortGroupPerDvs.intern()) { // Looking up local cache rather than firing another API call to see if dvPortGroup exists already. if (s_dvPortGroupCacheMap.containsKey(dvSwitchInstance)) { dvPortGroupList = s_dvPortGroupCacheMap.get(dvSwitchInstance); if (dvPortGroupList != null && dvPortGroupList.contains(dvPortGroupName)) { dvPortGroupExists = true; } } if (!dvPortGroupExists) { ManagedObjectReference task = _context.getService().addDVPortgroupTask(_mor, dvPortGroupSpecArray); if (!_context.getVimClient().waitForTask(task)) { throw new Exception("Failed to create dvPortGroup " + dvPortGroupSpec.getName()); } else { if (s_dvPortGroupCacheMap.containsKey(dvSwitchInstance)) { dvPortGroupList = s_dvPortGroupCacheMap.get(dvSwitchInstance); if (dvPortGroupList == null) { dvPortGroupList = new ArrayList<String>(); } dvPortGroupList.add(dvPortGroupName); //does this update map? } else { dvPortGroupList = new ArrayList<String>(); dvPortGroupList.add(dvPortGroupName); s_dvPortGroupCacheMap.put(dvSwitchInstance, dvPortGroupList); } } if (s_logger.isTraceEnabled()) { s_logger.trace("Created dvPortGroup. dvPortGroup cache is :" + s_dvPortGroupCacheMap); } } else if (s_logger.isDebugEnabled()) { s_logger.debug("Detected dvPortGroup [" + dvPortGroupName + "] already present. Not attempting to create again."); } } }