Best Python code snippet using tempest_python
test_live_block_migration_negative.py
Source:test_live_block_migration_negative.py
...32 cls.admin_hosts_client = cls.os_adm.hosts_client33 cls.admin_servers_client = cls.os_adm.servers_client34 def _migrate_server_to(self, server_id, dest_host):35 bmflm = CONF.compute_feature_enabled.block_migration_for_live_migration36 body = self.admin_servers_client.live_migrate_server(37 server_id, host=dest_host, block_migration=bmflm,38 disk_over_commit=False)39 return body40 @test.attr(type=['negative'])41 @test.idempotent_id('7fb7856e-ae92-44c9-861a-af62d7830bcb')42 def test_invalid_host_for_migration(self):43 # Migrating to an invalid host should not change the status44 target_host = data_utils.rand_name('host')45 server = self.create_test_server(wait_until="ACTIVE")46 server_id = server['id']47 self.assertRaises(lib_exc.BadRequest, self._migrate_server_to,48 server_id, target_host)49 waiters.wait_for_server_status(self.servers_client, server_id,50 'ACTIVE')
host_evac.py
Source:host_evac.py
...29def main(conn, hypervisor):30 if hypervisor_has_servers(conn, hypervisor):31 for server in conn.compute.servers(details=True, all_projects=True, host=hypervisor):32 wait_for_all_active(conn, hypervisor)33 conn.compute.live_migrate_server(server, block_migration=True)34if __name__ == '__main__':35 conn = openstack.connect(cloud='envvars')36 args = parse_args()...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!