Skip to content

Commit 0fa8aa0

Browse files
author
Dingane Hlaluku
committed
Fix bug for XenServer
1 parent 73a444d commit 0fa8aa0

1 file changed

Lines changed: 11 additions & 16 deletions

File tree

server/src/main/java/com/cloud/vm/UserVmManagerImpl.java

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4878,29 +4878,24 @@ public UserVm createVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityE
48784878
return vm;
48794879
}
48804880

4881-
protected void setExtraConfigKeyValues(Long vmId, HypervisorType hypervisorType, String[] configData){
4882-
String re = (hypervisorType == HypervisorType.VMware)? "=": " ";
4883-
for (String config : configData) {
4884-
int index = config.indexOf(re);
4885-
String cmd = config.substring(0, index);
4886-
try {
4887-
userVmDetailsDao.addDetail(vmId, cmd,config.substring(index),true);
4888-
} catch (StringIndexOutOfBoundsException e) {
4889-
s_logger.error("Exception occurred: " + e.getMessage());
4890-
throw new CloudRuntimeException("Issue occurred during parsing of:" + config);
4891-
}
4892-
}
4893-
}
4894-
48954881
protected void addExtraConfig(UserVm vm, Account caller, String extraConfig) {
48964882
final Long callerId = caller.getId();
48974883
final String decodedUrl = decodeExtraConfig(extraConfig);
48984884
final HypervisorType hypervisorType = vm.getHypervisorType();
48994885
final Long vmId = vm.getId();
49004886
validateConfigOption(decodedUrl, callerId, hypervisorType);
4901-
if (hypervisorType == HypervisorType.VMware || hypervisorType == HypervisorType.XenServer) {
4887+
if (hypervisorType == HypervisorType.VMware) {
49024888
String[] configDataArr = decodedUrl.split("\\r?\\n");
4903-
setExtraConfigKeyValues(vmId, hypervisorType, configDataArr);
4889+
for (String config : configDataArr) {
4890+
int index = config.indexOf("=");
4891+
String cmd = config.substring(0, index);
4892+
try {
4893+
userVmDetailsDao.addDetail(vmId, cmd,config.substring(index),true);
4894+
} catch (StringIndexOutOfBoundsException e) {
4895+
s_logger.error("Exception occurred: " + e.getMessage());
4896+
throw new CloudRuntimeException("Issue occurred during parsing of:" + config);
4897+
}
4898+
}
49044899
} else {
49054900
userVmDetailsDao.addDetail(vm.getId(), ApiConstants.EXTRA_CONFIG, decodedUrl, true);
49064901
}

0 commit comments

Comments
 (0)