[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-8308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14508551#comment-14508551
 ] 

ASF GitHub Bot commented on CLOUDSTACK-8308:
--------------------------------------------

Github user gauravaradhye commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/181#discussion_r28939823
  
    --- Diff: 
test/integration/testpaths/testpath_volume_cuncurrent_snapshots.py ---
    @@ -0,0 +1,827 @@
    +# 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 cases for VM/Volume snapshot Test Path
    +"""
    +
    +from nose.plugins.attrib import attr
    +from marvin.cloudstackTestCase import cloudstackTestCase, unittest
    +from marvin.lib.utils import (cleanup_resources, is_snapshot_on_nfs,
    +                              validateList)
    +from marvin.lib.base import (Account,
    +                             StoragePool,
    +                             Host,
    +                             ServiceOffering,
    +                             VirtualMachine,
    +                             Configurations,
    +                             Snapshot,
    +                             SnapshotPolicy,
    +                             )
    +from marvin.lib.common import (get_domain,
    +                               list_snapshot_policy,
    +                               get_zone,
    +                               get_template,
    +                               list_volumes,
    +                               list_snapshots,
    +                               list_virtual_machines,
    +                               createChecksum,
    +                               )
    +from marvin.sshClient import SshClient
    +import time
    +
    +from threading import Thread
    +from marvin.codes import PASS
    +
    +
    +def MigrateRootVolume(self,
    +                      vm,
    +                      destinationHost,
    +                      expectexception=False):
    +    """ Migrate given volume to type of storage pool mentioned in 
migrateto:
    +
    +        Inputs:
    +            1. vm:               VM to be migrated
    +                                 is to be migrated
    +            2. expectexception:  If exception is expected while migration
    +            3. destinationHost:  Destination host where the VM should get 
