Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ public boolean revertSnapshot(SnapshotInfo snapshotInfo) {

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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ private NicVO findDefaultDnsIp(final long userVmId) {
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;
}

Expand Down
8 changes: 6 additions & 2 deletions server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ public UserVm updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd cmd) th
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) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log warning perhaps if this method is called when not in running state?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the case should trigger only when user vm is in running state

try {
VirtualMachineProfile vmProfile = new VirtualMachineProfileImpl(vmInstance);
User callerUser = _accountMgr.getActiveUser(CallContext.current().getCallingUserId());
Expand Down Expand Up @@ -4761,7 +4761,11 @@ public void collectVmDiskStatistics(final UserVm userVm) {
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());
Expand Down
4 changes: 2 additions & 2 deletions systemvm/debian/opt/cloud/bin/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def load(self):
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
Expand Down
4 changes: 4 additions & 0 deletions systemvm/debian/opt/cloud/bin/setup/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down