test: stabilize 4.13/master (#3547)

Fix failing smoketests, fix NPEs. 

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2019-08-13 11:51:10 +05:30 committed by GitHub
parent 3c2af55d81
commit b576972f71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 8 deletions

View File

@ -78,8 +78,10 @@ public class CephSnapshotStrategy extends StorageSystemSnapshotStrategy {
protected boolean isSnapshotStoredOnRbdStoragePool(Snapshot snapshot) {
SnapshotDataStoreVO snapshotStore = snapshotStoreDao.findBySnapshot(snapshot.getId(), DataStoreRole.Primary);
long snapshotStoragePoolId = snapshotStore.getDataStoreId();
StoragePoolVO storagePoolVO = primaryDataStoreDao.findById(snapshotStoragePoolId);
return storagePoolVO.getPoolType() == StoragePoolType.RBD;
if (snapshotStore == null) {
return false;
}
StoragePoolVO storagePoolVO = primaryDataStoreDao.findById(snapshotStore.getDataStoreId());
return storagePoolVO != null && storagePoolVO.getPoolType() == StoragePoolType.RBD;
}
}

View File

@ -1062,7 +1062,7 @@ public class CommandSetupHelper {
final NicVO defaultNic = _nicDao.findDefaultNicForVM(userVmId);
// check if DNS provider is the domR
if (!_networkModel.isProviderSupportServiceInNetwork(defaultNic.getNetworkId(), Service.Dns, Provider.VirtualRouter)) {
if (defaultNic == null || !_networkModel.isProviderSupportServiceInNetwork(defaultNic.getNetworkId(), Service.Dns, Provider.VirtualRouter)) {
return null;
}

View File

@ -1476,7 +1476,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN, vmInstance.getAccountId(), vmInstance.getDataCenterId(), vmInstance.getId(),
oldNicIdString, oldNetworkOfferingId, null, 0L, VirtualMachine.class.getName(), vmInstance.getUuid(), vmInstance.isDisplay());
if (vmInstance.getState() != State.Stopped) {
if (vmInstance.getState() == State.Running) {
try {
VirtualMachineProfile vmProfile = new VirtualMachineProfileImpl(vmInstance);
User callerUser = _accountMgr.getActiveUser(CallContext.current().getCallingUserId());
@ -4806,7 +4806,11 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
if (!(userVm.getHypervisorType().equals(HypervisorType.KVM) || userVm.getHypervisorType().equals(HypervisorType.VMware))) {
return;
}
s_logger.debug("Collect vm disk statistics from host before stopping Vm");
s_logger.debug("Collect vm disk statistics from host before stopping VM");
if (userVm.getHostId() == null) {
s_logger.error("Unable to collect vm disk statistics for VM as the host is null, skipping VM disk statistics collection");
return;
}
long hostId = userVm.getHostId();
List<String> vmNames = new ArrayList<String>();
vmNames.add(userVm.getInstanceName());

View File

@ -56,8 +56,8 @@ class DataBag:
with open(self.fpath, 'r') as _fh:
logging.debug("Loading data bag type %s", self.key)
data = json.load(_fh)
except IOError:
logging.debug("Creating data bag type %s", self.key)
except (IOError, ValueError):
logging.debug("Caught load error, creating empty data bag type %s", self.key)
data.update({"id": self.key})
finally:
self.dbag = data

View File

@ -68,6 +68,7 @@ config_guest() {
xen-pv|xen-domU)
systemctl stop ntpd
systemctl disable ntpd
systemctl enable xe-daemon
systemctl start xe-daemon
cat /proc/cmdline > $CMDLINE
@ -76,6 +77,7 @@ config_guest() {
xen-hvm)
systemctl stop ntpd
systemctl disable ntpd
systemctl enable xe-daemon
systemctl start xe-daemon
if [ ! -f /usr/bin/xenstore-read ]; then
@ -114,12 +116,14 @@ config_guest() {
# system time sync'd with host via vmware tools
systemctl stop ntpd
systemctl disable ntpd
systemctl enable open-vm-tools
systemctl start open-vm-tools
vmtoolsd --cmd 'machine.id.get' > $CMDLINE
;;
virtualpc|hyperv)
# Hyper-V is recognized as virtualpc hypervisor type. Boot args are passed using KVP Daemon
systemctl enable hyperv-daemons.hv-fcopy-daemon.service hyperv-daemons.hv-kvp-daemon.service hyperv-daemons.hv-vss-daemon.service
systemctl start hyperv-daemons.hv-fcopy-daemon.service hyperv-daemons.hv-kvp-daemon.service hyperv-daemons.hv-vss-daemon.service
sleep 5
cp -f /var/opt/hyperv/.kvp_pool_0 $CMDLINE