• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python vm_operations.delete_instance_offering函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中zstackwoodpecker.operations.vm_operations.delete_instance_offering函数的典型用法代码示例。如果您正苦于以下问题:Python delete_instance_offering函数的具体用法?Python delete_instance_offering怎么用?Python delete_instance_offering使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了delete_instance_offering函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: 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')
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:30,代码来源:test_del_disk_qos.py


示例2: 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')
开发者ID:TinaL3,项目名称:zstack-woodpecker,代码行数:34,代码来源:test_disk_qos2.py


示例3: test

def test():
    global new_offering_uuid
    test_util.test_dsc('Test VM network outbound 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)

    new_offering_uuid = new_offering.uuid

    vm = test_stub.create_vm(vm_name = 'vm_net_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)
    if test_stub.test_scp_vm_inbound_speed(vm_inv, net_bandwidth, raise_exception=False):
        test_util.test_fail('VM network inbound is not expected to be limited when only outbound qos is set')

    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')
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:26,代码来源:test_net_outbound_qos.py


示例4: 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')
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:25,代码来源:test_net_outbound_inbound_qos.py


示例5: error_cleanup

def error_cleanup():
    global volume_offering_uuid,new_offering_uuid
    test_lib.lib_error_cleanup(test_obj_dict)
    try:
        vm_ops.delete_instance_offering(new_offering_uuid)
        vol_ops.delete_disk_offering(volume_offering_uuid)
    except:
        pass
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:8,代码来源:test_vm_full_clone_write_qos.py


示例6: error_cleanup

def error_cleanup():
    global vm, all_volume_offering_uuid, rw_volume_offering_uuid, all_volume_uuid, rw_volume_uuid, test_account_session, instance_offering_uuid
    if vm:
        vm.destroy(test_account_session)
    vol_ops.delete_disk_offering(all_volume_offering_uuid)
    vol_ops.delete_disk_offering(rw_volume_offering_uuid)
    vol_ops.delete_volume(all_volume_uuid, test_account_session)
    vol_ops.delete_volume(rw_volume_uuid, test_account_session)
    acc_ops.delete_account(test_account_uuid)
    vm_ops.delete_instance_offering(instance_offering_uuid)
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:10,代码来源:test_normal_change_qos.py


示例7: test

def test():
    global new_offering_uuid
    test_util.test_dsc('Test VM disk bandwidth QoS by 20MB')

    #unit is KB
    write_bandwidth = 5*1024*1024
    read_bandwidth = 10*1024*1024
    new_offering = test_lib.lib_create_instance_offering(read_bandwidth=read_bandwidth, write_bandwidth=write_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, read_bandwidth)
    vm_ops.set_vm_disk_qos(test_lib.lib_get_root_volume(vm_inv).uuid, read_bandwidth*2)
    if vm_ops.get_vm_disk_qos(test_lib.lib_get_root_volume(vm_inv).uuid).volumeBandwidth != read_bandwidth*2:
        test_util.test_fail('Retrieved disk qos not match')
    if vm_ops.get_vm_disk_qos(test_lib.lib_get_root_volume(vm_inv).uuid).volumeBandwidthRead == read_bandwidth:
        test_util.test_fail('read qos must be cleared after set total qos')
    if vm_ops.get_vm_disk_qos(test_lib.lib_get_root_volume(vm_inv).uuid).volumeBandwidthWrite == write_bandwidth:
        test_util.test_fail('write qos must be cleared after set total qos')

    vm_ops.set_vm_disk_qos(test_lib.lib_get_root_volume(vm_inv).uuid, read_bandwidth*2, 'read')
    if vm_ops.get_vm_disk_qos(test_lib.lib_get_root_volume(vm_inv).uuid).volumeBandwidthRead != read_bandwidth*2:
        test_util.test_fail('Retrieved disk qos not match')

    test_stub.test_fio_bandwidth(vm_inv, read_bandwidth*2, '/dev/vda')
    vm_ops.del_vm_disk_qos(test_lib.lib_get_root_volume(vm_inv).uuid, mode='all')

    if test_stub.test_fio_bandwidth(vm_inv, read_bandwidth, '/dev/vda', raise_exception=False):
        test_util.test_fail('disk qos is not expected to have limit after qos setting is deleted')

    vm_ops.set_vm_disk_qos(test_lib.lib_get_root_volume(vm_inv).uuid, write_bandwidth*2, 'write')
    if vm_ops.get_vm_disk_qos(test_lib.lib_get_root_volume(vm_inv).uuid).volumeBandwidthWrite != write_bandwidth*2:
        test_util.test_fail('Retrieved disk qos not match')

    test_stub.test_fio_bandwidth(vm_inv, write_bandwidth*2)
    vm_ops.del_vm_disk_qos(test_lib.lib_get_root_volume(vm_inv).uuid, mode='all')

    if test_stub.test_fio_bandwidth(vm_inv, write_bandwidth, 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')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:53,代码来源:test_del_disk_rw_qos.py


示例8: 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 = 1024
    new_offering = test_lib.lib_create_instance_offering(net_outbound_bandwidth = net_bandwidth, \
            net_inbound_bandwidth = net_bandwidth)

    new_offering_uuid = new_offering.uuid

    vm1 = test_stub.create_vm(vm_name = 'vm_net_inbound_outbound_qos', \
            instance_offering_uuid = new_offering.uuid)
    test_obj_dict.add_vm(vm1)
    vm1.check()
    vm1_inv = vm1.get_vm()
    test_stub.make_ssh_no_password(vm1_inv)
    vm1_ip = vm1_inv.vmNics[0].ip

    vm2 = test_stub.create_vm(vm_name = 'vm_net_inbound_outbound_qos', \
            instance_offering_uuid = new_offering.uuid)
    test_obj_dict.add_vm(vm2)
    vm2.check()
    vm2_inv = vm2.get_vm()
    vm2_ip = vm2_inv.vmNics[0].ip

    test_stub.make_ssh_no_password(vm2_inv)
    test_stub.copy_key_file(vm1_inv)
    test_stub.copy_key_file(vm2_inv)
    test_stub.create_test_file(vm1_inv, net_bandwidth)
    test_stub.create_test_file(vm2_inv, net_bandwidth)
    l3_name = os.environ.get('l3VlanNetworkName1')
    l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
    vm1.add_nic(l3_net_uuid)
    vm2.add_nic(l3_net_uuid)
    ssh_cmd = 'ssh -oStrictHostKeyChecking=no -oCheckHostIP=no -oUserKnownHostsFile=/dev/null'
    cmd = "pkill dhclient"
    os.system("%s %s %s" % (ssh_cmd, vm1_ip, cmd))
    os.system("%s %s %s" % (ssh_cmd, vm2_ip, cmd))
    cmd = "dhclient eth0 eth1"
    os.system("%s %s %s" % (ssh_cmd, vm1_ip, cmd))
    os.system("%s %s %s" % (ssh_cmd, vm2_ip, cmd))

    test_stub.test_scp_outbound_speed(vm1_ip, test_lib.lib_get_vm_nic_by_l3(vm2.get_vm(), l3_net_uuid).ip, 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')
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:48,代码来源:test_net_outbound_inbound_qos2.py


示例9: error_cleanup

def error_cleanup():
    global vm, all_volume_offering_uuid, rw_volume_offering_uuid, all_volume_uuid, rw_volume_uuid, volume_offering_3, volume_offering_4, volume_offering_5, volume_offering_6 
    global instance_offering_uuid, volume_uuid_3, volume_uuid_4, volume_uuid_5, volume_uuid_6
    if vm:
        vm.destroy()
    vol_ops.delete_disk_offering(all_volume_offering_uuid)
    vol_ops.delete_disk_offering(rw_volume_offering_uuid)
    vol_ops.delete_disk_offering(volume_offering_3.uuid)
    vol_ops.delete_disk_offering(volume_offering_4.uuid)
    vol_ops.delete_disk_offering(volume_offering_5.uuid)
    vol_ops.delete_disk_offering(volume_offering_6.uuid)
    vol_ops.delete_volume(all_volume_uuid)
    vol_ops.delete_volume(rw_volume_uuid)
    vol_ops.delete_volume(volume_uuid_3)
    vol_ops.delete_volume(volume_uuid_4)
    vol_ops.delete_volume(volume_uuid_5)
    vol_ops.delete_volume(volume_uuid_6)
    vm_ops.delete_instance_offering(instance_offering_uuid)
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:18,代码来源:test_crt_vm_with_volumes_and_detach_attach_reboot_detach_attach_volume.py


示例10: test

def test():
    global new_offering_uuid
    test_util.test_dsc('Test VM disk bandwidth QoS by 20MB')

    #unit is KB
    write_bandwidth = 15*1024*1024
    new_offering = test_lib.lib_create_instance_offering(write_bandwidth=write_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)

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

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

    test_util.test_pass('VM Disk wirte QoS Test Pass')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:41,代码来源:test_disk_write_qos.py


示例11: test

def test():
    global new_offering_uuid
    test_util.test_dsc('Test VM disk IOPS by 200')

    volume_iops = 200
    new_offering = test_lib.lib_create_instance_offering(volume_iops = volume_iops)

    new_offering_uuid = new_offering.uuid

    vm = test_stub.create_vm(vm_name = 'vm_volume_iops', \
            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_iops(vm_inv, volume_iops)
    vm_ops.delete_instance_offering(new_offering_uuid)
    test_lib.lib_robot_cleanup(test_obj_dict)

    test_util.test_pass('VM Network IOPS Test Pass')
开发者ID:KevinDavidMitnick,项目名称:zstack-woodpecker,代码行数:22,代码来源:test_disk_iops.py


示例12: 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()
    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)
    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')
开发者ID:KevinDavidMitnick,项目名称:zstack-woodpecker,代码行数:23,代码来源:test_disk_qos.py


示例13: test

def test():
    global deploy_conf
    global vm_inv
    global vm

    test_util.test_dsc('Test Delete VR Offering and Teboot Normal VM')

    vm = test_stub.create_basic_vm()
    test_obj_dict.add_vm(vm)

    vm_inv = vm.get_vm()
    vm_ip = vm_inv.vmNics[0].ip
  
    vm.check()
    
    test_util.test_dsc('Record current virtual router offering information')
    deploy_conf = exp_ops.export_zstack_deployment_config(test_lib.deploy_config)
    cond = res_ops.gen_query_conditions('zone.vmInstance.uuid', '=', vm_inv.uuid)
    vr_offering_uuid = res_ops.query_resource(res_ops.VR_OFFERING, cond)[0].uuid

    test_util.test_dsc('Delete VR-RM and VR-Offering')
    cond = res_ops.gen_query_conditions('zone.vmInstance.uuid', '=', vm_inv.uuid)
    vr_vm_uuid = res_ops.query_resource(res_ops.VIRTUALROUTER_VM, cond)[0].uuid

    vm_ops.destroy_vm(vr_vm_uuid)
    vm_ops.delete_instance_offering(vr_offering_uuid)

    test_util.test_dsc('Create new VR-Offering, same as the former one, stop and start VM')
    session_uuid = acc_ops.login_as_admin()
    dep_ops.add_virtual_router(None, None, deploy_conf, session_uuid) 
    vm.reboot()

    vm.destroy()
    test_obj_dict.rm_vm(vm)

    test_util.test_pass('Delete VR Offering and reboot normal VM: SUCCESS')
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:36,代码来源:test_delete_vr_offering_reboot_vm.py


示例14: error_cleanup

def error_cleanup():
    test_lib.lib_error_cleanup(test_obj_dict)
    if original_rate:
        test_lib.lib_set_provision_memory_rate(original_rate)
    if new_offering_uuid:
        vm_ops.delete_instance_offering(new_offering_uuid)
开发者ID:TinaL3,项目名称:zstack-woodpecker,代码行数:6,代码来源:test_parallel_crt_vm_to_use_all_mem.py


示例15: error_cleanup

def error_cleanup():
    test_lib.lib_error_cleanup(test_obj_dict)
    try:
        vm_ops.delete_instance_offering(new_offering_uuid)
    except:
        pass
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:6,代码来源:test_disk_rw_qos.py


示例16: error_cleanup

def error_cleanup():
    test_lib.lib_error_cleanup(test_obj_dict)
    if new_offering_uuid:
        vm_ops.delete_instance_offering(new_offering_uuid)
开发者ID:TinaL3,项目名称:zstack-woodpecker,代码行数:4,代码来源:test_net_inbound_qos.py


示例17: test

def test():
    global original_rate
    global new_offering_uuid
    test_util.test_dsc('Test memory over provision method')
    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 = host[0]
    over_provision_rate = 2
    target_vm_num = 4

    host_res = test_lib.lib_get_cpu_memory_capacity(host_uuids = [host.uuid])
    real_availableMemory = host_res.availableMemory
    avail_mem = real_availableMemory * over_provision_rate
    if avail_mem <= 1024*1024*1024:
        test_util.test_skip('Available memory is less than 512MB, skip test.')
        return True

    test_util.test_logger('host available memory is: %s' % host_res.availableMemory)

    original_rate = test_lib.lib_set_provision_memory_rate(over_provision_rate)

    new_offering_mem = int((avail_mem - 1) / target_vm_num)
    if (new_offering_mem % 2) != 0 :
        new_offering_mem = new_offering_mem - 1 
    new_offering = test_lib.lib_create_instance_offering(memorySize = new_offering_mem)

    new_offering_uuid = new_offering.uuid

    times = 1
    while (times <= target_vm_num):
        try:
            vm_name = 'mem_over_prs_vm_%d' % times
            vm = test_stub.create_vm(vm_name = vm_name, \
                    host_uuid = host.uuid, \
                    instance_offering_uuid = new_offering.uuid)
            test_obj_dict.add_vm(vm)
            host_res_new = test_lib.lib_get_cpu_memory_capacity(host_uuids = [host.uuid])
            test_util.test_logger('After create vm: %s, host available memory is: %s' % (vm_name, host_res_new.availableMemory))
        except Exception as e:
            test_util.test_logger("Unexpected VM Creation Failure in memory over provision test. Previous available memory is %s" % host_res_new.availableMemory)
            raise e

        times += 1

    host_res2 = test_lib.lib_get_cpu_memory_capacity(host_uuids = [host.uuid])
    avail_mem2 = host_res2.availableMemory
    if avail_mem2 > new_offering_mem:
        test_util.test_fail('Available memory: %d is still bigger than offering memory: %d , after creating 4 vms.' % (avail_mem2, new_offering_mem))
    
    try:
        vm = test_stub.create_vm(vm_name = 'mem_over_prs_vm_bad', \
                host_uuid = host.uuid, \
                instance_offering_uuid = new_offering.uuid)
        test_obj_dict.add_vm(vm)
    except:
        test_util.test_logger("Expected VM Creation Failure in memory over provision test. ")
    else:
        test_util.test_fail("The 5th VM is still created up, which is wrong")

    test_lib.lib_set_provision_memory_rate(original_rate)
    vm_ops.delete_instance_offering(new_offering_uuid)
    test_lib.lib_robot_cleanup(test_obj_dict)

    test_util.test_pass('Memory Over Provision Test Pass')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:69,代码来源:test_memory_over_provision.py


示例18: test

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 = 'password'
    os.system("sshpass -p '%s' ssh %[email protected]%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')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:74,代码来源:test_vm_full_clone_write_qos.py


示例19: test

def test():
    data_volume_size = 10737418240
    disk_offering_option = test_util.DiskOfferingOption()
    disk_offering_option.set_name('root-disk-iso')
    disk_offering_option.set_diskSize(data_volume_size)
    data_volume_offering = vol_ops.create_volume_offering(disk_offering_option)
    test_obj_dict.add_disk_offering(data_volume_offering)

    cpuNum = 1
    cpuSpeed = 16
    memorySize = 536870912
    name = 'vm-offering-iso'
    new_offering_option = test_util.InstanceOfferingOption()
    new_offering_option.set_cpuNum(cpuNum)
    new_offering_option.set_cpuSpeed(cpuSpeed)
    new_offering_option.set_memorySize(memorySize)
    new_offering_option.set_name(name)
    new_offering = vm_ops.create_instance_offering(new_offering_option)
    test_obj_dict.add_instance_offering(new_offering)

    img_option = test_util.ImageOption()
    img_option.set_name('image-iso')
    bs_uuid = res_ops.query_resource_fields(res_ops.BACKUP_STORAGE, [], None)[0].uuid
    img_option.set_backup_storage_uuid_list([bs_uuid])
    img_option.set_url('http://172.20.1.15:7480/iso/iso_for_install_vm_test.iso')
    image_inv = img_ops.add_iso_template(img_option)
    image_uuid = image_inv.uuid
    image = test_image.ZstackTestImage()
    image.set_image(image_inv)
    image.set_creation_option(img_option)
    test_obj_dict.add_image(image)

    l3_name = os.environ.get('l3PublicNetworkName')
    l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
    root_disk_uuid = data_volume_offering.uuid
    vm = test_stub.create_vm_with_iso([l3_net_uuid], image_uuid, 'vm-iso', root_disk_uuid, new_offering.uuid)
    test_obj_dict.add_vm(vm)
    
    test_util.test_dsc('wait for iso installation')    
    vm_inv = vm.get_vm()
    vm_ip = vm_inv.vmNics[0].ip

    test_lib.lib_wait_target_up(vm_ip, '22', 2400)

    cmd ='[ -e /root ] && echo yes || echo no' 
    ssh_num = 0
    ssh_ok = 0
    while ssh_num <= 5 and ssh_ok == 0 :
        rsp = test_lib.lib_execute_ssh_cmd(vm_ip, 'root', 'password', cmd, 180)
        if rsp == False:
            time.sleep(30)
        else:
            ssh_ok = 1
            break  
        ssh_num = ssh_num + 1

    if ssh_ok == 0:
        test_util.test_fail('fail to ssh to VM')

    vm.check()

    vm.destroy()
    test_obj_dict.rm_vm(vm)

    image.delete()
    test_obj_dict.rm_image(image)

    vol_ops.delete_disk_offering(root_disk_uuid)
    test_obj_dict.rm_disk_offering(data_volume_offering)

    vm_ops.delete_instance_offering(new_offering.uuid)
    test_obj_dict.rm_instance_offering(new_offering)

    test_util.test_pass('Create VM with ISO Installation Test Success')
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:74,代码来源:test_create_vm_install_iso.py


示例20: test


#.........这里部分代码省略.........
    vm_ops.set_vm_disk_qos(test_lib.lib_get_root_volume(vm_inv).uuid, volumeBandwidth = write_bandwidth/2, mode = 'write', session_uuid = test_account_session)

    #set data disk all_volume_uuid qos
    test_util.test_dsc('set read*2, read/2, write*2, write/2 and del the volume1 disk read and write qos')    
    try:
    	vm_ops.set_vm_disk_qos(all_volume_uuid, volumeBandwidth = volume_bandwidth*2, session_uuid = test_account_session)
    except:
	print "Test results were in line with expectations"
	pass

    test_util.test_dsc('del the data volume qos')    
    try:
    	vm_ops.del_vm_disk_qos(all_volume_uuid, session_uuid = test_account_session)
    except:
	print "Test results were in line with expectations"
	pass

    vm_ops.set_vm_disk_qos(all_volume_uuid, volumeBandwidth = volume_bandwidth/2, session_uuid = test_account_session)

    #set data disk rw_volume_uuid write qos
    test_util.test_dsc('set 2 times the data rw_volume_uuid write qos')    
    try:
    	vm_ops.set_vm_disk_qos(rw_volume_uuid, volumeBandwidth = volume_write_bandwidth*2, mode = 'write', session_uuid = test_account_session)
    except:
	print "Test results were in line with expectations"
	pass

    test_util.test_dsc('del the data rw_volume_uuid  write qos')
    try:
    	vm_ops.del_vm_disk_qos(rw_volume_uuid, mode = 'write', session_uuid = test_account_session)
    except:
	print "Test results were in line with expectations"
	pass

    vm_ops.set_vm_disk_qos(rw_volume_uuid, volumeBandwidth = volume_write_bandwidth/2, mode = 'write', session_uuid = test_account_session)

    #set data disk rw_volume_uuid read qos
    test_util.test_dsc('set 2 times the data rw_volume_uuid read qos')    
    try:
    	vm_ops.set_vm_disk_qos(rw_volume_uuid, volumeBandwidth = volume_read_bandwidth*2, mode = 'read', session_uuid = test_account_session)
    except:
	print "Test results were in line with expectations"
	pass
    test_util.test_dsc('del the data rw_volume_uuid read qos')
    try:
    	vm_ops.del_vm_disk_qos(rw_volume_uuid, mode = 'read', session_uuid = test_account_session)
    except:
	print "Test results were in line with expectations"
	pass
    vm_ops.set_vm_disk_qos(rw_volume_uuid, volumeBandwidth = volume_read_bandwidth/2, mode = 'read', session_uuid = test_account_session)

   # set the vm nic qos
    test_util.test_dsc('set higher than net out and in ')    
    try:
	vm_ops.set_vm_nic_qos(vm_nic.uuid, outboundBandwidth = net_outbound_bandwidth*2, inboundBandwidth = net_inbound_bandwidth*2, session_uuid = test_account_session)
    except:
	print "Test results were in line with expectations"
	pass

    test_util.test_dsc('set higher than net out and equal in ')    
    try:
	vm_ops.set_vm_nic_qos(vm_nic.uuid, outboundBandwidth = net_outbound_bandwidth*2, inboundBandwidth = net_inbound_bandwidth, session_uuid = test_account_session)
    except:
	print "Test results were in line with expectations"
	pass

    test_util.test_dsc('del net  in ')    
    try:
	vm_ops.del_vm_nic_qos(vm_nic.uuid, direction = 'in', session_uuid = test_account_session)
    except:
	print "Test results were in line with expectations"
	pass

    test_util.test_dsc('del net out ')    
    try:
	vm_ops.del_vm_nic_qos(vm_nic.uuid, direction = 'out', session_uuid = test_account_session)
    except:
	print "Test results were in line with expectations"
	pass

    test_util.test_dsc('set equal net out and  in ')    
    try:
	vm_ops.set_vm_nic_qos(vm_nic.uuid, outboundBandwidth = net_outbound_bandwidth, inboundBandwidth = net_inbound_bandwidth, session_uuid = test_account_session)
    #except:
    except Exception as e:	
	test_util.test_logger(e)

    test_util.test_dsc('set below net out and  in ')    
    vm_ops.set_vm_nic_qos(vm_nic.uuid, outboundBandwidth = net_outbound_bandwidth/2, inboundBandwidth = net_inbound_bandwidth/2, session_uuid = test_account_session)

    vm.check()
    vm.destroy(test_account_session)
    vm.check()
    vol_ops.delete_disk_offering(all_volume_offering_uuid)
    vol_ops.delete_disk_offering(rw_volume_offering_uuid)
    vol_ops.delete_volume(all_volume_uuid, test_account_session)
    vol_ops.delete_volume(rw_volume_uuid, test_account_session)
    acc_ops.delete_account(test_account_uuid)    
    vm_ops.delete_instance_offering(instance_offering_uuid)
    test_util.test_pass('Create VM Test Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:101,代码来源:test_normal_change_qos.py



注:本文中的zstackwoodpecker.operations.vm_operations.delete_instance_offering函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python vm_operations.reconnect_vr函数代码示例发布时间:2022-05-26
下一篇:
Python resource_operations.query_resource_fields函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap