本文整理汇总了Python中zstackwoodpecker.operations.config_operations.change_global_config函数的典型用法代码示例。如果您正苦于以下问题:Python change_global_config函数的具体用法?Python change_global_config怎么用?Python change_global_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了change_global_config函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: error_cleanup
def error_cleanup():
if session_to:
con_ops.change_global_config('identity', 'session.timeout', session_to, session_uuid)
if session_mc:
con_ops.change_global_config('identity', 'session.maxConcurrent', session_mc, session_uuid)
if session_uuid:
acc_ops.logout(session_uuid)
开发者ID:KevinDavidMitnick,项目名称:zstack-woodpecker,代码行数:7,代码来源:test_crt_vm_with_3_vr_nics_by_max_threads.py
示例2: test
def test():
global session_to
global session_mc
session_to = con_ops.change_global_config('identity', 'session.timeout', '720000')
session_mc = con_ops.change_global_config('identity', 'session.maxConcurrent', '10000')
test_util.test_dsc('Create test vm as utility vm')
vm = test_stub.create_vlan_vm()
test_obj_dict.add_vm(vm)
#use root volume to skip add_checking_point
test_util.test_dsc('Use root volume for snapshot testing')
root_volume_inv = test_lib.lib_get_root_volume(vm.get_vm())
root_volume = zstack_volume_header.ZstackTestVolume()
root_volume.set_volume(root_volume_inv)
root_volume.set_state(volume_header.ATTACHED)
root_volume.set_target_vm(vm)
test_obj_dict.add_volume(root_volume)
vm.check()
snapshots = test_obj_dict.get_volume_snapshot(root_volume.get_volume().uuid)
snapshots.set_utility_vm(vm)
ori_num = 100
index = 1
while index < 101:
thread = threading.Thread(target=create_snapshot, args=(snapshots, index,))
thread.start()
index += 1
while threading.activeCount() > 1:
time.sleep(0.1)
#snapshot.check() doesn't work for root volume
#snapshots.check()
#check if snapshot exists in install_path
ps = test_lib.lib_get_primary_storage_by_vm(vm.get_vm())
if ps.type == inventory.NFS_PRIMARY_STORAGE_TYPE or ps.type == inventory.LOCAL_STORAGE_TYPE:
host = test_lib.lib_get_vm_host(vm.get_vm())
for snapshot in snapshots.get_snapshot_list():
snapshot_inv = snapshot.get_snapshot()
sp_ps_install_path = snapshot_inv.primaryStorageInstallPath
if test_lib.lib_check_file_exist(host, sp_ps_install_path):
test_util.test_logger('Check result: snapshot %s is found in host %s in path %s' % (snapshot_inv.name, host.managementIp, sp_ps_install_path))
else:
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_fail('Check result: snapshot %s is not found in host %s in path %s' % (snapshot_inv.name, host.managementIp, sp_ps_install_path))
else:
test_util.test_logger('Skip check file install path for %s primary storage' % (ps.type))
cond = res_ops.gen_query_conditions('volumeUuid', '=', root_volume.get_volume().uuid)
sps_num = res_ops.query_resource_count(res_ops.VOLUME_SNAPSHOT, cond)
if sps_num != ori_num:
test_util.test_fail('Create %d snapshots, but only %d snapshots were successfully created' % (ori_num, sps_num))
try:
test_lib.lib_robot_cleanup(test_obj_dict)
except:
test_lib.test_logger('Delete VM may timeout')
test_util.test_pass('Test create 100 snapshots simultaneously success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:60,代码来源:test_crt_sp_simultaneously.py
示例3: error_cleanup
def error_cleanup():
global test_obj_dict
global test_file_des
global ct_original
con_ops.change_global_config('vm', 'cleanTraffic', ct_original)
os.system('rm -f %s' % test_file_des)
test_lib.lib_error_cleanup(test_obj_dict)
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:7,代码来源:test_ip_spoofing.py
示例4: 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
示例5: __init__
def __init__(self, get_host_con = None, justify_con = None):
self.exc_info = []
self.hosts = []
self.i = 0
self.session_uuid = None
self.session_to = None
self.session_mc = None
self.host_num = os.environ.get('ZSTACK_TEST_NUM')
self.thread_threshold = os.environ.get('ZSTACK_THREAD_THRESHOLD')
self.get_host_con = get_host_con
self.justify_con = justify_con
if not self.host_num:
self.host_num = 0
else:
self.host_num = int(self.host_num)
if not self.thread_threshold:
self.thread_threshold = 1000
else:
self.thread_threshold = int(self.thread_threshold)
self.hosts = res_ops.query_resource(res_ops.HOST, self.get_host_con)
if self.host_num > len(self.hosts):
self.host_num = len(self.hosts)
test_util.test_warn('ZSTACK_TEST_NUM is forcibly set as %d\n' % len(self.hosts))
self.session_to = con_ops.change_global_config('identity', 'session.timeout',\
'720000', self.session_uuid)
self.session_mc = con_ops.change_global_config('identity', 'session.maxConcurrent',\
'10000', self.session_uuid)
self.session_uuid = acc_ops.login_as_admin()
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:32,代码来源:test_stub.py
示例6: error_cleanup
def error_cleanup():
if session_to:
con_ops.change_global_config("identity", "session.timeout", session_to)
if session_mc:
con_ops.change_global_config("identity", "session.maxConcurrent", session_mc)
if session_uuid:
acc_ops.logout(session_uuid)
开发者ID:lstfyt,项目名称:zstack-woodpecker,代码行数:7,代码来源:delete_snapshot.py
示例7: test
def test():
test_util.test_dsc("set global config anti-spoofing value to true ")
cfg_ops.change_global_config(category="vm", name="cleanTraffic", value="true")
test_util.test_dsc("create vpc vrouter and attach vpc l3 to vpc")
for vpc_name in vpc_name_list:
vr_list.append(test_stub.create_vpc_vrouter(vpc_name))
for vr, l3_list in izip(vr_list, vpc_l3_list):
test_stub.attach_l3_to_vpc_vr(vr, l3_list)
test_util.test_dsc("create two vm, vm1 in l3 {}, vm2 in l3 {}".format(VLAN1_NAME, VLAN2_NAME))
vm1 = test_stub.create_vm_with_random_offering(vm_name='vpc_vm_{}'.format(VLAN1_NAME), l3_name=VLAN1_NAME)
test_obj_dict.add_vm(vm1)
vm1.check()
vm2 = test_stub.create_vm_with_random_offering(vm_name='vpc_vm_{}'.format(VLAN2_NAME), l3_name=VLAN2_NAME)
test_obj_dict.add_vm(vm2)
vm2.check()
vr_pub_nic = test_lib.lib_find_vr_pub_nic(vr_list[0].inv)
test_util.test_dsc("Create vip")
vip = test_stub.create_vip('vip1', vr_pub_nic.l3NetworkUuid)
test_obj_dict.add_vip(vip)
test_util.test_dsc("Create eip")
eip = test_stub.create_eip('eip1', vip_uuid=vip.get_vip().uuid)
vip.attach_eip(eip)
vip.check()
test_util.test_dsc("set global config anti-spoofing value to default value false ")
cfg_ops.change_global_config(category="vm", name="cleanTraffic", value="false")
test_lib.lib_error_cleanup(test_obj_dict)
test_stub.remove_all_vpc_vrouter()
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:35,代码来源:test_vpc_anti_spoofing.py
示例8: test
def test():
#Enable twofa and check login
password = 'b109f3bbbc244eb82441917ed06d618b9008dd09b3befd1b5e07394c706a8bb980b1d7785e5976ec049b46df5f1326af5a2ea6d103fd07c95385ffab0cacbc86'
session_uuid = acc_ops.login_as_admin()
twofa_enabled = conf_ops.get_global_config_value('twofa', 'twofa.enable')
if twofa_enabled == 'false':
conf_ops.change_global_config('twofa', 'twofa.enable', 'true')
twofa = acc_ops.get_twofa_auth_secret('admin', password, session_uuid = session_uuid)
secret = twofa.secret
twofa_status = twofa.status
if twofa_status != 'NewCreated':
test_util.test_fail("The twofa auth secret statue should be 'NewCreated' but it's %s" %twofa_status)
security_code = test_stub.get_security_code(secret)
session1_uuid = acc_ops.login_by_account('admin', password, system_tags=['twofatoken::%s' %security_code])
if session1_uuid != None:
test_util.test_logger("Enable twofa and login with security code passed")
twofa_status = acc_ops.get_twofa_auth_secret('admin', password, session_uuid = session_uuid).status
if twofa_status != 'Logined':
test_util.test_fail("The twofa auth secret statue should be 'Logined' but it's %s" %twofa_status)
#Disable twofa and check login again
conf_ops.change_global_config('twofa', 'twofa.enable', 'false', session_uuid = session_uuid)
session2_uuid = acc_ops.login_as_admin()
if session2_uuid != None:
test_util.test_pass("Disable twofa and login without security code passed")
test_util.test_fail("Fail to login without security code after twofa disabled")
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:28,代码来源:test_twofa_enable_disable.py
示例9: 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
示例10: test
def test():
global vm, host3_uuid
if test_lib.lib_get_ha_enable() != 'true':
test_util.test_skip("vm ha not enabled. Skip test")
conf_ops.change_global_config('ha', 'allow.slibing.cross.clusters', 'true')
vm_creation_option = test_util.VmOption()
image_name = os.environ.get('imageName_s')
image_uuid = test_lib.lib_get_image_by_name(image_name).uuid
#l3_name = os.environ.get('l3NoVlanNetworkName1')
#l3_name = os.environ.get('l3VlanNetworkName1')
l3_name = os.environ.get('l3PublicNetworkName')
host3_name = os.environ.get('hostName3')
host4_name = os.environ.get('hostName4')
conditions1 = res_ops.gen_query_conditions('name', '=', host3_name)
host3_uuid = res_ops.query_resource(res_ops.HOST, conditions1)[0].uuid
host3_ip = res_ops.query_resource(res_ops.HOST, conditions1)[0].managementIp
conditions2 = res_ops.gen_query_conditions('name', '=', host4_name)
host4_uuid = res_ops.query_resource(res_ops.HOST, conditions2)[0].uuid
host4_ip = res_ops.query_resource(res_ops.HOST, conditions2)[0].managementIp
l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
conditions = res_ops.gen_query_conditions('type', '=', 'UserVm')
instance_offering_uuid = res_ops.query_resource(res_ops.INSTANCE_OFFERING, conditions)[0].uuid
vm_creation_option.set_l3_uuids([l3_net_uuid])
vm_creation_option.set_image_uuid(image_uuid)
vm_creation_option.set_instance_offering_uuid(instance_offering_uuid)
vm_creation_option.set_name('multihost_basic_vm')
vm_creation_option.set_host_uuid(host3_uuid)
vm = test_vm_header.ZstackTestVm()
vm.set_creation_option(vm_creation_option)
vm.create()
time.sleep(30)
ha_ops.set_vm_instance_ha_level(vm.get_vm().uuid, "NeverStop")
time.sleep(5)
vm.check()
ssh_cmd1 = 'ssh -oStrictHostKeyChecking=no -oCheckHostIP=no -oUserKnownHostsFile=/dev/null %s' % host3_ip
cmd = '%s "poweroff" ' % ssh_cmd1
process_result = test_stub.execute_shell_in_process(cmd, tmp_file)
time.sleep(360)
host3_status = res_ops.query_resource(res_ops.HOST, conditions1)[0].status
if host3_status == "Disconnected":
conditions3 = res_ops.gen_query_conditions('uuid', '=', vm.vm.uuid)
vm_status = res_ops.query_resource(res_ops.VM_INSTANCE, conditions3)[0].state
vm_host_uuid = res_ops.query_resource(res_ops.VM_INSTANCE, conditions3)[0].hostUuid
if vm_status != "Running" or vm_host_uuid != host4_uuid:
test_util.test_fail('Test fail vm status: %s, vm_host_uuid: %s,' %(vm_status, vm_host_uuid))
vm.destroy()
conf_ops.change_global_config('ha', 'allow.slibing.cross.clusters', 'false')
conditions4 = res_ops.gen_query_conditions('vmNics.ip', '=', host3_ip)
vm3_uuid = sce_ops.query_resource(zstack_management_ip, res_ops.VM_INSTANCE, conditions4).inventories[0].uuid
sce_ops.start_vm(zstack_management_ip, vm3_uuid)
test_util.test_pass('VM auto ha across cluster Test Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:60,代码来源:test_ha_vm_auto_across_cluster_migration.py
示例11: env_recover
def env_recover():
config_ops.change_global_config('ha','enable', 'true')
global origin_value
config_ops.change_global_config('ha','neverStopVm.scan.interval', origin_value)
global vm
if vm != None:
vm.destroy()
vm.expunge()
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:8,代码来源:test_change_ha_global_config.py
示例12: error_cleanup
def error_cleanup():
global eip_snatInboundTraffic_default_value
global pf_snatInboundTraffic_default_value
conf_ops.change_global_config('eip', 'snatInboundTraffic', \
eip_snatInboundTraffic_default_value )
conf_ops.change_global_config('portForwarding', 'snatInboundTraffic', \
pf_snatInboundTraffic_default_value)
test_lib.lib_error_cleanup(test_obj_dict)
开发者ID:KevinDavidMitnick,项目名称:zstack-woodpecker,代码行数:8,代码来源:test_2l3s_eips.py
示例13: error_cleanup
def error_cleanup():
global test_obj_dict
global origin_interval
global bs_type
if bs_type == 'Ceph':
conf_ops.change_global_config('ceph', 'imageCache.cleanup.interval', origin_interval)
test_lib.lib_error_cleanup(test_obj_dict)
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:8,代码来源:test_crt_temp_image.py
示例14: env_recover
def env_recover():
global vm
if vm != None:
vm.destroy()
vm.expunge()
global live_migration
if ps_type == "Local":
config_ops.change_global_config('localStoragePrimaryStorage','liveMigrationWithStorage.allow', live_migration)
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:8,代码来源:test_migrate_vm.py
示例15: test
def test():
global origin_interval
global bs_type
test_util.test_dsc('Create test vm and check')
bs = res_ops.query_resource(res_ops.BACKUP_STORAGE)
for i in bs:
if i.type == 'AliyunEBS':
test_util.test_skip('Skip test on AliyunEBS')
vm1 = test_stub.create_vlan_vm()
#Without this checking, the image (created later) might be not able to get a DHCP IP, when using to create a new vm.
vm1.check()
test_obj_dict.add_vm(vm1)
vm1.stop()
image_creation_option = test_util.ImageOption()
backup_storage_list = test_lib.lib_get_backup_storage_list_by_vm(vm1.vm)
image_creation_option.set_backup_storage_uuid_list([backup_storage_list[0].uuid])
image_creation_option.set_root_volume_uuid(vm1.vm.rootVolumeUuid)
image_creation_option.set_name('test_create_image_template')
bs_type = backup_storage_list[0].type
if bs_type == 'Ceph':
origin_interval = conf_ops.change_global_config('ceph', 'imageCache.cleanup.interval', '1')
image = test_image.ZstackTestImage()
image.set_creation_option(image_creation_option)
image.create()
test_obj_dict.add_image(image)
image.check()
test_util.test_dsc('Use new created Image to create a VM')
new_img_uuid = image.image.uuid
vm_creation_option = vm1.get_creation_option()
vm_creation_option.set_image_uuid(new_img_uuid)
vm2 = test_vm.ZstackTestVm()
vm2.set_creation_option(vm_creation_option)
vm2.create()
test_obj_dict.add_vm(vm2)
vm2.check()
vm1.start()
vm1.check()
vm2.destroy()
vm1.destroy()
image.delete()
if bs_type == 'Ceph':
time.sleep(60)
image.check()
if bs_type == 'Ceph':
conf_ops.change_global_config('ceph', 'imageCache.cleanup.interval', origin_interval)
test_util.test_pass('Create Image Template Test Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:58,代码来源:test_crt_temp_image.py
示例16: test
def test():
global vm
global origin_value
imagestore = test_lib.lib_get_image_store_backup_storage()
if imagestore == None:
test_util.test_skip('Required imagestore to test')
image_uuid = test_stub.get_image_by_bs(imagestore.uuid)
cond = res_ops.gen_query_conditions('type', '=', 'SharedMountPoint')
pss = res_ops.query_resource(res_ops.PRIMARY_STORAGE, cond)
if len(pss) == 0:
test_util.test_skip('Required %s ps to test' % (ps_type))
ps_uuid = pss[0].uuid
vm = test_stub.create_vm(image_uuid=image_uuid, ps_uuid=ps_uuid)
vm.stop()
ha_ops.set_vm_instance_ha_level(vm.get_vm().uuid,'NeverStop')
cond = res_ops.gen_query_conditions('uuid', '=', vm.get_vm().uuid)
for i in range(5):
time.sleep(1)
try:
if res_ops.query_resource(res_ops.VM_INSTANCE, cond)[0].state == vm_header.RUNNING:
break
except:
test_util.test_logger('Retry until VM change to running')
if res_ops.query_resource(res_ops.VM_INSTANCE, cond)[0].state != vm_header.RUNNING:
test_util.test_fail('set HA after stopped VM test fail')
no_exception = True
try:
config_ops.change_global_config('ha','host.check.successRatio', -1)
no_exception = True
except:
test_util.test_logger('Expected exception')
no_exception = False
if no_exception:
test_util.test_fail('Expect exception while there is none')
origin_value = config_ops.change_global_config('ha','neverStopVm.scan.interval', '30')
config_ops.change_global_config('ha','enable', 'false')
vm.stop()
cond = res_ops.gen_query_conditions('uuid', '=', vm.get_vm().uuid)
for i in range(int(config_ops.get_global_config_value('ha','neverStopVm.scan.interval'))):
time.sleep(1)
try:
if res_ops.query_resource(res_ops.VM_INSTANCE, cond)[0].state != vm_header.STOPPED:
break
except:
test_util.test_logger('Retry until VM change to running')
if res_ops.query_resource(res_ops.VM_INSTANCE, cond)[0].state == vm_header.RUNNING:
test_util.test_fail('disable HA after stopped VM test fail')
test_util.test_pass('set HA global config pass')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:56,代码来源:test_change_ha_global_config.py
示例17: test
def test():
global vm
global default_mode
# default_mode = conf_ops.get_global_config_value('kvm', 'videoType')
default_mode = conf_ops.change_global_config('vm', 'videoType', 'qxl')
vm = test_stub.create_sg_vm()
console = test_lib.lib_get_vm_console_address(vm.get_vm().uuid)
test_util.test_logger('[vm:] %s console is on %s:%s' % (vm.get_vm().uuid, console.hostIp, console.port))
display = str(int(console.port)-5900)
vm.check()
vm_mode = test_lib.lib_get_vm_video_type(vm.get_vm())
if vm_mode != 'qxl':
test_util.test_fail('VM is expected to work in qxl mode instead of %s' % (vm_mode))
client = api.connect(console.hostIp+":"+display)
client.captureScreen('tmp.png')
image = Image.open('tmp.png')
if image.width != 720 or image.height != 400:
test_util.test_fail("VM is expected to work in 720x400 while its %sx%s" % (image.width, image.height))
box = image.getbbox()
if box != (0, 18, 403, 79) and box != (0, 18, 403, 80):
test_util.test_fail("VM is expected to display text in area (0, 18, 403, 79) while it's actually: (%s, %s, %s, %s)" % (box[0], box[1], box[2], box[3]))
test_util.test_logger('[vm:] change vga mode to vga=794 which is 1280x1024')
cmd = 'sed -i "s/115200$/115200 vga=794/g" /boot/grub2/grub.cfg'
test_lib.lib_execute_command_in_vm(vm.get_vm(), cmd)
vm.reboot()
vm.check()
client = api.connect(console.hostIp+":"+display)
client.captureScreen('tmp.png')
image = Image.open('tmp.png')
if image.width != 1280 or image.height != 1024:
test_util.test_fail("VM is expected to work in 1280x1024 while its %sx%s" % (image.width, image.height))
box = image.getbbox()
if box != (0, 18, 359, 79) and box != (0, 18, 359, 80):
test_util.test_fail("VM is expected to display text in area (0, 18, 359, 79) while it's actually: (%s, %s, %s, %s)" % (box[0], box[1], box[2], box[3]))
test_util.test_logger('[vm:] change vga mode to vga=907 which is 2560x1600')
cmd = 'sed -i "s/vga=794/vga=907/g" /boot/grub2/grub.cfg'
test_lib.lib_execute_command_in_vm(vm.get_vm(), cmd)
vm.reboot()
vm.check()
client = api.connect(console.hostIp+":"+display)
client.captureScreen('tmp.png')
image = Image.open('tmp.png')
if image.width != 2560 or image.height != 1600:
test_util.test_fail("VM is expected to work in 2560x1600 while its %sx%s" % (image.width, image.height))
box = image.getbbox()
if box != (0, 18, 359, 79) and box != (0, 18, 359, 80):
test_util.test_fail("VM is expected to display text in area (0, 18, 359, 79) while it's actually: (%s, %s, %s, %s)" % (box[0], box[1], box[2], box[3]))
vm.destroy()
vm.check()
conf_ops.change_global_config('vm', 'videoType', default_mode)
test_util.test_pass('Create VM Test Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:54,代码来源:test_vm_qxl.py
示例18: test
def test():
global test_obj_dict
global Port
global ct_original
# close ip_spoofing; keep the original value, used to restore the original state
if con_ops.get_global_config_value('vm', 'cleanTraffic') == 'false' :
ct_original ='false'
else:
ct_original ='true'
con_ops.change_global_config('vm', 'cleanTraffic', 'false')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:11,代码来源:test_sg_rule_close_anti-spoofing.py
示例19: test
def test():
global vms
global images
global threads
global checker_threads
global origin_interval
global bs_type
test_util.test_dsc('Create test vm and check')
script_file = tempfile.NamedTemporaryFile(delete=False)
script_file.write('dd if=/dev/zero of=/home/dd bs=1M count=100')
script_file.close()
for i in range(0, threads_num):
vms[i] = test_stub.create_vlan_vm()
vms[i].check()
backup_storage_list = test_lib.lib_get_backup_storage_list_by_vm(vms[i].vm)
if backup_storage_list[0].type != 'ImageStoreBackupStorage':
test_util.test_skip("Requires imagestore BS to test, skip testing")
if not test_lib.lib_execute_shell_script_in_vm(vms[i].get_vm(), script_file.name):
test_util.test_fail("fail to create data in [vm:] %s" % (vms[i].get_vm().uuid))
test_obj_dict.add_vm(vms[i])
vms[i].stop()
os.unlink(script_file.name)
for i in range(0, threads_num):
threads[i] = threading.Thread(target=create_temp_image, args=(i, ))
threads[i].start()
for i in range(0, threads_num):
checker_threads[i] = threading.Thread(target=check_create_temp_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()
vms[i].destroy()
images[i].delete()
for i in range(0, threads_num):
if checker_results[i] == None:
test_util.test_fail("Image checker thread %s fail" % (i))
if bs_type == 'Ceph':
time.sleep(60)
if bs_type == 'Ceph':
conf_ops.change_global_config('ceph', 'imageCache.cleanup.interval', origin_interval)
test_util.test_pass('Create Image Template Test Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:52,代码来源:test_crt_temp_image_progress2.py
示例20: test
def test():
global test_obj_dict
global test_file_src
global test_file_des
global ct_original
if con_ops.get_global_config_value('vm', 'cleanTraffic') == 'false' :
ct_original='false'
con_ops.change_global_config('vm', 'cleanTraffic', 'true')
else:
ct_original='true'
vm = test_stub.create_basic_vm()
test_obj_dict.add_vm(vm)
vm.check()
vm_inv = vm.get_vm()
vm_ip = vm_inv.vmNics[0].ip
new_vm_ip = '172.20.1.1'
if new_vm_ip == vm_ip:
new_vm_ip = '172.20.1.2'
test_util.test_dsc("Prepare Test File")
cmd = "cp %s %s" % (test_file_src, test_file_des)
os.system(cmd)
cmd = "sed -i \"s/TemplateNodeIP/%s/g\" %s" % (node_ip, test_file_des)
os.system(cmd)
cmd = "sed -i \"s/TemplateOriginalIP/%s/g\" %s" % (vm_ip, test_file_des)
os.system(cmd)
cmd = "sed -i \"s/TemplateTestIP/%s/g\" %s" % (new_vm_ip, test_file_des)
os.system(cmd)
target_file = "/home/change_ip_test.sh"
test_stub.scp_file_to_vm(vm_inv, test_file_des, target_file)
cmd = "chmod +x %s" % target_file
rsp = test_lib.lib_execute_ssh_cmd(vm_ip, 'root', 'password', cmd, 180)
rsp = test_lib.lib_execute_ssh_cmd(vm_ip, 'root', 'password', target_file, 180)
time.sleep(60)
cmd = "cat /home/ip_spoofing_result"
rsp = test_lib.lib_execute_ssh_cmd(vm_ip, 'root', 'password', cmd, 180)
if rsp[0] != "1":
test_util.test_fail(rsp)
vm.destroy()
test_obj_dict.rm_vm(vm)
con_ops.change_global_config('vm', 'cleanTraffic', ct_original)
os.system('rm -f %s' % test_file_des)
test_util.test_pass('IP Spoofing Test Success')
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:51,代码来源:test_ip_spoofing.py
注:本文中的zstackwoodpecker.operations.config_operations.change_global_config函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论