Skip to content

Commit 742b52d

Browse files
committed
Revert "VMware Import - Support external VMs in any folders/subfolders other than the root folder ('vm') of datacenter (apache#10411)"
This reverts commit b9ebc7b.
1 parent e196275 commit 742b52d

File tree

6 files changed

+2
-47
lines changed

6 files changed

+2
-47
lines changed

api/src/main/java/com/cloud/agent/api/to/RemoteInstanceTO.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public class RemoteInstanceTO implements Serializable {
2727

2828
private Hypervisor.HypervisorType hypervisorType;
2929
private String instanceName;
30-
private String instancePath;
3130

3231
// VMware Remote Instances parameters (required for exporting OVA through ovftool)
3332
// TODO: cloud.agent.transport.Request#getCommands() cannot handle gsoc decode for polymorphic classes
@@ -45,10 +44,9 @@ public RemoteInstanceTO(String instanceName) {
4544
this.instanceName = instanceName;
4645
}
4746

48-
public RemoteInstanceTO(String instanceName, String instancePath, String vcenterHost, String vcenterUsername, String vcenterPassword, String datacenterName) {
47+
public RemoteInstanceTO(String instanceName, String vcenterHost, String vcenterUsername, String vcenterPassword, String datacenterName) {
4948
this.hypervisorType = Hypervisor.HypervisorType.VMware;
5049
this.instanceName = instanceName;
51-
this.instancePath = instancePath;
5250
this.vcenterHost = vcenterHost;
5351
this.vcenterUsername = vcenterUsername;
5452
this.vcenterPassword = vcenterPassword;
@@ -63,10 +61,6 @@ public String getInstanceName() {
6361
return this.instanceName;
6462
}
6563

66-
public String getInstancePath() {
67-
return this.instancePath;
68-
}
69-
7064
public String getVcenterUsername() {
7165
return vcenterUsername;
7266
}

api/src/main/java/org/apache/cloudstack/vm/UnmanagedInstanceTO.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ public enum PowerState {
3333

3434
private String internalCSName;
3535

36-
private String path;
37-
3836
private PowerState powerState;
3937

4038
private PowerState cloneSourcePowerState;
@@ -77,14 +75,6 @@ public void setInternalCSName(String internalCSName) {
7775
this.internalCSName = internalCSName;
7876
}
7977

80-
public String getPath() {
81-
return path;
82-
}
83-
84-
public void setPath(String path) {
85-
this.path = path;
86-
}
87-
8878
public PowerState getPowerState() {
8979
return powerState;
9080
}

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtConvertInstanceCommandWrapper.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public Answer execute(ConvertInstanceCommand cmd, LibvirtComputingResource serve
5757
RemoteInstanceTO sourceInstance = cmd.getSourceInstance();
5858
Hypervisor.HypervisorType sourceHypervisorType = sourceInstance.getHypervisorType();
5959
String sourceInstanceName = sourceInstance.getInstanceName();
60-
String sourceInstancePath = sourceInstance.getInstancePath();
6160
Hypervisor.HypervisorType destinationHypervisorType = cmd.getDestinationHypervisorType();
6261
DataStoreTO conversionTemporaryLocation = cmd.getConversionTemporaryLocation();
6362
long timeout = (long) cmd.getWait() * 1000;
@@ -178,15 +177,9 @@ private String getExportOVAUrlFromRemoteInstance(RemoteInstanceTO vmwareInstance
178177
String password = vmwareInstance.getVcenterPassword();
179178
String datacenter = vmwareInstance.getDatacenterName();
180179
String vm = vmwareInstance.getInstanceName();
181-
String path = vmwareInstance.getInstancePath();
182180

183181
String encodedUsername = encodeUsername(username);
184182
String encodedPassword = encodeUsername(password);
185-
if (StringUtils.isNotBlank(path)) {
186-
s_logger.info("VM path: " + path);
187-
return String.format("vi://%s:%s@%s/%s/%s/%s",
188-
encodedUsername, encodedPassword, vcenter, datacenter, path, vm);
189-
}
190183
return String.format("vi://%s:%s@%s/%s/vm/%s",
191184
encodedUsername, encodedPassword, vcenter, datacenter, vm);
192185
}

server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1947,7 +1947,7 @@ private UnmanagedInstanceTO convertVmwareInstanceToKVMAfterExportingOVFToConvert
19471947
LOGGER.debug(String.format("Delegating the conversion of instance %s from VMware to KVM to the host %s (%s) after OVF export through ovftool",
19481948
sourceVM, convertHost.getId(), convertHost.getName()));
19491949

1950-
RemoteInstanceTO remoteInstanceTO = new RemoteInstanceTO(sourceVMwareInstance.getName(), sourceVMwareInstance.getPath(), vcenterHost, vcenterUsername, vcenterPassword, datacenterName);
1950+
RemoteInstanceTO remoteInstanceTO = new RemoteInstanceTO(sourceVMwareInstance.getName(), vcenterHost, vcenterUsername, vcenterPassword, datacenterName);
19511951
List<String> destinationStoragePools = selectInstanceConversionStoragePools(convertStoragePools, sourceVMwareInstance.getDisks(), serviceOffering, dataDiskOfferingMap);
19521952
ConvertInstanceCommand cmd = new ConvertInstanceCommand(remoteInstanceTO,
19531953
Hypervisor.HypervisorType.KVM, temporaryConvertLocation, null, false, true);

vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -891,27 +891,6 @@ public VirtualMachineFileLayoutEx getFileLayout() throws Exception {
891891
return fileLayout;
892892
}
893893

894-
public String getPath() throws Exception {
895-
List<String> subPaths = new ArrayList<>();
896-
ManagedObjectReference mor = _context.getVimClient().getDynamicProperty(_mor, "parent");
897-
while (mor != null && mor.getType().equalsIgnoreCase("Folder")) {
898-
String subPath = _context.getVimClient().getDynamicProperty(mor, "name");
899-
if (StringUtils.isBlank(subPath)) {
900-
return null;
901-
}
902-
subPaths.add(subPath);
903-
mor = _context.getVimClient().getDynamicProperty(mor, "parent");
904-
}
905-
906-
if (!subPaths.isEmpty()) {
907-
Collections.reverse(subPaths);
908-
String path = StringUtils.join(subPaths, "/");
909-
return path;
910-
}
911-
912-
return null;
913-
}
914-
915894
@Override
916895
public ManagedObjectReference getParentMor() throws Exception {
917896
return _context.getVimClient().getDynamicProperty(_mor, "parent");

vmware-base/src/main/java/com/cloud/hypervisor/vmware/util/VmwareHelper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,6 @@ public static UnmanagedInstanceTO getUnmanagedInstance(VmwareHypervisorHost hype
801801
instance = new UnmanagedInstanceTO();
802802
instance.setName(vmMo.getVmName());
803803
instance.setInternalCSName(vmMo.getInternalCSName());
804-
instance.setPath((vmMo.getPath()));
805804
instance.setCpuCoresPerSocket(vmMo.getCoresPerSocket());
806805
instance.setOperatingSystemId(vmMo.getVmGuestInfo().getGuestId());
807806
VirtualMachineConfigSummary configSummary = vmMo.getConfigSummary();

0 commit comments

Comments
 (0)