Fix bug 1572 - Reading availability-zone-hint for neutron from config 25/11025/2
authorsousaedu <eduardo.sousa@canonical.com>
Thu, 17 Jun 2021 14:39:29 +0000 (15:39 +0100)
committersousaedu <eduardo.sousa@canonical.com>
Fri, 18 Jun 2021 11:28:25 +0000 (12:28 +0100)
Fixes bug 1572 by reading the neutron-availability-zone-hint from VIM
plugin configuration, which is then applied at network-creation time.

Note: this patch also fixes some formatting issues that black showed.

Change-Id: Iaf152657ae31748ea6b4a123e8b0a0d9513cb692
Signed-off-by: sousaedu <eduardo.sousa@canonical.com>
RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py

index c59bf90..d3837ab 100644 (file)
@@ -864,6 +864,14 @@ class vimconnector(vimconn.VimConnector):
             if self.config.get("disable_network_port_security"):
                 network_dict["port_security_enabled"] = False
 
+            if self.config.get("neutron_availability_zone_hints"):
+                hints = self.config.get("neutron_availability_zone_hints")
+
+                if isinstance(hints, str):
+                    hints = [hints]
+
+                network_dict["availability_zone_hints"] = hints
+
             new_net = self.neutron.create_network({"network": network_dict})
             # print new_net
             # create subnetwork, even if there is no profile