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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,15 @@ private boolean canBypassSecondaryStorage(DataObject srcData, DataObject destDat
return true;
}

if (Hypervisor.HypervisorType.XenServer.equals(((VolumeInfo) srcData).getHypervisorType())) {
return false;
}
Comment thread
weizhouapache marked this conversation as resolved.

if (destData instanceof VolumeInfo) {
if (Hypervisor.HypervisorType.XenServer.equals(((VolumeInfo) destData).getHypervisorType())) {
return false;
}

Scope srcDataStoreScope = srcData.getDataStore().getScope();
Scope destDataStoreScope = destData.getDataStore().getScope();
logger.info("srcDataStoreScope: {}, srcData pool type: {}; destDataStoreScope: {}, destData pool type: {}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public void testCanBypassSecondaryStorageForDirectDownload() throws NoSuchMethod
@Test
public void testCanBypassSecondaryStorageForUnsupportedDataObject() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
VolumeObject srcVolumeInfo = Mockito.spy(new VolumeObject());
Mockito.doReturn(HypervisorType.KVM).when(srcVolumeInfo).getHypervisorType();

TemplateObject destTemplateInfo = Mockito.spy(new TemplateObject());

Expand All @@ -156,12 +157,14 @@ public void testCanBypassSecondaryStorageForUnsupportedDataObject() throws NoSuc
@Test
public void testCanBypassSecondaryStorageForUnsupportedSrcPoolType() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
VolumeObject srcVolumeInfo = Mockito.spy(new VolumeObject());
Mockito.doReturn(HypervisorType.KVM).when(srcVolumeInfo).getHypervisorType();
DataStore srcDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ZoneScope(1L)).when(srcDataStore).getScope();
Mockito.doReturn(srcDataStore).when(srcVolumeInfo).getDataStore();
Mockito.doReturn(Storage.StoragePoolType.PowerFlex).when(srcVolumeInfo).getStoragePoolType();

VolumeObject destVolumeInfo = Mockito.spy(new VolumeObject());
Mockito.doReturn(HypervisorType.KVM).when(destVolumeInfo).getHypervisorType();
DataStore destDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ZoneScope(1L)).when(destDataStore).getScope();
Mockito.doReturn(destDataStore).when(destVolumeInfo).getDataStore();
Expand All @@ -177,12 +180,14 @@ public void testCanBypassSecondaryStorageForUnsupportedSrcPoolType() throws NoSu
@Test
public void testCanBypassSecondaryStorageForUnsupportedDestPoolType() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
VolumeObject srcVolumeInfo = Mockito.spy(new VolumeObject());
Mockito.doReturn(HypervisorType.KVM).when(srcVolumeInfo).getHypervisorType();
DataStore srcDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ZoneScope(1L)).when(srcDataStore).getScope();
Mockito.doReturn(srcDataStore).when(srcVolumeInfo).getDataStore();
Mockito.doReturn(Storage.StoragePoolType.NetworkFilesystem).when(srcVolumeInfo).getStoragePoolType();

VolumeObject destVolumeInfo = Mockito.spy(new VolumeObject());
Mockito.doReturn(HypervisorType.KVM).when(destVolumeInfo).getHypervisorType();
DataStore destDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ZoneScope(1L)).when(destDataStore).getScope();
Mockito.doReturn(destDataStore).when(destVolumeInfo).getDataStore();
Expand All @@ -198,12 +203,14 @@ public void testCanBypassSecondaryStorageForUnsupportedDestPoolType() throws NoS
@Test
public void testCanBypassSecondaryStorageWithZoneWideNFSPoolsInSameZone() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
VolumeObject srcVolumeInfo = Mockito.spy(new VolumeObject());
Mockito.doReturn(HypervisorType.KVM).when(srcVolumeInfo).getHypervisorType();
DataStore srcDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ZoneScope(1L)).when(srcDataStore).getScope();
Mockito.doReturn(srcDataStore).when(srcVolumeInfo).getDataStore();
Mockito.doReturn(Storage.StoragePoolType.NetworkFilesystem).when(srcVolumeInfo).getStoragePoolType();