migrated
    +    """
    +
    +    if expectexception:
    +        with self.assertRaises(Exception):
    +            VirtualMachine.migrate(
    +                vm,
    +                self.apiclient,
    +                hostid=destinationHost.id,
    +            )
    +    else:
    +        VirtualMachine.migrate(
    +            vm,
    +            self.apiclient,
    +            hostid=destinationHost.id,
    +        )
    +
    +        migrated_vm_response = list_virtual_machines(
    +            self.apiclient,
    +            id=vm.id
    +        )
    +
    +        self.assertEqual(
    +            isinstance(migrated_vm_response, list),
    +            True,
    +            "Check list virtual machines response for valid list"
    +        )
    +
    +        self.assertNotEqual(
    +            migrated_vm_response,
    +            None,
    +            "Check if virtual machine exists in ListVirtualMachines"
    +        )
    +
    +        migrated_vm = migrated_vm_response[0]
    +
    +        vm_list = VirtualMachine.list(
    +            self.apiclient,
    +            id=migrated_vm.id
    +        )
    +
    +        self.assertEqual(
    +            vm_list[0].hostid,
    +            destinationHost.id,
    +            "Check volume is on migrated pool"
    +        )
    +    return
    +
    +
    +def CreateSnapshot(self, root_volume, is_recurring):
    +    """Create Snapshot"""
    +    if is_recurring:
    +        recurring_snapshot = SnapshotPolicy.create(
    +            self.apiclient,
    +            root_volume.id,
    +            self.testdata["recurring_snapshot"]
    +        )
    +        self.rec_policy_pool.append(recurring_snapshot)
    +    else:
    +        root_vol_snap = Snapshot.create(
    +            self.apiclient,
    +            root_volume.id)
    +
    +        self.snapshot_pool.append(root_vol_snap)
    +
    +
    +class TestConcurrentSnapshots(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +        testClient = super(TestConcurrentSnapshots, cls).getClsTestClient()
    +        cls.apiclient = testClient.getApiClient()
    +        cls.testdata = testClient.getParsedTestDataConfig()
    +        cls.hypervisor = cls.testClient.getHypervisorInfo()
    +
    +        # Get Zone, Domain and templates
    +        cls.domain = get_domain(cls.apiclient)
    +        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
    +
    +        cls.template = get_template(
    +            cls.apiclient,
    +            cls.zone.id,
    +            cls.testdata["ostype"])
    +
    +        cls._cleanup = []
    +
    +        cls.mgtSvrDetails = cls.config.__dict__["mgtSvr"][0].__dict__
    +
    +        try:
    +
    +            # Create an account
    +            cls.account = Account.create(
    +                cls.apiclient,
    +                cls.testdata["account"],
    +                domainid=cls.domain.id
    +            )
    +            cls._cleanup.append(cls.account)
    +
    +            # 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 = ServiceOffering.create(
    +                cls.apiclient,
    +                cls.testdata["service_offering"],
    +            )
    +            cls._cleanup.append(cls.service_offering)
    +
    +            cls.vm_pool = []
    +            for i in range(4):
    +                cls.vm = VirtualMachine.create(
    +                    cls.apiclient,
    +                    cls.testdata["small"],
    +                    templateid=cls.template.id,
    +                    accountid=cls.account.name,
    +                    domainid=cls.account.domainid,
    +                    serviceofferingid=cls.service_offering.id,
    +                    zoneid=cls.zone.id,
    +                    mode=cls.zone.networktype
    +                )
    +
    +                cls.vm_pool.append(cls.vm)
    +                cls._cleanup.append(cls.vm)
    +
    +            cls.chekcsum_pool = []
    +            cls.root_pool = []
    +            cls.snapshot_pool = []
    +            cls.rec_policy_pool = []
    +            for vm in cls.vm_pool:
    +                root_volumes = list_volumes(
    +                    cls.apiclient,
    +                    virtualmachineid=vm.id,
    +                    type='ROOT',
    +                    listall=True
    +                )
    +
    +                checksum_root = createChecksum(
    +                    cls.testdata,
    +                    vm,
    +                    root_volumes[0],
    +                    "rootdiskdevice")
    +
    +                cls.chekcsum_pool.append(checksum_root)
    +                cls.root_pool.append(root_volumes[0])
    +            try:
    +                cls.pools = StoragePool.list(cls.apiclient, 
zoneid=cls.zone.id)
    +            except Exception as e:
    +                raise unittest.SkipTest(e)
    +
    +        except Exception as e:
    +            cls.tearDownClass()
    +            raise e
    +        return
    +
    +    @classmethod
    +    def tearDownClass(cls):
    +        try:
    +            for vm in cls.vm_pool:
    +                vm.delete(cls.apiclient)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +
    +    def setUp(self):
    +        self.apiclient = self.testClient.getApiClient()
    +        self.dbclient = self.testClient.getDbConnection()
    +        self.cleanup = []
    +
    +    def tearDown(self):
    +        try:
    +            cleanup_resources(self.apiclient, self.cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    @classmethod
    +    def RestartServer(cls):
    +        """Restart management server"""
    +
    +        sshClient = SshClient(
    +            cls.mgtSvrDetails["mgtSvrIp"],
    +            22,
    +            cls.mgtSvrDetails["user"],
    +            cls.mgtSvrDetails["passwd"]
    +        )
    +        command = "service cloudstack-management restart"
    +        sshClient.execute(command)
    +
    +        return
    +    @classmethod
    +    def StopVM(cls, vms):
    +        for vm in vms:
    +            vm.stop(cls.apiclient)
    +        return
    +
    +    @attr(tags=["advanced", "basic"])
    --- End diff --
    
    Add required_hardware tag. Set value to false as this test case can't be 
run on simulator


> Add test cases for volume/VM snapshot test path
> -----------------------------------------------
>
>                 Key: CLOUDSTACK-8308
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8308
>             Project: CloudStack
>          Issue Type: Test
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>    Affects Versions: Future
>            Reporter: Priti Sarap
>              Labels: automation
>             Fix For: Future
>
>
> Add test cases for volume/VM snapshot test path



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to