@@ -4879,29 +4879,24 @@ public UserVm createVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityE
48794879 return vm ;
48804880 }
48814881
4882- protected void setExtraConfigKeyValues (Long vmId , HypervisorType hypervisorType , String [] configData ){
4883- String re = (hypervisorType == HypervisorType .VMware )? "=" : " " ;
4884- for (String config : configData ) {
4885- int index = config .indexOf (re );
4886- String cmd = config .substring (0 , index );
4887- try {
4888- userVmDetailsDao .addDetail (vmId , cmd ,config .substring (index ),true );
4889- } catch (StringIndexOutOfBoundsException e ) {
4890- s_logger .error ("Exception occurred: " + e .getMessage ());
4891- throw new CloudRuntimeException ("Issue occurred during parsing of:" + config );
4892- }
4893- }
4894- }
4895-
48964882 protected void addExtraConfig (UserVm vm , Account caller , String extraConfig ) {
48974883 final Long callerId = caller .getId ();
48984884 final String decodedUrl = decodeExtraConfig (extraConfig );
48994885 final HypervisorType hypervisorType = vm .getHypervisorType ();
49004886 final Long vmId = vm .getId ();
49014887 validateConfigOption (decodedUrl , callerId , hypervisorType );
4902- if (hypervisorType == HypervisorType .VMware || hypervisorType == HypervisorType . XenServer ) {
4888+ if (hypervisorType == HypervisorType .VMware ) {
49034889 String [] configDataArr = decodedUrl .split ("\\ r?\\ n" );
4904- setExtraConfigKeyValues (vmId , hypervisorType , configDataArr );
4890+ for (String config : configDataArr ) {
4891+ int index = config .indexOf ("=" );
4892+ String cmd = config .substring (0 , index );
4893+ try {
4894+ userVmDetailsDao .addDetail (vmId , cmd ,config .substring (index ),true );
4895+ } catch (StringIndexOutOfBoundsException e ) {
4896+ s_logger .error ("Exception occurred: " + e .getMessage ());
4897+ throw new CloudRuntimeException ("Issue occurred during parsing of:" + config );
4898+ }
4899+ }
49054900 } else {
49064901 userVmDetailsDao .addDetail (vm .getId (), ApiConstants .EXTRA_CONFIG , decodedUrl , true );
49074902 }
0 commit comments