コード例 #1
0
 def create_data_volume(self, sharable=False, vms=[], from_offering=True):
     '''
     {"next": ["migrate_data_volume", "create_image", "create_snapshot"],
      "skip": ["create_vm", "clone_vm", "migrate_vm"]}
     '''
     conditions = res_ops.gen_query_conditions('name', '=', os.getenv('largeDiskOfferingName'))
     disk_offering_uuid = res_ops.query_resource(res_ops.DISK_OFFERING, conditions)[0].uuid
     volume_option = test_util.VolumeOption()
     if from_offering:
         volume_option.set_disk_offering_uuid(disk_offering_uuid)
         ps_uuid = self.vm.vm.allVolumes[0].primaryStorageUuid
     else:
         volume_option.set_volume_template_uuid(self.image.uuid)
         ps_uuid = self.get_ps_for_volume_creation().uuid
     volume_option.set_name('data_volume_for_migration')
     volume_option.set_primary_storage_uuid(ps_uuid)
     if sharable:
         volume_option.set_system_tags(['ephemeral::shareable', 'capability::virtio-scsi'])
     self.data_volume = create_volume(volume_option, from_offering=from_offering)
     self.set_ceph_mon_env(ps_uuid)
     if vms:
         for vm in vms:
             self.data_volume.attach(vm)
     else:
         if ps_uuid != self.vm.vm.allVolumes[0].primaryStorageUuid:
             self.migrate_vm()
             self.clean_up_ps_trash_and_check(ps_uuid)
         self.data_volume.attach(self.vm)
     self.data_volume.check()
     if from_offering:
         test_lib.lib_mkfs_for_volume(self.data_volume.get_volume().uuid, self.vm.vm, '/mnt')
     return self
コード例 #2
0
    def _create_checking_file(self):
        #make fs for volume, if it doesn't exist
        if not self.parent and not self.child_list:
            test_lib.lib_mkfs_for_volume(self.target_volume.get_volume().uuid, \
                    self.utility_vm.get_vm())

        import tempfile
        with tempfile.NamedTemporaryFile() as script:
            script.write('''
device=`fdisk -l|grep Disk|tail -2|head -1|awk '{print $2}'|awk -F: '{print $1}'`1
mkdir -p %s
mount $device %s
mkdir -p %s
touch %s/%s
umount %s
            ''' % (test_lib.WOODPECKER_MOUNT_POINT, \
                    test_lib.WOODPECKER_MOUNT_POINT, \
                    checking_point_folder, checking_point_folder, \
                    self.checking_point, test_lib.WOODPECKER_MOUNT_POINT))
            script.flush()
            test_lib.lib_execute_shell_script_in_vm(self.utility_vm.get_vm(),
                                                    script.name)

        if self.parent:
            test_util.test_logger('[snapshot:] %s checking file: %s is created.\
Its [parent:] %s'                  % \
                    (self.snapshot_option.get_name(), \
                        self.checking_point, self.parent.get_snapshot().uuid))
        else:
            test_util.test_logger(
                '[snapshot:] %s checking file: %s is created.' %
                (self.snapshot_option.get_name(), self.checking_point))
コード例 #3
0
    def _create_checking_file(self):
        #make fs for volume, if it doesn't exist
        if not self.parent and not self.child_list:
            test_lib.lib_mkfs_for_volume(self.target_volume.get_volume().uuid, \
                    self.utility_vm.get_vm())

        import tempfile
        with tempfile.NamedTemporaryFile() as script:
            script.write('''
device=/dev/`ls -ltr --file-type /dev | grep disk | awk '{print $NF}' | grep -v '[[:digit:]]' | tail -1`1
mkdir -p %s
mount $device %s
mkdir -p %s
touch %s/%s
umount %s
            ''' % (test_lib.WOODPECKER_MOUNT_POINT, \
                    test_lib.WOODPECKER_MOUNT_POINT, \
                    checking_point_folder, checking_point_folder, \
                    self.checking_point, test_lib.WOODPECKER_MOUNT_POINT))
            script.flush()
            test_lib.lib_execute_shell_script_in_vm(self.utility_vm.get_vm(),
                    script.name)

        if self.parent:
            test_util.test_logger('[snapshot:] %s checking file: %s is created.\
Its [parent:] %s' % \
                    (self.snapshot_option.get_name(), \
                        self.checking_point, self.parent.get_snapshot().uuid))
        else:
            test_util.test_logger('[snapshot:] %s checking file: %s is created.'% (self.snapshot_option.get_name(), self.checking_point))
