def find_all_VMs(self, novaUrl, authent_id): try: serverListResponse, serverList = \ novaUtils.listServerSummaries(novaUrl, authent_id) return serverList except HttpError as e: print('HTTP Error: {0}'.format(e.body)) raise e
def test_1001_con_delete_off_all_vms(self): options_missing = False for option in self.required_options: if not self.config.has_option(self.config_section, option): print 'option=', option, 'not found in configuration file' options_missing = True if options_missing: print 'Provide missing options to the configuration file.' os._exit(1) concurrent_deletes = self.config_get(CONCURRENT_DELETES) print CONCURRENT_DELETES, concurrent_deletes authTokenId = self.authent_id print 'Obtaining the Managed Server List...' novaUrl = self.getServiceUrl('compute') errored_servers = [] stopped_servers = [] started_servers = [] server_list = [] error_server_list = [] vm_deleted = [] try: serverListResponse, serverList = novaUtils.listServerSummaries( novaUrl, authTokenId) if serverList['servers']: for server in serverList['servers']: server_list.append({ 'name': server['name'], 'id': server['id'] }) vm_deleted += conc_delete_servers(authTokenId, novaUrl, server_list, concurrent_deletes) print "Total number of VMs deleted: %d", len(vm_deleted) except HttpError, e: print 'HTTP Error: {0}'.format(e.body) os._exit(1)
def get_server_list(authTokenId, novaUrl): responseTuple = novaUtils.listServerSummaries(novaUrl, authTokenId) server_list = responseTuple[1]['servers'] return server_list