本文整理汇总了Python中zstackwoodpecker.test_lib.lib_create_instance_offering函数的典型用法代码示例。如果您正苦于以下问题:Python lib_create_instance_offering函数的具体用法?Python lib_create_instance_offering怎么用?Python lib_create_instance_offering使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lib_create_instance_offering函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
def test():
test_util.test_dsc('Test VM online change instance offering')
cpuNum = 1
memorySize = 555 * 1024 * 1024
new_offering = test_lib.lib_create_instance_offering(cpuNum = cpuNum,\
memorySize = memorySize)
vm = test_stub.create_vm(vm_name = 'ckvmoffering-c7-64', image_name = "imageName_i_c7", instance_offering_uuid=new_offering.uuid)
vm.check()
test_obj_dict.add_vm(vm)
test_obj_dict.add_instance_offering(new_offering)
cpuNum = 1
memorySize = 667 * 1024 * 1024
new_offering = test_lib.lib_create_instance_offering(cpuNum = cpuNum,\
memorySize = memorySize)
test_obj_dict.add_instance_offering(new_offering)
new_offering_uuid = new_offering.uuid
vm.change_instance_offering(new_offering_uuid)
vm.check()
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('VM online change instance offering Test Pass')
示例2: test
def test():
global new_offering_uuid
test_util.test_dsc('Test VM network bandwidth QoS by 1MB')
#unit is KB
net_bandwidth1 = 1024
new_offering1 = test_lib.lib_create_instance_offering(net_bandwidth = net_bandwidth1)
test_obj_dict.add_instance_offering(new_offering1)
new_offering_uuid = new_offering1.uuid
vm = test_stub.create_vm(vm_name = 'vm_net_qos', \
instance_offering_uuid = new_offering1.uuid)
test_obj_dict.add_vm(vm)
vm.stop()
net_bandwidth2 = 512
new_offering2 = test_lib.lib_create_instance_offering(net_bandwidth = net_bandwidth2)
test_obj_dict.add_instance_offering(new_offering2)
new_offering_uuid = new_offering2.uuid
vm_inv = vm.get_vm()
vm.change_instance_offering(new_offering_uuid)
vm.start()
vm.check()
import time
time.sleep(1)
test_stub.make_ssh_no_password(vm_inv)
test_stub.create_test_file(vm_inv, net_bandwidth2)
test_stub.test_scp_speed(vm_inv, net_bandwidth2)
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('VM Network QoS change instance offering Test Pass')
示例3: test
def test():
test_util.test_dsc('Test VM online change instance offering')
vm = test_stub.create_vlan_vm()
test_obj_dict.add_vm(vm)
cpuNum = 2
memorySize = 666 * 1024 * 1024
new_offering = test_lib.lib_create_instance_offering(cpuNum = cpuNum,\
memorySize = memorySize)
test_obj_dict.add_instance_offering(new_offering)
new_offering_uuid = new_offering.uuid
vm.change_instance_offering(new_offering_uuid)
vm.check()
vm.reboot()
vm.check()
cpuNum = 1
memorySize = 555 * 1024 * 1024
new_offering = test_lib.lib_create_instance_offering(cpuNum = cpuNum,\
memorySize = memorySize)
test_obj_dict.add_instance_offering(new_offering)
new_offering_uuid = new_offering.uuid
vm.change_instance_offering(new_offering_uuid)
vm.check()
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('VM online change instance offering Test Pass')
示例4: test
def test():
test_util.test_dsc('Test VM online change instance offering')
image_name = os.environ.get('imageName_net')
image_uuid = test_lib.lib_get_image_by_name(image_name).uuid
l3_name = os.environ.get('l3VlanNetworkName1')
l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
l3_net_list = [l3_net_uuid]
vm = test_stub.create_vm(l3_net_list, image_uuid, 'online_chg_offering_vm', system_tags=['instanceOfferingOnlinechange::true'])
test_obj_dict.add_vm(vm)
vm.check()
cpuNum = 2
memorySize = 666 * 1024 * 1024
new_offering = test_lib.lib_create_instance_offering(cpuNum = cpuNum,\
memorySize = memorySize)
test_obj_dict.add_instance_offering(new_offering)
new_offering_uuid = new_offering.uuid
new_offering2 = test_lib.lib_create_instance_offering(cpuNum = cpuNum,\
memorySize = memorySize)
test_obj_dict.add_instance_offering(new_offering2)
new_offering_uuid2 = new_offering2.uuid
vm.change_instance_offering(new_offering_uuid)
vm.change_instance_offering(new_offering_uuid2)
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('VM online change instance offering Test Pass')
示例5: test
def test():
global new_offering_uuid
test_util.test_dsc('Test memory status after change VM offering')
cond = res_ops.gen_query_conditions('state', '=', 'Enabled')
cond = res_ops.gen_query_conditions('status', '=', 'Connected', cond)
host = res_ops.query_resource_with_num(res_ops.HOST, cond, limit = 1)
if not host:
test_util.test_skip('No Enabled/Connected host was found, skip test.' )
return True
host_uuid = host[0].uuid
zone_uuid = host[0].zoneUuid
host_avail_mem1 = test_lib.lib_get_cpu_memory_capacity(host_uuids = [host_uuid]).availableMemory
zone_avail_mem1 = test_lib.lib_get_cpu_memory_capacity(zone_uuids = [zone_uuid]).availableMemory
#unit is KB
new_offering1 = test_lib.lib_create_instance_offering(cpuNum = 1, \
memorySize = 536870912, name = 'new_instance1')
test_obj_dict.add_instance_offering(new_offering1)
new_offering_uuid = new_offering1.uuid
vm = test_stub.create_vm(vm_name = 'test_avail_memory', \
host_uuid = host_uuid, \
instance_offering_uuid = new_offering1.uuid)
test_obj_dict.add_vm(vm)
vm.stop()
new_offering2 = test_lib.lib_create_instance_offering(cpuNum = 1, \
memorySize = 1073741824, name = 'new_instance2')
test_obj_dict.add_instance_offering(new_offering2)
new_offering_uuid = new_offering2.uuid
vm_inv = vm.get_vm()
vm.change_instance_offering(new_offering_uuid)
vm.start()
host_avail_mem2 = test_lib.lib_get_cpu_memory_capacity(host_uuids = [host_uuid]).availableMemory
host_mem_diff = host_avail_mem1 - host_avail_mem2
if host_avail_mem2 >= host_avail_mem1 :
test_util.test_fail('Host available memory is not correct after change vm template. Previous value: %s , Current value: %s' % (host_avail_mem1, host_avail_mem2))
else:
test_util.test_logger('Host available memory before change template: %s , after change template: %s , the difference: %s' % (host_avail_mem1, host_avail_mem2, host_mem_diff))
zone_avail_mem2 = test_lib.lib_get_cpu_memory_capacity(zone_uuids = [zone_uuid]).availableMemory
zone_mem_diff = zone_avail_mem1 - zone_avail_mem2
if zone_avail_mem2 >= zone_avail_mem1 :
test_util.test_fail('Zone available memory is not correct after change vm template. Previous value: %s , Current value: %s' % (zone_avail_mem1, zone_avail_mem2))
else:
test_util.test_logger('Zone available memory before change template: %s , after change template: %s , the difference: %s' % (zone_avail_mem1, zone_avail_mem2, zone_mem_diff))
if zone_mem_diff != host_mem_diff:
test_util.test_fail('available memory change is not correct after change vm template. zone changed value: %s , host changed value: %s' % ((zone_avail_mem1 - zone_avail_mem2), (host_avail_mem1 - host_avail_mem2)))
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('Test available memory when changing instance offering Pass')
示例6: test
def test():
test_util.test_dsc('Test VM online change instance offering')
image_name = os.environ.get('imageName_net')
image_uuid = test_lib.lib_get_image_by_name(image_name).uuid
l3_name = os.environ.get('l3VlanNetworkName1')
l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
l3_net_list = [l3_net_uuid]
vm = test_stub.create_vm(l3_net_list, image_uuid, 'online_chg_offering_vm', system_tags=['instanceOfferingOnlinechange::true'])
test_obj_dict.add_vm(vm)
vm.check()
cpuNum = 1
cpuSpeed = 222
memorySize = 666 * 1024 * 1024
new_offering = test_lib.lib_create_instance_offering(cpuNum = cpuNum,\
cpuSpeed = cpuSpeed, memorySize = memorySize)
test_obj_dict.add_instance_offering(new_offering)
new_offering_uuid = new_offering.uuid
vm.change_instance_offering(new_offering_uuid)
vm.check()
test_lib.lib_execute_command_in_vm(vm.get_vm(), 'ls -d /sys/devices/system/cpu/cpu*')
test_lib.lib_execute_command_in_vm(vm.get_vm(), 'ls -d /sys/devices/system/memory/memory*')
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('VM online change instance offering Test Pass')
示例7: test
def test():
flavor = case_flavor[os.environ.get('CASE_FLAVOR')]
test_util.test_dsc("STEP1: Ceate vm instance offering")
vm_instance_offering = test_lib.lib_create_instance_offering(cpuNum=1, memorySize=1024*1024*1024)
test_obj_dict.add_instance_offering(vm_instance_offering)
test_util.test_dsc("STEP2: Ceate vm and wait until it up for testing image_name : {}".format(flavor['image']))
vm = test_stub.create_vm(vm_name='test_vm', image_name=flavor['image'],
instance_offering_uuid=vm_instance_offering.uuid)
test_obj_dict.add_vm(vm)
vm.check()
cpu_change = random.randint(1, 5) if flavor['add_cpu'] else 0
mem_change = random.randint(1, 500)*1024*1024 if flavor['add_memory'] else 0
test_util.test_dsc("STEP3: Hot Plugin CPU: {} and Memory: {} and check capacity".format(cpu_change, mem_change))
with test_stub.CapacityCheckerContext(vm, cpu_change, mem_change):
vm_ops.update_vm(vm.get_vm().uuid, vm_instance_offering.cpuNum+cpu_change,
vm_instance_offering.memorySize+mem_change)
vm.update()
if flavor['need_online']:
test_stub.online_hotplug_cpu_memory(vm)
time.sleep(10)
test_util.test_dsc("STEP4: Destroy test object")
test_lib.lib_error_cleanup(test_obj_dict)
test_util.test_pass('VM online change instance offering Test Pass')
示例8: testmethod
def testmethod():
test_util.test_dsc("STEP1: Ceate vm instance offering")
vm_instance_offering = test_lib.lib_create_instance_offering(cpuNum=1, memorySize=1024*1024*1024)
tbj.add_instance_offering(vm_instance_offering)
test_util.test_dsc("STEP2: Ceate vm and wait until it up for testing")
vm = create_vm(vm_name='test_vm', image_name = test_image_name,
instance_offering_uuid=vm_instance_offering.uuid)
tbj.add_vm(vm)
vm.check()
cpu_change = random.randint(1, 5) if add_cpu else 0
mem_change = random.randint(1, 500)*1024*1024 if add_memory else 0
test_util.test_dsc("STEP3: Hot Plugin CPU: {} and Memory: {} and check capacity".format(cpu_change, mem_change))
with CapacityCheckerContext(vm, cpu_change, mem_change):
vm_ops.update_vm(vm.get_vm().uuid, vm_instance_offering.cpuNum+cpu_change,
vm_instance_offering.memorySize+mem_change)
vm.update()
if need_online:
online_hotplug_cpu_memory(vm)
time.sleep(10)
test_util.test_dsc("STEP4: Destroy test object")
test_lib.lib_error_cleanup(tbj)
test_util.test_pass('VM online change instance offering Test Pass')
示例9: test
def test():
test_util.test_dsc("STEP1: Ceate vm instance offering")
vm_instanc_offering = test_lib.lib_create_instance_offering(cpuNum = 2,
memorySize = 2 * 1024 * 1024 * 1024)
test_obj_dict.add_instance_offering(vm_instanc_offering)
test_util.test_dsc("STEP2: Ceate vm and wait until it up for testing")
vm = test_stub.create_vm(vm_name = 'window-telnet', image_name = "imageName_windows",
instance_offering_uuid=vm_instanc_offering.uuid)
test_obj_dict.add_vm(vm)
time.sleep(10)
test_util.test_dsc("STEP3: Hot Plugin CPU and Memory and check capacity")
cpu_change = random.randint(1,5)
mem_change = random.randint(1,500) * 1024 * 1024
with test_stub.CapacityCheckerContext(vm, cpu_change, mem_change, window=True):
# wait for 90s to ensure all the windows services up
time.sleep(90)
vm_ops.update_vm(vm.get_vm().uuid, vm_instanc_offering.cpuNum+cpu_change,
vm_instanc_offering.memorySize+mem_change)
vm.update()
time.sleep(10)
test_util.test_dsc("STEP4: Destroy test object")
test_lib.lib_error_cleanup(test_obj_dict)
test_util.test_pass('VM online change instance offering Test Pass')
示例10: test
def test():
test_util.test_dsc('Test update instance offering')
cond = res_ops.gen_query_conditions('state', '=', 'Enabled')
cond = res_ops.gen_query_conditions('status', '=', 'Connected', cond)
host = res_ops.query_resource_with_num(res_ops.HOST, cond, limit = 1)
if not host:
test_util.test_skip('No Enabled/Connected host was found, skip test.' )
return True
host_uuid = host[0].uuid
new_offering = test_lib.lib_create_instance_offering(cpuNum = 1, \
cpuSpeed = 16, memorySize = 536870912, name = 'orgin_instance_name')
test_obj_dict.add_instance_offering(new_offering)
vm = test_stub.create_vm(vm_name = 'test_update_instance_offering', \
host_uuid = host_uuid, \
instance_offering_uuid = new_offering.uuid)
test_obj_dict.add_vm(vm)
vm.stop()
#These parameters are need to be populated.
updated_offering = test_lib.lib_update_instance_offering(new_offering.uuid, cpuNum = 2, cpuSpeed = 16, \
memorySize = 1073741824, name = 'updated_instance_name', \
volume_iops = None, volume_bandwidth = None, \
net_outbound_bandwidth = None, net_inbound_bandwidth = None)
vm.start()
vm.check()
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('Test updated instance offering Pass')
示例11: test
def test():
global new_offering_uuid
test_util.test_dsc('Test VM network outbound & inbound bandwidth QoS by 1MB')
#unit is KB
net_bandwidth = 1*1024
new_offering = test_lib.lib_create_instance_offering(net_outbound_bandwidth = net_bandwidth*8*1024, \
net_inbound_bandwidth = net_bandwidth*8*1024)
new_offering_uuid = new_offering.uuid
vm = test_stub.create_vm(vm_name = 'vm_net_inbound_outbound_qos', \
instance_offering_uuid = new_offering.uuid)
test_obj_dict.add_vm(vm)
vm.check()
vm_inv = vm.get_vm()
test_stub.make_ssh_no_password(vm_inv)
test_stub.create_test_file(vm_inv, net_bandwidth)
test_stub.test_scp_vm_outbound_speed(vm_inv, net_bandwidth)
test_stub.test_scp_vm_inbound_speed(vm_inv, net_bandwidth)
vm_ops.delete_instance_offering(new_offering_uuid)
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('VM Network Outbound QoS Test Pass')
示例12: test
def test():
for bandwidth, net_out, net_in in itertools.product((None, BANDWIDTH), (None, NET_OUT), (None, NET_IN)):
instance_offering = test_lib.lib_create_instance_offering(name='test_offering',
volume_bandwidth=bandwidth,
net_outbound_bandwidth=net_out,
net_inbound_bandwidth=net_in)
test_obj_dict.add_instance_offering(instance_offering)
volume_list = test_stub.create_multi_volumes(ps=random.choice(res_ops.get_resource(res_ops.PRIMARY_STORAGE)))
for volume in volume_list:
test_obj_dict.add_volume(volume)
test_vm = test_stub.create_vm_with_random_offering(vm_name='test_vm', instance_offering_uuid=instance_offering.uuid,
l3_name='l3VlanNetwork2', image_name='imageName_net')
test_obj_dict.add_vm(test_vm)
for volume in volume_list:
volume.attach(test_vm)
volume.check()
test_vm.check()
for volume in volume_list:
volume.detach()
volume.check()
test_vm.check()
test_vm_with_datavol = test_stub.create_vm_with_random_offering(vm_name='test_vm_datavol', instance_offering_uuid=instance_offering.uuid,
disk_offering_uuids=[random.choice(res_ops.get_resource(res_ops.DISK_OFFERING)).uuid],
l3_name='l3VlanNetwork2', image_name='imageName_net')
test_obj_dict.add_vm(test_vm_with_datavol)
test_util.test_pass('Volume attach on QOS vm TEST PASS')
示例13: test
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')
示例14: test
def test():
global new_offering_uuid
test_util.test_dsc('Test VM disk bandwidth QoS by 20MB')
#unit is KB
volume_bandwidth = 5*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()
vm_inv = vm.get_vm()
test_stub.make_ssh_no_password(vm_inv)
test_stub.install_fio(vm_inv)
test_stub.test_fio_bandwidth(vm_inv, volume_bandwidth)
if vm_ops.get_vm_disk_qos(test_lib.lib_get_root_volume(vm_inv).uuid).volumeBandwidth != volume_bandwidth:
test_util.test_fail('Retrieved disk qos not match')
vm_ops.set_vm_disk_qos(test_lib.lib_get_root_volume(vm_inv).uuid, volume_bandwidth/2)
test_stub.test_fio_bandwidth(vm_inv, volume_bandwidth/2)
vm_ops.del_vm_disk_qos(test_lib.lib_get_root_volume(vm_inv).uuid)
if test_stub.test_fio_bandwidth(vm_inv, volume_bandwidth/2, raise_exception=False):
test_util.test_fail('disk qos is not expected to have limit after qos setting is deleted')
vm_ops.delete_instance_offering(new_offering_uuid)
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('VM Network QoS Test Pass')
示例15: test
def test():
global test_stub,test_obj_dict
vm = test_stub.create_arm_vm()
test_obj_dict.add_vm(vm)
vm.check()
vm.suspend()
vm.check()
vm.resume()
vm.check()
vm.reboot()
vm.check()
l3_name=os.environ.get('l3PublicNetworkName')
l3_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
vm.add_nic(l3_uuid)
# vm.check()
cpuNum = 2
memorySize = 666 * 1024 * 1024
new_offering = test_lib.lib_create_instance_offering(cpuNum = cpuNum,\
memorySize = memorySize)
test_obj_dict.add_instance_offering(new_offering)
vm.stop()
vm.change_instance_offering(new_offering.uuid)
vm.check()
vm.start()
vm.stop()
vm.check()
vm.reinit()
vm.check()
#time.sleep(5)
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('Create VM Test Success')