Skip to content

Commit 15b11a3

Browse files
committed
CLOUDSTACK-10013: Fix VMware related issues and fix misc tests
This fixes test failures around VMware with the new systemvmtemplate. In addition: - Does not skip rVR related test cases for VMware - Removes rc.local - Processes unprocessed cmd_line.json - Fixed NPEs around VMware tests/code - On VMware, use udevadm to reconfigure nic/mac address than rebooting - Fix proper acpi shutdown script for faster systemvm shutdowns - Give at least 256MB of swap for VRs to avoid OOM on VMware - Fixes smoke tests for environment related failures Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent ce33032 commit 15b11a3

26 files changed

Lines changed: 92 additions & 103 deletions

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4776,8 +4776,8 @@ private Pair<JobInfo.Status, String> orchestrateStop(final VmWorkStop work) thro
47764776
final VMInstanceVO vm = _entityMgr.findById(VMInstanceVO.class, work.getVmId());
47774777
if (vm == null) {
47784778
s_logger.info("Unable to find vm " + work.getVmId());
4779+
throw new CloudRuntimeException("Unable to find VM id=" + work.getVmId());
47794780
}
4780-
assert vm != null;
47814781

47824782
orchestrateStop(vm.getUuid(), work.isCleanup());
47834783
return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED, null);

python/lib/cloudutils/utilities.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ def isKVMEnabled(self):
216216
class serviceOpsRedhat7(serviceOps):
217217
def isServiceRunning(self, servicename):
218218
try:
219-
o = bash("systemctl status " + servicename)
220-
if "running" in o.getStdout() or "start" in o.getStdout() or "Running" in o.getStdout():
219+
o = bash("systemctl is-active " + servicename)
220+
if "inactive" not in o.getStdout():
221221
return True
222222
else:
223223
return False

