From c76a3eee8272c5f3c66f43b8eafe2c48273ee0c7 Mon Sep 17 00:00:00 2001 From: anwars Date: Thu, 4 Oct 2018 14:05:32 +0530 Subject: [PATCH] System tests fix for openstack. Flavor and Network related system tests are fixed in this change. Change-Id: I28aecb130cbfc9ab24d25df4b26a8ac824776d29 Signed-off-by: anwars --- osm_ro/vimconn_openstack.py | 165 ++++++++++++++++++------------------ test/test_RO.py | 50 ++++++++--- 2 files changed, 122 insertions(+), 93 deletions(-) diff --git a/osm_ro/vimconn_openstack.py b/osm_ro/vimconn_openstack.py index b9c4e7c1..57e22575 100644 --- a/osm_ro/vimconn_openstack.py +++ b/osm_ro/vimconn_openstack.py @@ -351,13 +351,13 @@ class vimconnector(vimconn.vimconnector): ConnectionError, ksExceptions.ConnectionError, neExceptions.ConnectionFailed )): raise vimconn.vimconnConnectionException(type(exception).__name__ + ": " + str(exception)) - elif isinstance(exception, (nvExceptions.ClientException, ksExceptions.ClientException, - neExceptions.NeutronException, nvExceptions.BadRequest)): - if "could not be found" in str(exception): - raise vimconn.vimconnNotFoundException(type(exception).__name__ + ": " + str(exception)) - raise vimconn.vimconnUnexpectedResponse(type(exception).__name__ + ": " + str(exception)) elif isinstance(exception, (neExceptions.NetworkNotFoundClient, nvExceptions.NotFound)): raise vimconn.vimconnNotFoundException(type(exception).__name__ + ": " + str(exception)) + elif isinstance(exception, (KeyError, nvExceptions.BadRequest)): + raise vimconn.vimconnException(type(exception).__name__ + ": " + str(exception)) + elif isinstance(exception, (nvExceptions.ClientException, ksExceptions.ClientException, + neExceptions.NeutronException)): + raise vimconn.vimconnUnexpectedResponse(type(exception).__name__ + ": " + str(exception)) elif isinstance(exception, nvExceptions.Conflict): raise vimconn.vimconnConflictException(type(exception).__name__ + ": " + str(exception)) elif isinstance(exception, vimconn.vimconnException): @@ -664,83 +664,84 @@ class vimconnector(vimconn.vimconnector): retry=0 max_retries=3 name_suffix = 0 - name=flavor_data['name'] - while retry 1: - return -1, "Can not add flavor with more than one numa" - numa_properties = {"hw:numa_nodes":str(numa_nodes)} - numa_properties["hw:mem_page_size"] = "large" - numa_properties["hw:cpu_policy"] = "dedicated" - numa_properties["hw:numa_mempolicy"] = "strict" - if self.vim_type == "VIO": - numa_properties["vmware:extra_config"] = '{"numa.nodeAffinity":"0"}' - numa_properties["vmware:latency_sensitivity_level"] = "high" - for numa in numas: - #overwrite ram and vcpus - #check if key 'memory' is present in numa else use ram value at flavor - if 'memory' in numa: - ram = numa['memory']*1024 - #See for reference: https://specs.openstack.org/openstack/nova-specs/specs/mitaka/implemented/virt-driver-cpu-thread-pinning.html - if 'paired-threads' in numa: - vcpus = numa['paired-threads']*2 - #cpu_thread_policy "require" implies that the compute node must have an STM architecture - numa_properties["hw:cpu_thread_policy"] = "require" - numa_properties["hw:cpu_policy"] = "dedicated" - elif 'cores' in numa: - vcpus = numa['cores'] - # cpu_thread_policy "prefer" implies that the host must not have an SMT architecture, or a non-SMT architecture will be emulated - numa_properties["hw:cpu_thread_policy"] = "isolate" - numa_properties["hw:cpu_policy"] = "dedicated" - elif 'threads' in numa: - vcpus = numa['threads'] - # cpu_thread_policy "prefer" implies that the host may or may not have an SMT architecture - numa_properties["hw:cpu_thread_policy"] = "prefer" - numa_properties["hw:cpu_policy"] = "dedicated" - # for interface in numa.get("interfaces",() ): - # if interface["dedicated"]=="yes": - # raise vimconn.vimconnException("Passthrough interfaces are not supported for the openstack connector", http_code=vimconn.HTTP_Service_Unavailable) - # #TODO, add the key 'pci_passthrough:alias"="