Skip to content

Commit b576972

Browse files
authored
test: stabilize 4.13/master (#3547)
Fix failing smoketests, fix NPEs. Signed-off-by: Rohit Yadav <[email protected]>
1 parent 3c2af55 commit b576972

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/CephSnapshotStrategy.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ public boolean revertSnapshot(SnapshotInfo snapshotInfo) {
7878

7979
protected boolean isSnapshotStoredOnRbdStoragePool(Snapshot snapshot) {
8080
SnapshotDataStoreVO snapshotStore = snapshotStoreDao.findBySnapshot(snapshot.getId(), DataStoreRole.Primary);
81-
long snapshotStoragePoolId = snapshotStore.getDataStoreId();
82-
StoragePoolVO storagePoolVO = primaryDataStoreDao.findById(snapshotStoragePoolId);
83-
return storagePoolVO.getPoolType() == StoragePoolType.RBD;
81+
if (snapshotStore == null) {
82+
return false;
83+
}
84+
StoragePoolVO storagePoolVO = primaryDataStoreDao.findById(snapshotStore.getDataStoreId());
85+
return storagePoolVO != null && storagePoolVO.getPoolType() == StoragePoolType.RBD;
8486
}
8587
}

server/src/main/java/com/cloud/network/router/CommandSetupHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ private NicVO findDefaultDnsIp(final long userVmId) {
10621062
final NicVO defaultNic = _nicDao.findDefaultNicForVM(userVmId);
10631063

10641064
// check if DNS provider is the domR
1065-
if (!_networkModel.isProviderSupportServiceInNetwork(defaultNic.getNetworkId(), Service.Dns, Provider.VirtualRouter)) {
1065+
if (defaultNic == null || !_networkModel.isProviderSupportServiceInNetwork(defaultNic.getNetworkId(), Service.Dns, Provider.VirtualRouter)) {
10661066
return null;
10671067
}
10681068

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,7 +1476,7 @@ public UserVm updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd cmd) th
14761476
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN, vmInstance.getAccountId(), vmInstance.getDataCenterId(), vmInstance.getId(),
14771477
oldNicIdString, oldNetworkOfferingId, null, 0L, VirtualMachine.class.getName(), vmInstance.getUuid(), vmInstance.isDisplay());
14781478

1479-
if (vmInstance.getState() != State.Stopped) {
1479+
if (vmInstance.getState() == State.Running) {
14801480
try {
14811481
VirtualMachineProfile vmProfile = new VirtualMachineProfileImpl(vmInstance);
14821482
User callerUser = _accountMgr.getActiveUser(CallContext.current().getCallingUserId());
@@ -4806,7 +4806,11 @@ public void collectVmDiskStatistics(final UserVm userVm) {
48064806
if (!(userVm.getHypervisorType().equals(HypervisorType.KVM) || userVm.getHypervisorType().equals(HypervisorType.VMware))) {
48074807
return;
48084808
}
4809-
s_logger.debug("Collect vm disk statistics from host before stopping Vm");
4809+
s_logger.debug("Collect vm disk statistics from host before stopping VM");
4810+
if (userVm.getHostId() == null) {
4811+
s_logger.error("Unable to collect vm disk statistics for VM as the host is null, skipping VM disk statistics collection");
4812+
return;
4813+
}
48104814
long hostId = userVm.getHostId();
48114815
List<String> vmNames = new ArrayList<String>();
48124816
vmNames.add(userVm.getInstanceName());

systemvm/debian/opt/cloud/bin/merge.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def load(self):
5656
with open(self.fpath, 'r') as _fh:
5757
logging.debug("Loading data bag type %s", self.key)
5858
data = json.load(_fh)
59-
except IOError:
60-
logging.debug("Creating data bag type %s", self.key)
59+
except (IOError, ValueError):
60+
logging.debug("Caught load error, creating empty data bag type %s", self.key)
6161
data.update({"id": self.key})
6262
finally:
6363
self.dbag = data

systemvm/debian/opt/cloud/bin/setup/bootstrap.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ config_guest() {
6868
xen-pv|xen-domU)
6969
systemctl stop ntpd
7070
systemctl disable ntpd
71+
systemctl enable xe-daemon
7172
systemctl start xe-daemon
7273

7374
cat /proc/cmdline > $CMDLINE
@@ -76,6 +77,7 @@ config_guest() {
7677
xen-hvm)
7778
systemctl stop ntpd
7879
systemctl disable ntpd
80+
systemctl enable xe-daemon
7981
systemctl start xe-daemon
8082

8183
if [ ! -f /usr/bin/xenstore-read ]; then
@@ -114,12 +116,14 @@ config_guest() {
114116
# system time sync'd with host via vmware tools
115117
systemctl stop ntpd
116118
systemctl disable ntpd
119+
systemctl enable open-vm-tools
117120
systemctl start open-vm-tools
118121

119122
vmtoolsd --cmd 'machine.id.get' > $CMDLINE
120123
;;
121124
virtualpc|hyperv)
122125
# Hyper-V is recognized as virtualpc hypervisor type. Boot args are passed using KVP Daemon
126+
systemctl enable hyperv-daemons.hv-fcopy-daemon.service hyperv-daemons.hv-kvp-daemon.service hyperv-daemons.hv-vss-daemon.service
123127
systemctl start hyperv-daemons.hv-fcopy-daemon.service hyperv-daemons.hv-kvp-daemon.service hyperv-daemons.hv-vss-daemon.service
124128
sleep 5
125129
cp -f /var/opt/hyperv/.kvp_pool_0 $CMDLINE

0 commit comments

Comments
 (0)