VolumeObject destVolumeInfo = Mockito.spy(new VolumeObject());
Mockito.doReturn(HypervisorType.KVM).when(destVolumeInfo).getHypervisorType();
DataStore destDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ZoneScope(1L)).when(destDataStore).getScope();
Mockito.doReturn(destDataStore).when(destVolumeInfo).getDataStore();
Expand All @@ -219,12 +226,14 @@ public void testCanBypassSecondaryStorageWithZoneWideNFSPoolsInSameZone() throws
@Test
public void testCanBypassSecondaryStorageWithClusterWideNFSPoolsInSameCluster() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
VolumeObject srcVolumeInfo = Mockito.spy(new VolumeObject());
Mockito.doReturn(HypervisorType.KVM).when(srcVolumeInfo).getHypervisorType();
DataStore srcDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ClusterScope(5L, 2L, 1L)).when(srcDataStore).getScope();
Mockito.doReturn(srcDataStore).when(srcVolumeInfo).getDataStore();
Mockito.doReturn(Storage.StoragePoolType.NetworkFilesystem).when(srcVolumeInfo).getStoragePoolType();

VolumeObject destVolumeInfo = Mockito.spy(new VolumeObject());
Mockito.doReturn(HypervisorType.KVM).when(destVolumeInfo).getHypervisorType();
DataStore destDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ClusterScope(5L, 2L, 1L)).when(destDataStore).getScope();
Mockito.doReturn(destDataStore).when(destVolumeInfo).getDataStore();
Expand All @@ -240,12 +249,14 @@ public void testCanBypassSecondaryStorageWithClusterWideNFSPoolsInSameCluster()
@Test
public void testCanBypassSecondaryStorageWithLocalAndClusterWideNFSPoolsInSameCluster() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
VolumeObject srcVolumeInfo = Mockito.spy(new VolumeObject());
Mockito.doReturn(HypervisorType.KVM).when(srcVolumeInfo).getHypervisorType();
DataStore srcDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new HostScope(1L, 1L, 1L)).when(srcDataStore).getScope();
Mockito.doReturn(srcDataStore).when(srcVolumeInfo).getDataStore();
Mockito.doReturn(Storage.StoragePoolType.Filesystem).when(srcVolumeInfo).getStoragePoolType();

VolumeObject destVolumeInfo = Mockito.spy(new VolumeObject());
Mockito.doReturn(HypervisorType.KVM).when(destVolumeInfo).getHypervisorType();
DataStore destDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ClusterScope(1L, 1L, 1L)).when(destDataStore).getScope();
Mockito.doReturn(destDataStore).when(destVolumeInfo).getDataStore();
Expand All @@ -264,12 +275,14 @@ public void testCanBypassSecondaryStorageWithLocalAndClusterWideNFSPoolsInSameCl
@Test
public void testCanBypassSecondaryStorageWithLocalAndZoneWideNFSPoolsInSameZone() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
VolumeObject srcVolumeInfo = Mockito.spy(new VolumeObject());
Mockito.doReturn(HypervisorType.KVM).when(srcVolumeInfo).getHypervisorType();
DataStore srcDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new HostScope(1L, 1L, 1L)).when(srcDataStore).getScope();
Mockito.doReturn(srcDataStore).when(srcVolumeInfo).getDataStore();
Mockito.doReturn(Storage.StoragePoolType.Filesystem).when(srcVolumeInfo).getStoragePoolType();

VolumeObject destVolumeInfo = Mockito.spy(new VolumeObject());
Mockito.doReturn(HypervisorType.KVM).when(destVolumeInfo).getHypervisorType();
DataStore destDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ZoneScope(1L)).when(destDataStore).getScope();
Mockito.doReturn(destDataStore).when(destVolumeInfo).getDataStore();
Expand All @@ -288,12 +301,14 @@ public void testCanBypassSecondaryStorageWithLocalAndZoneWideNFSPoolsInSameZone(
@Test
public void testCanBypassSecondaryStorageWithClusterWideNFSAndZoneWideNFSPoolsInSameZone() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
VolumeObject srcVolumeInfo = Mockito.spy(new VolumeObject());
Mockito.doReturn(HypervisorType.KVM).when(srcVolumeInfo).getHypervisorType();
DataStore srcDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ClusterScope(5L, 2L, 1L)).when(srcDataStore).getScope();
Mockito.doReturn(srcDataStore).when(srcVolumeInfo).getDataStore();
Mockito.doReturn(Storage.StoragePoolType.NetworkFilesystem).when(srcVolumeInfo).getStoragePoolType();

