def test(): global test_obj_dict volume_creation_option = test_util.VolumeOption() test_util.test_dsc('Create volume and check') disk_offering = test_lib.lib_get_disk_offering_by_name( os.environ.get('smallDiskOfferingName')) volume_creation_option.set_disk_offering_uuid(disk_offering.uuid) volume = test_stub.create_volume(volume_creation_option) test_obj_dict.add_volume(volume) volume.check() volume_uuid = volume.volume.uuid vol_size = volume.volume.size image_name = os.environ.get('imageName_net') l3_name = os.environ.get('l3VlanNetworkName1') vm = test_stub.create_vm("test_resize_vm", image_name, l3_name) vm.check() test_obj_dict.add_vm(vm) volume.attach(vm) vm.stop() vm.check() set_size = 1024 * 1024 * 1024 * 5 vol_ops.resize_data_volume(volume_uuid, set_size) vm.update() vol_size_after = test_lib.lib_get_data_volumes(vm.get_vm())[0].size if set_size != vol_size_after: test_util.test_fail('Resize Data Volume failed, size = %s' % vol_size_after) test_lib.lib_error_cleanup(test_obj_dict) test_util.test_pass('Resize Data Volume Test Success')
def resize_dvol(vm_obj): global dvol vol_size = dvol.volume.size volume_uuid = dvol.volume.uuid set_size = 1024 * 1024 * 1024 + int(vol_size) vol_ops.resize_data_volume(volume_uuid, set_size) dvol.set_volume(test_lib.lib_get_volume_by_uuid(volume_uuid))
def test(): global test_obj_dict volume_creation_option = test_util.VolumeOption() ps_uuid = res_ops.query_resource(res_ops.PRIMARY_STORAGE, [])[0].uuid test_util.test_dsc('Create volume and check') disk_offering = test_lib.lib_get_disk_offering_by_name( os.environ.get('smallDiskOfferingName')) volume_creation_option.set_disk_offering_uuid(disk_offering.uuid) volume_creation_option.set_primary_storage_uuid(ps_uuid) if res_ops.query_resource(res_ops.PRIMARY_STORAGE, [])[0].type == "LocalStorage": host = test_lib.lib_find_random_host() volume_creation_option.set_system_tags( ["localStorage::hostUuid::%s" % host.uuid]) volume = test_stub.create_volume(volume_creation_option) test_obj_dict.add_volume(volume) volume.check() volume_uuid = volume.volume.uuid vol_size = volume.volume.size set_size = 1024 * 1024 * 1024 * 5 vol_ops.resize_data_volume(volume_uuid, set_size) cond = res_ops.gen_query_conditions('type', '=', "Data") cond = res_ops.gen_query_conditions('status', '=', "Ready", cond) vol_size_after = res_ops.query_resource(res_ops.VOLUME, cond)[0].size if set_size != vol_size_after: test_util.test_fail('Resize Data Volume failed, size = %s' % vol_size_after) test_lib.lib_error_cleanup(test_obj_dict) test_util.test_pass('Resize Data Volume Test Success')
def test(): global test_obj_dict volume_creation_option = test_util.VolumeOption() ps_uuid = res_ops.query_resource(res_ops.PRIMARY_STORAGE, [])[0].uuid test_util.test_dsc('Create volume and check') disk_offering = test_lib.lib_get_disk_offering_by_name(os.environ.get('smallDiskOfferingName')) volume_creation_option.set_disk_offering_uuid(disk_offering.uuid) volume_creation_option.set_primary_storage_uuid(ps_uuid) if res_ops.query_resource(res_ops.PRIMARY_STORAGE, [])[0].type == "LocalStorage": host = test_lib.lib_find_random_host() volume_creation_option.set_system_tags(["localStorage::hostUuid::%s" % host.uuid]) volume = test_stub.create_volume(volume_creation_option) test_obj_dict.add_volume(volume) volume.check() volume_uuid = volume.volume.uuid vol_size = volume.volume.size set_size = 1024*1024*1024*5 vol_ops.resize_data_volume(volume_uuid, set_size) cond = res_ops.gen_query_conditions('type', '=', "Data") cond = res_ops.gen_query_conditions('status', '=', "Ready", cond) vol_size_after = res_ops.query_resource(res_ops.VOLUME, cond)[0].size if set_size != vol_size_after: test_util.test_fail('Resize Data Volume failed, size = %s' % vol_size_after) test_lib.lib_error_cleanup(test_obj_dict) test_util.test_pass('Resize Data Volume Test Success')
def test(): global test_obj_dict volume_creation_option = test_util.VolumeOption() test_util.test_dsc('Create volume and check') disk_offering = test_lib.lib_get_disk_offering_by_name(os.environ.get('smallDiskOfferingName')) volume_creation_option.set_disk_offering_uuid(disk_offering.uuid) volume = test_stub.create_volume(volume_creation_option) test_obj_dict.add_volume(volume) volume.check() volume_uuid = volume.volume.uuid vol_size = volume.volume.size image_name = os.environ.get('imageName_net') l3_name = os.environ.get('l3VlanNetworkName1') vm = test_stub.create_vm("test_resize_vm", image_name, l3_name) vm.check() volume.attach(vm) test_obj_dict.add_vm(vm) snapshots = test_obj_dict.get_volume_snapshot(volume_uuid) snapshots.set_utility_vm(vm) snapshots.create_snapshot('create_snapshot1') snapshots.check() vm.stop() vm.check() set_size = 1024*1024*1024*5 vol_ops.resize_data_volume(volume_uuid, set_size) vm.update() vol_size_after = test_lib.lib_get_data_volumes(vm.get_vm())[0].size if set_size != vol_size_after: test_util.test_fail('Resize Data Volume failed, size = %s' % vol_size_after) test_obj_dict.rm_volume_snapshot(snapshots) test_lib.lib_error_cleanup(test_obj_dict) test_util.test_pass('Resize Data Volume and Snapshot Test Success')
def resize_rvol(vm_obj, dvol): vol_size = dvol.volume.size volume_uuid = dvol.volume.uuid set_size = 1024 * 1024 * 1024 + int(vol_size) vol_ops.resize_data_volume(volume_uuid, set_size) vm_obj.update() # if set_size/vol_size_after > 0.9: # test_util.test_fail('Resize Root Volume failed, size = %s' % vol_size_after) vm_obj.check() test_lib.lib_wait_target_up(vm_obj.get_vm().vmNics[0].ip, 22, 300)
def test(): global test_obj_dict volume_creation_option = test_util.VolumeOption() test_util.test_dsc('Create volume and check') disk_offering = test_lib.lib_get_disk_offering_by_name( os.environ.get('smallDiskOfferingName')) volume_creation_option.set_disk_offering_uuid(disk_offering.uuid) volume = test_stub.create_volume(volume_creation_option) test_obj_dict.add_volume(volume) volume.check() volume_uuid = volume.volume.uuid vol_size = volume.volume.size image_name = os.environ.get('imageName_net') l3_name = os.environ.get('l3VlanNetworkName1') vm = test_stub.create_vm("test_resize_vm", image_name, l3_name) vm.check() test_obj_dict.add_vm(vm) volume.attach(vm) vm.stop() vm.check() set_size = 1024 * 1024 * 1024 * 5 vol_ops.resize_data_volume(volume_uuid, set_size) vm.update() vol_size_after = test_lib.lib_get_data_volumes(vm.get_vm())[0].size if set_size != vol_size_after: test_util.test_fail('Resize Data Volume failed, size = %s' % vol_size_after) bs_list = test_lib.lib_get_backup_storage_list_by_vm(vm.vm) image_option = test_util.ImageOption() image_option.set_data_volume_uuid(volume_uuid) image_option.set_name('data_resize_template') image_option.set_backup_storage_uuid_list([bs_list[0].uuid]) data_image = img_ops.create_data_volume_template(image_option) target_host = test_lib.lib_find_random_host(vm.get_vm()) new_data = vol_ops.create_volume_from_template( data_image.uuid, volume.volume.primaryStorageUuid, host_uuid=target_host.uuid) if set_size != new_data.size: test_util.test_fail('Resize Data Volume failed, size = %s' % new_data.size) test_lib.lib_error_cleanup(test_obj_dict) test_util.test_pass('Resize Data Volume Test Success')
def test(): global test_obj_dict volume_creation_option = test_util.VolumeOption() test_util.test_dsc('Create volume and check') disk_offering = test_lib.lib_get_disk_offering_by_name(os.environ.get('smallDiskOfferingName')) volume_creation_option.set_disk_offering_uuid(disk_offering.uuid) volume_creation_option.set_system_tags(["volumeProvisioningStrategy::ThinProvisioning", "capability::virtio-scsi"]) volume = test_stub.create_volume(volume_creation_option) test_obj_dict.add_volume(volume) volume.check() volume_uuid = volume.volume.uuid vol_size = volume.volume.size image_name = os.environ.get('imageName_net') l3_name = os.environ.get('l3VlanNetworkName1') create_vm_option = test_util.VmOption() create_vm_option.set_name('test_resize_vm_root_volume') vm = test_lib.lib_create_vm(create_vm_option) # vm = test_stub.create_vm("test_resize_vm", image_name, l3_name) vm.check() test_obj_dict.add_vm(vm) volume.attach(vm) vm.stop() vm.check() set_size = 1024*1024*1024*5 vol_ops.resize_data_volume(volume_uuid, set_size) vm.update() vol_size_after = test_lib.lib_get_data_volumes(vm.get_vm())[0].size if set_size != vol_size_after: test_util.test_fail('Resize Data Volume failed, size = %s' % vol_size_after) vm.start() vm.check() set_size = 1024*1024*1024*6 vol_ops.resize_data_volume(volume_uuid, set_size) vm.update() vol_size_after = test_lib.lib_get_data_volumes(vm.get_vm())[0].size if set_size != vol_size_after: test_util.test_fail('Resize Data Volume failed, size = %s' % vol_size_after) test_lib.lib_error_cleanup(test_obj_dict) test_util.test_pass('Resize Data Volume Test Success')
def test(): global test_obj_dict volume_creation_option = test_util.VolumeOption() test_util.test_dsc('Create volume and check') disk_offering = test_lib.lib_get_disk_offering_by_name( os.environ.get('smallDiskOfferingName')) volume_creation_option.set_disk_offering_uuid(disk_offering.uuid) volume = test_stub.create_volume(volume_creation_option) test_obj_dict.add_volume(volume) volume.check() volume_uuid = volume.volume.uuid vol_size = volume.volume.size image_name = os.environ.get('imageName_net') l3_name = os.environ.get('l3VlanNetworkName1') vm = test_stub.create_vm("test_resize_vm", image_name, l3_name) vm.check() test_obj_dict.add_vm(vm) volume.attach(vm) set_size = 1024 * 1024 * 1024 * 5 vol_ops.resize_data_volume(volume_uuid, set_size) vm.update() vol_size_after = test_lib.lib_get_data_volumes(vm.get_vm())[0].size if set_size != vol_size_after: test_util.test_fail('Resize Data Volume failed, size = %s' % vol_size_after) volume.detach() vm.update() target_host = test_lib.lib_find_random_host(vm.get_vm()) vol_ops.migrate_volume(volume_uuid, target_host.uuid) cond = res_ops.gen_query_conditions('uuid', '=', volume_uuid) data_volume = res_ops.query_resource(res_ops.VOLUME, cond) vol_size_after = data_volume[0].size if set_size != vol_size_after: test_util.test_fail('Resize Data Volume failed, size = %s' % vol_size_after) test_lib.lib_error_cleanup(test_obj_dict) test_util.test_pass('Resize Data Volume Test Success')
def test(): global test_obj_dict volume_creation_option = test_util.VolumeOption() test_util.test_dsc('Create volume and check') disk_offering = test_lib.lib_get_disk_offering_by_name(os.environ.get('smallDiskOfferingName')) volume_creation_option.set_disk_offering_uuid(disk_offering.uuid) volume = test_stub.create_volume(volume_creation_option) test_obj_dict.add_volume(volume) volume.check() volume_uuid = volume.volume.uuid vol_size = volume.volume.size image_name = os.environ.get('imageName_net') l3_name = os.environ.get('l3VlanNetworkName1') vm = test_stub.create_vm("test_resize_vm", image_name, l3_name) vm.check() test_obj_dict.add_vm(vm) volume.attach(vm) vm.stop() vm.check() set_size = 1024*1024*1024*5 vol_ops.resize_data_volume(volume_uuid, set_size) vm.update() vol_size_after = test_lib.lib_get_data_volumes(vm.get_vm())[0].size if set_size != vol_size_after: test_util.test_fail('Resize Data Volume failed, size = %s' % vol_size_after) bs_list = test_lib.lib_get_backup_storage_list_by_vm(vm.vm) image_option = test_util.ImageOption() image_option.set_data_volume_uuid(volume_uuid) image_option.set_name('data_resize_template') image_option.set_backup_storage_uuid_list([bs_list[0].uuid]) data_image = img_ops.create_data_volume_template(image_option) target_host = test_lib.lib_find_random_host(vm.get_vm()) new_data = vol_ops.create_volume_from_template(data_image.uuid, volume.volume.primaryStorageUuid, host_uuid = target_host.uuid) if set_size != new_data.size: test_util.test_fail('Resize Data Volume failed, size = %s' % new_data.size) test_lib.lib_error_cleanup(test_obj_dict) test_util.test_pass('Resize Data Volume Test Success')
def test(): global test_obj_dict volume_creation_option = test_util.VolumeOption() test_util.test_dsc('Create volume and check') disk_offering = test_lib.lib_get_disk_offering_by_name(os.environ.get('smallDiskOfferingName')) volume_creation_option.set_disk_offering_uuid(disk_offering.uuid) volume = test_stub.create_volume(volume_creation_option) test_obj_dict.add_volume(volume) volume.check() volume_uuid = volume.volume.uuid vol_size = volume.volume.size image_name = os.environ.get('imageName_net') l3_name = os.environ.get('l3VlanNetworkName1') vm = test_stub.create_vm("test_resize_vm", image_name, l3_name) vm.check() test_obj_dict.add_vm(vm) volume.attach(vm) vm.stop() vm.check() set_size = 1024*1024*1024*5 vol_ops.resize_data_volume(volume_uuid, set_size) vm.update() vol_size_after = test_lib.lib_get_data_volumes(vm.get_vm())[0].size if set_size != vol_size_after: test_util.test_fail('Resize Data Volume failed, size = %s' % vol_size_after) volume.detach() vm.update() target_host = test_lib.lib_find_random_host(vm.get_vm()) vol_ops.migrate_volume(volume_uuid, target_host.uuid) cond = res_ops.gen_query_conditions('uuid', '=', volume_uuid) data_volume = res_ops.query_resource(res_ops.VOLUME, cond) vol_size_after = data_volume[0].size if set_size != vol_size_after: test_util.test_fail('Resize Data Volume failed, size = %s' % vol_size_after) test_lib.lib_error_cleanup(test_obj_dict) test_util.test_pass('Resize Data Volume Test Success')
def resize_dvol(vm_obj, dvol): vol_size = dvol.volume.size volume_uuid = dvol.volume.uuid set_size = 1024 * 1024 * 1024 + int(vol_size) vol_ops.resize_data_volume(volume_uuid, set_size) vm_obj.update()
def resize(self, size): if self.get_volume().type == "Data": vol_ops.resize_data_volume(self.get_volume().uuid, size) elif self.get_volume().type == "Root": vol_ops.resize_volume(self.get_volume().uuid, size)
def resize_data_volume(self,new_size): self.data_vol_uuid = self.data_volume.get_volume().uuid vol_ops.resize_data_volume(self.data_vol_uuid, new_size) conditions = res_ops.gen_query_conditions('uuid', '=', self.data_vol_uuid) self.data_volume.data_volume = res_ops.query_resource(res_ops.VOLUME, conditions)[0] return self