Skip to content

Commit a1791cb

Browse files
Sakshamsyadvr
authored andcommitted
CLOUDSTACK-8088: VM scale up is failing in vmware with Unable to execute ScaleVmCommand due to java.lang.NullPointerException
(cherry picked from commit 1df0453) Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 8676ff2 commit a1791cb

11 files changed

Lines changed: 75 additions & 0 deletions

File tree

api/src/com/cloud/hypervisor/HypervisorGuru.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.cloud.hypervisor;
1818

1919
import java.util.List;
20+
import java.util.Map;
2021

2122
import org.apache.cloudstack.framework.config.ConfigKey;
2223

@@ -81,4 +82,6 @@ public interface HypervisorGuru extends Adapter {
8182
List<Command> finalizeExpungeNics(VirtualMachine vm, List<NicProfile> nics);
8283

8384
List<Command> finalizeExpungeVolumes(VirtualMachine vm);
85+
86+
Map<String, String> getClusterSettings(long vmId);
8487
}

engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3487,6 +3487,13 @@ private VMInstanceVO orchestrateReConfigureVm(String vmUuid, ServiceOffering old
34873487
newServiceOffering.getSpeed(), minMemory * 1024L * 1024L, newServiceOffering.getRamSize() * 1024L * 1024L, newServiceOffering.getLimitCpuUse());
34883488

34893489
Long dstHostId = vm.getHostId();
3490+
if(vm.getHypervisorType().equals(HypervisorType.VMware)) {
3491+
HypervisorGuru hvGuru = _hvGuruMgr.getGuru(vm.getHypervisorType());
3492+
Map<String, String> details = null;
3493+
details = hvGuru.getClusterSettings(vm.getId());
3494+
reconfigureCmd.getVirtualMachine().setDetails(details);
3495+
}
3496+
34903497
ItWorkVO work = new ItWorkVO(UUID.randomUUID().toString(), _nodeId, State.Running, vm.getType(), vm.getId());
34913498
work.setStep(Step.Prepare);
34923499
work.setResourceType(ItWorkVO.ResourceType.Host);

plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalGuru.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,10 @@ public VirtualMachineTO implement(VirtualMachineProfile vm) {
8484
public boolean trackVmHostChange() {
8585
return false;
8686
}
87+
88+
@Override
89+
public Map<String, String> getClusterSettings(long vmId) {
90+
return null;
91+
}
92+
8793
}

plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/guru/HypervGuru.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.Collections;
2121
import java.util.Comparator;
2222
import java.util.List;
23+
import java.util.Map;
2324

2425
import javax.ejb.Local;
2526
import javax.inject.Inject;
@@ -194,4 +195,10 @@ public int compare(NicTO arg0, NicTO arg1) {
194195
public final boolean trackVmHostChange() {
195196
return false;
196197
}
198+
199+
@Override
200+
public Map<String, String> getClusterSettings(long vmId) {
201+
return null;
202+
}
203+
197204
}

plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmGuru.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
// under the License.
1717
package com.cloud.ovm.hypervisor;
1818

19+
import java.util.Map;
20+
1921
import javax.ejb.Local;
2022
import javax.inject.Inject;
2123

@@ -58,4 +60,10 @@ public boolean trackVmHostChange() {
5860
return true;
5961
}
6062

63+
@Override
64+
public Map<String, String> getClusterSettings(long vmId) {
65+
return null;
66+
}
67+
68+
6169
}

plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorGuru.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
// under the License.
1717
package com.cloud.simulator;
1818

19+
import java.util.Map;
20+
1921
import javax.ejb.Local;
2022
import javax.inject.Inject;
2123

@@ -56,4 +58,10 @@ public VirtualMachineTO implement(VirtualMachineProfile vm) {
5658
public boolean trackVmHostChange() {
5759
return false;
5860
}
61+
62+
@Override
63+
public Map<String, String> getClusterSettings(long vmId) {
64+
return null;
65+
}
66+
5967
}

plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,4 +552,13 @@ public List<Command> finalizeExpungeVolumes(VirtualMachine vm) {
552552

553553
return commands;
554554
}
555+
556+
@Override
557+
public Map<String, String> getClusterSettings(long vmId) {
558+
Map<String, String> details = new HashMap<String, String>();
559+
long clusterId = getClusterId(vmId);
560+
details.put(VmwareReserveCpu.key(), VmwareReserveCpu.valueIn(clusterId).toString());
561+
details.put(VmwareReserveMemory.key(), VmwareReserveMemory.valueIn(clusterId).toString());
562+
return details;
563+
}
555564
}

plugins/hypervisors/xenserver/src/com/cloud/hypervisor/XenServerGuru.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.util.ArrayList;
2020
import java.util.List;
21+
import java.util.Map;
2122

2223
import javax.ejb.Local;
2324
import javax.inject.Inject;
@@ -128,6 +129,11 @@ public boolean trackVmHostChange() {
128129
return true;
129130
}
130131

132+
@Override
133+
public Map<String, String> getClusterSettings(long vmId) {
134+
return null;
135+
}
136+
131137
@Override
132138
public List<Command> finalizeExpungeVolumes(VirtualMachine vm) {
133139
List<Command> commands = new ArrayList<Command>();

server/src/com/cloud/hypervisor/HypervisorGuruBase.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,4 +190,10 @@ public List<Command> finalizeExpungeNics(VirtualMachine vm, List<NicProfile> nic
190190
public List<Command> finalizeExpungeVolumes(VirtualMachine vm) {
191191
return null;
192192
}
193+
194+
@Override
195+
public Map<String, String> getClusterSettings(long vmId) {
196+
return null;
197+
}
198+
193199
}

server/src/com/cloud/hypervisor/KVMGuru.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
// under the License.
1717
package com.cloud.hypervisor;
1818

19+
import java.util.Map;
20+
1921
import javax.ejb.Local;
2022
import javax.inject.Inject;
2123

@@ -86,4 +88,10 @@ public Pair<Boolean, Long> getCommandHostDelegation(long hostId, Command cmd) {
8688
public boolean trackVmHostChange() {
8789
return false;
8890
}
91+
92+
@Override
93+
public Map<String, String> getClusterSettings(long vmId) {
94+
return null;
95+
}
96+
8997
}

0 commit comments

Comments
 (0)