server/src/com/cloud/server/StatsCollector.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
import com.cloud.cluster.dao.ManagementServerHostDao;
6565
import com.cloud.dc.Vlan.VlanType;
6666
import com.cloud.dc.VlanVO;
67+
import com.cloud.dc.dao.ClusterDao;
6768
import com.cloud.dc.dao.VlanDao;
6869
import com.cloud.exception.StorageUnavailableException;
6970
import com.cloud.gpu.dao.HostGpuGroupsDao;
@@ -92,18 +93,20 @@
9293
import com.cloud.network.as.dao.AutoScaleVmProfileDao;
9394
import com.cloud.network.as.dao.ConditionDao;
9495
import com.cloud.network.as.dao.CounterDao;
96+
import com.cloud.org.Cluster;
9597
import com.cloud.resource.ResourceManager;
9698
import com.cloud.resource.ResourceState;
9799
import com.cloud.service.ServiceOfferingVO;
98100
import com.cloud.service.dao.ServiceOfferingDao;
99101
import com.cloud.storage.ImageStoreDetailsUtil;
102+
import com.cloud.storage.ScopeType;
103+
import com.cloud.storage.Storage.ImageFormat;
100104
import com.cloud.storage.StorageManager;
101105
import com.cloud.storage.StorageStats;
102106
import com.cloud.storage.VolumeStats;
103107
import com.cloud.storage.VolumeVO;
104108
import com.cloud.storage.dao.VolumeDao;
105109
import com.cloud.user.UserStatisticsVO;
106-
import com.cloud.storage.Storage.ImageFormat;
107110
import com.cloud.user.VmDiskStatisticsVO;
108111
import com.cloud.user.dao.UserStatisticsDao;
109112
import com.cloud.user.dao.VmDiskStatisticsDao;
@@ -173,6 +176,8 @@ public String toString() {
173176
@Inject
174177
private HostDao _hostDao;
175178
@Inject
179+
private ClusterDao _clusterDao;
180+
@Inject
176181
private UserVmDao _userVmDao;
177182
@Inject
178183
private VolumeDao _volsDao;
@@ -916,7 +921,18 @@ else if (volume.getFormat() == ImageFormat.OVA){
916921
}
917922
}
918923
try {
919-
HashMap<String, VolumeStatsEntry> volumeStatsByUuid = _userVmMgr.getVolumeStatistics(pool.getClusterId(), pool.getUuid(), pool.getPoolType(), volumeLocators, StatsTimeout.value());
924+
Map<String, VolumeStatsEntry> volumeStatsByUuid;
925+
if (pool.getScope() == ScopeType.ZONE) {
926+
volumeStatsByUuid = new HashMap<>();
927+
for (final Cluster cluster: _clusterDao.listByZoneId(pool.getDataCenterId())) {
928+
final Map<String, VolumeStatsEntry> volumeStatsForCluster = _userVmMgr.getVolumeStatistics(cluster.getId(), pool.getUuid(), pool.getPoolType(), volumeLocators, StatsTimeout.value());
929+
if (volumeStatsForCluster != null) {
930+
volumeStatsByUuid.putAll(volumeStatsForCluster);
931+
}
932+
}
933+
} else {
934+
volumeStatsByUuid = _userVmMgr.getVolumeStatistics(pool.getClusterId(), pool.getUuid(), pool.getPoolType(), volumeLocators, StatsTimeout.value());
935+
}
920936
if (volumeStatsByUuid != null){
921937
for (final Map.Entry<String, VolumeStatsEntry> entry : volumeStatsByUuid.entrySet()) {
922938
if (entry == null || entry.getKey() == null || entry.getValue() == null) {

systemvm/agent/conf/log4j-cloud.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ under the License.
2424
<!-- Preserve messages in a local file -->
2525
<!-- ================================= -->
2626

27-
<appender name="FILE1" class="org.apache.log4j.RollingFileAppender">
27+
<appender name="cloudLog" class="org.apache.log4j.RollingFileAppender">
2828
<param name="File" value="/var/log/cloud.log"/>
2929
<param name="MaxFileSize" value="10000KB"/>
3030
<param name="MaxBackupIndex" value="4"/>
@@ -34,7 +34,7 @@ under the License.
3434
</layout>
3535
</appender>
3636

37-
<appender name="FILE2" class="org.apache.log4j.RollingFileAppender">
37+
<appender name="cloudOut" class="org.apache.log4j.RollingFileAppender">
3838
<param name="File" value="/var/log/cloud/cloud.out"/>
3939
<param name="Append" value="true"/>
4040
<param name="MaxFileSize" value="10000KB"/>
@@ -45,7 +45,7 @@ under the License.
4545
</layout>
4646
</appender>
4747

48-
<appender name="FILE3" class="org.apache.log4j.rolling.RollingFileAppender">
48+
<appender name="cloudSystemvmLog" class="org.apache.log4j.rolling.RollingFileAppender">
4949
<param name="File" value="/usr/local/cloud/systemvm/cloud.log"/>
5050
<param name="Append" value="true"/>
5151
<param name="MaxFileSize" value="10000KB"/>
@@ -123,9 +123,9 @@ under the License.
123123
<root>
124124
<level value="INFO"/>
125125
<appender-ref ref="CONSOLE"/>
126-
<appender-ref ref="FILE1"/>
127-
<appender-ref ref="FILE2"/>
128-
<appender-ref ref="FILE3"/>
126+
<appender-ref ref="cloudLog"/>
127+
<appender-ref ref="cloudOut"/>
128+
<appender-ref ref="cloudSystemvmLog"/>
129129
</root>
130130

131131
</log4j:configuration>

systemvm/debian/etc/issue

Lines changed: 0 additions & 3 deletions
This file was deleted.

systemvm/debian/etc/rc.local

Lines changed: 0 additions & 19 deletions
This file was deleted.

systemvm/debian/opt/cloud/bin/cs/CsDhcp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def configure_server(self):
8080
# DNS search order
8181
if gn.get_dns() and device:
8282
sline = "dhcp-option=tag:interface-%s-%s,6" % (device, idx)
83-
dns_list = [x for x in gn.get_dns() if x is not None]
83+
dns_list = [x for x in gn.get_dns() if not (not x)]
8484
line = "dhcp-option=tag:interface-%s-%s,6,%s" % (device, idx, ','.join(dns_list))
8585
self.conf.search(sline, line)
8686
# Gateway

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,14 @@ setup_common() {
331331
ip route add default via $GW dev $gwdev
332332
fi
333333

334-
# a hacking way to activate vSwitch under VMware
335-
ping -n -c 3 $GW &
334+
# Workaround to activate vSwitch under VMware
335+
timeout 3 ping -n -c 3 $GW || true
336336
if [ -n "$MGMTNET" -a -n "$LOCAL_GW" ]
337337
then
338-
ping -n -c 3 $LOCAL_GW &
338+
timeout 3 ping -n -c 3 $LOCAL_GW || true
339339
#This code is added to address ARP issue by pinging MGMT_GW
340340
MGMT_GW=$(echo $MGMTNET | awk -F "." '{print $1"."$2"."$3".1"}')
341-
ping -n -c 3 $MGMT_GW &
341+
timeout 3 ping -n -c 3 $MGMT_GW || true
342342
fi
343343

344344
if [ "$HYPERVISOR" == "vmware" ]; then

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,8 @@ setup_router() {
5959

6060
if [ "$oldmd5" != "$newmd5" ]
6161
then
62-
log_it "udev NIC assignment requires reboot to take effect"
63-
sync
64-
sleep 2
65-
reboot
62+
log_it "Reloading udev for new udev NIC assignment"
63+
udevadm control --reload-rules && udevadm trigger
6664
fi
6765
fi
6866

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,8 @@ EOF
6565
if [ "$HYPERVISOR" == "vmware" ] || [ "$HYPERVISOR" == "hyperv" ];
6666
then
6767
ip route add $MGMTNET via $LOCAL_GW dev eth0
68-
69-
# a hacking way to activate vSwitch under VMware
70-
ping -n -c 3 $LOCAL_GW &
71-
sleep 3
72-
pkill ping
68+
# workaround to activate vSwitch under VMware
69+
timeout 3 ping -n -c 3 $LOCAL_GW || true
7370
fi
7471
fi
7572

0 commit comments

Comments
 (0)