Skip to content
Closed
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
51 changes: 32 additions & 19 deletions test/integration/component/test_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.cloudstackTestCase import cloudstackTestCase

from marvin.lib.base import (Snapshot,
Template,
Expand Down Expand Up @@ -167,9 +167,12 @@ def setUpClass(cls):
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.hypervisor = cls.testClient.getHypervisorInfo()
if cls.hypervisor.lower() in ['lxc']:
raise unittest.SkipTest("snapshots are not supported on %s" % cls.hypervisor.lower())
cls._cleanup = []
cls.unsupportedHypervisor = False
cls.hypervisor = get_hypervisor_type(cls.api_client)
if cls.hypervisor.lower() in ['hyperv', 'lxc']:
cls.unsupportedHypervisor = True
return
cls.disk_offering = DiskOffering.create(
cls.api_client,
cls.services["disk_offering"]
Expand All @@ -196,9 +199,6 @@ def setUpClass(cls):
cls.services["service_offering"]
)

# Get Hypervisor Type
cls.hypervisor = (get_hypervisor_type(cls.api_client)).lower()

cls._cleanup = [
cls.service_offering,
cls.disk_offering
Expand All @@ -216,15 +216,21 @@ def tearDownClass(cls):

def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.hypervisor = str(self.testClient.getHypervisorInfo()).lower()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []

if self.unsupportedHypervisor:
self.skipTest("Skipping test because unsupported hypervisor: %s" %
self.hypervisor)


# Create VMs, NAT Rules etc
self.account = Account.create(
self.apiclient,
self.services["account"],
domainid=self.domain.id
)
self.cleanup.append(self.account)

self.virtual_machine = self.virtual_machine_with_disk = \
VirtualMachine.create(
Expand All @@ -236,7 +242,6 @@ def setUp(self):
serviceofferingid=self.service_offering.id,
mode=self.services["mode"]
)
self.cleanup = [self.account, ]
return

def tearDown(self):
Expand Down Expand Up @@ -966,15 +971,17 @@ def setUpClass(cls):
TestCreateVMSnapshotTemplate,
cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.hypervisor = cls.testClient.getHypervisorInfo()
cls._cleanup = []
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.hypervisor = cls.testClient.getHypervisorInfo()
if cls.hypervisor.lower() in ['lxc']:
raise unittest.SkipTest("snapshots are not supported on %s" % cls.hypervisor.lower())
cls.unsupportedHypervisor = False
cls.hypervisor = get_hypervisor_type(cls.api_client)
if cls.hypervisor.lower() in ['hyperv', 'lxc']:
cls.unsupportedHypervisor = True
return

cls.template = get_template(
cls.api_client,
Expand Down Expand Up @@ -1012,9 +1019,11 @@ def tearDownClass(cls):

def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.hypervisor = str(self.testClient.getHypervisorInfo()).lower()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []

if self.unsupportedHypervisor:
self.skipTest("snapshots are not supported on %s" % self.hypervisor.lower())
return

def tearDown(self):
Expand Down Expand Up @@ -1183,15 +1192,17 @@ class TestSnapshotEvents(cloudstackTestCase):
def setUpClass(cls):
cls.testClient = super(TestSnapshotEvents, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.services = Services().services
cls._cleanup = []
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.hypervisor = cls.testClient.getHypervisorInfo()
if cls.hypervisor.lower() in ['lxc']:
raise unittest.SkipTest("snapshots are not supported on %s" % cls.hypervisor.lower())
cls.unsupportedHypervisor = False
cls.hypervisor = get_hypervisor_type(cls.api_client)
if cls.hypervisor.lower() in ['hyperv', 'lxc']:
cls.unsupportedHypervisor = True
return

template = get_template(
cls.api_client,
Expand Down Expand Up @@ -1241,9 +1252,11 @@ def tearDownClass(cls):

def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.hypervisor = str(self.testClient.getHypervisorInfo()).lower()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []

if self.unsupportedHypervisor:
self.skipTest("snapshots are not supported on %s" % self.hypervisor)
return

def tearDown(self):
Expand Down
29 changes: 21 additions & 8 deletions test/integration/component/test_snapshots_improvement.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.utils import (random_gen,
is_snapshot_on_nfs,
cleanup_resources)
Expand Down Expand Up @@ -128,14 +128,17 @@ class TestSnapshotOnRootVolume(cloudstackTestCase):
def setUpClass(cls):
cls.testClient = super(TestSnapshotOnRootVolume, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls._cleanup = []

cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.unsupportedHypervisor = False
cls.hypervisor = cls.testClient.getHypervisorInfo()
if cls.hypervisor.lower() in ['lxc']:
raise unittest.SkipTest("snapshots are not supported on %s" % cls.hypervisor.lower())
if cls.hypervisor.lower() in ['hyperv', 'lxc']:
cls.unsupportedHypervisor = True
return
cls.template = get_template(
cls.api_client,
cls.zone.id,
Expand Down Expand Up @@ -177,6 +180,10 @@ def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []

if self.unsupportedHypervisor:
self.skipTest("snapshots are not supported on %s" %
self.hypervisor)
return

def tearDown(self):
Expand Down Expand Up @@ -305,9 +312,12 @@ class TestCreateSnapshot(cloudstackTestCase):
def setUpClass(cls):
cls.testClient = super(TestCreateSnapshot, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls._cleanup = []
cls.unsupportedHypervisor = False
cls.hypervisor = cls.testClient.getHypervisorInfo()
if cls.hypervisor.lower() in ['hyperv', 'lxc']:
raise unittest.SkipTest("Snapshots feature is not supported on %s" % cls.hypervisor.lower())
cls.unsupportedHypervisor = True
return
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
Expand All @@ -326,9 +336,7 @@ def setUpClass(cls):
cls.api_client,
cls.services["service_offering"]
)
cls._cleanup = [
cls.service_offering,
]
cls._cleanup.append(cls.service_offering)
return

@classmethod
Expand All @@ -343,17 +351,22 @@ def tearDownClass(cls):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []

if self.unsupportedHypervisor:
self.skipTest("Snapshots are not supported on %s"
% self.hypervisor)

self.account = Account.create(
self.apiclient,
self.services["account"],
domainid=self.domain.id
)
self.cleanup.append(self.account)

self.apiclient = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
self.cleanup = [self.account, ]
return

def tearDown(self):
Expand Down