def deploy_vm(test_obj, handle, prompt): test_conf = test_obj.argument['test_conf']['test_conf'] url = test_conf['linux_vm_image_url'] d, f = os.path.split(url) dest = "/tmp/%s" % f gen_lib.wget_file(test_obj, handle, prompt, url, dest, 600) ostack.init_credentials(test_obj, handle, prompt) args = {} args['handle'] = handle args['prompt'] = prompt args['image_name'] = "ubuntu" args['disk_format'] = 'raw' args['is_public'] = True args['container_format'] = "ovf" args['image'] = dest args['test_obj'] = test_obj ostack.delete_all_vms(test_obj, handle, prompt) #ostack.delete_vm(test_obj,handle,prompt,"VM1") ostack.delete_glance_image(args) ostack.add_glance_image(args) ostack.delete_neutron_net(test_obj, handle, prompt, 'VN1') net_id = ostack.create_neutron_net(test_obj, handle, prompt, 'VN1') ostack.create_neutron_subnet(test_obj, handle, prompt, 'VN1', 'VN1', '192.168.1.0/24') ostack.add_security_rules(test_obj, handle, prompt) args['flavor'] = "m1.medium" args['vm_name'] = "VM1" args['net_id'] = net_id args['security-groups'] = "default" ostack.boot_nova_image(args) args['status'] = "ACTIVE" args['power_state'] = "Running" args['timeout'] = 600 ostack.wait_until_vm_status(args)
def deploy_linux_vm(test_obj, handle, prompt, host, net_id): test_conf = test_obj.argument['test_conf']['test_conf'] url = test_conf['linux_vm_image_url'] d, f = os.path.split(url) dest = "/tmp/%s" % f gen_lib.wget_file(test_obj, handle, prompt, url, dest, 600) ostack.init_credentials(test_obj, handle, prompt) args = {} args['handle'] = handle args['prompt'] = prompt args['image_name'] = "ubuntu" args['disk_format'] = 'raw' args['is_public'] = True args['container_format'] = "ovf" args['image'] = dest args['test_obj'] = test_obj ostack.add_glance_image(args) args['flavor'] = "m1.medium" args['vm_name'] = "client" args['net_id'] = net_id #args['zone'] = host args['security-groups'] = "default" ostack.boot_nova_image(args) args['status'] = "ACTIVE" args['power_state'] = "Running" args['timeout'] = 600 ret = ostack.wait_until_vm_status(args) if not ret: msg = "ERROR: %s VM did not come up correctly.timeout:%d\n" % ( args['vm_name'], args['timeout']) print msg test_obj.argument['err_msg'] += msg time.sleep( 120 ) # to let VM to come up fully.scp service was failing inconsistently.
print "INFO : local_only_disks.livem will not work.skipping the test." test_obj.PostResult() test_obj.cleanup() sys.exit() fab_node_host = testbed_config['%s,fab_node' % profile_name] fab_node = testbed_config['%s,node_name' % fab_node_host] fab_node_handle = test_obj.create_ssh_handle( node_name=fab_node, ntp_update=True, run_time=test_conf['runtime']) if runtime == "FAB": configure_livem(test_obj, fab_node_handle, testbed_config['%s,prompt' % fab_node], fab_node) ostack.init_credentials(test_obj, fab_node_handle, testbed_config['%s,prompt' % fab_node]) deploy_vm(test_obj, fab_node_handle, testbed_config['%s,prompt' % fab_node]) live_migrate(test_obj, fab_node_handle, testbed_config['%s,prompt' % fab_node]) except SystemExit: pass except: traceback.print_exc() test_obj.argument['err_msg'] += "Exception occured" test_obj.PostResult() test_obj.cleanup() if test_obj.argument['err_msg'] == "": sys.exit(0)