コード例 #4
0
def test():
    global volume_offering_uuid
    test_util.test_dsc('Test VM data volume bandwidth QoS by 20MB')

    #unit is KB
    write_bandwidth = 5*1024*1024
    new_volume_offering = test_lib.lib_create_disk_offering(write_bandwidth = write_bandwidth)
    volume_offering_uuid = new_volume_offering.uuid
    vm = test_stub.create_vm(vm_name='vm_volume_qos', disk_offering_uuids = [volume_offering_uuid])
    vm.check()
    test_obj_dict.add_vm(vm)
    vm_inv = vm.get_vm()
    cond = res_ops.gen_query_conditions("vmInstanceUuid", '=', vm_inv.uuid) 
    cond = res_ops.gen_query_conditions("type", '=', 'Data', cond)
    volume_uuid = res_ops.query_resource(res_ops.VOLUME, cond)[0].uuid
    test_lib.lib_mkfs_for_volume(volume_uuid, vm_inv)
    path = '/mnt'
    user_name = 'root'
    user_password = '******'
    os.system("sshpass -p '%s' ssh %s@%s 'mount /dev/vdb1 %s'"%(user_password, user_name, vm_inv.vmNics[0].ip, path))
    vm.check()
    test_stub.make_ssh_no_password(vm_inv)
    test_stub.install_fio(vm_inv)

    if vm_ops.get_vm_disk_qos(test_lib.lib_get_data_volumes(vm_inv)[0].uuid).volumeBandwidthRead != -1 and \
    vm_ops.get_vm_disk_qos(test_lib.lib_get_data_volumes(vm_inv)[0].uuid).volumeBandwidthWrite != write_bandwidth:
        test_util.test_fail('Retrieved disk qos not match')
    test_stub.test_fio_bandwidth(vm_inv, write_bandwidth, path)

    if test_stub.test_fio_bandwidth(vm_inv, write_bandwidth/2, '/dev/vdb', raise_exception=False):
        test_util.test_fail('disk read qos is not expected to have limit as only write qos was set')
    vol_ops.delete_disk_offering(volume_offering_uuid)
    test_lib.lib_robot_cleanup(test_obj_dict)

    test_util.test_pass('VM data volume write QoS Test Pass')
コード例 #5
0
def test():
    global volume_offering_uuid
    test_util.test_dsc('Test VM data volume bandwidth QoS by 20MB')

    #unit is KB
    volume_bandwidth = 5*1024*1024
    new_volume_offering = test_lib.lib_create_disk_offering(volume_bandwidth = volume_bandwidth)
    volume_offering_uuid = new_volume_offering.uuid
    vm = test_stub.create_vm(vm_name = 'vm_volume_qos', disk_offering_uuids = [volume_offering_uuid])
    vm.check()
    test_obj_dict.add_vm(vm)
    vm_inv = vm.get_vm()
    cond = res_ops.gen_query_conditions("vmInstanceUuid", '=', vm_inv.uuid) 
    cond = res_ops.gen_query_conditions("type", '=', 'Data', cond)
    volume_uuid = res_ops.query_resource(res_ops.VOLUME, cond)[0].uuid
    test_lib.lib_mkfs_for_volume(volume_uuid, vm_inv)
    path = '/mnt'
    user_name = 'root'
    user_password = '******'
    os.system("sshpass -p '%s' ssh %s@%s 'mount /dev/vdb1 %s'"%(user_password, user_name, vm_inv.vmNics[0].ip, path))
    vm.check()
    test_stub.make_ssh_no_password(vm_inv)
    test_stub.install_fio(vm_inv)
    test_stub.test_fio_bandwidth(vm_inv, volume_bandwidth, path)
    vol_ops.delete_disk_offering(volume_offering_uuid)
    test_lib.lib_robot_cleanup(test_obj_dict)

    test_util.test_pass('VM data volume QoS Test Pass')
