You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by pritisarap12 <gi...@git.apache.org> on 2015/08/07 14:02:45 UTC

[GitHub] cloudstack pull request: CLOUDSTACK-8716: Verify creation of snaps...

GitHub user pritisarap12 opened a pull request:

    https://github.com/apache/cloudstack/pull/665

    CLOUDSTACK-8716: Verify creation of snapshot from volume when the task is performed repeatedly in zone wide primary Storage

    On VMWare with a Zone wide primary storage and more than two clusters verify successful creation of snapshot multiple times.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/pritisarap12/cloudstack CLOUDSTACK-8716-Verify-creation-of-snapshot-from-volume-when-the-task-is-performed-repeatedly-in-zone-wide-primary-Storage

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cloudstack/pull/665.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #665
    
----
commit 44ba3a652e3c13c79f65aafd3e68c4b72e1dc134
Author: Priti Sarap <pr...@clogeny.com>
Date:   2015-08-07T11:48:42Z

    CLOUDSTACK-8716: Verify creation of snapshot from volume when the task is performed repeatedly in zone wide primary Storage

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8716: Verify creation of snaps...

Posted by nitt10prashant <gi...@git.apache.org>.
Github user nitt10prashant commented on the pull request:

    https://github.com/apache/cloudstack/pull/665#issuecomment-132583048
  
    LGTM


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8716: Verify creation of snaps...

Posted by remibergsma <gi...@git.apache.org>.
Github user remibergsma commented on the pull request:

    https://github.com/apache/cloudstack/pull/665#issuecomment-131213094
  
    @pritisarap12 Please squash the commits, they have the same titles which is confusing. If you need multiple commits, make sure they have a descriptive first line. Thanks!



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8716: Verify creation of snaps...

