本文整理汇总了Python中zstackwoodpecker.operations.resource_operations.query_resource_fields函数的典型用法代码示例。如果您正苦于以下问题:Python query_resource_fields函数的具体用法?Python query_resource_fields怎么用?Python query_resource_fields使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了query_resource_fields函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test
def test():
global session_to
global session_mc
global session_uuid
session_uuid = acc_ops.login_as_admin()
session_to = con_ops.change_global_config('identity', 'session.timeout', '720000', session_uuid)
session_mc = con_ops.change_global_config('identity', 'session.maxConcurrent', '10000', session_uuid)
cond = res_ops.gen_query_conditions('type', '=', inventory.USER_VM_TYPE)
num = res_ops.query_resource_count(res_ops.VM_INSTANCE, cond, session_uuid)
if num <= thread_threshold:
vms = res_ops.query_resource(res_ops.VM_INSTANCE, cond, session_uuid)
destroy_vms(vms)
else:
start = 0
limit = thread_threshold - 1
curr_num = start
vms = []
while curr_num < num:
vms_temp = res_ops.query_resource_fields(res_ops.VM_INSTANCE, \
cond, session_uuid, ['uuid'], start, limit)
vms.extend(vms_temp)
curr_num += limit
start += limit
destroy_vms(vms)
vip_num = res_ops.query_resource_count(res_ops.VIP, [], session_uuid)
if vip_num <= thread_threshold:
vips = res_ops.query_resource(res_ops.VIP, [], session_uuid)
destroy_vips(vips)
else:
start = 0
limit = thread_threshold - 1
curr_num = start
vms = []
while curr_num < vip_num:
vips_temp = res_ops.query_resource_fields(res_ops.VIP, \
[], session_uuid, ['uuid'], start, limit)
vips.extend(vips_temp)
curr_num += limit
start += limit
destroy_vips(vips)
#con_ops.change_global_config('identity', 'session.timeout', session_to)
#con_ops.change_global_config('identity', 'session.maxConcurrent', session_mc)
left_num = res_ops.query_resource_count(res_ops.VM_INSTANCE, cond, session_uuid)
if left_num == 0:
test_util.test_pass('None VR VMs destroy Success. Destroy %d VMs.' % num)
else:
test_util.test_fail('None VR VMs destroy Fail. %d VMs are not Destroied.' % left_num)
left_num = res_ops.query_resource_count(res_ops.VIP, [], session_uuid)
if left_num == 0:
test_util.test_pass('VIP destroy Success. Destroy %d VIP.' % num)
else:
test_util.test_fail('VIP destroy Fail. %d VIP are not Destroied.' % left_num)
con_ops.change_global_config('identity', 'session.timeout', session_to, session_uuid)
con_ops.change_global_config('identity', 'session.maxConcurrent', session_mc, session_uuid)
acc_ops.logout(session_uuid)
开发者ID:chancelq,项目名称:zstack-woodpecker,代码行数:60,代码来源:destroy_none_vr_vms.py
示例2: test
def test():
if os.environ.get('CASE_FLAVOR'):
flavor = case_flavor[os.environ.get('CASE_FLAVOR')]
num = flavor['vol_num']
else:
num = 10000
hostUuid = ''
hostName = ''
diskOfferingUuid = res_ops.query_resource_fields(res_ops.DISK_OFFERING)[0].uuid
hosts = res_ops.query_resource_fields(res_ops.HOST)
counter = 0
for i in range(0, 500):
hostUuid = hosts[i].uuid
hostName = hosts[i].name
clusterUuid = hosts[i].clusterUuid
cond = res_ops.gen_query_conditions('cluster.uuid', '=', clusterUuid)
psUuid = res_ops.query_resource_fields(res_ops.PRIMARY_STORAGE, cond)[0].uuid
for j in range(0, 20):
counter += 1
if counter > num:
test_util.test_pass("Create %s volumes finished" %num)
volName = 'vol-'+str(j)+'-on-host-'+hostName
thread = threading.Thread(target=create_vol, args=(volName, diskOfferingUuid, hostUuid, psUuid))
while threading.active_count() > 100:
time.sleep(5)
thread.start()
test_util.test_fail("Fail to create vms")
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:27,代码来源:test_create_volumes.py
示例3: test
def test():
if os.environ.get('CASE_FLAVOR'):
flavor = case_flavor[os.environ.get('CASE_FLAVOR')]
num = flavor['vm_num']
else:
num = 10000
cond = res_ops.gen_query_conditions('system', '=', 'false')
imageUuid = res_ops.query_resource_fields(res_ops.IMAGE, cond)[0].uuid
hostUuid = ''
hostName = ''
cond = res_ops.gen_query_conditions('type', '=', 'UserVm')
instanceOfferingUuid = res_ops.query_resource_fields(res_ops.INSTANCE_OFFERING, cond)[0].uuid
cond = res_ops.gen_query_conditions('system', '=', 'false')
l3NetworkUuids = res_ops.query_resource_fields(res_ops.L3_NETWORK, cond)[0].uuid
hosts = res_ops.query_resource_fields(res_ops.HOST)
counter = 0
for i in range(0, 500):
hostUuid = hosts[i].uuid
hostName = hosts[i].name
for j in range(0, 20):
counter += 1
if counter > num:
test_util.test_pass("Create %s vms finished" %num)
vm_name = 'vm-'+str(j)+'-on-host-'+hostName
thread = threading.Thread(target=create_vm, args=(vm_name, imageUuid, hostUuid, instanceOfferingUuid, l3NetworkUuids))
while threading.active_count() > 10:
time.sleep(5)
thread.start()
test_util.test_fail("Fail to create vms")
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:29,代码来源:test_create_vms.py
示例4: test
def test():
global new_image
bs_cond = res_ops.gen_query_conditions("status", '=', "Connected")
bss = res_ops.query_resource_fields(res_ops.BACKUP_STORAGE, bs_cond, \
None, fields=['uuid'])
if not bss:
test_util.test_skip("not find available backup storage. Skip test")
if bss[0].type != inventory.CEPH_BACKUP_STORAGE_TYPE:
if hasattr(inventory, 'IMAGE_STORE_BACKUP_STORAGE_TYPE') and bss[0].type != inventory.IMAGE_STORE_BACKUP_STORAGE_TYPE:
test_util.test_skip("not find available imagestore or ceph backup storage. Skip test")
thread = threading.Thread(target=add_image, args=(bss[0].uuid, ))
thread.start()
time.sleep(5)
image_cond = res_ops.gen_query_conditions("status", '=', "Downloading")
image = res_ops.query_resource_fields(res_ops.IMAGE, image_cond, \
None, fields=['uuid'])
progress = res_ops.get_task_progress(image[0].uuid)
if int(progress.progress) < 0 or int(progress.progress) > 100:
test_util.test_fail("Progress of task should be between 0 and 100, while it actually is %s" % (progress.progress))
thread.join()
new_image.delete()
if test_lib.lib_get_image_delete_policy() != 'Direct':
new_image.expunge()
test_util.test_pass('Add image Progress Test Success')
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:29,代码来源:test_add_image_progress.py
示例5: destroy_initial_database
def destroy_initial_database():
zoneinvs = res_ops.query_resource_fields(res_ops.ZONE, [], None, ['uuid'])
for zoneinv in zoneinvs:
zone_operations.delete_zone(zoneinv.uuid)
backstorageinvs = res_ops.query_resource_fields(res_ops.BACKUP_STORAGE, [], None, ['uuid'])
for backstorageinv in backstorageinvs:
bs_operations.delete_backup_storage(backstorageinv.uuid)
iam2_ops.clean_iam2_enviroment()
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:8,代码来源:case_setup.py
示例6: test
def test():
global session_to
global session_mc
global session_uuid
session_uuid = acc_ops.login_as_admin()
session_to = con_ops.change_global_config('identity', 'session.timeout', '720000')
session_mc = con_ops.change_global_config('identity', 'session.maxConcurrent', '10000')
cond = []
num = res_ops.query_resource_count(res_ops.VM_INSTANCE, cond)
if num <= thread_threshold:
vms = res_ops.query_resource(res_ops.VM_INSTANCE, cond)
destroy_vms(vms)
else:
start = 0
limit = thread_threshold - 1
curr_num = start
vms = []
while curr_num < num:
vms_temp = res_ops.query_resource_fields(res_ops.VM_INSTANCE, \
cond, None, ['uuid'], start, limit)
vms.extend(vms_temp)
curr_num += limit
start += limit
destroy_vms(vms)
vip_num = res_ops.query_resource_count(res_ops.VIP, [], session_uuid)
if vip_num <= thread_threshold:
vips = res_ops.query_resource(res_ops.VIP, [], session_uuid)
destroy_vips(vips)
else:
start = 0
limit = thread_threshold - 1
curr_num = start
vms = []
while curr_num < vip_num:
vips_temp = res_ops.query_resource_fields(res_ops.VIP, \
[], session_uuid, ['uuid'], start, limit)
vips.extend(vips_temp)
curr_num += limit
start += limit
destroy_vips(vips)
test_util.test_pass('vms destroy Success. Destroy %d VMs.' % num)
con_ops.change_global_config('identity', 'session.timeout', session_to)
con_ops.change_global_config('identity', 'session.maxConcurrent', session_mc)
acc_ops.logout(session_uuid)
开发者ID:chancelq,项目名称:zstack-woodpecker,代码行数:48,代码来源:destroy_all_vms.py
示例7: test
def test():
global vcenter_uuid
vcenter1_name = os.environ['vcenter1_name']
vcenter1_domain_name = os.environ['vcenter1_ip']
vcenter1_username = os.environ['vcenter1_domain_name']
vcenter1_password = os.environ['vcenter1_password']
vm_network_pattern1 = os.environ['vcenter1_network_pattern1']
#add vcenter senario1:
zone_uuid = res_ops.get_resource(res_ops.ZONE)[0].uuid
inv = vct_ops.add_vcenter(vcenter1_name, vcenter1_domain_name, vcenter1_username, vcenter1_password, True, zone_uuid)
vcenter_uuid = inv.uuid
if vcenter_uuid == None:
test_util.test_fail("vcenter_uuid is None")
#insert the basic operations for the newly join in vcenter resourse
vm_network_list = []
vm_network_names = res_ops.query_resource_fields(res_ops.L3_NETWORK, [], None, fields=['name'])
for vm_network in vm_network_names:
vm_network_list.append(vm_network.name)
test_util.test_logger( ", ".join( [ str(vm_network_tmp) for vm_network_tmp in vm_network_list ] ) )
if vm_network_pattern1 not in vm_network_list:
test_util.test_fail("newly joined vcenter missing vm network1, test failed")
vct_ops.delete_vcenter(vcenter_uuid)
test_util.test_pass("add && delete vcenter test passed.")
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:31,代码来源:test_vcenter_check_exist_network.py
示例8: test
def test():
global session_to
global session_mc
global session_uuid
session_to = con_ops.change_global_config("identity", "session.timeout", "720000", session_uuid)
session_mc = con_ops.change_global_config("identity", "session.maxConcurrent", "10000", session_uuid)
session_uuid = acc_ops.login_as_admin()
num = res_ops.query_resource_count(res_ops.SECURITY_GROUP, [], session_uuid)
if num <= thread_threshold:
sgs = res_ops.query_resource(res_ops.SECURITY_GROUP, [], session_uuid)
delete_sgs(sgs)
else:
start = 0
limit = thread_threshold - 1
curr_num = start
sgs = []
while curr_num < num:
sgs_tmp = res_ops.query_resource_fields(res_ops.SECURITY_GROUP, [], session_uuid, ["uuid"], start, limit)
sgs.extend(sgs_tmp)
curr_num += limit
start += limit
delete_sgs(sgs)
# con_ops.change_global_config('identity', 'session.timeout', session_to)
# con_ops.change_global_config('identity', 'session.maxConcurrent', session_mc)
con_ops.change_global_config("identity", "session.timeout", session_to, session_uuid)
con_ops.change_global_config("identity", "session.maxConcurrent", session_mc, session_uuid)
left_num = res_ops.query_resource_count(res_ops.SECURITY_GROUP, [], session_uuid)
acc_ops.logout(session_uuid)
if left_num == 0:
test_util.test_pass("Delete SG Success. Delete %d SGs." % num)
else:
test_util.test_fail("Delete SG Fail. %d SGs are not deleted." % left_num)
开发者ID:lstfyt,项目名称:zstack-woodpecker,代码行数:34,代码来源:delete_sg.py
示例9: test
def test():
test_util.test_logger("start cpu billing")
test_util.test_logger("create man cpu billing instantiation")
bill_cpu = test_stub.CpuBilling()
test_util.test_logger("loop 400 to create cpu billing")
test_stub.create_option_billing(bill_cpu, count)
test_util.test_logger("verify cpu billing instantiation if is right,and then delete all")
test_stub.verify_option_billing(count)
test_util.test_logger("create cpu billing instantiation")
bill_cpu.set_timeUnit("s")
bill_cpu.set_price("5")
bill_cpu.create_resource_type()
test_util.test_logger("create vm instance")
global vm
vm = test_stub.create_vm_billing("test_vmm", test_stub.set_vm_resource()[0], None,\
test_stub.set_vm_resource()[1], test_stub.set_vm_resource()[2])
cpuNum = res_ops.query_resource_fields(res_ops.INSTANCE_OFFERING, \
res_ops.gen_query_conditions('uuid', '=',\
test_stub.set_vm_resource()[1]))[0].cpuNum
time.sleep(1)
if bill_cpu.get_price_total().total < cpuNum * int(bill_cpu.get_price()):
test_util.test_fail("calculate cpu cost fail,actual result is %s" %(bill_cpu.get_price_total().total))
vm.clean()
bill_cpu.delete_resource()
test_util.test_pass("check cpu billing pass")
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:31,代码来源:test_cpu_billing.py
示例10: delete_all_volumes
def delete_all_volumes(thread_threshold = 1000):
session_uuid = acc_ops.login_as_admin()
session_to = con_ops.change_global_config('identity', 'session.timeout', '720000')
session_mc = con_ops.change_global_config('identity', 'session.maxConcurrent', '10000')
delete_policy = test_lib.lib_set_delete_policy('volume', 'Direct')
expunge_time = test_lib.lib_set_expunge_time('volume', 1)
cond = res_ops.gen_query_conditions('status', '!=', 'Deleted')
num = res_ops.query_resource_count(res_ops.VOLUME, cond)
if num <= thread_threshold:
volumes = res_ops.query_resource(res_ops.VOLUME, cond)
do_delete_volumes(volumes, thread_threshold)
else:
start = 0
limit = thread_threshold - 1
curr_num = start
volumes = []
while curr_num < num:
volumes_temp = res_ops.query_resource_fields(res_ops.VOLUME, \
cond, None, ['uuid'], start, limit)
volumes.extend(volumes_temp)
curr_num += limit
start += limit
do_delete_volumes(volumes, thread_threshold)
test_lib.lib_set_delete_policy('volume', delete_policy)
test_lib.lib_set_expunge_time('volume', expunge_time)
test_util.test_logger('Volumes destroy Success. Destroy %d Volumes.' % num)
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:28,代码来源:clean_util.py
示例11: delete_all_volumes
def delete_all_volumes(thread_threshold=1000):
session_uuid = acc_ops.login_as_admin()
session_to = con_ops.change_global_config("identity", "session.timeout", "720000")
session_mc = con_ops.change_global_config("identity", "session.maxConcurrent", "10000")
delete_policy = test_lib.lib_set_delete_policy("volume", "Direct")
expunge_time = test_lib.lib_set_expunge_time("volume", 1)
cond = res_ops.gen_query_conditions("status", "!=", "Deleted")
num = res_ops.query_resource_count(res_ops.VOLUME, cond)
if num <= thread_threshold:
volumes = res_ops.query_resource(res_ops.VOLUME, cond)
do_delete_volumes(volumes, thread_threshold)
else:
start = 0
limit = thread_threshold - 1
curr_num = start
volumes = []
while curr_num < num:
volumes_temp = res_ops.query_resource_fields(res_ops.VOLUME, cond, None, ["uuid"], start, limit)
volumes.extend(volumes_temp)
curr_num += limit
start += limit
do_delete_volumes(volumes, thread_threshold)
test_lib.lib_set_delete_policy("volume", delete_policy)
test_lib.lib_set_expunge_time("volume", expunge_time)
test_util.test_logger("Volumes destroy Success. Destroy %d Volumes." % num)
开发者ID:lstfyt,项目名称:zstack-woodpecker,代码行数:27,代码来源:clean_util.py
示例12: test
def test():
test_util.test_logger("start memory billing")
test_util.test_logger("create man memory billing instantiation")
bill_memory = test_stub.MemoryBilling()
test_util.test_logger("loop 400 to create memory billing")
test_stub.create_option_billing(bill_memory, count)
test_util.test_logger("verify memory billing instantiation if is right,and then delete all")
test_stub.verify_option_billing(count)
test_util.test_logger("create memory billing instantiation")
bill_memory.set_timeUnit("s")
bill_memory.set_price("5")
bill_memory.create_resource_type()
test_util.test_logger("create vm instance")
global vm
vm = test_stub.create_vm_billing("test_vmm", test_stub.set_vm_resource()[0], None,\
test_stub.set_vm_resource()[1], test_stub.set_vm_resource()[2])
vm_memory_size_ratio = res_ops.query_resource_fields(res_ops.INSTANCE_OFFERING, \
res_ops.gen_query_conditions('uuid', '=',\
test_stub.set_vm_resource()[1]))[0].memorySize / 1024 / 1024 / float(1024)
time.sleep(1)
if float(bill_memory.get_price()) * vm_memory_size_ratio > bill_memory.get_price_total().total:
test_util.test_fail("calculate memory cost fail,actual result is %s" %(bill_memory.get_price_total().total))
vm.clean()
bill_memory.delete_resource()
test_util.test_pass("check memory billing pass")
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:31,代码来源:test_memory_billing.py
示例13: test
def test():
global new_image
bs_cond = res_ops.gen_query_conditions("status", '=', "Connected")
bss = res_ops.query_resource_fields(res_ops.BACKUP_STORAGE, bs_cond, \
None)
if not bss:
test_util.test_skip("not find available backup storage. Skip test")
for bs in bss:
if bs.type == inventory.IMAGE_STORE_BACKUP_STORAGE_TYPE:
break
if bs.type == inventory.SFTP_BACKUP_STORAGE_TYPE:
break
if bs.type == inventory.CEPH_BACKUP_STORAGE_TYPE:
break
else:
test_util.test_skip('Not find image store type backup storage.')
image_option = test_util.ImageOption()
image_option.set_format('raw')
image_option.set_name('test_file_url_image')
image_option.set_system_tags('qemuga')
image_option.set_mediaType('RootVolumeTemplate')
image_option.set_url("file:///etc/issue")
image_option.set_backup_storage_uuid_list([bss[0].uuid])
image_option.set_timeout(60000)
new_image = zstack_image_header.ZstackTestImage()
new_image.set_creation_option(image_option)
new_image.add_root_volume_template()
new_image.delete()
test_util.test_pass('test add file:///image.raw passed.')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:35,代码来源:test_add_image_file_url.py
示例14: check
def check(self):
super(zstack_share_volume_attach_db_checker, self).check()
volume = self.test_obj.volume
try:
sv_cond = res_ops.gen_query_conditions("volumeUuid", '=', volume.uuid)
share_volume_vm_uuids = res_ops.query_resource_fields(res_ops.SHARE_VOLUME, sv_cond, None, fields=['vmInstanceUuid'])
except Exception as e:
traceback.print_exc(file=sys.stdout)
test_util.test_logger('Check result: [volumeInventory uuid:] %s does not exist in database.' % self.test_obj.volume.uuid)
return self.judge(False)
if not share_volume_vm_uuids:
#update self.test_obj, due to vm destroyed.
if self.test_obj.target_vm.state == vm_header.DESTROYED or \
self.test_obj.target_vm.state == vm_header.EXPUNGED:
test_util.test_warn('Update test [volume:] %s state, since attached VM was destroyed.' % volume.uuid)
self.test_obj.update()
else:
test_util.test_warn('Check warn: [volume:] %s state is not aligned with DB. DB did not record any attached VM, but test volume has attached vm record: %s.' % (volume.uuid, volume.vmInstanceUuid))
test_util.test_logger('Check result: [volume:] %s does NOT have vmInstanceUuid in Database. It is not attached to any vm.' % volume.uuid)
return self.judge(False)
if not self.test_obj.target_vm:
test_util.test_logger('Check result: test [volume:] %s does NOT have vmInstance record in test structure. Can not do furture checking.' % volume.uuid)
return self.judge(False)
vm = self.test_obj.target_vm.vm
if vm.uuid not in share_volume_vm_uuids:
test_util.test_logger('Check result: [volume:] %s is attached to [vm:] %s in zstack database.' % (volume.uuid, vm.uuid))
return self.judge(True)
else:
test_util.test_logger('Check result: [volume:] %s is NOT attached to [vm:] %s in zstack database.' % (volume.uuid, vm.uuid))
return self.judge(False)
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:35,代码来源:zstack_db_checker.py
示例15: test
def test():
success_round = 0
for i in range(0,vm_max):
test_util.test_logger("clear %s data" % billing_resource)
test_stub.resource_price_clear(billing_resource)
test_util.test_logger("=====SPENDING CHECK VM %s=====" % str(i+1))
bill_memory = test_stub.MemoryBilling()
time_unit = random.choice(time_unit_dict)
price = str(random.randint(0,9999))
resource_unit = random.choice(resource_unit_dict.keys())
bill_memory.set_timeUnit(time_unit)
bill_memory.set_price(price)
bill_memory.set_resourceUnit(resource_unit)
test_util.test_logger("create memory billing\n price=%s, timeUnit=%s resourceUnit=%s" % (price, time_unit, resource_unit))
bill_memory.create_resource_type()
test_util.test_logger("create vm instance")
global vm
vm = test_stub.create_vm_billing("test_vmm", test_stub.set_vm_resource()[0], None,\
test_stub.set_vm_resource()[1], test_stub.set_vm_resource()[2])
vm_memory_size_ratio = res_ops.query_resource_fields(res_ops.INSTANCE_OFFERING, \
res_ops.gen_query_conditions('uuid', '=',\
test_stub.set_vm_resource()[1]))[0].memorySize / resource_unit_dict[resource_unit]
test_util.test_logger("====check vm spending====")
for r in range(0,round_max):
test_util.test_logger("===spending check round %s-%s===" % (str(i+1), str(r+1)))
if test_stub.check(bill_memory, billing_resource, random.choice(offset_unit_dict), random.randint(0,3), vm_memory_size_ratio):
success_round += 1
else:
test_util.test_fail("check vm billing spending finished\n success: %s/%s" % (success_round, round_sum))
test_util.test_pass("check memory billing finished\n success: %s/%s" % (success_round, round_sum))
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:31,代码来源:test_check_vm_memory_billing.py
示例16: test
def test():
global threads
global checker_threads
bs_cond = res_ops.gen_query_conditions("status", '=', "Connected")
bss = res_ops.query_resource_fields(res_ops.BACKUP_STORAGE, bs_cond, \
None)
if not bss:
test_util.test_skip("not find available backup storage. Skip test")
if bss[0].type != inventory.CEPH_BACKUP_STORAGE_TYPE:
if hasattr(inventory, 'IMAGE_STORE_BACKUP_STORAGE_TYPE') and bss[0].type != inventory.IMAGE_STORE_BACKUP_STORAGE_TYPE:
test_util.test_skip("not find available imagestore or ceph backup storage. Skip test")
for i in range(0, threads_num):
threads[i] = threading.Thread(target=add_image, args=(bss[0].uuid, i, ))
threads[i].start()
for i in range(0, threads_num):
checker_threads[i] = threading.Thread(target=check_add_image_progress, args=(i, ))
checker_threads[i].start()
for i in range(0, threads_num):
checker_threads[i].join()
threads[i].join()
images[i].check()
images[i].delete()
test_util.test_pass('Add image Progress Test Success')
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:26,代码来源:test_add_image_progress2.py
示例17: test
def test():
global vcenter_uuid
vcenter1_name = os.environ['vcenter1_name']
vcenter1_domain_name = os.environ['vcenter1_ip']
vcenter1_username = os.environ['vcenter1_domain_name']
vcenter1_password = os.environ['vcenter1_password']
ova_template_pattern1 = os.environ['vcenter1_template_exist']
#add vcenter senario1:
zone_uuid = res_ops.get_resource(res_ops.ZONE)[0].uuid
inv = vct_ops.add_vcenter(vcenter1_name, vcenter1_domain_name, vcenter1_username, vcenter1_password, True, zone_uuid)
vcenter_uuid = inv.uuid
if vcenter_uuid == None:
test_util.test_fail("vcenter_uuid is None")
#insert the basic operations for the newly join in vcenter resourse
image_list = []
image_names = res_ops.query_resource_fields(res_ops.IMAGE, [], None, fields=['name'])
for image_name in image_names:
image_list.append(image_name.name)
test_util.test_logger( ", ".join( [ str(image_name_tmp) for image_name_tmp in image_list ] ) )
if ova_template_pattern1 not in image_list:
test_util.test_fail("newly joined vcenter missing fingerprint vm1, test failed")
vct_ops.delete_vcenter(vcenter_uuid)
test_util.test_pass("add && delete vcenter test passed.")
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:31,代码来源:test_vcenter_check_exist_template.py
示例18: test
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)
bs_cond = res_ops.gen_query_conditions("status", '=', "Connected")
bss = res_ops.query_resource_fields(res_ops.BACKUP_STORAGE, bs_cond, \
None, fields=['uuid'])
if not bss:
test_util.test_skip("not find available backup storage. Skip test")
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)
volume1 = test_stub.create_volume(volume_creation_option)
test_obj_dict.add_volume(volume1)
volume1.check()
volume_uuid = volume1.volume.uuid
test_util.test_dsc('Create vm and check')
vm = test_stub.create_vr_vm('migrate_volume_vm', 'imageName_net', 'l3VlanNetwork2')
test_obj_dict.add_vm(vm)
vm.check()
vm_uuid = vm.vm.uuid
volume1.attach(vm)
volume1.detach(vm_uuid)
vm.stop()
image_obj = volume1.create_template([bss[0].uuid])
vm.start()
host_uuid = vm.vm.hostUuid
ps = test_lib.lib_get_primary_storage_by_uuid(vm.get_vm().allVolumes[0].primaryStorageUuid)
volume2 = image_obj.create_data_volume(ps.uuid, 'volumeName', host_uuid)
test_obj_dict.add_volume(volume2)
volume2.check()
volume_uuid = volume2.volume.uuid
ps = test_lib.lib_get_primary_storage_by_uuid(vm.get_vm().allVolumes[0].primaryStorageUuid)
if ps.type != inventory.LOCAL_STORAGE_TYPE:
test_util.test_skip('Skip test on non-localstorage')
snapshots = test_obj_dict.get_volume_snapshot(volume_uuid)
snapshots.set_utility_vm(vm)
snapshots.create_snapshot('create_snapshot1')
snapshots.check()
snapshots.create_snapshot('create_snapshot2')
snapshots.check()
target_host = test_lib.lib_find_random_host_by_volume_uuid(volume_uuid)
target_host_uuid = target_host.uuid
vol_ops.migrate_volume(volume_uuid, target_host_uuid)
test_lib.lib_error_cleanup(test_obj_dict)
test_util.test_pass('Cold migrate Data Volume from Template with Snapshot Test Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:60,代码来源:test_cold_migrate_data_volume_from_tmpt_with_sp.py
示例19: test
def test():
img_option = test_util.ImageOption()
ipv6_image_url = os.environ.get('ipv6ImageUrl')
image_name = os.environ.get('ipv6ImageName')
img_option.set_name(image_name)
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_format('qcow2')
img_option.set_url(ipv6_image_url)
image_inv = img_ops.add_root_volume_template(img_option)
image = test_image.ZstackTestImage()
image.set_image(image_inv)
image.set_creation_option(img_option)
test_obj_dict.add_image(image)
vm1 = test_stub.create_vm(l3_name = "%s,%s" %(os.environ.get('l3PublicNetworkName1'), os.environ.get('l3PublicNetworkName')), vm_name = 'IPv6 2 stack test ipv4 and ipv6', image_name = image_name)
vm2 = test_stub.create_vm(l3_name = os.environ.get('l3PublicNetworkName1'), vm_name = 'IPv6 2 stack test ipv6', image_name = image_name)
time.sleep(90) #waiting for vm bootup
vm1_nic1 = vm1.get_vm().vmNics[0].ip
vm1_nic2 = vm1.get_vm().vmNics[1].ip
vm2_nic1 = vm2.get_vm().vmNics[0].ip
for ip in (vm1_nic1, vm1_nic2):
if "." in ip:
ipv4 = ip
print "vm1_nic1 : %s, vm1_nic2: %s, vm2_nic1 :%s, ipv4 :%s." %(vm1_nic1, vm1_nic2, vm2_nic1,ipv4)
cmd = "ping6 -c 4 %s" %(vm2_nic1)
(retcode, output, erroutput) = ssh.execute(cmd, ipv4, "root", "password", True, 22)
print "retcode is: %s; output is : %s.; erroutput is: %s" %(retcode, output , erroutput)
if retcode != 0:
test_util.test_fail('Test Create IPv6 VM Failed.')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:30,代码来源:test_ipv6_2_stack.py
示例20: test
def test():
bs_cond = res_ops.gen_query_conditions("status", '=', "Connected")
bss = res_ops.query_resource_fields(res_ops.BACKUP_STORAGE, bs_cond, \
None, fields=['uuid'])
if not bss:
test_util.test_skip("not find available backup storage. Skip test")
image_option = test_util.ImageOption()
image_option.set_name('test_150min_downloading_image')
image_option.set_format('qcow2')
image_option.set_mediaType('RootVolumeTemplate')
image_option.set_url(os.environ.get('timeout150MinImageUrl'))
image_option.set_backup_storage_uuid_list([bss[0].uuid])
new_image = zstack_image_header.ZstackTestImage()
new_image.set_creation_option(image_option)
time1 = time.time()
new_image.add_root_volume_template()
time2 = time.time()
cost_time = time2 - time1
if cost_time < 7200:
test_util.test_fail('The test image is added less than 2 hours: \
%s, which does not meet the test criterial.' % cost_time)
new_image.delete()
new_image.expunge([bss[0].uuid])
test_util.test_pass('Add Image with 150 mins Pass.')
开发者ID:wolfhml,项目名称:zstack-woodpecker,代码行数:29,代码来源:test_add_image_150min.py
注:本文中的zstackwoodpecker.operations.resource_operations.query_resource_fields函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论