VolumeObject destVolumeInfo = Mockito.spy(new VolumeObject());
Mockito.doReturn(HypervisorType.KVM).when(destVolumeInfo).getHypervisorType();
DataStore destDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ZoneScope(1L)).when(destDataStore).getScope();
Mockito.doReturn(destDataStore).when(destVolumeInfo).getDataStore();
Expand Down
1 change: 1 addition & 0 deletions test/integration/smoke/test_events_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def test_01_events_resource(self):
diskofferingid=self.disk_offering.id
)
self.cleanup.append(volume)
time.sleep(10)
virtual_machine.attach_volume(
self.apiclient,
volume
Expand Down
4 changes: 4 additions & 0 deletions test/integration/smoke/test_host_maintenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
from distutils.util import strtobool
from marvin.sshClient import SshClient

import time

_multiprocess_shared_ = False
MIN_VMS_FOR_TEST = 3

Expand Down Expand Up @@ -349,6 +351,7 @@ def test_02_cancel_host_maintenace_with_migration_jobs(self):
if (no_vm_req > 0):
self.logger.debug("Creating vms = {}".format(no_vm_req))
self.vmlist = self.createVMs(listHost[0].id, no_vm_req)
time.sleep(10)

try:
migrations_finished = self.hostPrepareAndCancelMaintenance(listHost[0].id, listHost[1].id)
Expand Down Expand Up @@ -413,6 +416,7 @@ def test_03_cancel_host_maintenace_with_migration_jobs_failure(self):
if (no_vm_req > 0):
self.logger.debug("Creating vms = {}".format(no_vm_req))
self.vmlist = self.createVMs(listHost[0].id, no_vm_req, "taggedsmall")
time.sleep(10)

# Attempt putting host in maintenance and check if ErrorInMaintenance state is reached
self.prepare_host_for_maintenance(target_host_id)
Expand Down
5 changes: 5 additions & 0 deletions test/integration/smoke/test_kms_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def setUpClass(cls):
cls.apiclient = cls.test_client.getApiClient()
cls.zone = get_zone(cls.apiclient, cls.test_client.getZoneForTests())
cls.domain = get_domain(cls.apiclient)
cls.hypervisor = cls.test_client.getHypervisorInfo()

cls._cleanup = []

Expand Down Expand Up @@ -424,6 +425,10 @@ def test_12_deploy_vm_with_root_disk_encryption(self):
Test: deploy a VM with its root disk encrypted using a KMS key.
Verify that the VM starts and the root volume has the KMS key ID.
"""

if self.hypervisor.lower() != 'kvm':
raise self.skipTest("Skipping test case for non-kvm hypervisor")

# 1. Create a KMS key for the user
key = self._create_kms_key(name=_random_name("vm-root-key"), profile_id=self.default_profile.id, apiclient=self.user_apiclient)

Expand Down
4 changes: 3 additions & 1 deletion test/integration/smoke/test_network_extension_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,8 @@ def _check_kvm_host_prerequisites(self, tools=None):
excluded from the check — the connectivity failure will surface
naturally when the test later tries to deploy scripts.
"""
if self.hv.lower() != 'kvm':
raise self.skipTest("Skipping test case for non-kvm hypervisor")
if tools is None:
tools = ['arping', 'dnsmasq', 'haproxy']
if not self.kvm_host_configs:
Expand Down Expand Up @@ -2387,7 +2389,7 @@ def _mk_action(name, parameters = []):
@attr(tags=["advanced", "smoke"], required_hardware="true")
def test_09_vpc_source_nat_ip_update(self):
"""Update VPC source NAT IP and verify old/new source NAT flags flip correctly."""
self._check_kvm_host_prerequisites(['arping'])
self._check_kvm_host_prerequisites(['ip', 'arping', 'dnsmasq', 'haproxy'])

svc = VPC_NETWORK_SERVICES
_nw_offering, ext_name = self._setup_extension_nsp_offering(
Expand Down
7 changes: 6 additions & 1 deletion test/integration/smoke/test_nonstrict_affinity_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"""

import logging
import time

from marvin.codes import FAILED
from nose.plugins.attrib import attr
Expand All @@ -38,7 +39,6 @@

from marvin.lib.common import (get_domain,
get_zone,
get_template,
get_test_template)


Expand Down Expand Up @@ -209,6 +209,9 @@ def test_01_non_strict_host_anti_affinity(self):
vm_2_host_id,
msg="Both VMs of affinity group %s are on the same host" % self.affinity_group.name)


time.sleep(10)

# 4. Migrate vm-2 to same host as vm-1
self.virtual_machine_2.migrate(
self.apiclient,
Expand Down Expand Up @@ -362,6 +365,8 @@ def test_02_non_strict_host_affinity(self):
vm_12_host_id,
msg="Both VMs of affinity group %s are on the different host" % self.affinity_group.name)

time.sleep(10)

# 4. Migrate vm-12 to different host as vm-11
self.virtual_machine_12.migrate(
self.apiclient
Expand Down
11 changes: 3 additions & 8 deletions test/integration/smoke/test_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
list_storage_pools,
find_storage_pool_type)

import time


class Services:
Expand Down Expand Up @@ -782,6 +783,7 @@ def test_01_volume_usage(self):
)
rool_volume_pool = rool_volume_pool_response[0]
try:
time.sleep(10)
self.virtual_machine.attach_volume(self.apiclient,volume_uploaded)
except Exception as e:
self.debug("Exception %s: " % e)
Expand Down Expand Up @@ -1744,16 +1746,9 @@ def setUpClass(cls):
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id
)
cls.public_ip = PublicIPAddress.create(
cls.api_client,
accountid=cls.virtual_machine.account,
zoneid=cls.virtual_machine.zoneid,
domainid=cls.virtual_machine.domainid,
services=cls.services["server"]
)
src_nat_list = PublicIPAddress.list(
cls.api_client,
accountid=cls.virtual_machine.account,
account=cls.virtual_machine.account,
zoneid=cls.virtual_machine.zoneid,
domainid=cls.virtual_machine.domainid,
issourcenat=True
Expand Down
1 change: 1 addition & 0 deletions test/integration/smoke/test_vm_life_cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,7 @@ def test_11_destroy_vm_and_volumes(self):
zoneid=self.zone.id
)

time.sleep(10)
small_virtual_machine.attach_volume(self.apiclient, vol1)

self.debug("Destroy VM - ID: %s" % small_virtual_machine.id)
Expand Down
4 changes: 4 additions & 0 deletions test/integration/smoke/test_vm_strict_host_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from marvin.lib.common import (get_domain, get_zone)
from nose.plugins.attrib import attr

import time

class TestVMDeploymentPlannerStrictTags(cloudstackTestCase):

Expand Down Expand Up @@ -529,6 +530,8 @@ def test_01_migrate_vm_strict_tags_success(self):
self.cleanup.append(vm)
self.assertEqual(self.host_h1.id, vm.hostid, "VM instance was not deployed on target host ID")
Host.update(self.apiclient, id=self.host_h2.id, hosttags="h1,t1,v1")

time.sleep(10) # Wait for VM to boot into OS before migrating the VM
vm.migrate(self.apiclient, self.host_h2.id)
migrated_vm = VirtualMachine.list(self.apiclient, id=vm.id, listall=True)[0]
self.assertEqual(migrated_vm.hostid, self.host_h2.id, "VM was not migratd")
Expand All @@ -545,6 +548,7 @@ def test_02_migrate_vm_strict_tags_failure(self):
self.assertEqual(self.host_h1.id, vm.hostid, "VM instance was not deployed on target host ID")
Host.update(self.apiclient, id=self.host_h2.id, hosttags="h2,t2,v2")
try:
time.sleep(10) # Wait for VM to boot into OS before migrating the VM
vm.migrate(self.apiclient, self.host_h2.id)
VirtualMachine.list(self.apiclient, id=vm.id, listall=True)[0]
self.fail("VM should not be migrated")
Expand Down
Loading