コード例 #6
0
def test():
    global new_offering_uuid
    test_util.test_dsc('Test VM disk bandwidth QoS by 20MB')

    #unit is KB
    volume_bandwidth = 25*1024*1024
    new_offering = test_lib.lib_create_instance_offering(volume_bandwidth = volume_bandwidth)
    new_offering_uuid = new_offering.uuid

    vm = test_stub.create_vm(vm_name = 'vm_volume_qos', \
            instance_offering_uuid = new_offering.uuid)
    test_obj_dict.add_vm(vm)

    vm.check()

    volume_creation_option = test_util.VolumeOption()
    disk_offering = test_lib.lib_get_disk_offering_by_name(os.environ.get('largeDiskOfferingName'))
    volume_creation_option.set_disk_offering_uuid(disk_offering.uuid)
    
    volume_creation_option.set_name('volume-1')
    volume = test_stub.create_volume(volume_creation_option)
    test_obj_dict.add_volume(volume)
    vm_inv = vm.get_vm()
    test_lib.lib_mkfs_for_volume(volume.get_volume().uuid, vm_inv)
    mount_point = '/tmp/zstack/test'
    test_stub.attach_mount_volume(volume, vm, mount_point)

    test_stub.make_ssh_no_password(vm_inv)
    test_stub.install_fio(vm_inv)
    test_stub.test_fio_bandwidth(vm_inv, volume_bandwidth, mount_point)
    vm_ops.delete_instance_offering(new_offering_uuid)
    test_lib.lib_robot_cleanup(test_obj_dict)

    test_util.test_pass('VM Disk QoS Test Pass')
コード例 #7
0
def test():
    global new_offering_uuid
    test_util.test_dsc('Test VM disk bandwidth QoS by 20MB')

    #unit is KB
    volume_bandwidth = 25*1024*1024
#    new_offering = test_lib.lib_create_instance_offering(volume_bandwidth = volume_bandwidth)
#    new_offering_uuid = new_offering.uuid

    vm = test_stub.create_vm(vm_name = 'vm_volume_qos')
    test_obj_dict.add_vm(vm)

    vm.check()

    volume_creation_option = test_util.VolumeOption()
    disk_offering = test_lib.lib_create_disk_offering(diskSize=1073741824,name="1G")
    volume_creation_option.set_disk_offering_uuid(disk_offering.uuid)
    tag_ops.create_system_tag('DiskOfferingVO', disk_offering.uuid, "volumeTotalBandwidth::26214400")
    
    volume_creation_option.set_name('volume-1')
    volume = test_stub.create_volume(volume_creation_option)
    test_obj_dict.add_volume(volume)
    vm_inv = vm.get_vm()
    test_lib.lib_mkfs_for_volume(volume.get_volume().uuid, vm_inv)
    mount_point = '/tmp/zstack/test'
    test_stub.attach_mount_volume(volume, vm, mount_point)

    test_stub.make_ssh_no_password(vm_inv)
    test_stub.install_fio(vm_inv)
    test_stub.test_fio_bandwidth(vm_inv, volume_bandwidth, mount_point)
    test_lib.lib_robot_cleanup(test_obj_dict)

    test_util.test_pass('VM Disk QoS Test Pass')
