Fix ext-host-list bug, catch more exceptions, fix usage
Change-Id: Ie22099419f618143008fc21d83d3c525050b84c3
This commit is contained in:
parent
d07d11b426
commit
4f3b5b0774
@ -72,10 +72,12 @@ VMTP Usage
|
|||||||
throughput test duration in seconds (default 10 sec)
|
throughput test duration in seconds (default 10 sec)
|
||||||
--host <user>@<host_ssh_ip>[:<server-listen-if-name>]
|
--host <user>@<host_ssh_ip>[:<server-listen-if-name>]
|
||||||
native host throughput (targets requires ssh key)
|
native host throughput (targets requires ssh key)
|
||||||
--external-host <user>@<ext_host_ssh_ip>
|
--external-host <user>@<host_ssh_ip>[:password>]
|
||||||
external-VM throughput (target requires ssh key)
|
external-VM throughput (host requires public key if no
|
||||||
--access_info '{"host":"<hostip>", "user":"<user>", "password":"<pass>"}'
|
password)
|
||||||
access info for the controller node
|
--controller-node <user>@<host_ssh_ip>[:<password>]
|
||||||
|
controller node ssh (host requires public key if no
|
||||||
|
password)
|
||||||
--mongod_server <server ip>
|
--mongod_server <server ip>
|
||||||
provide mongoDB server IP to store results
|
provide mongoDB server IP to store results
|
||||||
--json <file> store results in json format file
|
--json <file> store results in json format file
|
||||||
|
10
network.py
10
network.py
@ -16,7 +16,8 @@
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
# Module containing a helper class for operating on OpenStack networks
|
# 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):
|
class Network(object):
|
||||||
|
|
||||||
@ -149,7 +150,7 @@ class Network(object):
|
|||||||
self.neutron_client.delete_network(network['id'])
|
self.neutron_client.delete_network(network['id'])
|
||||||
print 'Network %s deleted' % (name)
|
print 'Network %s deleted' % (name)
|
||||||
break
|
break
|
||||||
except neutron_exceptions.NetworkInUseClient:
|
except NetworkInUseClient:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
# Add a network/subnet to a logical router
|
# Add a network/subnet to a logical router
|
||||||
@ -187,8 +188,13 @@ class Network(object):
|
|||||||
body = {
|
body = {
|
||||||
'subnet_id': int_net['subnets'][0]
|
'subnet_id': int_net['subnets'][0]
|
||||||
}
|
}
|
||||||
|
try:
|
||||||
self.neutron_client.remove_interface_router(self.ext_router['id'],
|
self.neutron_client.remove_interface_router(self.ext_router['id'],
|
||||||
body)
|
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
|
# Lookup network given network name
|
||||||
def lookup_network(self, network_name):
|
def lookup_network(self, network_name):
|
||||||
|
12
vmtp.py
12
vmtp.py
@ -37,6 +37,7 @@ from glanceclient.v2 import client as glanceclient
|
|||||||
from keystoneclient.v2_0 import client as keystoneclient
|
from keystoneclient.v2_0 import client as keystoneclient
|
||||||
from neutronclient.v2_0 import client as neutronclient
|
from neutronclient.v2_0 import client as neutronclient
|
||||||
from novaclient.client import Client
|
from novaclient.client import Client
|
||||||
|
from novaclient.exceptions import ClientException
|
||||||
|
|
||||||
__version__ = '2.0.0'
|
__version__ = '2.0.0'
|
||||||
|
|
||||||
@ -370,7 +371,7 @@ class VmtpTest(object):
|
|||||||
self.client = None
|
self.client = None
|
||||||
|
|
||||||
# If external network is specified run that case
|
# If external network is specified run that case
|
||||||
if ext_host_list:
|
if ext_host_list[0]:
|
||||||
self.ext_host_tp_test()
|
self.ext_host_tp_test()
|
||||||
|
|
||||||
def teardown(self):
|
def teardown(self):
|
||||||
@ -388,7 +389,11 @@ class VmtpTest(object):
|
|||||||
if self.comp:
|
if self.comp:
|
||||||
self.comp.remove_public_key(config.public_key_name)
|
self.comp.remove_public_key(config.public_key_name)
|
||||||
# Finally remove the security group
|
# Finally remove the security group
|
||||||
|
try:
|
||||||
self.comp.security_group_delete(self.sec_group)
|
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):
|
def run(self):
|
||||||
error_flag = False
|
error_flag = False
|
||||||
@ -398,10 +403,7 @@ class VmtpTest(object):
|
|||||||
self.measure_vm_flows()
|
self.measure_vm_flows()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
traceback.format_exc()
|
traceback.format_exc()
|
||||||
except VmtpException:
|
except (VmtpException, sshutils.SSHError, ClientException):
|
||||||
traceback.format_exc()
|
|
||||||
error_flag = True
|
|
||||||
except sshutils.SSHError:
|
|
||||||
traceback.format_exc()
|
traceback.format_exc()
|
||||||
error_flag = True
|
error_flag = True
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user