diff --git a/doc/source/usage.rst b/doc/source/usage.rst index cfde183..d7ec56f 100644 --- a/doc/source/usage.rst +++ b/doc/source/usage.rst @@ -72,10 +72,12 @@ VMTP Usage throughput test duration in seconds (default 10 sec) --host @[:] native host throughput (targets requires ssh key) - --external-host @ - external-VM throughput (target requires ssh key) - --access_info '{"host":"", "user":"", "password":""}' - access info for the controller node + --external-host @[:password>] + external-VM throughput (host requires public key if no + password) + --controller-node @[:] + controller node ssh (host requires public key if no + password) --mongod_server provide mongoDB server IP to store results --json store results in json format file diff --git a/network.py b/network.py index f233243..bf413f8 100755 --- a/network.py +++ b/network.py @@ -16,7 +16,8 @@ import time # Module containing a helper class for operating on OpenStack networks -import neutronclient.common.exceptions as neutron_exceptions +from neutronclient.common.exceptions import NetworkInUseClient +from neutronclient.common.exceptions import NeutronException class Network(object): @@ -149,7 +150,7 @@ class Network(object): self.neutron_client.delete_network(network['id']) print 'Network %s deleted' % (name) break - except neutron_exceptions.NetworkInUseClient: + except NetworkInUseClient: time.sleep(1) # Add a network/subnet to a logical router @@ -187,8 +188,13 @@ class Network(object): body = { 'subnet_id': int_net['subnets'][0] } - self.neutron_client.remove_interface_router(self.ext_router['id'], - body) + try: + self.neutron_client.remove_interface_router(self.ext_router['id'], + body) + except NeutronException: + # May fail with neutronclient.common.exceptions.Conflict + # if there are floating IP in use - just ignore + print('Router interface may have floating IP in use: not deleted') # Lookup network given network name def lookup_network(self, network_name): diff --git a/vmtp.py b/vmtp.py index 8b17d16..f44f9c4 100755 --- a/vmtp.py +++ b/vmtp.py @@ -37,6 +37,7 @@ from glanceclient.v2 import client as glanceclient from keystoneclient.v2_0 import client as keystoneclient from neutronclient.v2_0 import client as neutronclient from novaclient.client import Client +from novaclient.exceptions import ClientException __version__ = '2.0.0' @@ -370,7 +371,7 @@ class VmtpTest(object): self.client = None # If external network is specified run that case - if ext_host_list: + if ext_host_list[0]: self.ext_host_tp_test() def teardown(self): @@ -388,7 +389,11 @@ class VmtpTest(object): if self.comp: self.comp.remove_public_key(config.public_key_name) # Finally remove the security group - self.comp.security_group_delete(self.sec_group) + try: + self.comp.security_group_delete(self.sec_group) + except ClientException: + # May throw novaclient.exceptions.BadRequest if in use + print('Security group in use: not deleted') def run(self): error_flag = False @@ -398,10 +403,7 @@ class VmtpTest(object): self.measure_vm_flows() except KeyboardInterrupt: traceback.format_exc() - except VmtpException: - traceback.format_exc() - error_flag = True - except sshutils.SSHError: + except (VmtpException, sshutils.SSHError, ClientException): traceback.format_exc() error_flag = True