From 6e11623309406436dff813a97b8722b05b40f2c2 Mon Sep 17 00:00:00 2001 From: tierno Date: Mon, 18 Jul 2016 13:01:40 +0200 Subject: [PATCH] fixes #30. Using openstack as a VIM, avoid the metadata of pci_injection grater than 255 Change-Id: I03afca5ee05cdf14b884a33cee7b7d2795331851 Signed-off-by: tierno --- openmanod.py | 2 +- vimconn_openstack.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/openmanod.py b/openmanod.py index f2cfb7e5..bedcba88 100755 --- a/openmanod.py +++ b/openmanod.py @@ -33,7 +33,7 @@ It loads the configuration file and launches the http_server thread that will li ''' __author__="Alfonso Tierno, Gerardo Garcia, Pablo Montes" __date__ ="$26-aug-2014 11:09:29$" -__version__="0.4.43-r480" +__version__="0.4.43-r481" version_date="Jul 2016" database_version="0.11" #expected database schema version diff --git a/vimconn_openstack.py b/vimconn_openstack.py index 1c6227e7..f053022d 100644 --- a/vimconn_openstack.py +++ b/vimconn_openstack.py @@ -563,7 +563,7 @@ class vimconnector(vimconn.vimconnector): ''' self.logger.debug("Creating VM image '%s' flavor '%s' nics='%s'",image_id, flavor_id,str(net_list)) try: - metadata=[] + metadata={} net_list_vim=[] self._reload_connection() metadata_vpci={} #For a specific neutron plugin @@ -602,6 +602,11 @@ class vimconnector(vimconn.vimconnector): net_list_vim.append({"port-id": new_port["port"]["id"]}) if metadata_vpci: metadata = {"pci_assignement": json.dumps(metadata_vpci)} + if len(metadata["pci_assignement"] >255): + #limit the metadata size + #metadata["pci_assignement"] = metadata["pci_assignement"][0:255] + self.logger.warn("Metadata deleted since it exceeds the expected length (255) ") + metadata = {} self.logger.debug("name '%s' image_id '%s'flavor_id '%s' net_list_vim '%s' description '%s' metadata %s", name, image_id, flavor_id, str(net_list_vim), description, str(metadata)) -- 2.17.1