Bug 2029 mempage-size is ignored 57/12057/7
authorrodriguezgar <frodriguezg@indra.es>
Sat, 14 May 2022 22:42:45 +0000 (00:42 +0200)
committeraticig <gulsum.atici@canonical.com>
Tue, 17 May 2022 12:34:17 +0000 (14:34 +0200)
Change-Id: I2ca791474b9a717413964f1b85d7659489702f14
Signed-off-by: rodriguezgar <frodriguezg@indra.es>
RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py
releasenotes/notes/fix_bug_2029-bd1593d45e9c885b.yaml [new file with mode: 0644]

index 3d54903..ab9ef30 100644 (file)
@@ -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 (file)
index 0000000..3adcd4e
--- /dev/null
@@ -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