コード例 #8
0
def test():
    global volume_offering_uuid
    test_util.test_dsc('Test VM data volume bandwidth QoS by 20MB')

    #unit is KB
    volume_bandwidth = 5 * 1024 * 1024
    new_volume_offering = test_lib.lib_create_disk_offering(
        volume_bandwidth=volume_bandwidth)
    volume_offering_uuid = new_volume_offering.uuid
    vm = test_stub.create_vm(vm_name='vm_volume_qos',
                             disk_offering_uuids=[volume_offering_uuid])
    test_obj_dict.add_vm(vm)
    vm_inv = vm.get_vm()
    cond = res_ops.gen_query_conditions("vmInstanceUuid", '=', vm_inv.uuid)
    cond = res_ops.gen_query_conditions("type", '=', 'Data', cond)
    volume_uuid = res_ops.query_resource(res_ops.VOLUME, cond)[0].uuid
    test_lib.lib_mkfs_for_volume(volume_uuid, vm_inv)
    path = '/mnt'
    user_name = 'root'
    user_password = '******'
    os.system("sshpass -p '%s' ssh %s@%s 'mount /dev/vdb1 %s'" %
              (user_password, user_name, vm_inv.vmNics[0].ip, path))
    vm.check()
    test_stub.make_ssh_no_password(vm_inv)
    test_stub.install_fio(vm_inv)
    test_stub.test_fio_bandwidth(vm_inv, volume_bandwidth, path)
    vol_ops.delete_disk_offering(volume_offering_uuid)
    test_lib.lib_robot_cleanup(test_obj_dict)

    test_util.test_pass('VM data volume QoS Test Pass')
コード例 #9
0
def test():
    global volume_offering_uuid
    test_util.test_dsc('Test VM disk bandwidth QoS by 20MB')

    #unit is KB
    volume_bandwidth = 5 * 1024 * 1024
    new_volume_offering = test_lib.lib_create_disk_offering(
        volume_bandwidth=volume_bandwidth)

    volume_offering_uuid = new_volume_offering.uuid

    vm = test_stub.create_vm(vm_name='vm_volume_qos',
                             disk_offering_uuids=[volume_offering_uuid])
    test_obj_dict.add_vm(vm)
    vm_inv = vm.get_vm()
    cond = res_ops.gen_query_conditions("vmInstanceUuid", '=', vm_inv.uuid)
    cond = res_ops.gen_query_conditions("type", '=', 'Data', cond)
    volume_uuid = res_ops.query_resource(res_ops.VOLUME, cond)[0].uuid
    test_lib.lib_mkfs_for_volume(volume_uuid, vm_inv)
    path = '/mnt'
    user_name = 'root'
    user_password = '******'
    os.system("sshpass -p '%s' ssh %s@%s 'mount /dev/vdb1 %s'" %
              (user_password, user_name, vm_inv.vmNics[0].ip, path))
    test_stub.make_ssh_no_password(vm_inv)
    test_stub.install_fio(vm_inv)
    test_stub.test_fio_bandwidth(vm_inv, volume_bandwidth, path)
    if vm_ops.get_vm_disk_qos(test_lib.lib_get_data_volumes(vm_inv)
                              [0].uuid).volumeBandwidth != volume_bandwidth:
        test_util.test_fail('Retrieved disk qos not match')
    vm_ops.set_vm_disk_qos(
        test_lib.lib_get_data_volumes(vm_inv)[0].uuid, volume_bandwidth / 2)
    test_stub.test_fio_bandwidth(vm_inv, volume_bandwidth / 2, path)
    vm_ops.del_vm_disk_qos(test_lib.lib_get_data_volumes(vm_inv)[0].uuid)
    if test_stub.test_fio_bandwidth(vm_inv,
                                    volume_bandwidth / 2,
                                    path,
                                    raise_exception=False):
        test_util.test_fail(
            'disk qos is not expected to have limit after qos setting is deleted'
        )
    vol_ops.delete_disk_offering(volume_offering_uuid)
    test_lib.lib_robot_cleanup(test_obj_dict)

    test_util.test_pass('VM data volume QoS Test Pass')
