From ea2c8c8b363dceb3c73be8f02f078d7b78b2c712 Mon Sep 17 00:00:00 2001 From: Adam Gandelman Date: Thu, 26 Jan 2012 12:36:55 -0800 Subject: Fix multinode libvirt volume attachment lp #922232 iscsiadm returns 0 if local db contains no target records. As a result, no exception is caught and no entry gets created (--op new) before continuing to login. Devstack/single-node users avoided this because, apparently, records are created in initiator db on target creations. Update: Address smokestack failures if err == None fixes bug #922232 Change-Id: I39c3574b8d75ca32eba3716efc3b488e596fbaf6 --- nova/virt/libvirt/volume.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nova/virt/libvirt/volume.py b/nova/virt/libvirt/volume.py index d93680d59..2bcf60d72 100644 --- a/nova/virt/libvirt/volume.py +++ b/nova/virt/libvirt/volume.py @@ -106,12 +106,11 @@ class LibvirtISCSIVolumeDriver(LibvirtVolumeDriver): def connect_volume(self, connection_info, mount_device): """Attach the volume to instance_name""" iscsi_properties = connection_info['data'] - try: - # NOTE(vish): if we are on the same host as nova volume, the - # discovery makes the target so we don't need to - # run --op new - self._run_iscsiadm(iscsi_properties, ()) - except exception.ProcessExecutionError: + # NOTE(vish): if we are on the same host as nova volume, the + # discovery makes the target so we don't need to + # run --op new + (out, err) = self._run_iscsiadm(iscsi_properties, ()) + if err and err.strip() == "iscsiadm: no records found!": self._run_iscsiadm(iscsi_properties, ('--op', 'new')) if iscsi_properties.get('auth_method'): -- cgit