aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testcases/config_functest.yaml1
-rw-r--r--testcases/vPing/CI/libraries/vPing_ssh.py14
-rw-r--r--testcases/vPing/CI/libraries/vPing_userdata.py14
3 files changed, 17 insertions, 12 deletions
diff --git a/testcases/config_functest.yaml b/testcases/config_functest.yaml
index 78f4403e3..b1f7920fb 100644
--- a/testcases/config_functest.yaml
+++ b/testcases/config_functest.yaml
@@ -66,6 +66,7 @@ vping:
vm_flavor: m1.small #adapt to your environment
vm_name_1: opnfv-vping-1
vm_name_2: opnfv-vping-2
+ image_name: functest-vping
vping_private_net_name: vping-net
vping_private_subnet_name: vping-subnet
vping_private_subnet_cidr: 192.168.130.0/24
diff --git a/testcases/vPing/CI/libraries/vPing_ssh.py b/testcases/vPing/CI/libraries/vPing_ssh.py
index 530286c9c..b45d23be8 100644
--- a/testcases/vPing/CI/libraries/vPing_ssh.py
+++ b/testcases/vPing/CI/libraries/vPing_ssh.py
@@ -32,6 +32,7 @@ from glanceclient import client as glanceclient
pp = pprint.PrettyPrinter(indent=4)
parser = argparse.ArgumentParser()
+image_exists = False
parser.add_argument("-d", "--debug", help="Debug mode", action="store_true")
parser.add_argument("-r", "--report",
@@ -81,9 +82,7 @@ PING_TIMEOUT = functest_yaml.get("vping").get("ping_timeout")
TEST_DB = functest_yaml.get("results").get("test_db_url")
NAME_VM_1 = functest_yaml.get("vping").get("vm_name_1")
NAME_VM_2 = functest_yaml.get("vping").get("vm_name_2")
-# GLANCE_IMAGE_NAME = functest_yaml.get("general"). \
-# get("openstack").get("image_name")
-GLANCE_IMAGE_NAME = "functest-vping"
+GLANCE_IMAGE_NAME = functest_yaml.get("vping").get("image_name")
GLANCE_IMAGE_FILENAME = functest_yaml.get("general"). \
get("openstack").get("image_file_name")
GLANCE_IMAGE_FORMAT = functest_yaml.get("general"). \
@@ -252,9 +251,10 @@ def cleanup(nova, neutron, image_id, network_dic, sg_id, floatingip):
# delete both VMs
logger.info("Cleaning up...")
- logger.debug("Deleting image...")
- if not functest_utils.delete_glance_image(nova, image_id):
- logger.error("Error deleting the glance image")
+ if not image_exists:
+ logger.debug("Deleting image...")
+ if not functest_utils.delete_glance_image(nova, image_id):
+ logger.error("Error deleting the glance image")
vm1 = functest_utils.get_instance_by_name(nova, NAME_VM_1)
if vm1:
@@ -373,6 +373,8 @@ def main():
image_id = functest_utils.get_image_id(glance_client, GLANCE_IMAGE_NAME)
if image_id != '':
logger.info("Using existing image '%s'..." % GLANCE_IMAGE_NAME)
+ global image_exists
+ image_exists = True
else:
logger.info("Creating image '%s' from '%s'..." % (GLANCE_IMAGE_NAME,
GLANCE_IMAGE_PATH))
diff --git a/testcases/vPing/CI/libraries/vPing_userdata.py b/testcases/vPing/CI/libraries/vPing_userdata.py
index daaee9bed..3af65e348 100644
--- a/testcases/vPing/CI/libraries/vPing_userdata.py
+++ b/testcases/vPing/CI/libraries/vPing_userdata.py
@@ -30,6 +30,7 @@ from glanceclient import client as glanceclient
pp = pprint.PrettyPrinter(indent=4)
parser = argparse.ArgumentParser()
+image_exists = False
parser.add_argument("-d", "--debug", help="Debug mode", action="store_true")
parser.add_argument("-r", "--report",
@@ -78,9 +79,7 @@ PING_TIMEOUT = functest_yaml.get("vping").get("ping_timeout")
TEST_DB = functest_yaml.get("results").get("test_db_url")
NAME_VM_1 = functest_yaml.get("vping").get("vm_name_1")
NAME_VM_2 = functest_yaml.get("vping").get("vm_name_2")
-# GLANCE_IMAGE_NAME = functest_yaml.get("general"). \
-# get("openstack").get("image_name")
-GLANCE_IMAGE_NAME = "functest-vping"
+GLANCE_IMAGE_NAME = functest_yaml.get("vping").get("image_name")
GLANCE_IMAGE_FILENAME = functest_yaml.get("general"). \
get("openstack").get("image_file_name")
GLANCE_IMAGE_FORMAT = functest_yaml.get("general"). \
@@ -250,9 +249,10 @@ def cleanup(nova, neutron, image_id, network_dic):
# delete both VMs
logger.info("Cleaning up...")
- logger.debug("Deleting image...")
- if not functest_utils.delete_glance_image(nova, image_id):
- logger.error("Error deleting the glance image")
+ if not image_exists:
+ logger.debug("Deleting image...")
+ if not functest_utils.delete_glance_image(nova, image_id):
+ logger.error("Error deleting the glance image")
vm1 = functest_utils.get_instance_by_name(nova, NAME_VM_1)
if vm1:
@@ -359,6 +359,8 @@ def main():
image_id = functest_utils.get_image_id(glance_client, GLANCE_IMAGE_NAME)
if image_id != '':
logger.info("Using existing image '%s'..." % GLANCE_IMAGE_NAME)
+ global image_exists
+ image_exists = True
else:
logger.info("Creating image '%s' from '%s'..." % (GLANCE_IMAGE_NAME,
GLANCE_IMAGE_PATH))