コード例 #10
0
def test():
    global new_offering_uuid
    test_util.test_dsc('Test VM disk bandwidth QoS by 20MB')

    #unit is KB
    volume_bandwidth = 25 * 1024 * 1024
    new_offering = test_lib.lib_create_instance_offering(
        volume_bandwidth=volume_bandwidth)
    new_offering_uuid = new_offering.uuid

    vm = test_stub.create_vm(vm_name = 'vm_volume_qos', \
            instance_offering_uuid = new_offering.uuid)
    test_obj_dict.add_vm(vm)

    vm.check()

    volume_creation_option = test_util.VolumeOption()
    disk_offering = test_lib.lib_get_disk_offering_by_name(
        os.environ.get('largeDiskOfferingName'))
    volume_creation_option.set_disk_offering_uuid(disk_offering.uuid)

    volume_creation_option.set_name('volume-1')
    volume = test_stub.create_volume(volume_creation_option)
    test_obj_dict.add_volume(volume)
    vm_inv = vm.get_vm()
    test_lib.lib_mkfs_for_volume(volume.get_volume().uuid, vm_inv)
    mount_point = '/tmp/zstack/test'
    test_stub.attach_mount_volume(volume, vm, mount_point)

    test_stub.make_ssh_no_password(vm_inv)
    test_stub.install_fio(vm_inv)
    test_stub.test_fio_bandwidth(vm_inv, volume_bandwidth, mount_point)
    vm_ops.delete_instance_offering(new_offering_uuid)
    test_lib.lib_robot_cleanup(test_obj_dict)

    test_util.test_pass('VM Disk QoS Test Pass')
コード例 #11
0
def test():
    global volume_offering_uuid,new_offering_uuid
    test_util.test_dsc('Test VM data volume bandwidth QoS by 20MB')

    # Only imagestore supports full clone
    bs = res_ops.query_resource(res_ops.BACKUP_STORAGE)
    for i in bs:
        if i.type == inventory.IMAGE_STORE_BACKUP_STORAGE_TYPE:
            break
    else:
        test_util.test_skip('Skip test on non-imagestore')

    # SharedBlock and AliyunNAS not support full clone
    ps = res_ops.query_resource(res_ops.PRIMARY_STORAGE)
    for i in ps:
        if i.type in ['SharedBlock', 'AliyunNAS']:
            test_util.test_skip('Skip test on SharedBlock and AliyunNAS PS')

    #unit is KB
    write_bandwidth = 10*1024*1024
    new_offering = test_lib.lib_create_instance_offering(write_bandwidth = write_bandwidth)
    new_offering_uuid = new_offering.uuid
    new_volume_offering = test_lib.lib_create_disk_offering(write_bandwidth = write_bandwidth)
    volume_offering_uuid = new_volume_offering.uuid
    vm = test_stub.create_vm(vm_name='vm_volume_qos', instance_offering_uuid = new_offering_uuid,
                             disk_offering_uuids = [volume_offering_uuid])
    test_obj_dict.add_vm(vm)
    vm.check()
    vm_inv = vm.get_vm()
    cond = res_ops.gen_query_conditions("vmInstanceUuid", '=', vm_inv.uuid) 
    cond = res_ops.gen_query_conditions("type", '=', 'Data', cond)
    volume_uuid = res_ops.query_resource(res_ops.VOLUME, cond)[0].uuid
    test_lib.lib_mkfs_for_volume(volume_uuid, vm_inv)
    path = '/mnt'
    user_name = 'root'
    user_password = '******'
    os.system("sshpass -p '%s' ssh %s@%s 'mount /dev/vdb1 %s'"%(user_password, user_name, vm_inv.vmNics[0].ip, path))
    vm.check()
    test_stub.make_ssh_no_password(vm_inv)
