This is an automated email from the ASF dual-hosted git repository. rohit pushed a commit to branch debian9-systemvmtemplate in repository https://gitbox.apache.org/repos/asf/cloudstack.git
commit df3036e5d83552ad7c23689caf876679ad0c0b9f Author: Rohit Yadav <rohit.ya...@shapeblue.com> AuthorDate: Sat Dec 9 16:37:31 2017 +0530 CLOUDSTACK-10193: Fix smoke tests failures with new systemvmtemplate - Several systemvmtemplate optimizations - Uses new macchinina template for running smoke tests - Switch to latest Debian 9.3.0 release for systemvmtemplate - Introduce a new `get_test_template` that uses tiny test template such as macchinina as defined test_data.py - rVR related fixes and improvements Signed-off-by: Rohit Yadav <rohit.ya...@shapeblue.com> --- .travis.yml | 11 +-- .../framework/jobs/impl/AsyncJobManagerImpl.java | 4 + .../com/cloud/resource/ResourceManagerImpl.java | 2 +- server/src/com/cloud/server/StatsCollector.java | 12 ++- .../secondary/SecondaryStorageVmManager.java | 6 +- .../SecondaryStorageManagerImpl.java | 2 +- systemvm/debian/etc/issue | 2 +- systemvm/debian/etc/rc.local | 28 ------- .../etc/systemd/system/cloud-postinit.service | 2 +- systemvm/debian/opt/cloud/bin/cs/CsApp.py | 2 +- systemvm/debian/opt/cloud/bin/cs/CsRedundant.py | 11 ++- systemvm/debian/opt/cloud/bin/passwd_server | 26 ------ systemvm/debian/opt/cloud/bin/passwd_server_ip | 29 ------- systemvm/debian/opt/cloud/bin/setup/common.sh | 61 +------------- .../debian/opt/cloud/bin/setup/consoleproxy.sh | 2 +- systemvm/debian/opt/cloud/bin/setup/dhcpsrvr.sh | 2 +- systemvm/debian/opt/cloud/bin/setup/elbvm.sh | 2 +- systemvm/debian/opt/cloud/bin/setup/ilbvm.sh | 2 +- .../debian/opt/cloud/bin/setup/patchsystemvm.sh | 4 + systemvm/debian/opt/cloud/bin/setup/postinit.sh | 46 +++++++++-- systemvm/debian/opt/cloud/bin/setup/router.sh | 5 -- systemvm/debian/opt/cloud/bin/setup/secstorage.sh | 2 +- systemvm/debian/opt/cloud/bin/setup/vpcrouter.sh | 5 -- systemvm/debian/opt/cloud/bin/update_config.py | 7 -- systemvm/debian/opt/cloud/bin/vpc_passwd_server | 32 -------- .../opt/cloud/templates/keepalived.conf.templ | 11 ++- test/integration/smoke/test_accounts.py | 22 +++--- test/integration/smoke/test_affinity_groups.py | 10 +-- .../smoke/test_affinity_groups_projects.py | 11 +-- test/integration/smoke/test_deploy_vm_iso.py | 7 +- .../smoke/test_deploy_vm_with_userdata.py | 11 +-- ...st_deploy_vms_with_varied_deploymentplanners.py | 9 ++- test/integration/smoke/test_host_maintenance.py | 6 +- test/integration/smoke/test_hostha_kvm.py | 4 +- test/integration/smoke/test_internal_lb.py | 53 ++----------- test/integration/smoke/test_list_ids_parameter.py | 10 +-- test/integration/smoke/test_loadbalance.py | 10 +-- test/integration/smoke/test_metrics_api.py | 4 +- test/integration/smoke/test_multipleips_per_nic.py | 7 +- .../smoke/test_nested_virtualization.py | 15 ++-- test/integration/smoke/test_network.py | 36 ++++----- test/integration/smoke/test_network_acl.py | 9 ++- test/integration/smoke/test_nic_adapter_type.py | 6 +- test/integration/smoke/test_password_server.py | 7 +- test/integration/smoke/test_portforwardingrules.py | 6 +- test/integration/smoke/test_privategw_acl.py | 7 +- test/integration/smoke/test_projects.py | 7 +- test/integration/smoke/test_reset_vm_on_reboot.py | 7 +- test/integration/smoke/test_router_dhcphosts.py | 12 +-- test/integration/smoke/test_router_dns.py | 11 ++- test/integration/smoke/test_router_dnsservice.py | 11 +-- test/integration/smoke/test_routers.py | 12 ++- .../smoke/test_routers_iptables_default_policy.py | 15 ++-- test/integration/smoke/test_routers_network_ops.py | 71 ++--------------- test/integration/smoke/test_service_offerings.py | 11 ++- test/integration/smoke/test_snapshots.py | 65 +-------------- test/integration/smoke/test_templates.py | 22 +++--- test/integration/smoke/test_usage.py | 22 +----- test/integration/smoke/test_vpc_redundant.py | 55 ++----------- test/integration/smoke/test_vpc_router_nics.py | 30 ++++--- test/integration/smoke/test_vpc_vpn.py | 92 +++------------------- tools/appliance/build.sh | 4 +- .../definitions/systemvmtemplate/apt_upgrade.sh | 9 ++- .../definitions/systemvmtemplate/cleanup.sh | 5 +- .../definitions/systemvmtemplate/configure_grub.sh | 4 +- .../definitions/systemvmtemplate/definition.rb | 8 +- .../definitions/systemvmtemplate/finalize.sh | 3 +- .../systemvmtemplate/install_systemvm_packages.sh | 2 +- .../definitions/systemvmtemplate/preseed.cfg | 13 ++- tools/marvin/marvin/config/test_data.py | 48 ++++++++++- tools/marvin/marvin/lib/base.py | 7 +- tools/marvin/marvin/lib/common.py | 47 +++++++++++ ui/l10n/en.js | 1 - ui/scripts/system.js | 4 +- ui/scripts/ui/dialog.js | 2 +- ui/scripts/ui/widgets/multiEdit.js | 2 +- 76 files changed, 442 insertions(+), 728 deletions(-) diff --git a/.travis.yml b/.travis.yml index a206cbe..b4749c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -115,8 +115,7 @@ env: component/test_acl_sharednetwork_deployVM-impersonation component/test_affinity_groups_projects component/test_cpu_domain_limits - component/test_cpu_limits - component/test_volumes" + component/test_cpu_limits" - TESTS="component/test_cpu_max_limits component/test_acl_isolatednetwork @@ -144,10 +143,12 @@ env: component/test_snapshots component/test_stopped_vm" - - TESTS="component/test_resource_limits - component/test_tags + - TESTS="component/test_resource_limits" + + - TESTS="component/test_tags component/test_templates - component/test_update_vm" + component/test_update_vm + component/test_volumes" - TESTS="component/test_vpc component/test_vpc_network diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java index 7f2e156..3ce96a6 100644 --- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java +++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java @@ -216,6 +216,10 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager, @SuppressWarnings("rawtypes") final GenericDao dao = GenericDaoBase.getDao(job.getClass()); + if (dao == null) { + throw new CloudRuntimeException(String.format("Failed to get dao from job's class=%s, for job id=%d, cmd=%s", job.getClass(), job.getId(), job.getCmd())); + } + publishOnEventBus(job, "submit"); if (!_vmInstanceDao.lockInLockTable(String.valueOf(syncObjId), VmJobLockTimeout.value())){ diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java index 33c36de..c9916e9 100755 --- a/server/src/com/cloud/resource/ResourceManagerImpl.java +++ b/server/src/com/cloud/resource/ResourceManagerImpl.java @@ -2274,7 +2274,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager, } try { - SSHCmdHelper.SSHCmdResult result = SSHCmdHelper.sshExecuteCmdOneShot(connection, "service cloudstack-agent restart || systemctl restart cloudstack-agent"); + SSHCmdHelper.SSHCmdResult result = SSHCmdHelper.sshExecuteCmdOneShot(connection, "service cloudstack-agent restart"); s_logger.debug("cloudstack-agent restart result: " + result.toString()); } catch (final SshException e) { return false; diff --git a/server/src/com/cloud/server/StatsCollector.java b/server/src/com/cloud/server/StatsCollector.java index 305711e..d32ed98 100644 --- a/server/src/com/cloud/server/StatsCollector.java +++ b/server/src/com/cloud/server/StatsCollector.java @@ -918,7 +918,12 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc try { HashMap<String, VolumeStatsEntry> volumeStatsByUuid = _userVmMgr.getVolumeStatistics(pool.getClusterId(), pool.getUuid(), pool.getPoolType(), volumeLocators, StatsTimeout.value()); if (volumeStatsByUuid != null){ - _volumeStats.putAll(volumeStatsByUuid); + for (final Map.Entry<String, VolumeStatsEntry> entry : volumeStatsByUuid.entrySet()) { + if (entry == null || entry.getKey() == null || entry.getValue() == null) { + continue; + } + _volumeStats.put(entry.getKey(), entry.getValue()); + } } } catch (Exception e) { s_logger.warn("Failed to get volume stats for cluster with ID: " + pool.getClusterId(), e); @@ -932,7 +937,10 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc } public VolumeStats getVolumeStats(String volumeLocator) { - return _volumeStats.get(volumeLocator); + if (volumeLocator != null && _volumeStats.containsKey(volumeLocator)) { + return _volumeStats.get(volumeLocator); + } + return null; } class StorageCollector extends ManagedContextRunnable { diff --git a/server/src/com/cloud/storage/secondary/SecondaryStorageVmManager.java b/server/src/com/cloud/storage/secondary/SecondaryStorageVmManager.java index 3b32c85..99073f7 100644 --- a/server/src/com/cloud/storage/secondary/SecondaryStorageVmManager.java +++ b/server/src/com/cloud/storage/secondary/SecondaryStorageVmManager.java @@ -27,11 +27,11 @@ import com.cloud.vm.SecondaryStorageVmVO; public interface SecondaryStorageVmManager extends Manager { - public static final int DEFAULT_SS_VM_RAMSIZE = 512; // 512M - public static final int DEFAULT_SS_VM_CPUMHZ = 500; // 500 MHz + public static final int DEFAULT_SS_VM_RAMSIZE = 1024; // 1024M + public static final int DEFAULT_SS_VM_CPUMHZ = 500; // 500 MHz public static final int DEFAULT_SS_VM_MTUSIZE = 1500; public static final int DEFAULT_SS_VM_CAPACITY = 50; // max command execution session per SSVM - public static final int DEFAULT_STANDBY_CAPACITY = 10; // standy capacity to reserve per zone + public static final int DEFAULT_STANDBY_CAPACITY = 10; // standy capacity to reserve per zone public static final String ALERT_SUBJECT = "secondarystoragevm-alert"; diff --git a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java index 273fdd0..bed0313 100644 --- a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java +++ b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java @@ -951,7 +951,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar int ramSize = NumbersUtil.parseInt(_configDao.getValue("ssvm.ram.size"), DEFAULT_SS_VM_RAMSIZE); int cpuFreq = NumbersUtil.parseInt(_configDao.getValue("ssvm.cpu.mhz"), DEFAULT_SS_VM_CPUMHZ); List<ServiceOfferingVO> offerings = _offeringDao.createSystemServiceOfferings("System Offering For Secondary Storage VM", - ServiceOffering.ssvmDefaultOffUniqueName, 1, ramSize, cpuFreq, null, null, false, null, + ServiceOffering.ssvmDefaultOffUniqueName, 2, ramSize, cpuFreq, null, null, false, null, Storage.ProvisioningType.THIN, true, null, true, VirtualMachine.Type.SecondaryStorageVm, true); // this can sometimes happen, if DB is manually or programmatically manipulated if (offerings == null || offerings.size() < 2) { diff --git a/systemvm/debian/etc/issue b/systemvm/debian/etc/issue index 2d2b7c0..fdef90e 100644 --- a/systemvm/debian/etc/issue +++ b/systemvm/debian/etc/issue @@ -1,3 +1,3 @@ - __?.o/ Apache CloudStack SystemVM 4.11 + __?.o/ Apache CloudStack SystemVM ( )# https://cloudstack.apache.org (___(_) \s \r \n \l diff --git a/systemvm/debian/etc/rc.local b/systemvm/debian/etc/rc.local index 94c6466..e419de0 100755 --- a/systemvm/debian/etc/rc.local +++ b/systemvm/debian/etc/rc.local @@ -16,32 +16,4 @@ # specific language governing permissions and limitations # under the License. -[ ! -f /var/cache/cloud/enabled_svcs ] && touch /var/cache/cloud/enabled_svcs -for svc in $(cat /var/cache/cloud/enabled_svcs) -do - logger -t cloud "Starting $svc" - systemctl enable --no-block --now $svc -done -[ ! -f /var/cache/cloud/disabled_svcs ] && touch /var/cache/cloud/disabled_svcs -for svc in $(cat /var/cache/cloud/disabled_svcs) -do - logger -t cloud "Stopping $svc" - systemctl disable --no-block --now $svc -done - -# Restore the persistent iptables nat, rules and filters for IPv4 and IPv6 if they exist -ipv4="/etc/iptables/rules.v4" -if [ -e $ipv4 ] -then - iptables-restore < $ipv4 -fi - -ipv6="/etc/iptables/rules.v6" -if [ -e $ipv6 ] -then - iptables-restore < $ipv6 -fi - -date > /var/cache/cloud/boot_up_done -logger -t cloud "Boot up process done" diff --git a/systemvm/debian/etc/systemd/system/cloud-postinit.service b/systemvm/debian/etc/systemd/system/cloud-postinit.service index 83f0636..c23516e 100644 --- a/systemvm/debian/etc/systemd/system/cloud-postinit.service +++ b/systemvm/debian/etc/systemd/system/cloud-postinit.service @@ -11,4 +11,4 @@ WantedBy=multi-user.target Type=oneshot ExecStart=/opt/cloud/bin/setup/postinit.sh RemainAfterExit=true -TimeoutStartSec=1min +TimeoutStartSec=10min diff --git a/systemvm/debian/opt/cloud/bin/cs/CsApp.py b/systemvm/debian/opt/cloud/bin/cs/CsApp.py index 2085088..031ac05 100755 --- a/systemvm/debian/opt/cloud/bin/cs/CsApp.py +++ b/systemvm/debian/opt/cloud/bin/cs/CsApp.py @@ -66,7 +66,7 @@ class CsApache(CsApp): class CsPasswdSvc(): """ - nohup bash /opt/cloud/bin/vpc_passwd_server $ip >/dev/null 2>&1 & + CloudStack VR password server """ def __init__(self, ip): diff --git a/systemvm/debian/opt/cloud/bin/cs/CsRedundant.py b/systemvm/debian/opt/cloud/bin/cs/CsRedundant.py index 108f337..29b5028 100755 --- a/systemvm/debian/opt/cloud/bin/cs/CsRedundant.py +++ b/systemvm/debian/opt/cloud/bin/cs/CsRedundant.py @@ -75,6 +75,10 @@ class CsRedundant(object): def _redundant_off(self): CsHelper.service("conntrackd", "stop") CsHelper.service("keepalived", "stop") + CsHelper.umount_tmpfs(self.CS_RAMDISK_DIR) + CsHelper.rmdir(self.CS_RAMDISK_DIR) + CsHelper.rm(self.CONNTRACKD_CONF) + CsHelper.rm(self.KEEPALIVED_CONF) def _redundant_on(self): guest = self.address.get_guest_if() @@ -107,10 +111,9 @@ class CsRedundant(object): CsHelper.service("keepalived", "stop") return - # setup_router should execute this already: - # CsHelper.mkdir(self.CS_RAMDISK_DIR, 0755, False) - # CsHelper.mount_tmpfs(self.CS_RAMDISK_DIR) - # CsHelper.mkdir(self.CS_ROUTER_DIR, 0755, False) + CsHelper.mkdir(self.CS_RAMDISK_DIR, 0755, False) + CsHelper.mount_tmpfs(self.CS_RAMDISK_DIR) + CsHelper.mkdir(self.CS_ROUTER_DIR, 0755, False) for s in self.CS_TEMPLATES: d = s if s.endswith(".templ"): diff --git a/systemvm/debian/opt/cloud/bin/passwd_server b/systemvm/debian/opt/cloud/bin/passwd_server deleted file mode 100755 index 295e720..0000000 --- a/systemvm/debian/opt/cloud/bin/passwd_server +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -#we have intentionally split the ip gathering command into two. -#This was done to avoid getting a SIGPIPE during certain load conditions. -ipInfo=$(ip addr show dev eth0 | grep inet | grep eth0 ) -ips=$(echo "$ipInfo" | awk '{print $2}' ); echo $ips -for ip in $ips; do - addr=$(echo $ip | awk -F'/' '{print $1}') - /opt/cloud/bin/passwd_server_ip $addr >> /var/log/cloud.log 2>&1 & -done; diff --git a/systemvm/debian/opt/cloud/bin/passwd_server_ip b/systemvm/debian/opt/cloud/bin/passwd_server_ip deleted file mode 100755 index ce21b53..0000000 --- a/systemvm/debian/opt/cloud/bin/passwd_server_ip +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -addr=$1; -while true -do - python /opt/cloud/bin/passwd_server_ip.py $addr >/dev/null 2>/dev/null - rc=$? - if [ $rc -ne 0 ] - then - logger -t cloud "Password server failed with error code $rc. Restarting it..." - sleep 3 - fi -done diff --git a/systemvm/debian/opt/cloud/bin/setup/common.sh b/systemvm/debian/opt/cloud/bin/setup/common.sh index e6a4417..078cb58 100755 --- a/systemvm/debian/opt/cloud/bin/setup/common.sh +++ b/systemvm/debian/opt/cloud/bin/setup/common.sh @@ -590,8 +590,7 @@ routing_svcs() { systemctl disable --now portmap systemctl enable apache2 systemctl enable haproxy - systemctl enable ssh - echo "ssh haproxy apache2" > /var/cache/cloud/enabled_svcs + echo "haproxy apache2" > /var/cache/cloud/enabled_svcs echo "cloud nfs-common portmap" > /var/cache/cloud/disabled_svcs if [ $RROUTER -eq 1 ] then @@ -609,61 +608,6 @@ routing_svcs() { fi } -setup_redundant_router() { - rrouter_bin_path="/ramdisk/rrouter" - rrouter_log="/ramdisk/rrouter/keepalived.log" - rrouter_bin_path_str="\/ramdisk\/rrouter" - rrouter_log_str="\/ramdisk\/rrouter\/keepalived.log" - mkdir -p /ramdisk - mount tmpfs /ramdisk -t tmpfs - mkdir -p /ramdisk/rrouter - ip route delete default - - # Seed keepalived - cp /opt/cloud/templates/keepalived.conf.templ /etc/keepalived/keepalived.conf # changes! - sed -i "s/\[ROUTER_ID\]/$NAME/g" /etc/keepalived/keepalived.conf - sed -i "s/\[ROUTER_IP\]/$GUEST_GW\/$GUEST_CIDR_SIZE/g" /etc/keepalived/keepalived.conf #fixme, multiple ips? - sed -i "s/\[BOARDCAST\]/$GUEST_BRD/g" /etc/keepalived/keepalived.conf - sed -i "s/\[PRIORITY\]/$ROUTER_PR/g" /etc/keepalived/keepalived.conf - sed -i "s/\[PASS\]/$VM_PASSWORD/g" /etc/keepalived/keepalived.conf #FIXME, router password? - sed -i "s/\[RROUTER_BIN_PATH\]/$rrouter_bin_path_str/g" /etc/keepalived/keepalived.conf - sed -i "s/\[DELTA\]/2/g" /etc/keepalived/keepalived.conf - sed -i "s/--exec\ \$DAEMON;/--exec\ \$DAEMON\ --\ --vrrp;/g" /etc/init.d/keepalived - if [ $ADVERT_INT ] - then - sed -i "s/advert_int 1/advert_int $ADVERT_INT/g" /etc/keepalived/keepalived.conf - fi - chmod -x /etc/keepalived/keepalived.conf - - # Seed conntrackd - cp /opt/cloud/templates/conntrackd.conf.templ /etc/conntrackd/conntrackd.conf - sed -i "s/\[LINK_IF\]/eth0/g" /etc/conntrackd/conntrackd.conf - sed -i "s/\[LINK_IP\]/$ETH0_IP/g" /etc/conntrackd/conntrackd.conf - sed -i "s/\[IGNORE_IP1\]/$GUEST_GW/g" /etc/conntrackd/conntrackd.conf # checkme? - sed -i "s/\[IGNORE_IP2\]/$ETH0_IP/g" /etc/conntrackd/conntrackd.conf - sed -i "s/\[IGNORE_IP3\]/$ETH1_IP/g" /etc/conntrackd/conntrackd.conf - - # ramdisk scripts - cp /opt/cloud/templates/heartbeat.sh.templ $rrouter_bin_path/heartbeat.sh - cp /opt/cloud/templates/check_heartbeat.sh.templ $rrouter_bin_path/check_heartbeat.sh - cp /opt/cloud/templates/arping_gateways.sh.templ $rrouter_bin_path/arping_gateways.sh - cp /opt/cloud/templates/check_bumpup.sh $rrouter_bin_path/ - cp /opt/cloud/templates/checkrouter.sh.templ /opt/cloud/bin/checkrouter.sh # changes! - #sed -i "s/\[RROUTER_LOG\]/$rrouter_log_str/g" /opt/cloud/bin/checkrouter.sh - - sed -i "s/\[RROUTER_BIN_PATH\]/$rrouter_bin_path_str/g" $rrouter_bin_path/heartbeat.sh - sed -i "s/\[RROUTER_BIN_PATH\]/$rrouter_bin_path_str/g" $rrouter_bin_path/check_heartbeat.sh - sed -i "s/\[RROUTER_LOG\]/$rrouter_log_str/g" $rrouter_bin_path/check_heartbeat.sh - sed -i "s/\[RROUTER_LOG\]/$rrouter_log_str/g" $rrouter_bin_path/arping_gateways.sh - chmod a+x $rrouter_bin_path/*.sh - - crontab -l|grep "check_heartbeat.sh" - if [ $? -ne 0 ] - then - (crontab -l; echo -e "SHELL=/bin/bash\nPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin\n* * * * * $rrouter_bin_path/check_heartbeat.sh 2>&1 > /dev/null") | crontab - fi -} - parse_cmd_line() { CMDLINE=$(cat /var/cache/cloud/cmdline) TYPE="unknown" @@ -782,6 +726,9 @@ parse_cmd_line() { redundant_router) export RROUTER=$VALUE ;; + redundant_state) + export RROUTER_STATE=$VALUE + ;; guestgw) export GUEST_GW=$VALUE ;; diff --git a/systemvm/debian/opt/cloud/bin/setup/consoleproxy.sh b/systemvm/debian/opt/cloud/bin/setup/consoleproxy.sh index a3b2797..225dc6f 100755 --- a/systemvm/debian/opt/cloud/bin/setup/consoleproxy.sh +++ b/systemvm/debian/opt/cloud/bin/setup/consoleproxy.sh @@ -19,7 +19,7 @@ . /opt/cloud/bin/setup/common.sh consoleproxy_svcs() { - echo "cloud ssh" > /var/cache/cloud/enabled_svcs + echo "cloud" > /var/cache/cloud/enabled_svcs echo "haproxy dnsmasq apache2 nfs-common portmap" > /var/cache/cloud/disabled_svcs mkdir -p /var/log/cloud } diff --git a/systemvm/debian/opt/cloud/bin/setup/dhcpsrvr.sh b/systemvm/debian/opt/cloud/bin/setup/dhcpsrvr.sh index 467bb56..9161aeb 100755 --- a/systemvm/debian/opt/cloud/bin/setup/dhcpsrvr.sh +++ b/systemvm/debian/opt/cloud/bin/setup/dhcpsrvr.sh @@ -19,7 +19,7 @@ . /opt/cloud/bin/setup/common.sh dhcpsrvr_svcs() { - echo "ssh dnsmasq apache2" > /var/cache/cloud/enabled_svcs + echo "dnsmasq apache2" > /var/cache/cloud/enabled_svcs echo "cloud nfs-common conntrackd keepalived haproxy portmap" > /var/cache/cloud/disabled_svcs } diff --git a/systemvm/debian/opt/cloud/bin/setup/elbvm.sh b/systemvm/debian/opt/cloud/bin/setup/elbvm.sh index 600fb0d..ae16b4b 100755 --- a/systemvm/debian/opt/cloud/bin/setup/elbvm.sh +++ b/systemvm/debian/opt/cloud/bin/setup/elbvm.sh @@ -19,7 +19,7 @@ . /opt/cloud/bin/setup/common.sh elbvm_svcs() { - echo "ssh haproxy" > /var/cache/cloud/enabled_svcs + echo "haproxy" > /var/cache/cloud/enabled_svcs echo "cloud dnsmasq conntrackd keepalived apache2 nfs-common portmap" > /var/cache/cloud/disabled_svcs } diff --git a/systemvm/debian/opt/cloud/bin/setup/ilbvm.sh b/systemvm/debian/opt/cloud/bin/setup/ilbvm.sh index 58a711c..ac801b2 100755 --- a/systemvm/debian/opt/cloud/bin/setup/ilbvm.sh +++ b/systemvm/debian/opt/cloud/bin/setup/ilbvm.sh @@ -19,7 +19,7 @@ . /opt/cloud/bin/setup/common.sh ilbvm_svcs() { - echo "ssh haproxy" > /var/cache/cloud/enabled_svcs + echo "haproxy" > /var/cache/cloud/enabled_svcs echo "cloud dnsmasq conntrackd keepalived apache2 nfs-common portmap" > /var/cache/cloud/disabled_svcs } diff --git a/systemvm/debian/opt/cloud/bin/setup/patchsystemvm.sh b/systemvm/debian/opt/cloud/bin/setup/patchsystemvm.sh index 8642945..ba5e2d8 100755 --- a/systemvm/debian/opt/cloud/bin/setup/patchsystemvm.sh +++ b/systemvm/debian/opt/cloud/bin/setup/patchsystemvm.sh @@ -44,6 +44,10 @@ CMDLINE=/var/cache/cloud/cmdline PATCH_MOUNT=$1 TYPE=$2 +# Refresh and setup systemd +chmod -x /etc/systemd/system/cloud*.service +systemctl daemon-reload + echo "Patching systemvm for cloud service with mount=$PATCH_MOUNT for type=$TYPE" >> $logfile if [ "$TYPE" == "consoleproxy" ] || [ "$TYPE" == "secstorage" ] && [ -f ${PATCH_MOUNT}/agent.zip ] diff --git a/systemvm/debian/opt/cloud/bin/setup/postinit.sh b/systemvm/debian/opt/cloud/bin/setup/postinit.sh index efd1b4b..d29203f 100755 --- a/systemvm/debian/opt/cloud/bin/setup/postinit.sh +++ b/systemvm/debian/opt/cloud/bin/setup/postinit.sh @@ -15,9 +15,13 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. - +# # This scripts before ssh.service but after cloud-early-config +# Eject cdrom if any +eject || true + +# Setup router CMDLINE=/var/cache/cloud/cmdline for str in $(cat $CMDLINE) do @@ -32,15 +36,12 @@ for str in $(cat $CMDLINE) esac done -chmod -x /etc/systemd/system/cloud*.service -systemctl daemon-reload - if [ "$TYPE" == "router" ] || [ "$TYPE" == "vpcrouter" ] || [ "$TYPE" == "dhcpsrvr" ] then if [ -x /opt/cloud/bin/update_config.py ] then - /opt/cloud/bin/update_config.py cmd_line.json - logger -t cloud "Updated config: cmd_line.json" + /opt/cloud/bin/update_config.py cmd_line.json || true + logger -t cloud "postinit: Updated config cmd_line.json" fi fi @@ -49,3 +50,36 @@ then python /opt/cloud/bin/baremetal-vr.py & logger -t cloud "Started baremetal-vr service" fi + +[ ! -f /var/cache/cloud/enabled_svcs ] && touch /var/cache/cloud/enabled_svcs +for svc in $(cat /var/cache/cloud/enabled_svcs) +do + logger -t cloud "Starting $svc" + systemctl enable --no-block --now $svc +done + +[ ! -f /var/cache/cloud/disabled_svcs ] && touch /var/cache/cloud/disabled_svcs +for svc in $(cat /var/cache/cloud/disabled_svcs) +do + logger -t cloud "Stopping $svc" + systemctl disable --no-block --now $svc +done + +# Enable SSH by default +systemctl enable --no-block --now ssh + +# Restore the persistent iptables nat, rules and filters for IPv4 and IPv6 if they exist +ipv4="/etc/iptables/rules.v4" +if [ -e $ipv4 ] +then + iptables-restore < $ipv4 +fi + +ipv6="/etc/iptables/rules.v6" +if [ -e $ipv6 ] +then + iptables-restore < $ipv6 +fi + +date > /var/cache/cloud/boot_up_done +logger -t cloud "Boot up process done" diff --git a/systemvm/debian/opt/cloud/bin/setup/router.sh b/systemvm/debian/opt/cloud/bin/setup/router.sh index 3bd4224..c3141f8 100755 --- a/systemvm/debian/opt/cloud/bin/setup/router.sh +++ b/systemvm/debian/opt/cloud/bin/setup/router.sh @@ -49,11 +49,6 @@ setup_router() { fi fi - if [ -n "$ETH2_IP" -a "$RROUTER" == "1" ] - then - setup_redundant_router - fi - log_it "Checking udev NIC assignment order changes" if [ "$NIC_MACS" != "" ] then diff --git a/systemvm/debian/opt/cloud/bin/setup/secstorage.sh b/systemvm/debian/opt/cloud/bin/setup/secstorage.sh index b890d77..8b6d4ee 100755 --- a/systemvm/debian/opt/cloud/bin/setup/secstorage.sh +++ b/systemvm/debian/opt/cloud/bin/setup/secstorage.sh @@ -19,7 +19,7 @@ . /opt/cloud/bin/setup/common.sh secstorage_svcs() { - echo "apache2 cloud ssh nfs-common portmap" > /var/cache/cloud/enabled_svcs + echo "apache2 cloud nfs-common portmap" > /var/cache/cloud/enabled_svcs echo "conntrackd keepalived haproxy dnsmasq" > /var/cache/cloud/disabled_svcs mkdir -p /var/log/cloud } diff --git a/systemvm/debian/opt/cloud/bin/setup/vpcrouter.sh b/systemvm/debian/opt/cloud/bin/setup/vpcrouter.sh index 5ed09c7..106cfd6 100755 --- a/systemvm/debian/opt/cloud/bin/setup/vpcrouter.sh +++ b/systemvm/debian/opt/cloud/bin/setup/vpcrouter.sh @@ -73,11 +73,6 @@ EOF fi fi - if [ "$RROUTER" == "1" ] - then - setup_redundant_router - fi - ip route delete default # create route table for static route diff --git a/systemvm/debian/opt/cloud/bin/update_config.py b/systemvm/debian/opt/cloud/bin/update_config.py index a603f47..7b86378 100755 --- a/systemvm/debian/opt/cloud/bin/update_config.py +++ b/systemvm/debian/opt/cloud/bin/update_config.py @@ -39,13 +39,6 @@ jsonFilename = sys.argv[1] jsonConfigFile = jsonPath % jsonFilename currentGuestNetConfig = "/etc/cloudstack/guestnetwork.json" -# If the command line json file is unprocessed process it -# This is important or, the control interfaces will get deleted! -if os.path.isfile(jsonPath % "cmd_line.json"): - qf = QueueFile() - qf.setFile("cmd_line.json") - qf.load(None) - def finish_config(): # Converge diff --git a/systemvm/debian/opt/cloud/bin/vpc_passwd_server b/systemvm/debian/opt/cloud/bin/vpc_passwd_server deleted file mode 100755 index 3e201cb..0000000 --- a/systemvm/debian/opt/cloud/bin/vpc_passwd_server +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - - -ip=$1 -result=$ip -while [ -n "$result" ] -do - python /opt/cloud/bin/passwd_server_ip.py $ip >/dev/null 2>/dev/null - rc=$? - if [ $rc -ne 0 ] - then - logger -t cloud "Password server failed with error code $rc. Restarting password server..." - sleep 3 - fi - result=`ip addr show | grep $ip` -done & \ No newline at end of file diff --git a/systemvm/debian/opt/cloud/templates/keepalived.conf.templ b/systemvm/debian/opt/cloud/templates/keepalived.conf.templ index 5434ec5..5412fd9 100644 --- a/systemvm/debian/opt/cloud/templates/keepalived.conf.templ +++ b/systemvm/debian/opt/cloud/templates/keepalived.conf.templ @@ -21,16 +21,23 @@ global_defs { vrrp_script heartbeat { script "[RROUTER_BIN_PATH]/heartbeat.sh" - interval 4 + interval 5 } vrrp_instance inside_network { - state BACKUP + state EQUAL interface eth2 virtual_router_id 51 nopreempt advert_int 1 + garp_master_delay 1 + garp_master_repeat 10 + garp_master_refresh 5 + + #use_vmac + #vmac_xmit_base + authentication { auth_type AH auth_pass PASS diff --git a/test/integration/smoke/test_accounts.py b/test/integration/smoke/test_accounts.py index a64d922..00047bf 100644 --- a/test/integration/smoke/test_accounts.py +++ b/test/integration/smoke/test_accounts.py @@ -32,7 +32,7 @@ from marvin.lib.base import (Domain, PublicIPAddress) from marvin.lib.common import (get_domain, get_zone, - get_template, + get_test_template, list_accounts, list_virtual_machines, list_service_offering, @@ -128,11 +128,12 @@ class TestAccounts(cloudstackTestCase): cls.services = Services().services cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services['mode'] = cls.zone.networktype - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id @@ -270,11 +271,12 @@ class TestRemoveUserFromAccount(cloudstackTestCase): cls.services = Services().services cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services['mode'] = cls.zone.networktype - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id @@ -948,6 +950,7 @@ class TestAddVmToSubDomain(cloudstackTestCase): cls.services = Services().services cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services['mode'] = cls.zone.networktype cls.sub_domain = Domain.create( cls.api_client, @@ -983,10 +986,10 @@ class TestAddVmToSubDomain(cloudstackTestCase): cls.sub_domain, cls.service_offering ] - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.vm_1 = VirtualMachine.create( @@ -1717,12 +1720,13 @@ class TestDomainForceRemove(cloudstackTestCase): cls.services = Services().services cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services['mode'] = cls.zone.networktype - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) cls.services["virtual_machine"]["zoneid"] = cls.zone.id diff --git a/test/integration/smoke/test_affinity_groups.py b/test/integration/smoke/test_affinity_groups.py index 3f78a84..64ec8ae 100644 --- a/test/integration/smoke/test_affinity_groups.py +++ b/test/integration/smoke/test_affinity_groups.py @@ -40,15 +40,16 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase): cls.services = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests()) - - cls.template = get_template( + cls.hypervisor = cls.testClient.getHypervisorInfo() + + cls.template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) if cls.template == FAILED: - assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] + assert False, "get_test_template() failed to return template" cls.services["virtual_machine"]["zoneid"] = cls.zone.id @@ -155,7 +156,6 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase): @classmethod def tearDownClass(cls): try: - #Clean up, terminate the created templates cleanup_resources(cls.apiclient, cls._cleanup) except Exception as e: raise Exception("Warning: Exception during cleanup : %s" % e) diff --git a/test/integration/smoke/test_affinity_groups_projects.py b/test/integration/smoke/test_affinity_groups_projects.py index 2e971c5..76401c6 100644 --- a/test/integration/smoke/test_affinity_groups_projects.py +++ b/test/integration/smoke/test_affinity_groups_projects.py @@ -40,16 +40,17 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase): cls.services = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests()) - - cls.template = get_template( + cls.hypervisor = cls.testClient.getHypervisorInfo() + + cls.template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) if cls.template == FAILED: - assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] - + assert False, "get_test_template() failed to return template" + cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["template"] = cls.template.id diff --git a/test/integration/smoke/test_deploy_vm_iso.py b/test/integration/smoke/test_deploy_vm_iso.py index 5298c48..f2273cb 100644 --- a/test/integration/smoke/test_deploy_vm_iso.py +++ b/test/integration/smoke/test_deploy_vm_iso.py @@ -28,7 +28,7 @@ from marvin.lib.base import (Account, DiskOffering) from marvin.lib.common import (get_zone, get_domain, - get_template) + get_test_template) from marvin.codes import PASS @@ -44,11 +44,12 @@ class TestDeployVMFromISO(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.testdata["ostype"] + cls.hypervisor ) # Create service, disk offerings etc diff --git a/test/integration/smoke/test_deploy_vm_with_userdata.py b/test/integration/smoke/test_deploy_vm_with_userdata.py index 96c9986..52b71f7 100644 --- a/test/integration/smoke/test_deploy_vm_with_userdata.py +++ b/test/integration/smoke/test_deploy_vm_with_userdata.py @@ -19,7 +19,7 @@ from marvin.cloudstackTestCase import cloudstackTestCase from marvin.lib.base import (ServiceOffering, VirtualMachine, Account) -from marvin.lib.common import get_template, get_zone, list_virtual_machines +from marvin.lib.common import get_test_template, get_zone, list_virtual_machines from marvin.lib.utils import cleanup_resources from nose.plugins.attrib import attr from marvin.codes import FAILED @@ -37,6 +37,7 @@ class TestDeployVmWithUserData(cloudstackTestCase): cls.services = testClient.getParsedTestDataConfig() cls.zone = get_zone(cls.apiClient, testClient.getZoneForTests()) + cls.hypervisor = testClient.getHypervisorInfo() if cls.zone.localstorageenabled: #For devcloud since localstroage is enabled cls.services["service_offerings"]["tiny"]["storagetype"] = "local" @@ -46,14 +47,14 @@ class TestDeployVmWithUserData(cloudstackTestCase): ) cls.account = Account.create(cls.apiClient, services=cls.services["account"]) cls.cleanup = [cls.account] - cls.template = get_template( + cls.template = get_test_template( cls.apiClient, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) if cls.template == FAILED: - assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] + assert False, "get_test_template() failed to return template" cls.debug("Successfully created account: %s, id: \ %s" % (cls.account.name,\ @@ -68,7 +69,7 @@ class TestDeployVmWithUserData(cloudstackTestCase): cls.services["virtual_machine"]["userdata"] = user_data def setup(self): - self.hypervisor = self.testClient.getHypervisorInfo() + self.hypervisor = self.testClient.getHypervisorInfo() @attr(tags=["devcloud", "basic", "advanced", "post"], required_hardware="true") def test_deployvm_userdata_post(self): diff --git a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py index 1ef6af9..62ba1a4 100644 --- a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py +++ b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py @@ -18,7 +18,7 @@ from marvin.codes import FAILED from marvin.cloudstackTestCase import cloudstackTestCase from marvin.lib.base import Account, VirtualMachine, ServiceOffering, Host, Cluster -from marvin.lib.common import get_zone, get_domain, get_template +from marvin.lib.common import get_zone, get_domain, get_test_template from marvin.lib.utils import cleanup_resources from nose.plugins.attrib import attr @@ -36,14 +36,15 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.apiclient) cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) - cls.template = get_template( + cls.hypervisor = testClient.getHypervisorInfo() + cls.template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) if cls.template == FAILED: - assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] + assert False, "get_test_template() failed to return template" cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["template"] = cls.template.id diff --git a/test/integration/smoke/test_host_maintenance.py b/test/integration/smoke/test_host_maintenance.py index 94f964c..7fc2139 100644 --- a/test/integration/smoke/test_host_maintenance.py +++ b/test/integration/smoke/test_host_maintenance.py @@ -89,14 +89,14 @@ class TestHostMaintenance(cloudstackTestCase): def createVMs(self, hostId, number): - self.template = get_template( + self.template = get_test_template( self.apiclient, self.zone.id, - self.services["ostype"] + self.hypervisor ) if self.template == FAILED: - assert False, "get_template() failed to return template with description %s" % self.services["ostype"] + assert False, "get_test_template() failed to return template" self.logger.debug("Using template %s " % self.template.id) diff --git a/test/integration/smoke/test_hostha_kvm.py b/test/integration/smoke/test_hostha_kvm.py index cc44426..a153e15 100644 --- a/test/integration/smoke/test_hostha_kvm.py +++ b/test/integration/smoke/test_hostha_kvm.py @@ -80,10 +80,10 @@ class TestHAKVM(cloudstackTestCase): self.services["service_offerings"]["hasmall"] ) - self.template = get_template( + self.template = get_test_template( self.apiclient, self.zone.id, - self.services["ostype"] + self.hypervisor ) self.configureAndDisableHostHa() diff --git a/test/integration/smoke/test_internal_lb.py b/test/integration/smoke/test_internal_lb.py index 379bbb0..21a6f40 100644 --- a/test/integration/smoke/test_internal_lb.py +++ b/test/integration/smoke/test_internal_lb.py @@ -47,7 +47,7 @@ from marvin.sshClient import SshClient from marvin.lib.common import (get_zone, get_domain, - get_template, + get_test_template, list_network_offerings) from marvin.lib.decoratorGenerators import skipTestIf @@ -221,44 +221,6 @@ class Services: "privateport": 22, "publicport": 22, "protocol": 'TCP', - }, - "template": { - "kvm": { - "name": "tiny-kvm", - "displaytext": "macchinina kvm", - "format": "qcow2", - "hypervisor": "kvm", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2", - "requireshvm": "True" - }, - "xenserver": { - "name": "tiny-xen", - "displaytext": "macchinina xen", - "format": "vhd", - "hypervisor": "xenserver", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2", - "requireshvm": "True", - }, - "hyperv": { - "name": "tiny-hyperv", - "displaytext": "macchinina xen", - "format": "vhd", - "hypervisor": "hyperv", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip", - "requireshvm": "True", - }, - "vmware": { - "name": "tiny-vmware", - "displaytext": "macchinina vmware", - "format": "ova", - "hypervisor": "vmware", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova", - "requireshvm": "True", - } } } @@ -294,12 +256,14 @@ class TestInternalLb(cloudstackTestCase): cls.hypervisor = testClient.getHypervisorInfo() - cls.logger.debug("Downloading Template: %s from: %s" %(cls.services["template"][cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"])) - cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower()], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id) - cls.template.download(cls.apiclient) + cls.template = get_test_template( + cls.apiclient, + cls.zone.id, + cls.hypervisor + ) if cls.template == FAILED: - assert False, "get_template() failed to return template" + assert False, "get_test_template() failed to return template" cls.logger.debug("Successfully created account: %s, id: \ %s" % (cls.account.name, @@ -857,9 +821,6 @@ class TestInternalLb(cloudstackTestCase): def tearDownClass(cls): try: cls.logger.debug("Cleaning up class resources") - try: - cls.template.delete(cls.apiclient) - except Exception: pass cleanup_resources(cls.apiclient, cls._cleanup) except Exception as e: raise Exception("Cleanup failed with %s" % e) diff --git a/test/integration/smoke/test_list_ids_parameter.py b/test/integration/smoke/test_list_ids_parameter.py index cc45ce3..e5053cb 100755 --- a/test/integration/smoke/test_list_ids_parameter.py +++ b/test/integration/smoke/test_list_ids_parameter.py @@ -29,7 +29,7 @@ from marvin.lib.base import (Account, VmSnapshot, VirtualMachine) from marvin.lib.common import (get_domain, - get_zone, get_template) + get_zone, get_test_template) from marvin.codes import FAILED, PASS from nose.plugins.attrib import attr #Import System modules @@ -62,14 +62,14 @@ class TestListIdsParams(cloudstackTestCase): cls.services["service_offerings"]["tiny"] ) - template = get_template( + template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) if template == FAILED: - assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] - + assert False, "get_test_template() failed to return template" + cls.services["template"]["ostypeid"] = template.ostypeid cls.services["template_2"]["ostypeid"] = template.ostypeid cls.services["ostypeid"] = template.ostypeid diff --git a/test/integration/smoke/test_loadbalance.py b/test/integration/smoke/test_loadbalance.py index 8e958a9..53047f9 100644 --- a/test/integration/smoke/test_loadbalance.py +++ b/test/integration/smoke/test_loadbalance.py @@ -40,14 +40,14 @@ class TestLoadBalance(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.apiclient) cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) - template = get_template( + cls.hypervisor = testClient.getHypervisorInfo() + template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"] - ) + cls.hypervisor) if template == FAILED: - assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] - + assert False, "get_test_template() failed to return template" + cls.services["virtual_machine"]["zoneid"] = cls.zone.id #Create an account, network, VM and IP addresses diff --git a/test/integration/smoke/test_metrics_api.py b/test/integration/smoke/test_metrics_api.py index 27c4a1b..7cd09b4 100644 --- a/test/integration/smoke/test_metrics_api.py +++ b/test/integration/smoke/test_metrics_api.py @@ -49,10 +49,10 @@ class TestMetrics(cloudstackTestCase): self.apiclient, self.services["service_offering"] ) - self.template = get_template( + self.template = get_test_template( self.apiclient, self.zone.id, - self.services["ostype"] + self.hypervisor ) self.cleanup = [] diff --git a/test/integration/smoke/test_multipleips_per_nic.py b/test/integration/smoke/test_multipleips_per_nic.py index 4093356..3078328 100644 --- a/test/integration/smoke/test_multipleips_per_nic.py +++ b/test/integration/smoke/test_multipleips_per_nic.py @@ -30,7 +30,7 @@ from marvin.lib.base import Account, VirtualMachine, ServiceOffering from marvin.lib.utils import cleanup_resources #common - commonly used methods for all tests are listed here -from marvin.lib.common import get_zone, get_domain, get_template +from marvin.lib.common import get_zone, get_domain, get_test_template from marvin.cloudstackAPI.addIpToNic import addIpToNicCmd from marvin.cloudstackAPI.removeIpFromNic import removeIpFromNicCmd @@ -50,11 +50,12 @@ class TestDeployVM(cloudstackTestCase): # Get Zone, Domain and Default Built-in template self.domain = get_domain(self.apiclient) self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests()) + self.hypervisor = self.testClient.getHypervisorInfo() self.testdata["mode"] = self.zone.networktype - self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"]) + self.template = get_test_template(self.apiclient, self.zone.id, self.hypervisor) if self.template == FAILED: - assert False, "get_template() failed to return template with description %s" % self.testdata["ostype"] + assert False, "get_test_template() failed to return template" #create a user account self.account = Account.create( diff --git a/test/integration/smoke/test_nested_virtualization.py b/test/integration/smoke/test_nested_virtualization.py index 3b03f77..c10dd2f 100755 --- a/test/integration/smoke/test_nested_virtualization.py +++ b/test/integration/smoke/test_nested_virtualization.py @@ -30,7 +30,7 @@ from marvin.lib.base import (Account, Network) from marvin.lib.common import (get_zone, get_domain, - get_template) + get_test_template) from nose.plugins.attrib import attr from marvin.sshClient import SshClient import logging @@ -49,6 +49,7 @@ class TestNestedVirtualization(cloudstackTestCase): cls.logger.addHandler(cls.stream_handler) cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) + cls.hypervisor = get_hypervisor_type(cls.apiclient) cls.services['mode'] = cls.zone.networktype cls.services["isolated_network"]["zoneid"] = cls.zone.id cls.domain = get_domain(cls.apiclient) @@ -57,13 +58,12 @@ class TestNestedVirtualization(cloudstackTestCase): cls.services["service_offerings"]["tiny"] ) cls.account = Account.create(cls.apiclient, services=cls.services["account"]) - cls.template = get_template( + cls.template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) - cls.hypervisor = get_hypervisor_type(cls.apiclient) - + cls.isolated_network_offering = NetworkOffering.create( cls.apiclient, cls.services["isolated_network_offering"]) @@ -71,8 +71,8 @@ class TestNestedVirtualization(cloudstackTestCase): cls.isolated_network_offering.update(cls.apiclient, state='Enabled') if cls.template == FAILED: - assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] - + assert False, "get_test_template() failed to return template" + cls.services["small"]["zoneid"] = cls.zone.id cls.services["small"]["template"] = cls.template.id @@ -149,4 +149,3 @@ class TestNestedVirtualization(cloudstackTestCase): cleanup_resources(cls.apiclient, cls.cleanup) except Exception, e: raise Exception("Cleanup failed with %s" % e) - \ No newline at end of file diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py index bb1e14b..f01f7bf 100644 --- a/test/integration/smoke/test_network.py +++ b/test/integration/smoke/test_network.py @@ -37,7 +37,7 @@ from marvin.lib.base import (Account, Router) from marvin.lib.common import (get_domain, get_zone, - get_template, + get_test_template, list_hosts, list_publicIP, list_nat_rules, @@ -258,14 +258,13 @@ class TestPortForwarding(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.apiclient) cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) - template = get_template( + template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) if template == FAILED: - assert False, "get_template() failed to return template with description %s" % cls.services[ - "ostype"] + assert False, "get_test_template() failed to return template" # Create an account, network, VM and IP addresses cls.account = Account.create( @@ -583,15 +582,15 @@ class TestRebootRouter(cloudstackTestCase): # Get Zone, Domain and templates self.domain = get_domain(self.apiclient) self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests()) - template = get_template( + self.hypervisor = self.testClient.getHypervisorInfo() + template = get_test_template( self.apiclient, self.zone.id, - self.services["ostype"] + self.hypervisor ) if template == FAILED: - self.fail( - "get_template() failed to return template with description %s" % - self.services["ostype"]) + self.fail("get_test_template() failed to return template") + self.services["virtual_machine"]["zoneid"] = self.zone.id # Create an account, network, VM and IP addresses @@ -756,10 +755,11 @@ class TestReleaseIP(cloudstackTestCase): # Get Zone, Domain and templates self.domain = get_domain(self.apiclient) self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests()) - template = get_template( + self.hypervisor = self.testClient.getHypervisorInfo() + template = get_test_template( self.apiclient, self.zone.id, - self.services["ostype"] + self.hypervisor ) self.services["virtual_machine"]["zoneid"] = self.zone.id @@ -897,10 +897,11 @@ class TestDeleteAccount(cloudstackTestCase): # Get Zone, Domain and templates self.domain = get_domain(self.apiclient) self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests()) - template = get_template( + self.hypervisor = self.testClient.getHypervisorInfo() + template = get_test_template( self.apiclient, self.zone.id, - self.services["ostype"] + self.hypervisor ) self.services["virtual_machine"]["zoneid"] = self.zone.id @@ -1040,14 +1041,13 @@ class TestRouterRules(cloudstackTestCase): cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) cls.hypervisor = testClient.getHypervisorInfo() cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__ - template = get_template( + template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) if template == FAILED: - assert False, "get_template() failed to return template\ - with description %s" % cls.services["ostype"] + assert False, "get_test_template() failed to return template" # Create an account, network, VM and IP addresses cls.account = Account.create( diff --git a/test/integration/smoke/test_network_acl.py b/test/integration/smoke/test_network_acl.py index 734c312..7b8aa36 100644 --- a/test/integration/smoke/test_network_acl.py +++ b/test/integration/smoke/test_network_acl.py @@ -34,20 +34,21 @@ class TestNetworkACL(cloudstackTestCase): cls.services = testClient.getParsedTestDataConfig() cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) + cls.hypervisor = testClient.getHypervisorInfo() cls.domain = get_domain(cls.apiclient) cls.service_offering = ServiceOffering.create( cls.apiclient, cls.services["service_offerings"]["tiny"] ) cls.account = Account.create(cls.apiclient, services=cls.services["account"]) - cls.template = get_template( + cls.template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) - + if cls.template == FAILED: - assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] + assert False, "get_test_template() failed to return template" cls.debug("Successfully created account: %s, id: \ %s" % (cls.account.name,\ diff --git a/test/integration/smoke/test_nic_adapter_type.py b/test/integration/smoke/test_nic_adapter_type.py index 91492eb..933b8d9 100644 --- a/test/integration/smoke/test_nic_adapter_type.py +++ b/test/integration/smoke/test_nic_adapter_type.py @@ -33,7 +33,7 @@ from marvin.lib.base import ( ) from marvin.lib.common import (get_domain, get_zone, - get_template + get_test_template ) from marvin.lib.utils import ( get_hypervisor_type, @@ -57,10 +57,10 @@ class TestAdapterTypeForNic(cloudstackTestCase): cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.testdata["ostype"]) + cls.hypervisor) # Create Accounts & networks cls.testdata["isolated_network"]["zoneid"] = cls.zone.id diff --git a/test/integration/smoke/test_password_server.py b/test/integration/smoke/test_password_server.py index 98c5ced..b623313 100644 --- a/test/integration/smoke/test_password_server.py +++ b/test/integration/smoke/test_password_server.py @@ -35,7 +35,7 @@ from marvin.lib.base import (ServiceOffering, Network, Router) from marvin.lib.common import (get_zone, - get_template, + get_test_template, get_domain, list_virtual_machines, list_networks, @@ -69,11 +69,12 @@ class TestIsolatedNetworksPasswdServer(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services['mode'] = cls.zone.networktype - template = get_template( + template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) cls.services["virtual_machine"]["zoneid"] = cls.zone.id diff --git a/test/integration/smoke/test_portforwardingrules.py b/test/integration/smoke/test_portforwardingrules.py index fbac0b4..11901bd 100644 --- a/test/integration/smoke/test_portforwardingrules.py +++ b/test/integration/smoke/test_portforwardingrules.py @@ -38,7 +38,7 @@ from marvin.lib.base import (PublicIPAddress, User) from marvin.lib.common import (get_domain, get_zone, - get_template) + get_test_template) from marvin.lib.utils import validateList, cleanup_resources from marvin.codes import PASS from nose.plugins.attrib import attr @@ -58,10 +58,10 @@ class TestPortForwardingRules(cloudstackTestCase): cls.zone = get_zone( cls.api_client, cls.testClient.getZoneForTests()) - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) if cls.zone.localstorageenabled: cls.storagetype = 'local' diff --git a/test/integration/smoke/test_privategw_acl.py b/test/integration/smoke/test_privategw_acl.py index d48eb42..09d3fa4 100644 --- a/test/integration/smoke/test_privategw_acl.py +++ b/test/integration/smoke/test_privategw_acl.py @@ -168,11 +168,12 @@ class TestPrivateGwACL(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services['mode'] = cls.zone.networktype - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"]) + cls.hypervisor) cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__ cls.services["virtual_machine"]["zoneid"] = cls.zone.id @@ -183,8 +184,6 @@ class TestPrivateGwACL(cloudstackTestCase): cls.services["service_offering"]) cls._cleanup = [cls.service_offering] - cls.hypervisor = cls.testClient.getHypervisorInfo() - # Skip rVR related test cases for VMware, for details see # https://issues.apache.org/jira/browse/CLOUDSTACK-10181 cls.rvrNotSupported = False diff --git a/test/integration/smoke/test_projects.py b/test/integration/smoke/test_projects.py index e38bccc..173e81d 100644 --- a/test/integration/smoke/test_projects.py +++ b/test/integration/smoke/test_projects.py @@ -30,7 +30,7 @@ from marvin.lib.base import (Account, Domain) from marvin.lib.common import (get_domain, get_zone, - get_template, + get_test_template, list_configurations) import time @@ -1532,12 +1532,13 @@ class TestProjectSuspendActivate(cloudstackTestCase): cls.services = Services().services # Get Zone cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() cls.domain = get_domain(cls.api_client) cls.services['mode'] = cls.zone.networktype - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) cls._cleanup = [] cls.isGlobalSettingInvalid = False diff --git a/test/integration/smoke/test_reset_vm_on_reboot.py b/test/integration/smoke/test_reset_vm_on_reboot.py index 668c77f..5c1e93d 100644 --- a/test/integration/smoke/test_reset_vm_on_reboot.py +++ b/test/integration/smoke/test_reset_vm_on_reboot.py @@ -38,15 +38,16 @@ class TestResetVmOnReboot(cloudstackTestCase): # Get Zone, Domain and templates domain = get_domain(cls.apiclient) zone = get_zone(cls.apiclient, testClient.getZoneForTests()) + hypervisor = testClient.getHypervisorInfo() cls.services['mode'] = zone.networktype - template = get_template( + template = get_test_template( cls.apiclient, zone.id, - cls.services["ostype"] + hypervisor ) if template == FAILED: - assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] + assert False, "get_test_template() failed to return template" # Set Zones and disk offerings ?? cls.services["small"]["zoneid"] = zone.id diff --git a/test/integration/smoke/test_router_dhcphosts.py b/test/integration/smoke/test_router_dhcphosts.py index 668475e..aff50bc 100644 --- a/test/integration/smoke/test_router_dhcphosts.py +++ b/test/integration/smoke/test_router_dhcphosts.py @@ -35,7 +35,7 @@ from marvin.lib.base import (ServiceOffering, Network, Router) from marvin.lib.common import (get_zone, - get_template, + get_test_template, get_domain, list_virtual_machines, list_networks, @@ -68,11 +68,12 @@ class TestRouterDHCPHosts(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services['mode'] = cls.zone.networktype - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__ cls.services["virtual_machine"]["zoneid"] = cls.zone.id @@ -407,11 +408,12 @@ class TestRouterDHCPOpts(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services['mode'] = cls.zone.networktype - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__ cls.services["virtual_machine"]["zoneid"] = cls.zone.id diff --git a/test/integration/smoke/test_router_dns.py b/test/integration/smoke/test_router_dns.py index 9b4ca7e..ec1d275 100644 --- a/test/integration/smoke/test_router_dns.py +++ b/test/integration/smoke/test_router_dns.py @@ -29,7 +29,7 @@ from marvin.lib.base import (ServiceOffering, NetworkOffering, Network) from marvin.lib.common import (get_zone, - get_template, + get_test_template, get_domain, list_routers, list_nat_rules, @@ -51,12 +51,15 @@ class TestRouterDns(cloudstackTestCase): cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() + cls.services['mode'] = cls.zone.networktype - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) + cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.logger.debug("Creating Admin Account for domain %s on zone %s" % (cls.domain.id, cls.zone.id)) @@ -264,5 +267,5 @@ class TestRouterDns(cloudstackTestCase): if not result: self.fail("Did not to receive any response from the guest VM, failing.") - self.assertTrue("google.com" in result and "#53" in result, + self.assertTrue("google.com" in result and "10.1.1.1" in result, "VR DNS should serve requests from guest network, unable to get valid nslookup result from guest VM.") diff --git a/test/integration/smoke/test_router_dnsservice.py b/test/integration/smoke/test_router_dnsservice.py index ffadec7..d0c5a67 100644 --- a/test/integration/smoke/test_router_dnsservice.py +++ b/test/integration/smoke/test_router_dnsservice.py @@ -29,7 +29,7 @@ from marvin.lib.base import (ServiceOffering, NetworkOffering, Network) from marvin.lib.common import (get_zone, - get_template, + get_test_template, get_domain, list_routers, list_nat_rules, @@ -54,11 +54,12 @@ class TestRouterDnsService(cloudstackTestCase): cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services['mode'] = cls.zone.networktype - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) cls.services["virtual_machine"]["zoneid"] = cls.zone.id @@ -267,9 +268,9 @@ class TestRouterDnsService(cloudstackTestCase): if not result1: self.fail("Did not to receive any response from the guest VM, failing.") - self.assertTrue(VM1_NAME in result1 and "#53" in result1, + self.assertTrue(VM1_NAME in result1 and "10.1.1.1" in result1, "VR DNS should serve requests from guest network, ping for %s successful." % VM1_NAME) - self.assertTrue(VM2_NAME in result2 and "#53" in result2, + self.assertTrue(VM2_NAME in result2 and "10.1.1.1" in result2, "VR DNS should serve requests from guest network, ping for %s successful." % VM2_NAME) return diff --git a/test/integration/smoke/test_routers.py b/test/integration/smoke/test_routers.py index 070841e..dfd5916 100644 --- a/test/integration/smoke/test_routers.py +++ b/test/integration/smoke/test_routers.py @@ -31,7 +31,7 @@ from marvin.lib.base import (Account, VirtualMachine) from marvin.lib.common import (get_domain, get_zone, - get_template, + get_test_template, list_hosts, list_routers, list_networks, @@ -57,17 +57,15 @@ class TestRouterServices(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.apiclient) cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) + cls.hypervisor = testClient.getHypervisorInfo() cls.services['mode'] = cls.zone.networktype - template = get_template( + template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) if template == FAILED: - cls.fail( - "get_template() failed to return template\ - with description %s" % - cls.services["ostype"]) + cls.fail("get_test_template() failed to return template") cls.services["virtual_machine"]["zoneid"] = cls.zone.id diff --git a/test/integration/smoke/test_routers_iptables_default_policy.py b/test/integration/smoke/test_routers_iptables_default_policy.py index ec35396..c077b56 100644 --- a/test/integration/smoke/test_routers_iptables_default_policy.py +++ b/test/integration/smoke/test_routers_iptables_default_policy.py @@ -35,7 +35,7 @@ from marvin.lib.base import (stopRouter, LoadBalancerRule) from marvin.lib.common import (get_domain, get_zone, - get_template, + get_test_template, list_routers, list_hosts) from marvin.lib.utils import (cleanup_resources, @@ -214,10 +214,12 @@ class TestVPCIpTablesPolicies(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.apiclient) cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests()) - cls.template = get_template( + cls.hypervisor = cls.testClient.getHypervisorInfo() + cls.template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"]) + cls.hypervisor) + cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__ cls.services["virtual_machine"]["zoneid"] = cls.zone.id @@ -366,11 +368,12 @@ class TestRouterIpTablesPolicies(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.apiclient) cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests()) - cls.template = get_template( + cls.hypervisor = cls.testClient.getHypervisorInfo() + cls.template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"]) - + cls.hypervisor) + cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__ cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id diff --git a/test/integration/smoke/test_routers_network_ops.py b/test/integration/smoke/test_routers_network_ops.py index 09eb4f3..c189437 100644 --- a/test/integration/smoke/test_routers_network_ops.py +++ b/test/integration/smoke/test_routers_network_ops.py @@ -39,7 +39,7 @@ from marvin.lib.base import (ServiceOffering, Router, EgressFireWallRule) from marvin.lib.common import (get_zone, - get_template, + get_test_template, get_domain, list_virtual_machines, list_networks, @@ -67,57 +67,6 @@ def check_router_command(virtual_machine, public_ip, ssh_command, check_string, return result.count(check_string) -class Templates: - """Test data for templates - """ - - def __init__(self): - self.templates = { - "macchinina": { - "kvm": { - "name": "tiny-kvm", - "displaytext": "macchinina kvm", - "format": "qcow2", - "hypervisor": "kvm", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2", - "requireshvm": "True", - "ispublic": "True", - }, - "xenserver": { - "name": "tiny-xen", - "displaytext": "macchinina xen", - "format": "vhd", - "hypervisor": "xen", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2", - "requireshvm": "True", - "ispublic": "True", - }, - "hyperv": { - "name": "tiny-hyperv", - "displaytext": "macchinina xen", - "format": "vhd", - "hypervisor": "hyperv", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip", - "requireshvm": "True", - "ispublic": "True", - }, - "vmware": { - "name": "tiny-vmware", - "displaytext": "macchinina vmware", - "format": "ova", - "hypervisor": "vmware", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova", - "requireshvm": "True", - "ispublic": "True", - }, - } - } - - class TestRedundantIsolateNetworks(cloudstackTestCase): @classmethod @@ -146,15 +95,9 @@ class TestRedundantIsolateNetworks(cloudstackTestCase): cls.rvrNotSupported = True return - macchinina = Templates().templates["macchinina"] - cls.logger.debug("Downloading Template: %s from: %s" % (macchinina[cls.hypervisor.lower()], - macchinina[cls.hypervisor.lower()]["url"])) - cls.template = Template.register(cls.api_client, macchinina[cls.hypervisor.lower()], - cls.zone.id, hypervisor=cls.hypervisor.lower(), domainid=cls.domain.id) - cls.template.download(cls.api_client) - + cls.template = get_test_template(cls.api_client, cls.zone.id, cls.hypervisor) if cls.template == FAILED: - assert False, "get_template() failed to return template" + assert False, "get_test_template() failed to return template" cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id @@ -193,8 +136,7 @@ class TestRedundantIsolateNetworks(cloudstackTestCase): cls._cleanup = [ cls.service_offering, - cls.account, - cls.template + cls.account ] return @@ -723,11 +665,12 @@ class TestIsolatedNetworks(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services['mode'] = cls.zone.networktype - cls.template = get_template( + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) cls.services["virtual_machine"]["zoneid"] = cls.zone.id diff --git a/test/integration/smoke/test_service_offerings.py b/test/integration/smoke/test_service_offerings.py index 519b5ae..50c69d7 100644 --- a/test/integration/smoke/test_service_offerings.py +++ b/test/integration/smoke/test_service_offerings.py @@ -31,7 +31,7 @@ from marvin.lib.common import (list_service_offering, list_virtual_machines, get_domain, get_zone, - get_template) + get_test_template) from nose.plugins.attrib import attr @@ -163,14 +163,13 @@ class TestServiceOfferings(cloudstackTestCase): cls.apiclient, cls.services["service_offerings"]["tiny"] ) - template = get_template( + template = get_test_template( cls.apiclient, cls.zone.id, - cls.services["ostype"] + cls.hypervisor ) if template == FAILED: - assert False, "get_template() failed to return\ - template with description %s" % cls.services["ostype"] + assert False, "get_test_template() failed to return template" # Set Zones and disk offerings cls.services["small"]["zoneid"] = cls.zone.id @@ -386,7 +385,7 @@ class TestServiceOfferings(cloudstackTestCase): "Check CPU Speed for small offering" ) - range = 20 + range = 25 if self.hypervisor.lower() == "hyperv": range = 200 # TODO: Find the memory allocated to VM on hyperv hypervisor using diff --git a/test/integration/smoke/test_snapshots.py b/test/integration/smoke/test_snapshots.py index 5761262..6e9a877 100644 --- a/test/integration/smoke/test_snapshots.py +++ b/test/integration/smoke/test_snapshots.py @@ -30,7 +30,7 @@ from marvin.lib.base import (VirtualMachine, Volume, DiskOffering) from marvin.lib.common import (get_domain, - get_template, + get_test_template, get_zone, get_pod, list_volumes, @@ -41,57 +41,6 @@ from marvin.lib.decoratorGenerators import skipTestIf from marvin.codes import PASS -class Templates: - """Test data for templates - """ - - def __init__(self): - self.templates = { - "macchinina": { - "kvm": { - "name": "tiny-kvm", - "displaytext": "macchinina kvm", - "format": "qcow2", - "hypervisor": "kvm", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2", - "requireshvm": "True", - "ispublic": "True", - }, - "xenserver": { - "name": "tiny-xen", - "displaytext": "macchinina xen", - "format": "vhd", - "hypervisor": "xen", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2", - "requireshvm": "True", - "ispublic": "True", - }, - "hyperv": { - "name": "tiny-hyperv", - "displaytext": "macchinina xen", - "format": "vhd", - "hypervisor": "hyperv", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip", - "requireshvm": "True", - "ispublic": "True", - }, - "vmware": { - "name": "tiny-vmware", - "displaytext": "macchinina vmware", - "format": "ova", - "hypervisor": "vmware", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova", - "requireshvm": "True", - "ispublic": "True", - }, - } - } - - class TestSnapshotRootDisk(cloudstackTestCase): @classmethod @@ -113,14 +62,9 @@ class TestSnapshotRootDisk(cloudstackTestCase): cls._cleanup = [] if not cls.hypervisorNotSupported: - macchinina = Templates().templates["macchinina"] - cls.template = Template.register(cls.apiclient, macchinina[cls.hypervisor.lower()], - cls.zone.id, hypervisor=cls.hypervisor.lower(), domainid=cls.domain.id) - cls.template.download(cls.apiclient) - + cls.template = get_test_template(cls.apiclient, cls.zone.id, cls.hypervisor) if cls.template == FAILED: - assert False, "get_template() failed to return template" - + assert False, "get_test_template() failed to return template" cls.services["domainid"] = cls.domain.id cls.services["small"]["zoneid"] = cls.zone.id @@ -155,7 +99,6 @@ class TestSnapshotRootDisk(cloudstackTestCase): cls._cleanup.append(cls.service_offering) cls._cleanup.append(cls.account) - cls._cleanup.append(cls.template) cls._cleanup.append(cls.disk_offering) return @@ -430,4 +373,4 @@ class TestSnapshotRootDisk(cloudstackTestCase): "Check list Snapshot response" ) - return \ No newline at end of file + return diff --git a/test/integration/smoke/test_templates.py b/test/integration/smoke/test_templates.py index 8d76de3..6544ad2 100644 --- a/test/integration/smoke/test_templates.py +++ b/test/integration/smoke/test_templates.py @@ -106,7 +106,7 @@ class TestCreateTemplateWithChecksum(cloudstackTestCase): if "kvm" in self.hypervisor.lower(): self.test_template = registerTemplate.registerTemplateCmd() self.test_template = registerTemplate.registerTemplateCmd() - self.test_template.checksum = "{SHA-1}" + "bf580a13f791d86acf3449a7b457a91a14389264" + self.test_template.checksum = "{SHA-1}" + "6952e58f39b470bd166ace11ffd20bf479bed936" self.test_template.hypervisor = self.hypervisor self.test_template.zoneid = self.zone.id self.test_template.name = 'test sha-2333' @@ -114,13 +114,13 @@ class TestCreateTemplateWithChecksum(cloudstackTestCase): self.test_template.url = "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2" self.test_template.format = "QCOW2" self.test_template.ostypeid = self.getOsType("Other Linux (64-bit)") - self.md5 = "ada77653dcf1e59495a9e1ac670ad95f" - self.sha256 = "0efc03633f2b8f5db08acbcc5dc1be9028572dfd8f1c6c8ea663f0ef94b458c5" + self.md5 = "88c60fd500ce7ced985cf845df0db9da" + self.sha256 = "bc4cc040bbab843000fab78db6cb4a33f3a06ae1ced2cf563d36b38c7fee3049" if "vmware" in self.hypervisor.lower(): self.test_template = registerTemplate.registerTemplateCmd() self.test_template = registerTemplate.registerTemplateCmd() - self.test_template.checksum = "{SHA-1}" + "b25d404de8335b4348ff01e49a95b403c90df466" + self.test_template.checksum = "{SHA-1}" + "178639bd5ec089a27f6d39025be28c3de5d9393b" self.test_template.hypervisor = self.hypervisor self.test_template.zoneid = self.zone.id self.test_template.name = 'test sha-2333' @@ -128,13 +128,13 @@ class TestCreateTemplateWithChecksum(cloudstackTestCase): self.test_template.url = "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova" self.test_template.format = "OVA" self.test_template.ostypeid = self.getOsType("Other Linux (64-bit)") - self.md5 = "d6d97389b129c7d898710195510bf4fb" - self.sha256 = "f57b59f118ab59284a70d6c63229d1de8f2d69bffc5a82b773d6c47e769c12d9" + self.md5 = "3c23ac66bac7888dc7c972783646c644" + self.sha256 = "97aaa096d419522158c54f83eb61d9242d9f6bca9166fd4030d73683d647c7e7" if "xen" in self.hypervisor.lower(): self.test_template = registerTemplate.registerTemplateCmd() self.test_template = registerTemplate.registerTemplateCmd() - self.test_template.checksum = "{SHA-1}" + "427fad501d0d8a1d63b8600a9a469fbf91191314" + self.test_template.checksum = "{SHA-1}" + "80af2c18f96e94273188808c3d56e561a1cda717" self.test_template.hypervisor = self.hypervisor self.test_template.zoneid = self.zone.id self.test_template.name = 'test sha-2333' @@ -142,8 +142,8 @@ class TestCreateTemplateWithChecksum(cloudstackTestCase): self.test_template.url = "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2" self.test_template.format = "VHD" self.test_template.ostypeid = self.getOsType("Other Linux (64-bit)") - self.md5 = "54ebc933e6e07ae58c0dc97dfd37c824" - self.sha256 = "bddd9876021d33df9792b71ae4b776598680ac68ecf55e9d9af33c80904cc1f3" + self.md5 = "1662bbf224e41bb62b1dee043d785731" + self.sha256 = "80fba5a7a83842ec4e5f67cc6755d61d4fca46ae170d59b0c6ed47ebf7162722" if self.unsupportedHypervisor: self.skipTest("Skipping test because unsupported hypervisor\ @@ -158,7 +158,6 @@ class TestCreateTemplateWithChecksum(cloudstackTestCase): cmd.id = temp.id cmd.zoneid = self.zone.id self.apiclient.deleteTemplate(cmd) - except Exception as e: raise Exception("Warning: Exception during cleanup : %s" % e) return @@ -227,7 +226,8 @@ class TestCreateTemplateWithChecksum(cloudstackTestCase): def registerTemplate(self, cmd): temp = self.apiclient.registerTemplate(cmd)[0] - self.cleanup.append(temp) + if not temp: + self.cleanup.append(temp) return temp def getOsType(self, param): diff --git a/test/integration/smoke/test_usage.py b/test/integration/smoke/test_usage.py index e6c6565..4419835 100644 --- a/test/integration/smoke/test_usage.py +++ b/test/integration/smoke/test_usage.py @@ -680,26 +680,12 @@ class TestVolumeUsage(cloudstackTestCase): "Check VOLUME.DELETE in events table" ) self.hypervisor = str(get_hypervisor_type(self.apiclient)).lower() - if self.hypervisor == "vmware": - self.testdata["coreos_volume"][ - "url"] = self.testdata["coreos_volume"]["urlvmware"] - self.testdata["coreos_volume"]["format"] = "OVA" - elif self.hypervisor == "xenserver": - self.testdata["coreos_volume"][ - "url"] = self.testdata["coreos_volume"]["urlxen"] - self.testdata["coreos_volume"]["format"] = "VHD" - elif self.hypervisor == "kvm": - self.testdata["coreos_volume"][ - "url"] = self.testdata["coreos_volume"]["urlkvm"] - self.testdata["coreos_volume"]["format"] = "QCOW2" - elif self.hypervisor == "hyperv": - self.testdata["coreos_volume"][ - "url"] = self.testdata["coreos_volume"]["urlxen"] - self.testdata["coreos_volume"]["format"] = "VHD" - + volume_template = self.testdata["test_templates"][self.hypervisor] + volume_template["diskname"] = "Volume_tiny" + volume_template["format"] = volume_template["format"].upper() volume_uploaded = Volume.upload( self.apiclient, - self.testdata["coreos_volume"], + volume_template, self.zone.id, account=self.account.name, domainid=self.account.domainid) diff --git a/test/integration/smoke/test_vpc_redundant.py b/test/integration/smoke/test_vpc_redundant.py index 915736d..b87ce43 100644 --- a/test/integration/smoke/test_vpc_redundant.py +++ b/test/integration/smoke/test_vpc_redundant.py @@ -40,7 +40,7 @@ from marvin.lib.base import (stopRouter, Configurations) from marvin.lib.common import (get_domain, get_zone, - get_template, + get_test_template, list_routers, list_hosts) from marvin.lib.utils import (cleanup_resources, @@ -193,49 +193,7 @@ class Services: "publicport": 22, "protocol": 'TCP', }, - "timeout": 10, - "template": { - "kvm": { - "name": "tiny-kvm", - "displaytext": "macchinina kvm", - "format": "qcow2", - "hypervisor": "kvm", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2", - "requireshvm": "True", - "ispublic": "True", - }, - "xenserver": { - "name": "tiny-xen", - "displaytext": "macchinina xen", - "format": "vhd", - "hypervisor": "xen", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2", - "requireshvm": "True", - "ispublic": "True", - }, - "hyperv": { - "name": "tiny-hyperv", - "displaytext": "macchinina xen", - "format": "vhd", - "hypervisor": "hyperv", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip", - "requireshvm": "True", - "ispublic": "True", - }, - "vmware": { - "name": "tiny-vmware", - "displaytext": "macchinina vmware", - "format": "ova", - "hypervisor": "vmware", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova", - "requireshvm": "True", - "ispublic": "True", - } - } + "timeout": 10 } @@ -263,12 +221,9 @@ class TestVPCRedundancy(cloudstackTestCase): cls.rvrNotSupported = True return - cls.template = Template.register(cls.api_client, cls.services["template"][cls.hypervisor.lower( - )], cls.zone.id, hypervisor=cls.hypervisor.lower(), domainid=cls.domain.id) - cls.template.download(cls.api_client) - + cls.template = get_test_template(cls.api_client, cls.zone.id, cls.hypervisor) if cls.template == FAILED: - assert False, "get_template() failed to return template" + assert False, "get_test_template() failed to return template" cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id @@ -276,7 +231,7 @@ class TestVPCRedundancy(cloudstackTestCase): cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"]) - cls._cleanup = [cls.service_offering, cls.template] + cls._cleanup = [cls.service_offering] cls.logger = logging.getLogger('TestVPCRedundancy') cls.stream_handler = logging.StreamHandler() diff --git a/test/integration/smoke/test_vpc_router_nics.py b/test/integration/smoke/test_vpc_router_nics.py index 39a9214..092a70f 100644 --- a/test/integration/smoke/test_vpc_router_nics.py +++ b/test/integration/smoke/test_vpc_router_nics.py @@ -35,7 +35,7 @@ from marvin.lib.base import (stopRouter, LoadBalancerRule) from marvin.lib.common import (get_domain, get_zone, - get_template, + get_test_template, list_routers) from marvin.lib.utils import cleanup_resources import socket @@ -186,10 +186,11 @@ class TestVPCNics(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) - cls.template = get_template( + cls.hypervisor = cls.testClient.getHypervisorInfo() + cls.template = get_test_template( cls.api_client, cls.zone.id, - cls.services["ostype"]) + cls.hypervisor) cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id @@ -450,10 +451,10 @@ class TestVPCNics(cloudstackTestCase): def do_default_routes_test(self): for o in self.networks: for vmObj in o.get_vms(): - ssh_command = "ping -c 3 8.8.8.8" + ssh_command = "ping -c 5 8.8.8.8" # Should be able to SSH VM - result = 'failed' + packet_loss = 100 try: vm = vmObj.get_vm() public_ip = vmObj.get_ip() @@ -462,19 +463,22 @@ class TestVPCNics(cloudstackTestCase): ssh = vm.get_ssh_client(ipaddress=public_ip.ipaddress.ipaddress) self.logger.debug("Ping to google.com from VM") - result = str(ssh.execute(ssh_command)) + result = ssh.execute(ssh_command) - self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count(" 0% packet loss"))) + for line in result: + if "packet loss" in line: + packet_loss = int(line.split("% packet loss")[0].split(" ")[-1]) + break + + self.logger.debug("SSH result: %s; packet loss is ==> %s" % (result, packet_loss)) except Exception as e: self.fail("SSH Access failed for %s: %s" % \ (vmObj.get_ip(), e) ) - - self.assertEqual( - result.count(" 0% packet loss"), - 1, - "Ping to outside world from VM should be successful" - ) + + # Most pings should be successful + self.assertTrue(packet_loss < 50, + "Ping to outside world from VM should be successful") class networkO(object): diff --git a/test/integration/smoke/test_vpc_vpn.py b/test/integration/smoke/test_vpc_vpn.py index 1c4d418..4ab5971 100644 --- a/test/integration/smoke/test_vpc_vpn.py +++ b/test/integration/smoke/test_vpc_vpn.py @@ -52,7 +52,7 @@ from marvin.sshClient import SshClient from marvin.lib.common import (get_zone, get_domain, - get_template, + get_test_template, list_network_offerings) from nose.plugins.attrib import attr @@ -215,48 +215,6 @@ class Services: "privateport": 22, "publicport": 22, "protocol": 'TCP', - }, - "template": { - - "kvm": { - "name": "tiny-kvm", - "displaytext": "macchinina kvm", - "format": "qcow2", - "hypervisor": "kvm", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2", - "requireshvm": "True", - }, - - "xenserver": { - "name": "tiny-xen", - "displaytext": "macchinina xen", - "format": "vhd", - "hypervisor": "xen", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2", - "requireshvm": "True", - }, - - "hyperv": { - "name": "tiny-hyperv", - "displaytext": "macchinina xen", - "format": "vhd", - "hypervisor": "hyperv", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip", - "requireshvm": "True", - }, - - "vmware": { - "name": "tiny-vmware", - "displaytext": "macchinina vmware", - "format": "ova", - "hypervisor": "vmware", - "ostype": "Other Linux (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova", - "requireshvm": "True", - } } } @@ -287,14 +245,9 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase): cls.hypervisor = testClient.getHypervisorInfo() - cls.logger.debug("Downloading Template: %s from: %s" % (cls.services["template"][ - cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"])) - cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower( - )], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id) - cls.template.download(cls.apiclient) - + cls.template = get_test_template(cls.apiclient, cls.zone.id, cls.hypervisor) if cls.template == FAILED: - assert False, "get_template() failed to return template" + assert False, "get_test_template() failed to return template" cls.logger.debug("Successfully created account: %s, id: \ %s" % (cls.account.name, @@ -436,9 +389,6 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase): try: cls.logger.debug("Cleaning up resources") - try: - cls.template.delete(cls.apiclient) - except Exception: pass cleanup_resources(cls.apiclient, cls.cleanup) except Exception, e: raise Exception("Cleanup failed with %s" % e) @@ -470,14 +420,9 @@ class TestVpcSite2SiteVpn(cloudstackTestCase): cls.hypervisor = testClient.getHypervisorInfo() - cls.logger.debug("Downloading Template: %s from: %s" % (cls.services["template"][ - cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"])) - cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower( - )], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id) - cls.template.download(cls.apiclient) - + cls.template = get_test_template(cls.apiclient, cls.zone.id, cls.hypervisor) if cls.template == FAILED: - assert False, "get_template() failed to return template" + assert False, "get_test_template() failed to return template" cls.logger.debug("Successfully created account: %s, id: \ %s" % (cls.account.name, @@ -813,9 +758,6 @@ class TestVpcSite2SiteVpn(cloudstackTestCase): @classmethod def tearDownClass(cls): try: - try: - cls.template.delete(cls.apiclient) - except Exception: pass cleanup_resources(cls.apiclient, cls.cleanup) except Exception, e: raise Exception("Cleanup failed with %s" % e) @@ -854,14 +796,9 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase): cls.rvrNotSupported = True return - cls.logger.debug("Downloading Template: %s from: %s" % (cls.services["template"][ - cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"])) - cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower( - )], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id) - cls.template.download(cls.apiclient) - + cls.template = get_test_template(cls.apiclient, cls.zone.id, cls.hypervisor) if cls.template == FAILED: - assert False, "get_template() failed to return template" + assert False, "get_test_template() failed to return template" cls.logger.debug("Successfully created account: %s, id: \ %s" % (cls.account.name, @@ -1203,9 +1140,6 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase): @classmethod def tearDownClass(cls): try: - try: - cls.template.delete(cls.apiclient) - except Exception: pass cleanup_resources(cls.apiclient, cls.cleanup) except Exception, e: raise Exception("Cleanup failed with %s" % e) @@ -1237,14 +1171,9 @@ class TestVPCSite2SiteVPNMultipleOptions(cloudstackTestCase): cls.hypervisor = testClient.getHypervisorInfo() - cls.logger.debug("Downloading Template: %s from: %s" % (cls.services["template"][ - cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"])) - cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower( - )], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id) - cls.template.download(cls.apiclient) - + cls.template = get_test_template(cls.apiclient, cls.zone.id, cls.hypervisor) if cls.template == FAILED: - assert False, "get_template() failed to return template" + assert False, "get_test_template() failed to return template" cls.logger.debug("Successfully created account: %s, id: \ %s" % (cls.account.name, @@ -1651,9 +1580,6 @@ class TestVPCSite2SiteVPNMultipleOptions(cloudstackTestCase): @classmethod def tearDownClass(cls): try: - try: - cls.template.delete(cls.apiclient) - except Exception: pass cleanup_resources(cls.apiclient, cls.cleanup) except Exception, e: raise Exception("Cleanup failed with %s" % e) diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh index 45f4728..ab3cac8 100755 --- a/tools/appliance/build.sh +++ b/tools/appliance/build.sh @@ -397,7 +397,7 @@ function stage_vmx (){ displayname = "${1}" annotation = "${1}" guestos = "otherlinux-64" -virtualhw.version = "7" +virtualHW.version = "8" config.version = "8" numvcpus = "1" cpuid.coresPerSocket = "1" @@ -611,8 +611,8 @@ function main() { ovm_export "${hdd_path}" kvm_export "${hdd_path}" vmware_export "${machine_uuid}" "${hdd_uuid}" - vagrant_export "${machine_uuid}" hyperv_export "${hdd_uuid}" + #vagrant_export "${machine_uuid}" md5sum dist/* > dist/md5sum.txt add_on_exit log INFO "BUILD SUCCESSFUL" } diff --git a/tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh b/tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh index 6f37e34..4d5ff26 100644 --- a/tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh +++ b/tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh @@ -19,10 +19,12 @@ set -e set -x -function remove_reserved_blocks() { +# Perform fsck check on every 2nd boot +function fix_tune2fs() { for partition in $(blkid -o list | grep ext | awk '{print $1}') do - tune2fs -m0 $partition + tune2fs -m 1 $partition + tune2fs -c 2 $partition done fdisk -l df -h @@ -39,10 +41,11 @@ function apt_upgrade() { DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical + fix_tune2fs + # Setup sudo echo 'cloud ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/cloud - remove_reserved_blocks add_backports rm -fv /root/*.iso diff --git a/tools/appliance/definitions/systemvmtemplate/cleanup.sh b/tools/appliance/definitions/systemvmtemplate/cleanup.sh index 00f068d..eed29af 100644 --- a/tools/appliance/definitions/systemvmtemplate/cleanup.sh +++ b/tools/appliance/definitions/systemvmtemplate/cleanup.sh @@ -21,8 +21,8 @@ set -x function cleanup_apt() { apt-get -y remove --purge dictionaries-common busybox isc-dhcp-client isc-dhcp-common \ - task-english task-ssh-server tasksel tasksel-data laptop-detect nano wamerican \ - debconf-i18n sharutils gnupg gnupg-agent keyboard-configuration + task-english task-ssh-server tasksel tasksel-data laptop-detect wamerican \ + debconf-i18n sharutils gnupg gnupg-agent apt-get -y autoremove --purge apt-get autoclean @@ -59,7 +59,6 @@ function cleanup_misc() { # Docs and data files rm -fr /var/lib/apt/* rm -fr /var/cache/apt/* - rm -fr /usr/lib/gnupg* rm -fr /usr/share/doc rm -fr /usr/share/man rm -fr /usr/share/info diff --git a/tools/appliance/definitions/systemvmtemplate/configure_grub.sh b/tools/appliance/definitions/systemvmtemplate/configure_grub.sh index eb2692e..5d80e46 100644 --- a/tools/appliance/definitions/systemvmtemplate/configure_grub.sh +++ b/tools/appliance/definitions/systemvmtemplate/configure_grub.sh @@ -27,8 +27,8 @@ function configure_grub() { GRUB_DEFAULT=0 GRUB_TIMEOUT=0 GRUB_DISTRIBUTOR=Debian -GRUB_CMDLINE_LINUX_DEFAULT="quiet" -GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8 console=hvc0 earlyprintk=xen net.ifnames=0 biosdevname=0 debian-installer=en_US" +GRUB_CMDLINE_LINUX_DEFAULT="" +GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8 console=hvc0 earlyprintk=xen net.ifnames=0 biosdevname=0 debian-installer=en_US nomodeset" GRUB_CMDLINE_XEN="com1=115200 console=com1" GRUB_TERMINAL="console serial" GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1" diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb index 03be568..52cb7df 100644 --- a/tools/appliance/definitions/systemvmtemplate/definition.rb +++ b/tools/appliance/definitions/systemvmtemplate/definition.rb @@ -27,16 +27,16 @@ arch = 'amd64' architectures = { :amd64 => { :os_type_id => 'Debian_64', - :iso_file => 'debian-9.2.1-amd64-netinst.iso', - :iso_src => 'https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-9.2.1-amd64-netinst.iso', - :iso_sha512 => 'ebfe25dc593967e39349b205480b0ec0103ef4a0468c602f4857e13d06d407bfe876162399e0e8d4dea5675953dc37ab585316f307ccf9f4440124b4f719df04' + :iso_file => 'debian-9.3.0-amd64-netinst.iso', + :iso_src => 'https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-9.3.0-amd64-netinst.iso', + :iso_sha512 => '8775231d6f56a3d8f116eb64fe048f5cbd2ea0f8c092a1cb7608bcb4106f9c85cb69ce68f53bd381019ab40f1c0316843036daf3fd9107c81c58a240334cc747' } } config = { :cpu_count => '1', :memory_size => '512', - :disk_size => '2000', :disk_format => 'VDI', :hostiocache => 'off', + :disk_size => '2100', :disk_format => 'VDI', :hostiocache => 'off', :iso_download_timeout => '1000', :boot_wait => '10', :boot_cmd_sequence => [ diff --git a/tools/appliance/definitions/systemvmtemplate/finalize.sh b/tools/appliance/definitions/systemvmtemplate/finalize.sh index 1a25e39..febae7b 100644 --- a/tools/appliance/definitions/systemvmtemplate/finalize.sh +++ b/tools/appliance/definitions/systemvmtemplate/finalize.sh @@ -51,13 +51,14 @@ function cleanup_veewee() { # Zero out the free space to save space in the final image: function zero_disk() { + df -h + fstrim -av for path in / /boot /var/log /tmp do dd if=/dev/zero of=${path}/zero bs=1M || true sync rm -f ${path}/zero done - df -h } function finalize() { diff --git a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh index 40ff6df..b60f908 100644 --- a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh +++ b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh @@ -53,7 +53,7 @@ function install_packages() { fi ${apt_get} install grub-legacy \ - rsyslog logrotate cron net-tools ifupdown vim netbase iptables \ + rsyslog logrotate cron net-tools ifupdown tmux vim netbase iptables \ openssh-server e2fsprogs tcpdump socat wget \ python bzip2 sed gawk diffutils grep gzip less tar telnet ftp rsync traceroute psmisc lsof procps \ inetutils-ping iputils-arping httping curl \ diff --git a/tools/appliance/definitions/systemvmtemplate/preseed.cfg b/tools/appliance/definitions/systemvmtemplate/preseed.cfg index 5a8e2d9..d218172 100644 --- a/tools/appliance/definitions/systemvmtemplate/preseed.cfg +++ b/tools/appliance/definitions/systemvmtemplate/preseed.cfg @@ -57,23 +57,28 @@ d-i partman-auto/method string regular d-i partman-auto/choose_recipe select atomic d-i partman-auto/expert_recipe string \ boot-root :: \ - 50 50 50 ext2 \ + 100 50 200 ext2 \ $primary{ } $bootable{ } \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext2 } \ mountpoint{ /boot } \ . \ - 1500 40 1600 ext4 \ + 1450 40 1600 ext4 \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ / } \ . \ - 350 50 400 ext4 \ + 350 60 500 ext4 \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ /var/log } \ . \ - 100 100 100 linux-swap \ + 100 90 200 ext4 \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /tmp } \ + . \ + 100 100 1024 linux-swap \ method{ swap } format{ } \ . diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py index b2a969c..d55ea36 100644 --- a/tools/marvin/marvin/config/test_data.py +++ b/tools/marvin/marvin/config/test_data.py @@ -1,4 +1,4 @@ -#t Licensed to the Apache Software Foundation (ASF) under one +# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file @@ -897,8 +897,54 @@ test_data = { "name": "xs", "passwordenabled": False, "ostype": "CentOS 5.6 (64-bit)" + }, + "test_templates": { + "kvm": { + "name": "tiny-kvm", + "displaytext": "tiny kvm", + "format": "qcow2", + "hypervisor": "kvm", + "ostype": "Other Linux (64-bit)", + "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2", + "requireshvm": "True", + "ispublic": "True", + "isextractable": "True" + }, + "xenserver": { + "name": "tiny-xen", + "displaytext": "tiny xen", + "format": "vhd", + "hypervisor": "xenserver", + "ostype": "Other Linux (64-bit)", + "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2", + "requireshvm": "True", + "ispublic": "True", + "isextractable": "True" + }, + "hyperv": { + "name": "tiny-hyperv", + "displaytext": "tiny hyperv", + "format": "vhd", + "hypervisor": "hyperv", + "ostype": "Other Linux (64-bit)", + "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip", + "requireshvm": "True", + "ispublic": "True", + "isextractable": "True" + }, + "vmware": { + "name": "tiny-vmware", + "displaytext": "tiny vmware", + "format": "ova", + "hypervisor": "vmware", + "ostype": "Other Linux (64-bit)", + "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova", + "requireshvm": "True", + "ispublic": "True" + } }, + "coreos_volume": { "diskname": "Volume_core", "urlvmware":"http://dl.openvm.eu/cloudstack/coreos/x86_64/coreos_production_cloudstack_image-vmware.ova", diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py index 340419a..6f26009 100755 --- a/tools/marvin/marvin/lib/base.py +++ b/tools/marvin/marvin/lib/base.py @@ -1225,13 +1225,16 @@ class Template: @classmethod def register(cls, apiclient, services, zoneid=None, account=None, domainid=None, hypervisor=None, - projectid=None, details=None): + projectid=None, details=None, randomize_name=True): """Create template from URL""" # Create template from Virtual machine and Volume ID cmd = registerTemplate.registerTemplateCmd() cmd.displaytext = services["displaytext"] - cmd.name = "-".join([services["name"], random_gen()]) + if randomize_name: + cmd.name = "-".join([services["name"], random_gen()]) + else: + cmd.name = services["name"] cmd.format = services["format"] if hypervisor: cmd.hypervisor = hypervisor diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py index d1b872a..86203d6 100644 --- a/tools/marvin/marvin/lib/common.py +++ b/tools/marvin/marvin/lib/common.py @@ -18,6 +18,7 @@ """ # Import Local Modules +from marvin.config.test_data import test_data from marvin.cloudstackAPI import (listConfigurations, listPhysicalNetworks, listRegions, @@ -76,6 +77,7 @@ from marvin.lib.base import (PhysicalNetwork, NATRule, StaticNATRule, Volume, + Template, Account, Project, Snapshot, @@ -296,6 +298,7 @@ def get_pod(apiclient, zone_id=None, pod_id=None, pod_name=None): if validateList(cmd_out)[0] != PASS: return FAILED return cmd_out[0] + def get_template( apiclient, zone_id=None, ostype_desc=None, template_filter="featured", template_type='BUILTIN', template_id=None, template_name=None, account=None, domain_id=None, project_id=None, @@ -342,6 +345,50 @@ def get_template( return list_templatesout[0] +def get_test_template(apiclient, zone_id=None, hypervisor=None): + """ + @Name : get_test_template + @Desc : Retrieves the test template used to running tests. When the template + is missing it will be download at most one in a zone for a hypervisor. + @Input : returns a template + """ + test_templates = test_data["test_templates"] + + if hypervisor is None: + return FAILED + + hypervisor = hypervisor.lower() + + # Return built-in template for simulator + if hypervisor == 'simulator': + return get_template(apiclient, zone_id) + + if hypervisor not in test_templates.keys(): + print "Provided hypervisor has no test template" + return FAILED + + test_template = test_templates[hypervisor] + + cmd = listTemplates.listTemplatesCmd() + cmd.name = test_template['name'] + cmd.templatefilter = 'all' + if zone_id is not None: + cmd.zoneid = zone_id + if hypervisor is not None: + cmd.hypervisor = hypervisor + templates = apiclient.listTemplates(cmd) + + if validateList(templates)[0] != PASS: + template = Template.register(apiclient, test_template, zoneid=zone_id, hypervisor=hypervisor.lower(), randomize_name=False) + template.download(apiclient) + return template + + for template in templates: + if template.isready and template.ispublic: + return template + + return FAILED + def get_windows_template( apiclient, zone_id=None, ostype_desc=None, template_filter="featured", template_type='USER', diff --git a/ui/l10n/en.js b/ui/l10n/en.js index 57700de..2587562 100644 --- a/ui/l10n/en.js +++ b/ui/l10n/en.js @@ -556,7 +556,6 @@ var dictionary = {"ICMP.code":"ICMP Code", "label.console.proxy.vm":"Console Proxy VM", "label.continue":"Continue", "label.continue.basic.install":"Continue with basic installation", -"label.control.ip":"Control IP", "label.copying.iso":"Copying ISO", "label.corrections.saved":"Corrections saved", "label.counter":"Counter", diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 70837fa..d8a5f92 100755 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -10895,8 +10895,8 @@ return args; } }, - controlip: { - label: 'label.control.ip' + publicip: { + label: 'label.public.ip' }, hostname: { label: 'label.host' diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js index 1564a2b..c518859 100644 --- a/ui/scripts/ui/dialog.js +++ b/ui/scripts/ui/dialog.js @@ -897,7 +897,7 @@ $listView.dialog({ dialogClass: 'multi-edit-add-list panel', - width: 825, + width: 900, title: _l('Select VM'), buttons: [{ text: _l('label.apply'), diff --git a/ui/scripts/ui/widgets/multiEdit.js b/ui/scripts/ui/widgets/multiEdit.js index 48d597e..677448a 100755 --- a/ui/scripts/ui/widgets/multiEdit.js +++ b/ui/scripts/ui/widgets/multiEdit.js @@ -579,7 +579,7 @@ var $dataList = $listView.addClass('multi-edit-add-list').dialog({ dialogClass: 'multi-edit-add-list panel', - width: 825, + width: 900, title: label, buttons: [{ text: _l('label.apply'), -- To stop receiving notification emails like this one, please contact "commits@cloudstack.apache.org" <commits@cloudstack.apache.org>.