From 1a0e2c84fce70dbad40c029489200e0c440f90fe Mon Sep 17 00:00:00 2001 From: rodriguezgar Date: Sun, 15 May 2022 00:42:45 +0200 Subject: [PATCH] Bug 2029 mempage-size is ignored Change-Id: I2ca791474b9a717413964f1b85d7659489702f14 Signed-off-by: rodriguezgar --- .../osm_rovim_openstack/vimconn_openstack.py | 20 +++++++++++++++++++ .../notes/fix_bug_2029-bd1593d45e9c885b.yaml | 20 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 releasenotes/notes/fix_bug_2029-bd1593d45e9c885b.yaml diff --git a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py index dbd7c81b..c2ac81f4 100644 --- a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py +++ b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py @@ -1349,6 +1349,26 @@ class vimconnector(vimconn.VimConnector): extended.get("disk-io-quota"), "disk_io", extra_specs ) + # Set the mempage size as specified in the descriptor + if extended.get("mempage-size"): + if extended.get("mempage-size") == "LARGE": + extra_specs["hw:mem_page_size"] = "large" + elif extended.get("mempage-size") == "SMALL": + extra_specs["hw:mem_page_size"] = "small" + elif extended.get("mempage-size") == "SIZE_2MB": + extra_specs["hw:mem_page_size"] = "2MB" + elif extended.get("mempage-size") == "SIZE_1GB": + extra_specs["hw:mem_page_size"] = "1GB" + elif extended.get("mempage-size") == "PREFER_LARGE": + extra_specs["hw:mem_page_size"] = "any" + else: + # The validations in NBI should make reaching here not possible. + # If this message is shown, check validations + self.logger.debug( + "Invalid mempage-size %s. Will be ignored", + extended.get("mempage-size"), + ) + # create flavor new_flavor = self.nova.flavors.create( name=name, diff --git a/releasenotes/notes/fix_bug_2029-bd1593d45e9c885b.yaml b/releasenotes/notes/fix_bug_2029-bd1593d45e9c885b.yaml new file mode 100644 index 00000000..3adcd4ee --- /dev/null +++ b/releasenotes/notes/fix_bug_2029-bd1593d45e9c885b.yaml @@ -0,0 +1,20 @@ +####################################################################################### +# Copyright ETSI Contributors and Others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +####################################################################################### +--- +fixes: + - | + Fixing bug 2029 - mempage-size was ignored when creating the flavor -- 2.25.1