Posted by sanju1010 <gi...@git.apache.org>.
Github user sanju1010 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/665#discussion_r36601462
  
    --- Diff: test/integration/testpaths/testpath_multiple_snapshot.py ---
    @@ -0,0 +1,255 @@
    +# 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.
    +
    +""" Test case for Multiple Volume Snapshot in ZWPS
    +"""
    +from nose.plugins.attrib import attr
    +from marvin.cloudstackTestCase import cloudstackTestCase
    +from marvin.lib.utils import (cleanup_resources,
    +                              validateList)
    +from marvin.lib.base import (Account,
    +                             ServiceOffering,
    +                             DiskOffering,
    +                             Snapshot,
    +                             VirtualMachine,
    +                             StoragePool
    +                             )
    +from marvin.lib.common import (get_domain,
    +                               get_zone,
    +                               list_volumes,
    +                               list_clusters,
    +                               get_template
    +                               )
    +
    +from marvin.codes import PASS, ZONETAG1, ROOT, DATA
    +
    +
    +class TestMultipleVolumeSnapshots(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +        testClient = super(TestMultipleVolumeSnapshots, cls).getClsTestClient()
    +        cls.apiclient = testClient.getApiClient()
    +        cls.testdata = testClient.getParsedTestDataConfig()
    +
    +        # Get Zone, Domain and templates
    +        cls.domain = get_domain(cls.apiclient)
    +        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
    +        cls.hypervisor = cls.testClient.getHypervisorInfo()
    +        cls.template = get_template(
    +            cls.apiclient,
    +            cls.zone.id,
    +            cls.testdata["ostype"])
    +
    +        cls._cleanup = []
    +
    +        cls.skiptest = False
    +
    +        clus_list = list_clusters(cls.apiclient)
    +
    +        if cls.hypervisor.lower() not in ['vmware'] or len(clus_list) < 2:
    +            cls.skiptest = True
    +            return
    +
    +        try:
    +            # Create an account
    +            cls.account = Account.create(
    +                cls.apiclient,
    +                cls.testdata["account"],
    +                domainid=cls.domain.id
    +            )
    +
    +            # Create user api client of the account
    +            cls.userapiclient = testClient.getUserApiClient(
    +                UserName=cls.account.name,
    +                DomainName=cls.account.domain
    +            )
    +            # Create Service offering
    +            cls.service_offering_zwps = ServiceOffering.create(
    +                cls.apiclient,
    +                cls.testdata["service_offering"],
    +                tags=ZONETAG1
    +            )
    +
    +            cls.disk_offering_zwps = DiskOffering.create(
    +                cls.apiclient,
    +                cls.testdata["disk_offering"],
    +                tags=ZONETAG1
    +            )
    +
    +            cls._cleanup = [
    +                cls.account,
    +                cls.service_offering_zwps,
    +                cls.disk_offering_zwps,
    +            ]
    +        except Exception as e:
    +            cls.tearDownClass()
    +            raise e
    +        return
    +
    +    @classmethod
    +    def tearDownClass(cls):
    +        try:
    +            cleanup_resources(cls.apiclient, cls._cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +
    +    def setUp(self):
    +
    +        self.cleanup = []
    +        if self.skiptest:
    +            self.skipTest("Skip test as setup is either not VMWare or  \
    +                    having less than 2 clusters %s" % self.hypervisor)
    +
    +        self.apiclient = self.testClient.getApiClient()
    +        self.dbclient = self.testClient.getDbConnection()
    +        self.pools = []
    +
    +    def tearDown(self):
    +        try:
    +            for storagePool in self.pools:
    +                StoragePool.update(self.apiclient, id=storagePool.id, tags="")
    +
    +            cleanup_resources(self.apiclient, self.cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    @attr(tags=["advanced", "basic"], required_hardware="true")
    +    def test_01_multiple_snapshot_in_zwps(self):
    +        """ Test multiple volume snapshot in zwps
    +
    +        # 1. Verify if setup has a ZWPS and 2 CWPS
    +        # 2. Deploy a VM with data disk in ZWPS
    +        # 1. Verify ROOT and DATA Disk of the VM is in ZWPS.
    +        # 2. Take a snapshot of VM.
    +        # 3. Create Multiple Snapshots till operation fails.
    +        """
    +        try:
    +            if (self.clus_list) < 2:
    +                self.skipTest(
    +                    "There must be at least two clusters in the setup")
    +
    +            self.pools = StoragePool.list(self.apiclient, zoneid=self.zone.id)
    +            if len(list(storagePool for storagePool in self.pools
    +                        if storagePool.scope == "ZONE")) < 1:
    +                self.skipTest("There must be at least one zone wide\
    +                storage pools available in the setup")
    +
    +            if len(list(storagePool for storagePool in self.pools
    +                        if storagePool.scope == "CLUSTER")) < 2:
    +                self.skipTest("There must be at atleast two cluster wide\
    +                storage pools available in the setup")
    +        except Exception as e:
    +            self.skipTest(e)
    +
    +        # Adding tags to Storage Pools
    +        zone_no = 1
    +        self.debug("Storage Pools: %s" % self.pools)
    +        self.zone_pool = []
    +        for storagePool in self.pools:
    +            if storagePool.scope == "ZONE":
    +                StoragePool.update(
    +                    self.apiclient,
    +                    id=storagePool.id,
    +                    tags=[ZONETAG1[:-1] + repr(zone_no)])
    +                self.zone_pool.append(storagePool)
    +                zone_no += 1
    +
    +        self.vm_zwps = VirtualMachine.create(
    +            self.apiclient,
    +            self.testdata["small"],
    +            templateid=self.template.id,
    +            accountid=self.account.name,
    +            domainid=self.account.domainid,
    +            serviceofferingid=self.service_offering_zwps.id,
    +            diskofferingid=self.disk_offering_zwps.id,
    +            zoneid=self.zone.id,
    +        )
    +
    +        self.cleanup.append(self.vm_zwps)
    +
    +        # Step 1
    +        volumes_root_list = list_volumes(
    +            self.apiclient,
    +            virtualmachineid=self.vm_zwps.id,
    +            type=ROOT,
    +            listall=True
    +        )
    +
    +        root_volume = volumes_root_list[0]
    +
    +        if root_volume.storage != self.zone_pool[0].name:
    +            self.skipTest("Root Volume not in Zone-Wide Storage Pool !")
    --- End diff --
    
    When we are creating vm with zone wide primary storage(service offering used has zone wide primary storage tag) root volume should be created in zwps as per the tagging. So instead of skipping the test, fail the test if the root volume is not in zwps.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8716: Verify creation of snaps...

Posted by nitt10prashant <gi...@git.apache.org>.
Github user nitt10prashant commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/665#discussion_r36735392
  
    --- Diff: test/integration/testpaths/testpath_multiple_snapshot.py ---
    @@ -0,0 +1,279 @@
    +# 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.
    +
    +""" Test case for Multiple Volume Snapshot in ZWPS
    +"""
    +from nose.plugins.attrib import attr
    +from marvin.cloudstackTestCase import cloudstackTestCase
    +from marvin.lib.utils import (cleanup_resources,
    +                              validateList)
    +from marvin.lib.base import (Account,
    +                             ServiceOffering,
    +                             DiskOffering,
    +                             Snapshot,
    +                             VirtualMachine,
    +                             StoragePool
    +                             )
    +from marvin.lib.common import (get_domain,
    +                               get_zone,
    +                               list_volumes,
    +                               list_clusters,
    +                               get_template
    +                               )
    +
    +from marvin.codes import PASS, ZONETAG1, ROOT, DATA
    +
    +
    +class TestMultipleVolumeSnapshots(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +        testClient = super(TestMultipleVolumeSnapshots, cls).getClsTestClient()
    +        cls.apiclient = testClient.getApiClient()
    +        cls.testdata = testClient.getParsedTestDataConfig()
    +
    +        # Get Zone, Domain and templates
    +        cls.domain = get_domain(cls.apiclient)
    +        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
    +        cls.hypervisor = cls.testClient.getHypervisorInfo()
    +        cls.template = get_template(
    +            cls.apiclient,
    +            cls.zone.id,
    +            cls.testdata["ostype"])
    +
    +        cls._cleanup = []
    +
    +        cls.skiptest = False
    +
    +        clus_list = list_clusters(cls.apiclient)
    +
    +        if cls.hypervisor.lower() not in ['vmware'] or len(clus_list) < 2:
    +            cls.skiptest = True
    +            return
    +
    +        try:
    +            # Create an account
    +            cls.account = Account.create(
    +                cls.apiclient,
    +                cls.testdata["account"],
    +                domainid=cls.domain.id
    +            )
    +
    +            # Create user api client of the account
    +            cls.userapiclient = testClient.getUserApiClient(
    +                UserName=cls.account.name,
    +                DomainName=cls.account.domain
    +            )
    +            # Create Service offering
    +            cls.service_offering_zwps = ServiceOffering.create(
    +                cls.apiclient,
    +                cls.testdata["service_offering"],
    +                tags=ZONETAG1
    +            )
    +
    +            cls.disk_offering_zwps = DiskOffering.create(
    +                cls.apiclient,
    +                cls.testdata["disk_offering"],
    +                tags=ZONETAG1
    +            )
    +
    +            cls._cleanup = [
    +                cls.account,
    +                cls.service_offering_zwps,
    +                cls.disk_offering_zwps,
    +            ]
    +        except Exception as e:
    +            cls.tearDownClass()
    +            raise e
    +        return
    +
    +    @classmethod
    +    def tearDownClass(cls):
    +        try:
    +            cleanup_resources(cls.apiclient, cls._cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +
    +    def setUp(self):
    +
    +        self.cleanup = []
    +        if self.skiptest:
    +            self.skipTest("Skip test as setup is either not VMWare or  \
    +                    having less than 2 clusters %s" % self.hypervisor)
    +
    +        self.apiclient = self.testClient.getApiClient()
    +        self.dbclient = self.testClient.getDbConnection()
    +        self.pools = []
    +
    +    def tearDown(self):
    +        try:
    +            for storagePool in self.pools:
    +                StoragePool.update(self.apiclient, id=storagePool.id, tags="")
    +
    +            cleanup_resources(self.apiclient, self.cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    @attr(tags=["advanced", "basic"], required_hardware="true")
    +    def test_01_multiple_snapshot_in_zwps(self):
    +        """ Test multiple volume snapshot in zwps
    +
    +        # 1. Verify if setup has a ZWPS and 2 CWPS
    +        # 2. Deploy a VM with data disk in ZWPS
    +        # 1. Verify ROOT and DATA Disk of the VM is in ZWPS.
    +        # 2. Take a snapshot of VM.
    +        # 3. Create Multiple Snapshots till operation fails.
    +        """
    +        try:
    +
    +            self.pools = StoragePool.list(self.apiclient, zoneid=self.zone.id)
    +            if len(list(storagePool for storagePool in self.pools
    +                        if storagePool.scope == "ZONE")) < 1:
    +                self.skipTest("There must be at least one zone wide\
    +                storage pools available in the setup")
    +
    +            if len(list(storagePool for storagePool in self.pools
    +                        if storagePool.scope == "CLUSTER")) < 2:
    +                self.skipTest("There must be at atleast two cluster wide\
    +                storage pools available in the setup")
    +        except Exception as e:
    +            self.skipTest(e)
    +
    +        # Adding tags to Storage Pools
    +        zone_no = 1
    +        self.debug("Storage Pools: %s" % self.pools)
    +        self.zone_pool = []
    +        for storagePool in self.pools:
    --- End diff --
    
    No need to tag  all the zone wide pool , only one tagged pool is enough for this test case .
    You can just update the 1st zone wide pool .


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8716: Verify creation of snaps...

Posted by nitt10prashant <gi...@git.apache.org>.
Github user nitt10prashant commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/665#discussion_r36733882
  
    --- Diff: test/integration/testpaths/testpath_multiple_snapshot.py ---
    @@ -0,0 +1,279 @@
    +# 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.
    +
    +""" Test case for Multiple Volume Snapshot in ZWPS
    +"""
    +from nose.plugins.attrib import attr
    +from marvin.cloudstackTestCase import cloudstackTestCase
    +from marvin.lib.utils import (cleanup_resources,
    +                              validateList)
    +from marvin.lib.base import (Account,
    +                             ServiceOffering,
    +                             DiskOffering,
    +                             Snapshot,
    +                             VirtualMachine,
    +                             StoragePool
    +                             )
    +from marvin.lib.common import (get_domain,
    +                               get_zone,
    +                               list_volumes,
    +                               list_clusters,
    +                               get_template
    +                               )
    +
    +from marvin.codes import PASS, ZONETAG1, ROOT, DATA
    +
    +
    +class TestMultipleVolumeSnapshots(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +        testClient = super(TestMultipleVolumeSnapshots, cls).getClsTestClient()
    +        cls.apiclient = testClient.getApiClient()
    +        cls.testdata = testClient.getParsedTestDataConfig()
    +
    +        # Get Zone, Domain and templates
    +        cls.domain = get_domain(cls.apiclient)
    +        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
    +        cls.hypervisor = cls.testClient.getHypervisorInfo()
    +        cls.template = get_template(
    +            cls.apiclient,
    +            cls.zone.id,
    +            cls.testdata["ostype"])
    +
    +        cls._cleanup = []
    +
    +        cls.skiptest = False
    +
    +        clus_list = list_clusters(cls.apiclient)
    +
    +        if cls.hypervisor.lower() not in ['vmware'] or len(clus_list) < 2:
    +            cls.skiptest = True
    +            return
    +
    +        try:
    +            # Create an account
    +            cls.account = Account.create(
    +                cls.apiclient,
    +                cls.testdata["account"],
    +                domainid=cls.domain.id
    +            )
    +
    +            # Create user api client of the account
    +            cls.userapiclient = testClient.getUserApiClient(
    +                UserName=cls.account.name,
    +                DomainName=cls.account.domain
    +            )
    +            # Create Service offering
    +            cls.service_offering_zwps = ServiceOffering.create(
    +                cls.apiclient,
    +                cls.testdata["service_offering"],
    +                tags=ZONETAG1
    +            )
    +
    +            cls.disk_offering_zwps = DiskOffering.create(
    +                cls.apiclient,
    +                cls.testdata["disk_offering"],
    +                tags=ZONETAG1
    +            )
    +
    +            cls._cleanup = [
    +                cls.account,
    +                cls.service_offering_zwps,
    +                cls.disk_offering_zwps,
    +            ]
    +        except Exception as e:
    +            cls.tearDownClass()
    +            raise e
    +        return
    +
    +    @classmethod
    +    def tearDownClass(cls):
    +        try:
    +            cleanup_resources(cls.apiclient, cls._cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +
    +    def setUp(self):
    +
    +        self.cleanup = []
    +        if self.skiptest:
    +            self.skipTest("Skip test as setup is either not VMWare or  \
    +                    having less than 2 clusters %s" % self.hypervisor)
    +
    +        self.apiclient = self.testClient.getApiClient()
    +        self.dbclient = self.testClient.getDbConnection()
    +        self.pools = []
    +
    +    def tearDown(self):
    +        try:
    +            for storagePool in self.pools:
    +                StoragePool.update(self.apiclient, id=storagePool.id, tags="")
    +
    +            cleanup_resources(self.apiclient, self.cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    @attr(tags=["advanced", "basic"], required_hardware="true")
    +    def test_01_multiple_snapshot_in_zwps(self):
    +        """ Test multiple volume snapshot in zwps
    +
    +        # 1. Verify if setup has a ZWPS and 2 CWPS
    +        # 2. Deploy a VM with data disk in ZWPS
    +        # 1. Verify ROOT and DATA Disk of the VM is in ZWPS.
    +        # 2. Take a snapshot of VM.
    +        # 3. Create Multiple Snapshots till operation fails.
    +        """
    +        try:
    +
    +            self.pools = StoragePool.list(self.apiclient, zoneid=self.zone.id)
    --- End diff --
    
    use validate list


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8716: Verify creation of snaps...

Posted by remibergsma <gi...@git.apache.org>.
Github user remibergsma commented on the pull request:

    https://github.com/apache/cloudstack/pull/665#issuecomment-132573747
  
    @nitt10prashant Can you please review this PR again?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8716: Verify creation of snaps...

Posted by sanju1010 <gi...@git.apache.org>.
Github user sanju1010 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/665#discussion_r36601607
  
    --- Diff: test/integration/testpaths/testpath_multiple_snapshot.py ---
    @@ -0,0 +1,255 @@
    +# 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.
    +
    +""" Test case for Multiple Volume Snapshot in ZWPS
    +"""
    +from nose.plugins.attrib import attr
    +from marvin.cloudstackTestCase import cloudstackTestCase
    +from marvin.lib.utils import (cleanup_resources,
    +                              validateList)
    +from marvin.lib.base import (Account,
    +                             ServiceOffering,
    +                             DiskOffering,
    +                             Snapshot,
    +                             VirtualMachine,
    +                             StoragePool
    +                             )
    +from marvin.lib.common import (get_domain,
    +                               get_zone,
    +                               list_volumes,
    +                               list_clusters,
    +                               get_template
    +                               )
    +
    +from marvin.codes import PASS, ZONETAG1, ROOT, DATA
    +
    +
    +class TestMultipleVolumeSnapshots(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +        testClient = super(TestMultipleVolumeSnapshots, cls).getClsTestClient()
    +        cls.apiclient = testClient.getApiClient()
    +        cls.testdata = testClient.getParsedTestDataConfig()
    +
    +        # Get Zone, Domain and templates
    +        cls.domain = get_domain(cls.apiclient)
    +        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
    +        cls.hypervisor = cls.testClient.getHypervisorInfo()
    +        cls.template = get_template(
    +            cls.apiclient,
    +            cls.zone.id,
    +            cls.testdata["ostype"])
    +
    +        cls._cleanup = []
    +
    +        cls.skiptest = False
    +
    +        clus_list = list_clusters(cls.apiclient)
    +
    +        if cls.hypervisor.lower() not in ['vmware'] or len(clus_list) < 2:
    +            cls.skiptest = True
    +            return
    +
    +        try:
    +            # Create an account
    +            cls.account = Account.create(
    +                cls.apiclient,
    +                cls.testdata["account"],
    +                domainid=cls.domain.id
    +            )
    +
    +            # Create user api client of the account
    +            cls.userapiclient = testClient.getUserApiClient(
    +                UserName=cls.account.name,
    +                DomainName=cls.account.domain
    +            )
    +            # Create Service offering
    +            cls.service_offering_zwps = ServiceOffering.create(
    +                cls.apiclient,
    +                cls.testdata["service_offering"],
    +                tags=ZONETAG1
    +            )
    +
    +            cls.disk_offering_zwps = DiskOffering.create(
    +                cls.apiclient,
    +                cls.testdata["disk_offering"],
    +                tags=ZONETAG1
    +            )
    +
    +            cls._cleanup = [
    +                cls.account,
    +                cls.service_offering_zwps,
    +                cls.disk_offering_zwps,
    +            ]
    +        except Exception as e:
    +            cls.tearDownClass()
    +            raise e
    +        return
    +
    +    @classmethod
    +    def tearDownClass(cls):
    +        try:
    +            cleanup_resources(cls.apiclient, cls._cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +
    +    def setUp(self):
    +
    +        self.cleanup = []
    +        if self.skiptest:
    +            self.skipTest("Skip test as setup is either not VMWare or  \
    +                    having less than 2 clusters %s" % self.hypervisor)
    +
    +        self.apiclient = self.testClient.getApiClient()
    +        self.dbclient = self.testClient.getDbConnection()
    +        self.pools = []
    +
    +    def tearDown(self):
    +        try:
    +            for storagePool in self.pools:
    +                StoragePool.update(self.apiclient, id=storagePool.id, tags="")
    +
    +            cleanup_resources(self.apiclient, self.cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    @attr(tags=["advanced", "basic"], required_hardware="true")
    +    def test_01_multiple_snapshot_in_zwps(self):
    +        """ Test multiple volume snapshot in zwps
    +
    +        # 1. Verify if setup has a ZWPS and 2 CWPS
    +        # 2. Deploy a VM with data disk in ZWPS
    +        # 1. Verify ROOT and DATA Disk of the VM is in ZWPS.
    +        # 2. Take a snapshot of VM.
    +        # 3. Create Multiple Snapshots till operation fails.
    +        """
    +        try:
    +            if (self.clus_list) < 2:
    +                self.skipTest(
    +                    "There must be at least two clusters in the setup")
    +
    +            self.pools = StoragePool.list(self.apiclient, zoneid=self.zone.id)
    +            if len(list(storagePool for storagePool in self.pools
    +                        if storagePool.scope == "ZONE")) < 1:
    +                self.skipTest("There must be at least one zone wide\
    +                storage pools available in the setup")
    +
    +            if len(list(storagePool for storagePool in self.pools
    +                        if storagePool.scope == "CLUSTER")) < 2:
    +                self.skipTest("There must be at atleast two cluster wide\
    +                storage pools available in the setup")
    +        except Exception as e:
    +            self.skipTest(e)
    +
    +        # Adding tags to Storage Pools
    +        zone_no = 1
    +        self.debug("Storage Pools: %s" % self.pools)
    +        self.zone_pool = []
    +        for storagePool in self.pools:
    +            if storagePool.scope == "ZONE":
    +                StoragePool.update(
    +                    self.apiclient,
    +                    id=storagePool.id,
    +                    tags=[ZONETAG1[:-1] + repr(zone_no)])
    +                self.zone_pool.append(storagePool)
    +                zone_no += 1
    +
    +        self.vm_zwps = VirtualMachine.create(
    +            self.apiclient,
    +            self.testdata["small"],
    +            templateid=self.template.id,
    +            accountid=self.account.name,
    +            domainid=self.account.domainid,
    +            serviceofferingid=self.service_offering_zwps.id,
    +            diskofferingid=self.disk_offering_zwps.id,
    +            zoneid=self.zone.id,
    +        )
    +
    +        self.cleanup.append(self.vm_zwps)
    +
    +        # Step 1
    +        volumes_root_list = list_volumes(
    +            self.apiclient,
    +            virtualmachineid=self.vm_zwps.id,
    +            type=ROOT,
    +            listall=True
    +        )
    +
    +        root_volume = volumes_root_list[0]
    +
    +        if root_volume.storage != self.zone_pool[0].name:
    +            self.skipTest("Root Volume not in Zone-Wide Storage Pool !")
    +
    +        volumes_data_list = list_volumes(
    +            self.apiclient,
    +            virtualmachineid=self.vm_zwps.id,
    +            type=DATA,
    +            listall=True
    +        )
    +
    +        data_volume = volumes_data_list[0]
    +
    +        if data_volume.storage != self.zone_pool[0].name:
    +            self.skipTest("Data Volume not in Zone-Wide Storage Pool !")
    +
    +        # Step 2
    +        self.vm_zwps.stop(self.apiclient)
    +
    +        self.debug(
    +            "Creation of Snapshot of Data Volume after VM is stopped.....")
    +
    +        data_vol_snapshot = Snapshot.create(
    +            self.apiclient,
    +            data_volume.id)
    +
    +        snap_list_validation_result = validateList(data_vol_snapshot)
    +
    +        self.assertEqual(
    +            snap_list_validation_result[0],
    +            PASS,
    +            "snapshot list validation failed due to %s" %
    +            snap_list_validation_result[2])
    +
    +        snapshots_list = Snapshot.list(
    +            self.apiclient,
    +            volumeid=data_volume.id)
    --- End diff --
    
    If possible add validtaList. Same applies to other snapshot list operations.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8716: Verify creation of snaps...

Posted by bhaisaab <gi...@git.apache.org>.
Github user bhaisaab commented on the pull request:

    https://github.com/apache/cloudstack/pull/665#issuecomment-134920085
  
    LGTM


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8716: Verify creation of snaps...

Posted by pritisarap12 <gi...@git.apache.org>.
Github user pritisarap12 commented on the pull request:

    https://github.com/apache/cloudstack/pull/665#issuecomment-132555104
  
    Test result:
    
    Test multiple volume snapshot in zwps ... === TestName: test_01_multiple_snapshot_in_zwps | Status : SUCCESS ===
    ok
    
    ----------------------------------------------------------------------
    Ran 1 test in 2291.172s
    
    OK


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8716: Verify creation of snaps...

Posted by sanju1010 <gi...@git.apache.org>.
Github user sanju1010 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/665#discussion_r36601402
  
    --- Diff: test/integration/testpaths/testpath_multiple_snapshot.py ---
    @@ -0,0 +1,255 @@
    +# 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.
    +
    +""" Test case for Multiple Volume Snapshot in ZWPS
    +"""
    +from nose.plugins.attrib import attr
    +from marvin.cloudstackTestCase import cloudstackTestCase
    +from marvin.lib.utils import (cleanup_resources,
    +                              validateList)
    +from marvin.lib.base import (Account,
    +                             ServiceOffering,
    +                             DiskOffering,
    +                             Snapshot,
    +                             VirtualMachine,
    +                             StoragePool
    +                             )
    +from marvin.lib.common import (get_domain,
    +                               get_zone,
    +                               list_volumes,
    +                               list_clusters,
    +                               get_template
    +                               )
    +
    +from marvin.codes import PASS, ZONETAG1, ROOT, DATA
    +
    +
    +class TestMultipleVolumeSnapshots(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +        testClient = super(TestMultipleVolumeSnapshots, cls).getClsTestClient()
    +        cls.apiclient = testClient.getApiClient()
    +        cls.testdata = testClient.getParsedTestDataConfig()
    +
    +        # Get Zone, Domain and templates
    +        cls.domain = get_domain(cls.apiclient)
    +        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
    +        cls.hypervisor = cls.testClient.getHypervisorInfo()
    +        cls.template = get_template(
    +            cls.apiclient,
    +            cls.zone.id,
    +            cls.testdata["ostype"])
    +
    +        cls._cleanup = []
    +
    +        cls.skiptest = False
    +
    +        clus_list = list_clusters(cls.apiclient)
    +
    +        if cls.hypervisor.lower() not in ['vmware'] or len(clus_list) < 2:
    +            cls.skiptest = True
    +            return
    +
    +        try:
    +            # Create an account
    +            cls.account = Account.create(
    +                cls.apiclient,
    +                cls.testdata["account"],
    +                domainid=cls.domain.id
    +            )
    +
    +            # Create user api client of the account
    +            cls.userapiclient = testClient.getUserApiClient(
    +                UserName=cls.account.name,
    +                DomainName=cls.account.domain
    +            )
    +            # Create Service offering
    +            cls.service_offering_zwps = ServiceOffering.create(
    +                cls.apiclient,
    +                cls.testdata["service_offering"],
    +                tags=ZONETAG1
    +            )
    +
    +            cls.disk_offering_zwps = DiskOffering.create(
    +                cls.apiclient,
    +                cls.testdata["disk_offering"],
    +                tags=ZONETAG1
    +            )
    +
    +            cls._cleanup = [
    +                cls.account,
    +                cls.service_offering_zwps,
    +                cls.disk_offering_zwps,
    +            ]
    +        except Exception as e:
    +            cls.tearDownClass()
    +            raise e
    +        return
    +
    +    @classmethod
    +    def tearDownClass(cls):
    +        try:
    +            cleanup_resources(cls.apiclient, cls._cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +
    +    def setUp(self):
    +
    +        self.cleanup = []
    +        if self.skiptest:
    +            self.skipTest("Skip test as setup is either not VMWare or  \
    +                    having less than 2 clusters %s" % self.hypervisor)
    +
    +        self.apiclient = self.testClient.getApiClient()
    +        self.dbclient = self.testClient.getDbConnection()
    +        self.pools = []
    +
    +    def tearDown(self):
    +        try:
    +            for storagePool in self.pools:
    +                StoragePool.update(self.apiclient, id=storagePool.id, tags="")
    +
    +            cleanup_resources(self.apiclient, self.cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    @attr(tags=["advanced", "basic"], required_hardware="true")
    +    def test_01_multiple_snapshot_in_zwps(self):
    +        """ Test multiple volume snapshot in zwps
    +
    +        # 1. Verify if setup has a ZWPS and 2 CWPS
    +        # 2. Deploy a VM with data disk in ZWPS
    +        # 1. Verify ROOT and DATA Disk of the VM is in ZWPS.
    +        # 2. Take a snapshot of VM.
    +        # 3. Create Multiple Snapshots till operation fails.
    +        """
    +        try:
    +            if (self.clus_list) < 2:
    +                self.skipTest(
    +                    "There must be at least two clusters in the setup")
    +
    +            self.pools = StoragePool.list(self.apiclient, zoneid=self.zone.id)
    --- End diff --
    
    We are skipping the test here if the self.clus_list < 2. In that case self.pools will not have any value. However, we are referring it in teatDown method. I think test will fail in that case.
    We are already validating the no.of clusters in setUpClass method. So why do we need this here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8716: Verify creation of snaps...

Posted by pritisarap12 <gi...@git.apache.org>.
Github user pritisarap12 commented on the pull request:

    https://github.com/apache/cloudstack/pull/665#issuecomment-129314182
  
    Updated testcase:
        -Removed redundant code 
        -Added validate_list function for list snapshot operation 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8716: Verify creation of snaps...

Posted by nitt10prashant <gi...@git.apache.org>.
Github user nitt10prashant commented on the pull request:

    https://github.com/apache/cloudstack/pull/665#issuecomment-129846827
  
    can you update test results ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8716: Verify creation of snaps...

Posted by nitt10prashant <gi...@git.apache.org>.
Github user nitt10prashant commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/665#discussion_r36734361
  
    --- Diff: test/integration/testpaths/testpath_multiple_snapshot.py ---
    @@ -0,0 +1,279 @@
    +# 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.
    +
    +""" Test case for Multiple Volume Snapshot in ZWPS
    +"""
    +from nose.plugins.attrib import attr
    +from marvin.cloudstackTestCase import cloudstackTestCase
    +from marvin.lib.utils import (cleanup_resources,
    +                              validateList)
    +from marvin.lib.base import (Account,
    +                             ServiceOffering,
    +                             DiskOffering,
    +                             Snapshot,
    +                             VirtualMachine,
    +                             StoragePool
    +                             )
    +from marvin.lib.common import (get_domain,
    +                               get_zone,
    +                               list_volumes,
    +                               list_clusters,
    +                               get_template
    +                               )
    +
    +from marvin.codes import PASS, ZONETAG1, ROOT, DATA
    +
    +
    +class TestMultipleVolumeSnapshots(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +        testClient = super(TestMultipleVolumeSnapshots, cls).getClsTestClient()
    +        cls.apiclient = testClient.getApiClient()
    +        cls.testdata = testClient.getParsedTestDataConfig()
    +
    +        # Get Zone, Domain and templates
    +        cls.domain = get_domain(cls.apiclient)
    +        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
    +        cls.hypervisor = cls.testClient.getHypervisorInfo()
    +        cls.template = get_template(
    +            cls.apiclient,
    +            cls.zone.id,
    +            cls.testdata["ostype"])
    +
    +        cls._cleanup = []
    +
    +        cls.skiptest = False
    +
    +        clus_list = list_clusters(cls.apiclient)
    +
    +        if cls.hypervisor.lower() not in ['vmware'] or len(clus_list) < 2:
    +            cls.skiptest = True
    +            return
    +
    +        try:
    +            # Create an account
    +            cls.account = Account.create(
    +                cls.apiclient,
    +                cls.testdata["account"],
    +                domainid=cls.domain.id
    +            )
    +
    +            # Create user api client of the account
    +            cls.userapiclient = testClient.getUserApiClient(
    +                UserName=cls.account.name,
    +                DomainName=cls.account.domain
    +            )
    +            # Create Service offering
    +            cls.service_offering_zwps = ServiceOffering.create(
    +                cls.apiclient,
    +                cls.testdata["service_offering"],
    +                tags=ZONETAG1
    +            )
    +
    +            cls.disk_offering_zwps = DiskOffering.create(
    +                cls.apiclient,
    +                cls.testdata["disk_offering"],
    +                tags=ZONETAG1
    +            )
    +
    +            cls._cleanup = [
    +                cls.account,
    +                cls.service_offering_zwps,
    +                cls.disk_offering_zwps,
    +            ]
    +        except Exception as e:
    +            cls.tearDownClass()
    +            raise e
    +        return
    +
    +    @classmethod
    +    def tearDownClass(cls):
    +        try:
    +            cleanup_resources(cls.apiclient, cls._cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +
    +    def setUp(self):
    +
    +        self.cleanup = []
    +        if self.skiptest:
    +            self.skipTest("Skip test as setup is either not VMWare or  \
    +                    having less than 2 clusters %s" % self.hypervisor)
    +
    +        self.apiclient = self.testClient.getApiClient()
    +        self.dbclient = self.testClient.getDbConnection()
    +        self.pools = []
    +
    +    def tearDown(self):
    +        try:
    +            for storagePool in self.pools:
    +                StoragePool.update(self.apiclient, id=storagePool.id, tags="")
    +
    +            cleanup_resources(self.apiclient, self.cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    @attr(tags=["advanced", "basic"], required_hardware="true")
    +    def test_01_multiple_snapshot_in_zwps(self):
    +        """ Test multiple volume snapshot in zwps
    +
    +        # 1. Verify if setup has a ZWPS and 2 CWPS
    +        # 2. Deploy a VM with data disk in ZWPS
    +        # 1. Verify ROOT and DATA Disk of the VM is in ZWPS.
    +        # 2. Take a snapshot of VM.
    +        # 3. Create Multiple Snapshots till operation fails.
    +        """
    +        try:
    +
    +            self.pools = StoragePool.list(self.apiclient, zoneid=self.zone.id)
    +            if len(list(storagePool for storagePool in self.pools
    +                        if storagePool.scope == "ZONE")) < 1:
    +                self.skipTest("There must be at least one zone wide\
    +                storage pools available in the setup")
    +
    +            if len(list(storagePool for storagePool in self.pools
    +                        if storagePool.scope == "CLUSTER")) < 2:
    +                self.skipTest("There must be at atleast two cluster wide\
    +                storage pools available in the setup")
    +        except Exception as e:
    +            self.skipTest(e)
    +
    +        # Adding tags to Storage Pools
    +        zone_no = 1
    +        self.debug("Storage Pools: %s" % self.pools)
    +        self.zone_pool = []
    +        for storagePool in self.pools:
    +            if storagePool.scope == "ZONE":
    +                StoragePool.update(
    +                    self.apiclient,
    +                    id=storagePool.id,
    +                    tags=[ZONETAG1[:-1] + repr(zone_no)])
    +                self.zone_pool.append(storagePool)
    +                zone_no += 1
    +
    +        self.vm_zwps = VirtualMachine.create(
    +            self.apiclient,
    +            self.testdata["small"],
    +            templateid=self.template.id,
    +            accountid=self.account.name,
    +            domainid=self.account.domainid,
    +            serviceofferingid=self.service_offering_zwps.id,
    +            diskofferingid=self.disk_offering_zwps.id,
    +            zoneid=self.zone.id,
    +        )
    +
    +        self.cleanup.append(self.vm_zwps)
    +
    +        # Step 1
    +        volumes_root_list = list_volumes(
    +            self.apiclient,
    +            virtualmachineid=self.vm_zwps.id,
    +            type=ROOT,
    +            listall=True
    +        )
    +
    +        root_volume = volumes_root_list[0]
    +
    +        if root_volume.storage != self.zone_pool[0].name:
    +            self.fail("Root Volume not in Zone-Wide Storage Pool !")
    +
    +        volumes_data_list = list_volumes(
    +            self.apiclient,
    +            virtualmachineid=self.vm_zwps.id,
    +            type=DATA,
    +            listall=True
    +        )
    +
    +        data_volume = volumes_data_list[0]
    +
    +        if data_volume.storage != self.zone_pool[0].name:
    +            self.fail("Data Volume not in Zone-Wide Storage Pool !")
    +
    +        # Step 2
    +        self.vm_zwps.stop(self.apiclient)
    +
    +        self.debug(
    +            "Creation of Snapshot of Data Volume after VM is stopped.....")
    +
    +        data_vol_snapshot = Snapshot.create(
    +            self.apiclient,
    +            data_volume.id)
    +
    +        snap_validation_result = validateList(data_vol_snapshot)
    --- End diff --
    
    No need to use validate list 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8716: Verify creation of snaps...

Posted by nitt10prashant <gi...@git.apache.org>.
Github user nitt10prashant commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/665#discussion_r36734207
  
    --- Diff: test/integration/testpaths/testpath_multiple_snapshot.py ---
    @@ -0,0 +1,279 @@
    +# 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.
    +
    +""" Test case for Multiple Volume Snapshot in ZWPS
    +"""
    +from nose.plugins.attrib import attr
    +from marvin.cloudstackTestCase import cloudstackTestCase
    +from marvin.lib.utils import (cleanup_resources,
    +                              validateList)
    +from marvin.lib.base import (Account,
    +                             ServiceOffering,
    +                             DiskOffering,
    +                             Snapshot,
    +                             VirtualMachine,
    +                             StoragePool
    +                             )
    +from marvin.lib.common import (get_domain,
    +                               get_zone,
    +                               list_volumes,
    +                               list_clusters,
    +                               get_template
    +                               )
    +
    +from marvin.codes import PASS, ZONETAG1, ROOT, DATA
    +
    +
    +class TestMultipleVolumeSnapshots(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +        testClient = super(TestMultipleVolumeSnapshots, cls).getClsTestClient()
    +        cls.apiclient = testClient.getApiClient()
    +        cls.testdata = testClient.getParsedTestDataConfig()
    +
    +        # Get Zone, Domain and templates
    +        cls.domain = get_domain(cls.apiclient)
    +        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
    +        cls.hypervisor = cls.testClient.getHypervisorInfo()
    +        cls.template = get_template(
    +            cls.apiclient,
    +            cls.zone.id,
    +            cls.testdata["ostype"])
    +
    +        cls._cleanup = []
    +
    +        cls.skiptest = False
    +
    +        clus_list = list_clusters(cls.apiclient)
    +
    +        if cls.hypervisor.lower() not in ['vmware'] or len(clus_list) < 2:
    +            cls.skiptest = True
    +            return
    +
    +        try:
    +            # Create an account
    +            cls.account = Account.create(
    +                cls.apiclient,
    +                cls.testdata["account"],
    +                domainid=cls.domain.id
    +            )
    +
    +            # Create user api client of the account
    +            cls.userapiclient = testClient.getUserApiClient(
    +                UserName=cls.account.name,
    +                DomainName=cls.account.domain
    +            )
    +            # Create Service offering
    +            cls.service_offering_zwps = ServiceOffering.create(
    +                cls.apiclient,
    +                cls.testdata["service_offering"],
    +                tags=ZONETAG1
    +            )
    +
    +            cls.disk_offering_zwps = DiskOffering.create(
    +                cls.apiclient,
    +                cls.testdata["disk_offering"],
    +                tags=ZONETAG1
    +            )
    +
    +            cls._cleanup = [
    +                cls.account,
    +                cls.service_offering_zwps,
    +                cls.disk_offering_zwps,
    +            ]
    +        except Exception as e:
    +            cls.tearDownClass()
    +            raise e
    +        return
    +
    +    @classmethod
    +    def tearDownClass(cls):
    +        try:
    +            cleanup_resources(cls.apiclient, cls._cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +
    +    def setUp(self):
    +
    +        self.cleanup = []
    +        if self.skiptest:
    +            self.skipTest("Skip test as setup is either not VMWare or  \
    +                    having less than 2 clusters %s" % self.hypervisor)
    +
    +        self.apiclient = self.testClient.getApiClient()
    +        self.dbclient = self.testClient.getDbConnection()
    +        self.pools = []
    +
    +    def tearDown(self):
    +        try:
    +            for storagePool in self.pools:
    +                StoragePool.update(self.apiclient, id=storagePool.id, tags="")
    +
    +            cleanup_resources(self.apiclient, self.cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    @attr(tags=["advanced", "basic"], required_hardware="true")
    +    def test_01_multiple_snapshot_in_zwps(self):
    +        """ Test multiple volume snapshot in zwps
    +
    +        # 1. Verify if setup has a ZWPS and 2 CWPS
    +        # 2. Deploy a VM with data disk in ZWPS
    +        # 1. Verify ROOT and DATA Disk of the VM is in ZWPS.
    +        # 2. Take a snapshot of VM.
    +        # 3. Create Multiple Snapshots till operation fails.
    +        """
    +        try:
    +
    +            self.pools = StoragePool.list(self.apiclient, zoneid=self.zone.id)
    +            if len(list(storagePool for storagePool in self.pools
    +                        if storagePool.scope == "ZONE")) < 1:
    +                self.skipTest("There must be at least one zone wide\
    +                storage pools available in the setup")
    +
    +            if len(list(storagePool for storagePool in self.pools
    +                        if storagePool.scope == "CLUSTER")) < 2:
    +                self.skipTest("There must be at atleast two cluster wide\
    +                storage pools available in the setup")
    +        except Exception as e:
    +            self.skipTest(e)
    +
    +        # Adding tags to Storage Pools
    +        zone_no = 1
    +        self.debug("Storage Pools: %s" % self.pools)
    +        self.zone_pool = []
    +        for storagePool in self.pools:
    +            if storagePool.scope == "ZONE":
    +                StoragePool.update(
    +                    self.apiclient,
    +                    id=storagePool.id,
    +                    tags=[ZONETAG1[:-1] + repr(zone_no)])
    +                self.zone_pool.append(storagePool)
    +                zone_no += 1
    +
    +        self.vm_zwps = VirtualMachine.create(
    +            self.apiclient,
    +            self.testdata["small"],
    +            templateid=self.template.id,
    +            accountid=self.account.name,
    +            domainid=self.account.domainid,
    +            serviceofferingid=self.service_offering_zwps.id,
    +            diskofferingid=self.disk_offering_zwps.id,
    +            zoneid=self.zone.id,
    +        )
    +
    +        self.cleanup.append(self.vm_zwps)
    +
    +        # Step 1
    +        volumes_root_list = list_volumes(
    +            self.apiclient,
    +            virtualmachineid=self.vm_zwps.id,
    +            type=ROOT,
    +            listall=True
    +        )
    +
    --- End diff --
    
    use validate list


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8716: Verify creation of snaps...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cloudstack/pull/665


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---