Add more features for Mercury
1. Add --delete-image-after-run; 2. Add --availability-zone to CLI options; 3. Doc updates; Change-Id: If26d8c60e73ef119c70fad815cdf8b11cf23a001
This commit is contained in:
parent
2cf7167718
commit
041039359b
@ -13,12 +13,14 @@ VMTP Usage
|
|||||||
[--external-host <user>@<host_ssh_ip>[:password>]]
|
[--external-host <user>@<host_ssh_ip>[:password>]]
|
||||||
[--controller-node <user>@<host_ssh_ip>[:<password>]]
|
[--controller-node <user>@<host_ssh_ip>[:<password>]]
|
||||||
[--mongod-server <server ip>] [--json <file>]
|
[--mongod-server <server ip>] [--json <file>]
|
||||||
[--tp-tool <nuttcp|iperf>] [--hypervisor [<az>:] <hostname>]
|
[--tp-tool <nuttcp|iperf>]
|
||||||
[--inter-node-only] [--protocols <T|U|I>]
|
[--availability_zone <availability_zone>] [--hypervisor [<az>:]
|
||||||
|
<hostname>] [--inter-node-only] [--protocols <T|U|I>]
|
||||||
[--bandwidth <bandwidth>] [--tcpbuf <tcp_pkt_size1,...>]
|
[--bandwidth <bandwidth>] [--tcpbuf <tcp_pkt_size1,...>]
|
||||||
[--udpbuf <udp_pkt_size1,...>]
|
[--udpbuf <udp_pkt_size1,...>]
|
||||||
[--reuse_network_name <network_name>]
|
[--reuse_network_name <network_name>]
|
||||||
[--os-dataplane-network <network_name>] [--no-env]
|
[--os-dataplane-network <network_name>]
|
||||||
|
[--delete-image-after-run] [--no-env]
|
||||||
[--vnic-type <direct|macvtap|normal>] [-d] [-v]
|
[--vnic-type <direct|macvtap|normal>] [-d] [-v]
|
||||||
[--stop-on-error] [--vm-image-url <url_to_image>]
|
[--stop-on-error] [--vm-image-url <url_to_image>]
|
||||||
[--test-description <test_description>]
|
[--test-description <test_description>]
|
||||||
@ -49,6 +51,8 @@ VMTP Usage
|
|||||||
--json <file> store results in json format file
|
--json <file> store results in json format file
|
||||||
--tp-tool <nuttcp|iperf>
|
--tp-tool <nuttcp|iperf>
|
||||||
transport perf tool to use (default=nuttcp)
|
transport perf tool to use (default=nuttcp)
|
||||||
|
--availability_zone <availability_zone>
|
||||||
|
availability zone for running VMTP
|
||||||
--hypervisor [<az>:] <hostname>
|
--hypervisor [<az>:] <hostname>
|
||||||
hypervisor to use (1 per arg, up to 2 args)
|
hypervisor to use (1 per arg, up to 2 args)
|
||||||
--inter-node-only only measure inter-node
|
--inter-node-only only measure inter-node
|
||||||
@ -67,6 +71,9 @@ VMTP Usage
|
|||||||
--os-dataplane-network <network_name>
|
--os-dataplane-network <network_name>
|
||||||
Internal network name for OpenStack to hold data plane
|
Internal network name for OpenStack to hold data plane
|
||||||
traffic
|
traffic
|
||||||
|
--delete-image-after-run
|
||||||
|
delete image that are uploaded by VMTP when tests are
|
||||||
|
finished
|
||||||
--no-env do not read env variables
|
--no-env do not read env variables
|
||||||
--vnic-type <direct|macvtap|normal>
|
--vnic-type <direct|macvtap|normal>
|
||||||
binding vnic type for test VMs
|
binding vnic type for test VMs
|
||||||
|
@ -68,6 +68,17 @@ class Compute(object):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def delete_image(self, glance_client, img_name):
|
||||||
|
try:
|
||||||
|
print "Deleting image %s..." % img_name
|
||||||
|
img = glance_client.images.find(name=img_name)
|
||||||
|
glance_client.images.delete(img.id)
|
||||||
|
except Exception:
|
||||||
|
print "Failed to delete the image %s." % img_name
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
# Remove keypair name from openstack if exists
|
# Remove keypair name from openstack if exists
|
||||||
def remove_public_key(self, name):
|
def remove_public_key(self, name):
|
||||||
keypair_list = self.novaclient.keypairs.list()
|
keypair_list = self.novaclient.keypairs.list()
|
||||||
|
24
vmtp/vmtp.py
24
vmtp/vmtp.py
@ -145,6 +145,8 @@ class VmtpTest(object):
|
|||||||
self.image_instance = None
|
self.image_instance = None
|
||||||
self.flavor_type = None
|
self.flavor_type = None
|
||||||
self.instance_access = None
|
self.instance_access = None
|
||||||
|
self.glance_client = None
|
||||||
|
self.image_uploaded = False
|
||||||
self.rescol = rescol
|
self.rescol = rescol
|
||||||
self.config = config
|
self.config = config
|
||||||
self.cred = cred
|
self.cred = cred
|
||||||
@ -212,13 +214,14 @@ class VmtpTest(object):
|
|||||||
keystone = keystoneclient.Client(**creds)
|
keystone = keystoneclient.Client(**creds)
|
||||||
glance_endpoint = keystone.service_catalog.url_for(
|
glance_endpoint = keystone.service_catalog.url_for(
|
||||||
service_type='image', endpoint_type='publicURL')
|
service_type='image', endpoint_type='publicURL')
|
||||||
glance_client = glanceclient.Client(
|
self.glance_client = glanceclient.Client(
|
||||||
glance_endpoint, token=keystone.auth_token)
|
glance_endpoint, token=keystone.auth_token)
|
||||||
self.comp.upload_image_via_url(
|
self.comp.upload_image_via_url(
|
||||||
glance_client,
|
self.glance_client,
|
||||||
self.config.image_name,
|
self.config.image_name,
|
||||||
self.config.vm_image_url)
|
self.config.vm_image_url)
|
||||||
self.image_instance = self.comp.find_image(self.config.image_name)
|
self.image_instance = self.comp.find_image(self.config.image_name)
|
||||||
|
self.image_uploaded = True
|
||||||
else:
|
else:
|
||||||
# Exit the pogram
|
# Exit the pogram
|
||||||
print '%s: image to launch VM not found. ABORTING.' \
|
print '%s: image to launch VM not found. ABORTING.' \
|
||||||
@ -405,6 +408,8 @@ class VmtpTest(object):
|
|||||||
except ClientException:
|
except ClientException:
|
||||||
# May throw novaclient.exceptions.BadRequest if in use
|
# May throw novaclient.exceptions.BadRequest if in use
|
||||||
print('Security group in use: not deleted')
|
print('Security group in use: not deleted')
|
||||||
|
if self.image_uploaded and self.config.delete_image_after_run:
|
||||||
|
self.comp.delete_image(self.glance_client, self.config.image_name)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
error_flag = False
|
error_flag = False
|
||||||
@ -719,6 +724,11 @@ def parse_opts_from_cli():
|
|||||||
help='transport perf tool to use (default=nuttcp)',
|
help='transport perf tool to use (default=nuttcp)',
|
||||||
metavar='<nuttcp|iperf>')
|
metavar='<nuttcp|iperf>')
|
||||||
|
|
||||||
|
parser.add_argument('--availability_zone', dest='availability_zone',
|
||||||
|
action='store',
|
||||||
|
help='availability zone for running VMTP',
|
||||||
|
metavar='<availability_zone>')
|
||||||
|
|
||||||
# note there is a bug in argparse that causes an AssertionError
|
# note there is a bug in argparse that causes an AssertionError
|
||||||
# when the metavar is set to '[<az>:]<hostname>', hence had to insert a space
|
# when the metavar is set to '[<az>:]<hostname>', hence had to insert a space
|
||||||
parser.add_argument('--hypervisor', dest='hypervisors',
|
parser.add_argument('--hypervisor', dest='hypervisors',
|
||||||
@ -770,6 +780,11 @@ def parse_opts_from_cli():
|
|||||||
help='Internal network name for OpenStack to hold data plane traffic',
|
help='Internal network name for OpenStack to hold data plane traffic',
|
||||||
metavar='<network_name>')
|
metavar='<network_name>')
|
||||||
|
|
||||||
|
parser.add_argument('--delete-image-after-run', dest='delete_image_after_run',
|
||||||
|
default=False,
|
||||||
|
action='store_true',
|
||||||
|
help='delete image that are uploaded by VMTP when tests are finished')
|
||||||
|
|
||||||
parser.add_argument('--no-env', dest='no_env',
|
parser.add_argument('--no-env', dest='no_env',
|
||||||
default=False,
|
default=False,
|
||||||
action='store_true',
|
action='store_true',
|
||||||
@ -850,6 +865,9 @@ def merge_opts_to_configs(opts):
|
|||||||
config.vnic_type = opts.vnic_type
|
config.vnic_type = opts.vnic_type
|
||||||
config.hypervisors = opts.hypervisors
|
config.hypervisors = opts.hypervisors
|
||||||
|
|
||||||
|
if opts.availability_zone:
|
||||||
|
config.availability_zone = opts.availability_zone
|
||||||
|
|
||||||
# time to run each perf test in seconds
|
# time to run each perf test in seconds
|
||||||
if opts.time:
|
if opts.time:
|
||||||
config.time = int(opts.time)
|
config.time = int(opts.time)
|
||||||
@ -923,6 +941,8 @@ def merge_opts_to_configs(opts):
|
|||||||
if opts.os_dataplane_network:
|
if opts.os_dataplane_network:
|
||||||
config.os_dataplane_network = opts.os_dataplane_network
|
config.os_dataplane_network = opts.os_dataplane_network
|
||||||
|
|
||||||
|
config.delete_image_after_run = opts.delete_image_after_run
|
||||||
|
|
||||||
#####################################################
|
#####################################################
|
||||||
# Set Ganglia server ip and port if the monitoring (-m)
|
# Set Ganglia server ip and port if the monitoring (-m)
|
||||||
# option is enabled.
|
# option is enabled.
|
||||||
|
Loading…
Reference in New Issue
Block a user