How to use migrate_server method in tempest

Best Python code snippet using tempest_python

stress_test.py

Source:stress_test.py Github

copy

Full Screen

...37 yield38 finally:39 if cleanup:40 run("nova image-delete %(snapshot_name)s" % locals())41def migrate_server(server_name):42 run("nova migrate %(server_name)s --poll" % locals())43 cmd = "nova list | grep %(server_name)s | awk '{print $6}'" % locals()44 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)45 stdout, stderr = proc.communicate()46 status = stdout.strip()47 if status.upper() != 'VERIFY_RESIZE':48 print >> sys.stderr, "Server %(server_name)s failed to rebuild"\49 % locals()50 return False51 # Confirm the resize52 run("nova resize-confirm %(server_name)s" % locals())53 return True54def test_migrate(context):55 count, args = context56 server_name = "server%d" % count57 cleanup = args.cleanup58 with server_built(server_name, args.image, cleanup=cleanup):59 # Migrate A -> B60 result = migrate_server(server_name)61 if not result:62 return False63 # Migrate B -> A64 return migrate_server(server_name)65def rebuild_server(server_name, snapshot_name):66 run("nova rebuild %(server_name)s %(snapshot_name)s --poll" % locals())67 cmd = "nova list | grep %(server_name)s | awk '{print $6}'" % locals()68 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)69 stdout, stderr = proc.communicate()70 status = stdout.strip()71 if status != 'ACTIVE':72 print >> sys.stderr, "Server %(server_name)s failed to rebuild"\73 % locals()74 return False75 return True76def test_rebuild(context):77 count, args = context78 server_name = "server%d" % count...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful