Skip to content

Commit 4254cb8

Browse files
committed
Fix errors caused by branch-merge in vmware-base module
1 parent 167a6dc commit 4254cb8

11 files changed

Lines changed: 63 additions & 68 deletions

File tree

plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ public List<ManagedObjectReference> addHostToPodCluster(VmwareContext serviceCon
396396
returnedHostList.add(mor);
397397
return returnedHostList;
398398
} else {
399-
s_logger.error("Unsupport host type " + mor.getType() + ":" + mor.getPresetParams() + " from inventory path: " + hostInventoryPath);
399+
s_logger.error("Unsupport host type " + mor.getType() + ":" + mor.getValue() + " from inventory path: " + hostInventoryPath);
400400
return null;
401401
}
402402
}

plugins/network-elements/midonet/test/com/cloud/network/element/MidoNetElementTest.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
import java.util.ArrayList;
3030
import java.util.UUID;
3131

32-
import org.junit.Ignore;
33-
3432
import junit.framework.TestCase;
3533

3634
import com.midokura.midonet.client.MidonetApi;
@@ -60,7 +58,6 @@ public class MidoNetElementTest extends TestCase {
6058
/*
6159
* Test the standard case of addDhcpEntry with no errors.
6260
*/
63-
@Ignore
6461
public void testAddDhcpEntry() {
6562

6663
//mockMgmt
@@ -82,9 +79,8 @@ public void testAddDhcpEntry() {
8279
ResourceCollection mockSubnetCollection = mock(ResourceCollection.class);
8380
when(mockSubnetCollection.get(anyInt())).thenReturn(mockSub);
8481

85-
//mockBridge
86-
Bridge mockBridge = mock(Bridge.class); // FIXME! the mocked object can't be casted for some reason
87-
// I have to disable the whole test case for now
82+
83+
Bridge mockBridge = mock(Bridge.class);
8884

8985
when(api.addBridge().tenantId(anyString()).name(anyString()).create()).thenReturn(mockBridge);
9086
when(mockBridge.getDhcpSubnets()).thenReturn(mockSubnetCollection);
@@ -141,7 +137,6 @@ public void testAddDhcpEntry() {
141137
/*
142138
* Test the standard case of implement with no errors.
143139
*/
144-
@Ignore
145140
public void testImplement() {
146141
//mock
147142
MidonetApi api = mock(MidonetApi.class, RETURNS_DEEP_STUBS);

vmware-base/src/com/cloud/hypervisor/vmware/mo/BaseMO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public String getCustomFieldValue(String fieldName) throws Exception {
129129
CustomFieldStringValue cfValue = (CustomFieldStringValue)_context.getVimClient().getDynamicProperty(getMor(),
130130
String.format("value[%d]", key));
131131
if(cfValue != null)
132-
return cfValue.getPresetParams();
132+
return cfValue.getValue();
133133

134134
return null;
135135
}

vmware-base/src/com/cloud/hypervisor/vmware/mo/ClusterMO.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public VirtualMachineMO findVmOnPeerHyperHost(String name) throws Exception {
120120
@Override
121121
public ObjectContent[] getVmPropertiesOnHyperHost(String[] propertyPaths) throws Exception {
122122
if(s_logger.isTraceEnabled())
123-
s_logger.trace("vCenter API trace - retrieveProperties() for VM properties. target MOR: " + _mor.getPresetParams() + ", properties: " + new Gson().toJson(propertyPaths));
123+
s_logger.trace("vCenter API trace - retrieveProperties() for VM properties. target MOR: " + _mor.getValue() + ", properties: " + new Gson().toJson(propertyPaths));
124124

125125
PropertySpec pSpec = new PropertySpec();
126126
pSpec.setType("VirtualMachine");
@@ -158,7 +158,7 @@ public ObjectContent[] getVmPropertiesOnHyperHost(String[] propertyPaths) throws
158158
@Override
159159
public ObjectContent[] getDatastorePropertiesOnHyperHost(String[] propertyPaths) throws Exception {
160160
if(s_logger.isTraceEnabled())
161-
s_logger.trace("vCenter API trace - retrieveProperties() on Datastore properties. target MOR: " + _mor.getPresetParams() + ", properties: " + new Gson().toJson(propertyPaths));
161+
s_logger.trace("vCenter API trace - retrieveProperties() on Datastore properties. target MOR: " + _mor.getValue() + ", properties: " + new Gson().toJson(propertyPaths));
162162

163163
PropertySpec pSpec = new PropertySpec();
164164
pSpec.setType("Datastore");
@@ -190,7 +190,7 @@ public ObjectContent[] getDatastorePropertiesOnHyperHost(String[] propertyPaths)
190190

191191
private ObjectContent[] getHostPropertiesOnCluster(String[] propertyPaths) throws Exception {
192192
if(s_logger.isTraceEnabled())
193-
s_logger.trace("vCenter API trace - retrieveProperties() on Host properties. target MOR: " + _mor.getPresetParams() + ", properties: " + new Gson().toJson(propertyPaths));
193+
s_logger.trace("vCenter API trace - retrieveProperties() on Host properties. target MOR: " + _mor.getValue() + ", properties: " + new Gson().toJson(propertyPaths));
194194

195195
PropertySpec pSpec = new PropertySpec();
196196
pSpec.setType("HostSystem");
@@ -224,7 +224,7 @@ private ObjectContent[] getHostPropertiesOnCluster(String[] propertyPaths) throw
224224
@Override
225225
public boolean createVm(VirtualMachineConfigSpec vmSpec) throws Exception {
226226
if(s_logger.isTraceEnabled())
227-
s_logger.trace("vCenter API trace - createVM_Task(). target MOR: " + _mor.getPresetParams() + ", VirtualMachineConfigSpec: " + new Gson().toJson(vmSpec));
227+
s_logger.trace("vCenter API trace - createVM_Task(). target MOR: " + _mor.getValue() + ", VirtualMachineConfigSpec: " + new Gson().toJson(vmSpec));
228228

229229
assert(vmSpec != null);
230230
DatacenterMO dcMo = new DatacenterMO(_context, getHyperHostDatacenter());
@@ -252,14 +252,14 @@ public boolean createVm(VirtualMachineConfigSpec vmSpec) throws Exception {
252252
@Override
253253
public void importVmFromOVF(String ovfFilePath, String vmName, DatastoreMO dsMo, String diskOption) throws Exception {
254254
if(s_logger.isTraceEnabled())
255-
s_logger.trace("vCenter API trace - importVmFromOVF(). target MOR: " + _mor.getPresetParams() + ", ovfFilePath: " + ovfFilePath + ", vmName: " + vmName
256-
+ ", datastore: " + dsMo.getMor().getPresetParams() + ", diskOption: " + diskOption);
255+
s_logger.trace("vCenter API trace - importVmFromOVF(). target MOR: " + _mor.getValue() + ", ovfFilePath: " + ovfFilePath + ", vmName: " + vmName
256+
+ ", datastore: " + dsMo.getMor().getValue() + ", diskOption: " + diskOption);
257257

258258
ManagedObjectReference morRp = getHyperHostOwnerResourcePool();
259259
assert(morRp != null);
260260

261261
if(s_logger.isTraceEnabled())
262-
s_logger.trace("vCenter API trace - importVmFromOVF(). resource pool: " + morRp.getPresetParams());
262+
s_logger.trace("vCenter API trace - importVmFromOVF(). resource pool: " + morRp.getValue());
263263

264264
HypervisorHostHelper.importVmFromOVF(this, ovfFilePath, vmName, dsMo, diskOption, morRp, null);
265265

@@ -272,9 +272,9 @@ public boolean createBlankVm(String vmName, int cpuCount, int cpuSpeedMHz, int c
272272
String guestOsIdentifier, ManagedObjectReference morDs, boolean snapshotDirToParent) throws Exception {
273273

274274
if(s_logger.isTraceEnabled())
275-
s_logger.trace("vCenter API trace - createBlankVm(). target MOR: " + _mor.getPresetParams() + ", vmName: " + vmName + ", cpuCount: " + cpuCount
275+
s_logger.trace("vCenter API trace - createBlankVm(). target MOR: " + _mor.getValue() + ", vmName: " + vmName + ", cpuCount: " + cpuCount
276276
+ ", cpuSpeedMhz: " + cpuSpeedMHz + ", cpuReservedMHz: " + cpuReservedMHz + ", limitCpu: " + limitCpuUse + ", memoryMB: " + memoryMB
277-
+ ", guestOS: " + guestOsIdentifier + ", datastore: " + morDs.getPresetParams() + ", snapshotDirToParent: " + snapshotDirToParent);
277+
+ ", guestOS: " + guestOsIdentifier + ", datastore: " + morDs.getValue() + ", snapshotDirToParent: " + snapshotDirToParent);
278278

279279
boolean result = HypervisorHostHelper.createBlankVm(this, vmName, cpuCount, cpuSpeedMHz, cpuReservedMHz, limitCpuUse,
280280
memoryMB, memoryReserveMB, guestOsIdentifier, morDs, snapshotDirToParent);
@@ -290,7 +290,7 @@ public ManagedObjectReference mountDatastore(boolean vmfsDatastore, String poolH
290290
int poolHostPort, String poolPath, String poolUuid) throws Exception {
291291

292292
if(s_logger.isTraceEnabled())
293-
s_logger.trace("vCenter API trace - mountDatastore(). target MOR: " + _mor.getPresetParams() + ", vmfs: " + vmfsDatastore + ", poolHost: " + poolHostAddress
293+
s_logger.trace("vCenter API trace - mountDatastore(). target MOR: " + _mor.getValue() + ", vmfs: " + vmfsDatastore + ", poolHost: " + poolHostAddress
294294
+ ", poolHostPort: " + poolHostPort + ", poolPath: " + poolPath + ", poolUuid: " + poolUuid);
295295

296296
ManagedObjectReference morDs = null;
@@ -304,7 +304,7 @@ public ManagedObjectReference mountDatastore(boolean vmfsDatastore, String poolH
304304
morDsFirst = morDs;
305305

306306
// assume datastore is in scope of datacenter
307-
assert(morDsFirst.getPresetParams().equals(morDs.getPresetParams()));
307+
assert(morDsFirst.getValue().equals(morDs.getValue()));
308308
}
309309
}
310310

@@ -326,7 +326,7 @@ public ManagedObjectReference mountDatastore(boolean vmfsDatastore, String poolH
326326
@Override
327327
public void unmountDatastore(String poolUuid) throws Exception {
328328
if(s_logger.isTraceEnabled())
329-
s_logger.trace("vCenter API trace - unmountDatastore(). target MOR: " + _mor.getPresetParams() + ", poolUuid: " + poolUuid);
329+
s_logger.trace("vCenter API trace - unmountDatastore(). target MOR: " + _mor.getValue() + ", poolUuid: " + poolUuid);
330330

331331
List<ManagedObjectReference> hosts = (List<ManagedObjectReference>)_context.getVimClient().getDynamicProperty(_mor, "host");
332332
if(hosts != null && hosts.size() > 0) {
@@ -344,7 +344,7 @@ public void unmountDatastore(String poolUuid) throws Exception {
344344
public ManagedObjectReference findDatastore(String poolUuid) throws Exception {
345345

346346
if(s_logger.isTraceEnabled())
347-
s_logger.trace("vCenter API trace - findDatastore(). target MOR: " + _mor.getPresetParams() + ", poolUuid: " + poolUuid);
347+
s_logger.trace("vCenter API trace - findDatastore(). target MOR: " + _mor.getValue() + ", poolUuid: " + poolUuid);
348348

349349
CustomFieldsManagerMO cfmMo = new CustomFieldsManagerMO(_context,
350350
_context.getServiceContent().getCustomFieldsManager());
@@ -361,7 +361,7 @@ public ManagedObjectReference findDatastore(String poolUuid) throws Exception {
361361
DynamicProperty prop = oc.getPropSet().get(1);
362362
if(prop != null && prop.getVal() != null) {
363363
if(prop.getVal() instanceof CustomFieldStringValue) {
364-
String val = ((CustomFieldStringValue)prop.getVal()).getPresetParams();
364+
String val = ((CustomFieldStringValue)prop.getVal()).getValue();
365365
if(val.equalsIgnoreCase(poolUuid)) {
366366

367367
if(s_logger.isTraceEnabled())
@@ -382,7 +382,7 @@ public ManagedObjectReference findDatastore(String poolUuid) throws Exception {
382382
@Override
383383
public ManagedObjectReference findDatastoreByExportPath(String exportPath) throws Exception {
384384
if(s_logger.isTraceEnabled())
385-
s_logger.trace("vCenter API trace - findDatastoreByExportPath(). target MOR: " + _mor.getPresetParams() + ", exportPath: " + exportPath);
385+
s_logger.trace("vCenter API trace - findDatastoreByExportPath(). target MOR: " + _mor.getValue() + ", exportPath: " + exportPath);
386386

387387
ObjectContent[] ocs = getDatastorePropertiesOnHyperHost(new String[] {"info"});
388388
if(ocs != null && ocs.length > 0) {
@@ -415,7 +415,7 @@ public ManagedObjectReference findDatastoreByExportPath(String exportPath) throw
415415
@Override
416416
public ManagedObjectReference findMigrationTarget(VirtualMachineMO vmMo) throws Exception {
417417
if(s_logger.isTraceEnabled())
418-
s_logger.trace("vCenter API trace - findMigrationTarget(). target MOR: " + _mor.getPresetParams() + ", vm: " + vmMo.getName());
418+
s_logger.trace("vCenter API trace - findMigrationTarget(). target MOR: " + _mor.getValue() + ", vm: " + vmMo.getName());
419419

420420
List<ClusterHostRecommendation> candidates = recommendHostsForVm(vmMo);
421421
if(candidates != null && candidates.size() > 0) {
@@ -464,7 +464,7 @@ public String getHyperHostDefaultGateway() throws Exception {
464464
@Override
465465
public VmwareHypervisorHostResourceSummary getHyperHostResourceSummary() throws Exception {
466466
if(s_logger.isTraceEnabled())
467-
s_logger.trace("vCenter API trace - getHyperHostResourceSummary(). target MOR: " + _mor.getPresetParams());
467+
s_logger.trace("vCenter API trace - getHyperHostResourceSummary(). target MOR: " + _mor.getValue());
468468

469469
VmwareHypervisorHostResourceSummary summary = new VmwareHypervisorHostResourceSummary();
470470

@@ -496,7 +496,7 @@ public VmwareHypervisorHostResourceSummary getHyperHostResourceSummary() throws
496496
public VmwareHypervisorHostNetworkSummary getHyperHostNetworkSummary(String esxServiceConsolePort) throws Exception {
497497

498498
if(s_logger.isTraceEnabled())
499-
s_logger.trace("vCenter API trace - getHyperHostNetworkSummary(). target MOR: " + _mor.getPresetParams() + ", mgmtPortgroup: " + esxServiceConsolePort);
499+
s_logger.trace("vCenter API trace - getHyperHostNetworkSummary(). target MOR: " + _mor.getValue() + ", mgmtPortgroup: " + esxServiceConsolePort);
500500

501501
List<ManagedObjectReference> hosts = (List<ManagedObjectReference>)_context.getVimClient().getDynamicProperty(_mor, "host");
502502
if(hosts != null && hosts.size() > 0) {
@@ -515,7 +515,7 @@ public VmwareHypervisorHostNetworkSummary getHyperHostNetworkSummary(String esxS
515515
@Override
516516
public ComputeResourceSummary getHyperHostHardwareSummary() throws Exception {
517517
if(s_logger.isTraceEnabled())
518-
s_logger.trace("vCenter API trace - getHyperHostHardwareSummary(). target MOR: " + _mor.getPresetParams());
518+
s_logger.trace("vCenter API trace - getHyperHostHardwareSummary(). target MOR: " + _mor.getValue());
519519

520520
ClusterComputeResourceSummary hardwareSummary = (ClusterComputeResourceSummary)
521521
_context.getVimClient().getDynamicProperty(_mor, "summary");
@@ -562,7 +562,7 @@ public HashMap<String, Integer> getVmVncPortsOnCluster() throws Exception {
562562
name = (String)objProp.getVal();
563563
} else {
564564
OptionValue optValue = (OptionValue)objProp.getVal();
565-
value = (String)optValue.getPresetParams();
565+
value = (String)optValue.getValue();
566566
}
567567
}
568568

vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public List<VirtualMachineMO> findVmByNameAndLabel(String vmLabel) throws Except
117117
break; // break out inner loop
118118
}
119119
} else if(prop.getVal() instanceof CustomFieldStringValue) {
120-
String val = ((CustomFieldStringValue)prop.getVal()).getPresetParams();
120+
String val = ((CustomFieldStringValue)prop.getVal()).getValue();
121121
if(val.equals(vmLabel)) {
122122
list.add(new VirtualMachineMO(_context, oc.getObj()));
123123
break; // break out inner loop
@@ -451,7 +451,7 @@ public ManagedObjectReference getDvSwitchMor(ManagedObjectReference dvPortGroupM
451451
dvSwitchMor = (ManagedObjectReference) prop.getVal();
452452
}
453453
}
454-
if ((dvPortGroupKey != null) && dvPortGroupKey.equals(dvPortGroupMor.getPresetParams())) {
454+
if ((dvPortGroupKey != null) && dvPortGroupKey.equals(dvPortGroupMor.getValue())) {
455455
return dvSwitchMor;
456456
}
457457
}
@@ -474,7 +474,7 @@ public VirtualEthernetCardDistributedVirtualPortBackingInfo getDvPortBackingInfo
474474
ManagedObjectReference dvsMor = getDvSwitchMor(networkInfo.first());
475475
String dvSwitchUuid = getDvSwitchUuid(dvsMor);
476476
dvPortConnection.setSwitchUuid(dvSwitchUuid);
477-
dvPortConnection.setPortgroupKey(networkInfo.first().getPresetParams());
477+
dvPortConnection.setPortgroupKey(networkInfo.first().getValue());
478478
dvPortBacking.setPort(dvPortConnection);
479479
System.out.println("Plugging NIC device into network " + networkInfo.second() + " backed by dvSwitch: "
480480
+ dvSwitchUuid);

vmware-base/src/com/cloud/hypervisor/vmware/mo/HostDatastoreBrowserMO.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public HostDatastoreBrowserMO(VmwareContext context, String morType, String morV
3939

4040
public void DeleteFile(String datastoreFullPath) throws Exception {
4141
if(s_logger.isTraceEnabled())
42-
s_logger.trace("vCenter API trace - deleteFile(). target mor: " + _mor.getPresetParams() + ", file datastore path: " + datastoreFullPath);
42+
s_logger.trace("vCenter API trace - deleteFile(). target mor: " + _mor.getValue() + ", file datastore path: " + datastoreFullPath);
4343

4444
_context.getService().deleteFile(_mor, datastoreFullPath);
4545

@@ -49,7 +49,7 @@ public void DeleteFile(String datastoreFullPath) throws Exception {
4949

5050
public HostDatastoreBrowserSearchResults searchDatastore(String datastorePath, HostDatastoreBrowserSearchSpec searchSpec) throws Exception {
5151
if(s_logger.isTraceEnabled())
52-
s_logger.trace("vCenter API trace - searchDatastore(). target mor: " + _mor.getPresetParams() + ", file datastore path: " + datastorePath);
52+
s_logger.trace("vCenter API trace - searchDatastore(). target mor: " + _mor.getValue() + ", file datastore path: " + datastorePath);
5353

5454
try {
5555
ManagedObjectReference morTask = _context.getService().searchDatastoreTask(_mor, datastorePath, searchSpec);
@@ -81,7 +81,7 @@ public HostDatastoreBrowserSearchResults searchDatastore(String datastorePath, S
8181
@SuppressWarnings("unchecked")
8282
public ArrayList<HostDatastoreBrowserSearchResults> searchDatastoreSubFolders(String datastorePath, HostDatastoreBrowserSearchSpec searchSpec) throws Exception {
8383
if(s_logger.isTraceEnabled())
84-
s_logger.trace("vCenter API trace - searchDatastoreSubFolders(). target mor: " + _mor.getPresetParams() + ", file datastore path: " + datastorePath);
84+
s_logger.trace("vCenter API trace - searchDatastoreSubFolders(). target mor: " + _mor.getValue() + ", file datastore path: " + datastorePath);
8585

8686
try {
8787
ManagedObjectReference morTask = _context.getService().searchDatastoreSubFoldersTask(_mor, datastorePath, searchSpec);

vmware-base/src/com/cloud/hypervisor/vmware/mo/HostDatastoreSystemMO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public ManagedObjectReference findDatastore(String name) throws Exception {
6363
DynamicProperty prop = oc.getPropSet().get(1);
6464
if(prop != null && prop.getVal() != null) {
6565
if(prop.getVal() instanceof CustomFieldStringValue) {
66-
String val = ((CustomFieldStringValue)prop.getVal()).getPresetParams();
66+
String val = ((CustomFieldStringValue)prop.getVal()).getValue();
6767
if(val.equalsIgnoreCase(name))
6868
return oc.getObj();
6969
}

0 commit comments

Comments
 (0)