Amador Pahim has uploaded a new change for review.

Change subject: Handle iscsi iface.net_ifacename for existing iface
......................................................................

Handle iscsi iface.net_ifacename for existing iface

Using a new version of engine which provides netIfaceName as an iscsi
connection option, hypervisor has to properly handle this option.

- For non-existent iscsi iface, nothing changes. We will create
  the device using the netIfaceName coming from engine.
- For already present iscsi iface:
 * If iface.net_ifacename is empty, we update iface using the value
   coming from engine.
 * If iface.net_ifacename has a value and the value is different from
   the netIfaceName coming from engine, we raise an exception and skip
   the iface configuration. Manual intervention will be needed.

Change-Id: I18c2b92a75ee3bcbbcc546e2bfa4f133a5f9ad22
Signed-off-by: Amador Pahim <[email protected]>
---
M vdsm/storage/hsm.py
M vdsm/storage/iscsi.py
2 files changed, 16 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/76/35976/1

diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 4ea7760..7c9cd8c 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -153,6 +153,20 @@
 
     for iface in iscsi.iterateIscsiInterfaces():
         if iface.name == ifaceName:
+            if netIfaceName is not None:
+                if iface.netIfaceName is None:
+                    iface.netIfaceName = netIfaceName
+                    iface.update()
+                elif netIfaceName != iface.netIfaceName:
+                    logging.error('iSCSI netIfaceName coming from engine [%s] '
+                                  'is different from iface.net_ifacename '
+                                  'present on the system [%s]. Aborting iscsi '
+                                  'iface [%s] configuration.' %
+                                  (netIfaceName, iface.netIfaceName,
+                                   iface.name))
+
+                    raise se.iSCSIifaceError()
+
             return iface
 
     iface = iscsi.IscsiInterface(ifaceName, initiatorName=initiatorName,
diff --git a/vdsm/storage/iscsi.py b/vdsm/storage/iscsi.py
index 5435ac4..ef0825c 100644
--- a/vdsm/storage/iscsi.py
+++ b/vdsm/storage/iscsi.py
@@ -383,7 +383,8 @@
         # If this fails mid operation we get a partially updated interface.
         # Suggestions are welcome.
         for key, value in self._conf.iteritems():
-            if value is None or key == 'iface.iscsi_ifacename':
+            if value is None or value == '<empty>' \
+               or key == 'iface.iscsi_ifacename':
                 continue
 
             iscsiadm.iface_update(self.name, key, value)


-- 
To view, visit http://gerrit.ovirt.org/35976
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I18c2b92a75ee3bcbbcc546e2bfa4f133a5f9ad22
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Amador Pahim <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to