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.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2017-12-09 16:37:31 +05:30
parent 85aee8d18d
commit facc5945f0
76 changed files with 442 additions and 724 deletions

View File

@ -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

View File

@ -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())){

View File

@ -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;

View File

@ -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 {

View File

@ -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";

View File

@ -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) {

View File

@ -1,3 +1,3 @@
__?.o/ Apache CloudStack SystemVM 4.11
__?.o/ Apache CloudStack SystemVM
( )# https://cloudstack.apache.org
(___(_) \s \r \n \l

View File

@ -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"

View File

@ -11,4 +11,4 @@ WantedBy=multi-user.target
Type=oneshot
ExecStart=/opt/cloud/bin/setup/postinit.sh
RemainAfterExit=true
TimeoutStartSec=1min
TimeoutStartSec=10min

View File

@ -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):

View File

@ -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"):

View File

@ -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;

View File

@ -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

View File

@ -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
;;

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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 ]

View File

@ -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"

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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 &

View File

@ -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

View File

@ -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

View File

@ -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.hypervisor = cls.testClient.getHypervisorInfo()
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.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)

View File

@ -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.hypervisor = cls.testClient.getHypervisorInfo()
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.services["virtual_machine"]["zoneid"] = cls.zone.id

View File

@ -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

View File

@ -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):

View File

@ -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

View File

@ -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)

View File

@ -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()

View File

@ -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 nose.plugins.attrib import attr
@ -219,44 +219,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",
}
}
}
@ -291,12 +253,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,
@ -846,9 +810,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)

View File

@ -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,13 +62,13 @@ 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

View File

@ -40,13 +40,13 @@ 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

View File

@ -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 = []

View File

@ -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(

View File

@ -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,12 +58,11 @@ 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,
@ -71,7 +71,7 @@ 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)

View File

@ -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(

View File

@ -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,\

View File

@ -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

View File

@ -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

View File

@ -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'

View File

@ -167,11 +167,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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.")

View File

@ -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

View File

@ -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

View File

@ -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,10 +368,11 @@ 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

View File

@ -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
@ -137,16 +86,11 @@ class TestRedundantIsolateNetworks(cloudstackTestCase):
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
macchinina = Templates().templates["macchinina"]
cls.hypervisor = cls.testClient.getHypervisorInfo()
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
@ -185,8 +129,7 @@ class TestRedundantIsolateNetworks(cloudstackTestCase):
cls._cleanup = [
cls.service_offering,
cls.account,
cls.template
cls.account
]
return
@ -712,11 +655,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

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -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)

View File

@ -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
}
@ -255,12 +213,10 @@ class TestVPCRedundancy(cloudstackTestCase):
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.hypervisor = cls.testClient.getHypervisorInfo()
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
@ -268,7 +224,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()

View File

@ -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):

View File

@ -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,
@ -437,9 +390,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)
@ -471,14 +421,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,
@ -814,9 +759,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)
@ -848,14 +790,9 @@ class TestRVPCSite2SiteVpn(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,
@ -1194,9 +1131,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)
@ -1228,14 +1162,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,
@ -1642,9 +1571,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)

View File

@ -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"
}

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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 => [

View File

@ -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() {

View File

@ -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 \

View File

@ -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{ } \
.

View File

@ -956,8 +956,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",

View File

@ -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

View File

@ -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',

View File

@ -558,7 +558,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",

View File

@ -10993,8 +10993,8 @@
return args;
}
},
controlip: {
label: 'label.control.ip'
publicip: {
label: 'label.public.ip'
},
hostname: {
label: 'label.host'

View File

@ -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'),

View File

@ -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'),