#     test_stub.install_fio(vm_inv)

    vm_ops.set_vm_disk_qos(test_lib.lib_get_data_volumes(vm_inv)[0].uuid, write_bandwidth*2, 'write')
    vm_ops.set_vm_disk_qos(test_lib.lib_get_root_volume(vm_inv).uuid, write_bandwidth*2, 'write')

    new_vm = vm.clone(['full_cloned_vm'], full=True)[0]
    new_vm.check()
    test_obj_dict.add_vm(new_vm)

    volumes_number = len(test_lib.lib_get_all_volumes(new_vm.vm))
    if volumes_number != 2:
        test_util.test_fail('Did not find 2 volumes for [vm:] %s. But we assigned 2 data volume when create the vm. We only catch %s volumes' % (new_vm.vm.uuid, volumes_number))
    else:
        test_util.test_logger('Find 2 volumes for [vm:] %s.' % new_vm.vm.uuid)

    new_vm_inv = new_vm.get_vm()
    test_stub.install_fio(new_vm_inv)

    if vm_ops.get_vm_disk_qos(test_lib.lib_get_data_volumes(new_vm_inv)[0].uuid).volumeBandwidthWrite != write_bandwidth*2:
        test_util.test_fail('Retrieved disk qos not match')

    test_stub.test_fio_bandwidth(new_vm_inv, write_bandwidth*2)
    test_stub.test_fio_bandwidth(new_vm_inv, write_bandwidth*2, path)

    if test_stub.test_fio_bandwidth(vm_inv, write_bandwidth, '/dev/vda', raise_exception=False):
        test_util.test_fail('disk read qos is not expected to have limit as only read qos was set')

    if test_stub.test_fio_bandwidth(vm_inv, write_bandwidth, '/dev/vdb', raise_exception=False):
        test_util.test_fail('disk read qos is not expected to have limit as only read qos was set')

    vm_ops.delete_instance_offering(new_offering_uuid)
    vol_ops.delete_disk_offering(volume_offering_uuid)
    test_lib.lib_robot_cleanup(test_obj_dict)

    test_util.test_pass('VM data volume read QoS Test Pass')
