Esempio n. 1
0
    def test_05_set_vcpolicy_tag_with_admin_and_try_delete_with_user(self):
        ''' Test set vc-policy tag to VM with one attached disk
        '''
        tag = Tag.create(self.apiclient,
                         resourceIds=self.virtual_machine.id,
                         resourceType='UserVm',
                         tags={'vc-policy': 'testing_vc-policy'})

        self.debug(
            '######################### test_05_set_vcpolicy_tag_with_admin_and_try_delete_with_user tags ######################### '
        )

        vm = list_virtual_machines(self.userapiclient,
                                   id=self.virtual_machine.id)
        vm_tags = vm[0].tags
        volumes = list_volumes(self.apiclient,
                               virtualmachineid=self.virtual_machine.id,
                               listall=True)
        self.debug(
            '######################### test_01_set_vcpolicy_tag_to_vm_with_attached_disks tags ######################### '
        )

        self.vc_policy_tags(volumes, vm_tags, vm)

        try:
            Tag.delete(self.userapiclient,
                       resourceIds=self.virtual_machine.id,
                       resourceType='UserVm',
                       tags={'vc-policy': 'testing_vc-policy'})
        except Exception as e:
            self.debug(
                "##################### test_05_set_vcpolicy_tag_with_admin_and_try_delete_with_user %s "
                % e)
Esempio n. 2
0
    def test_07_delete_vcpolicy_tag(self):
        """ Test delete vc-policy tag of VM"""
        Tag.delete(self.apiclient,
                   resourceIds=self.virtual_machine.id,
                   resourceType='UserVm',
                   tags={'vc-policy': 'testing_vc-policy'})

        volumes = list_volumes(self.apiclient,
                               virtualmachineid=self.virtual_machine.id,
                               listall=True)
        for v in volumes:
            name = v.path.split("/")[3]
            spvolume = self.spapi.volumeList(volumeName="~" + name)
            tags = spvolume[0].tags
            for t in tags:
                self.assertFalse(t.lower() == 'vc-policy'.lower(),
                                 "There is VC Policy tag")