mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
Rebase with master, bring into Vmware vswitch change.
This commit is contained in:
parent
93f14e7c65
commit
bcaac324aa
@ -484,8 +484,8 @@ public class DatacenterMO extends BaseMO {
|
||||
public ManagedObjectReference getDvSwitchMor(String dvSwitchName) throws Exception {
|
||||
ManagedObjectReference dvSwitchMor = null;
|
||||
ManagedObjectReference networkFolderMor = null;
|
||||
networkFolderMor = _context.getServiceUtil().getMoRefProp(_mor, "networkFolder");
|
||||
dvSwitchMor = _context.getServiceUtil().getDecendentMoRef(networkFolderMor, "VmwareDistributedVirtualSwitch", dvSwitchName);
|
||||
networkFolderMor = _context.getVimClient().getMoRefProp(_mor, "networkFolder");
|
||||
dvSwitchMor = _context.getVimClient().getDecendentMoRef(networkFolderMor, "VmwareDistributedVirtualSwitch", dvSwitchName);
|
||||
return dvSwitchMor;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,11 +16,13 @@
|
||||
// under the License.
|
||||
package com.cloud.hypervisor.vmware.mo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.hypervisor.vmware.util.VmwareContext;
|
||||
import com.vmware.vim25.DVPortgroupConfigSpec;
|
||||
import com.vmware.vim25.HostPortGroupSpec;
|
||||
import com.vmware.vim25.ManagedObjectReference;
|
||||
|
||||
public class DistributedVirtualSwitchMO extends BaseMO {
|
||||
@ -35,13 +37,13 @@ public class DistributedVirtualSwitchMO extends BaseMO {
|
||||
}
|
||||
|
||||
public void createDVPortGroup(DVPortgroupConfigSpec dvPortGroupSpec) throws Exception {
|
||||
DVPortgroupConfigSpec[] dvPortGroupSpecArray = new DVPortgroupConfigSpec[1];
|
||||
dvPortGroupSpecArray[0] = dvPortGroupSpec;
|
||||
_context.getService().addDVPortgroup_Task(_mor, dvPortGroupSpecArray);
|
||||
List<DVPortgroupConfigSpec> dvPortGroupSpecArray = new ArrayList<DVPortgroupConfigSpec>();
|
||||
dvPortGroupSpecArray.add(dvPortGroupSpec);
|
||||
_context.getService().addDVPortgroupTask(_mor, dvPortGroupSpecArray);
|
||||
}
|
||||
|
||||
public void updateDvPortGroup(ManagedObjectReference dvPortGroupMor, DVPortgroupConfigSpec dvPortGroupSpec) throws Exception {
|
||||
// TODO(sateesh): Update numPorts
|
||||
_context.getService().reconfigureDVPortgroup_Task(dvPortGroupMor, dvPortGroupSpec);
|
||||
_context.getService().reconfigureDVPortgroupTask(dvPortGroupMor, dvPortGroupSpec);
|
||||
}
|
||||
}
|
||||
|
||||
@ -540,4 +540,20 @@ public class VmwareClient {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a MORef from the property returned.
|
||||
*
|
||||
* @param objMor Object to get a reference property from
|
||||
* @param propName name of the property that is the MORef
|
||||
* @return the ManagedObjectReference for that property.
|
||||
*/
|
||||
public ManagedObjectReference getMoRefProp(ManagedObjectReference objMor, String propName) throws Exception {
|
||||
Object props = getDynamicProperty(objMor, propName);
|
||||
ManagedObjectReference propmor = null;
|
||||
if (!props.getClass().isArray()) {
|
||||
propmor = (ManagedObjectReference)props;
|
||||
}
|
||||
return propmor;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user