X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=inline;f=RO-VIM-openstack%2Fosm_rovim_openstack%2Fvimconn_openstack.py;h=76596494934bb99ded833eab9b4c74738b939282;hb=refs%2Ftags%2Fv13.0.2;hp=e404f22e41a8b8a3ab3308632b525543ac6c9dc6;hpb=d66107f9c92b90e3b90ff2eccbb3bd7bd068cabb;p=osm%2FRO.git diff --git a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py index e404f22e..76596494 100644 --- a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py +++ b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py @@ -355,12 +355,21 @@ class vimconnector(vimconn.VimConnector): endpoint_type=self.endpoint_type, region_name=region_name, ) - self.cinder = self.session["cinder"] = cClient.Client( - 2, - session=sess, - endpoint_type=self.endpoint_type, - region_name=region_name, - ) + + if sess.get_all_version_data(service_type="volumev2"): + self.cinder = self.session["cinder"] = cClient.Client( + 2, + session=sess, + endpoint_type=self.endpoint_type, + region_name=region_name, + ) + else: + self.cinder = self.session["cinder"] = cClient.Client( + 3, + session=sess, + endpoint_type=self.endpoint_type, + region_name=region_name, + ) try: self.my_tenant_id = self.session["my_tenant_id"] = sess.get_project_id() @@ -1353,8 +1362,7 @@ class vimconnector(vimconn.VimConnector): cpu_cores, cpu_threads = 0, 0 if self.vim_type == "VIO": - extra_specs["vmware:extra_config"] = '{"numa.nodeAffinity":"0"}' - extra_specs["vmware:latency_sensitivity_level"] = "high" + self.process_vio_numa_nodes(numa_nodes, extra_specs) for numa in numas: if "id" in numa: @@ -1384,6 +1392,19 @@ class vimconnector(vimconn.VimConnector): if cpu_threads: extra_specs["hw:cpu_threads"] = str(cpu_threads) + @staticmethod + def process_vio_numa_nodes(numa_nodes: int, extra_specs: Dict) -> None: + """According to number of numa nodes, updates the extra_specs for VIO. + + Args: + + numa_nodes (int): List keeps the numa node numbers + extra_specs (dict): Extra specs dict to be updated + + """ + # If there are several numas, we do not define specific affinity. + extra_specs["vmware:latency_sensitivity_level"] = "high" + def _change_flavor_name( self, name: str, name_suffix: int, flavor_data: dict ) -> str: @@ -4488,3 +4509,19 @@ class vimconnector(vimconn.VimConnector): self.__wait_for_vm(vm_id, "ACTIVE") instance_status = self.get_vdu_state(vm_id)[0] return instance_status + + def get_monitoring_data(self): + try: + self.logger.debug("Getting servers and ports data from Openstack VIMs.") + self._reload_connection() + all_servers = self.nova.servers.list(detailed=True) + all_ports = self.neutron.list_ports() + return all_servers, all_ports + except ( + vimconn.VimConnException, + vimconn.VimConnNotFoundException, + vimconn.VimConnConnectionException, + ) as e: + raise vimconn.VimConnException( + f"Exception in monitoring while getting VMs and ports status: {str(e)}" + )