コード例 #12
0
def test():
    test_util.test_dsc('Test Set Data Volume WWN')
    vm1=test_stub.create_basic_vm()
    vm2=test_stub.create_basic_vm()
    vm1.check()
    vm2.check()
    test_obj_dict.add_vm(vm1)
    test_obj_dict.add_vm(vm2)

    volume1 = test_stub.create_volume()
    tag_ops.create_system_tag('VolumeVO',volume1.get_volume().uuid,"capability::virtio-scsi")
    volume2 = test_stub.create_volume()
    tag_ops.create_system_tag('VolumeVO',volume2.get_volume().uuid,"capability::virtio-scsi")
    test_obj_dict.add_volume(volume1)
    test_obj_dict.add_volume(volume2)
    vm1_inv = vm1.get_vm()
    vm2_inv = vm2.get_vm()
    mount_point_1 = '/tmp/zstack/test1'
    mount_point_2 = '/tmp/zstack/test2'
    test_lib.lib_mkfs_for_volume(volume1.get_volume().uuid, vm1_inv)
    test_stub.attach_mount_volume(volume1, vm1, mount_point_1)
    test_lib.lib_mkfs_for_volume(volume2.get_volume().uuid, vm1_inv)
    test_stub.attach_mount_volume(volume2, vm1, mount_point_2)
    wwn_dev_cmd=" ls /dev/disk/by-id -la | awk '$9~/^wwn-.*-part1/ {print $9,$11}'"
    wwn_dev_list=test_lib.lib_execute_command_in_vm(vm1_inv,wwn_dev_cmd)
    if not wwn_dev_list or wwn_dev_list == "<no stdout output>":
        test_util.test_fail('vm [%s] cannot show data volume wwn '%(vm1.get_vm().uuid))

    for wwn_dev in wwn_dev_list.strip().split('\n'):
        wwn = wwn_dev.split()[0]
        device = wwn_dev.split()[1].split('/')[-1]
        path_cmd = "mount | awk '/^\/dev\/"+device+"/ {print $3}'"
        mount_point = test_lib.lib_execute_command_in_vm(vm1_inv, path_cmd).strip()
        test_stub.create_test_file(vm1_inv,mount_point+'/'+wwn)
        test_lib.lib_execute_command_in_vm(vm1_inv, 'umount '+mount_point+' >/dev/null')
    volume1.detach()
    volume2.detach()

    wwn_cmd="ls /dev/disk/by-id -la | awk '$9~/^wwn-.*-part1/ {print $9}'"

    test_stub.attach_mount_volume(volume1, vm2, mount_point_1)
    set_wwn_1 = test_lib.lib_execute_command_in_vm(vm2_inv, wwn_cmd).strip()
    check_file_cmd = "ls "+mount_point_1
    file_list = test_lib.lib_execute_command_in_vm(vm2_inv, check_file_cmd)
    if set_wwn_1 not in file_list.split():
        test_util.test_fail('wwn [%s] file does not exist in wwn [%s] volume' % (set_wwn_1, set_wwn_1))
    wwn_1 = set_wwn_1.split('-')[1]
    cond = res_ops.gen_query_conditions('resourceUuid', '=', volume1.get_volume().uuid)
    cond = res_ops.gen_query_conditions('tag','=','kvm::volume::%s' % (wwn_1),cond)
    volume1_tag_invs = res_ops.query_resource(res_ops.SYSTEM_TAG, cond)
    if not volume1_tag_invs:
        cond = res_ops.gen_query_conditions('resourceUuid', '=', volume1.get_volume().uuid)
        volume1_tag_invs = res_ops.query_resource(res_ops.SYSTEM_TAG, cond)
	for tag_inv in volume1_tag_invs:
            if tag_inv.tag.startswith("kvm::volume::"):
                volume1_tag = tag_inv.tag.split("::")[2]
                test_util.test_fail('data volume [%s] with tag [%s] does not match its wwn number [%s] in vm' % (volume2.get_volume().uuid,volume1_tag, wwn_1))
                break
    volume1.detach()

    test_stub.attach_mount_volume(volume2, vm2, mount_point_2)
    set_wwn_2 = test_lib.lib_execute_command_in_vm(vm2_inv, wwn_cmd).strip()
    check_file_cmd = "ls "+mount_point_2
    file_list = test_lib.lib_execute_command_in_vm(vm2_inv, check_file_cmd)
    if set_wwn_2 not in file_list.split():
        test_util.test_fail('wwn [%s] file does not exist in wwn [%s] volume' % (set_wwn_2, set_wwn_2))
    wwn_2 = set_wwn_2.split('-')[1]
    cond = res_ops.gen_query_conditions('resourceUuid', '=', volume2.get_volume().uuid)
    cond = res_ops.gen_query_conditions('tag','=','kvm::volume::%s'%(wwn_2),cond)
    volume2_tag_invs = res_ops.query_resource(res_ops.SYSTEM_TAG, cond)
    if not volume2_tag_invs:
        cond = res_ops.gen_query_conditions('resourceUuid', '=', volume2.get_volume().uuid)
        volume2_tag_invs = res_ops.query_resource(res_ops.SYSTEM_TAG, cond)
	for tag_inv in volume2_tag_invs:
            if tag_inv.tag.startswith("kvm::volume::"):
                volume2_tag = tag_inv.tag.split("::")[2]
                test_util.test_fail('data volume [%s] with tag [%s] does not match its wwn number [%s] in vm' % (volume2.get_volume().uuid,volume2_tag, wwn_2))
                break
    volume2.detach()

    test_lib.lib_robot_cleanup(test_obj_dict)

    test_util.test_pass('Set Data Volume WWN Test Pass')