diff options
| author | Adam Gandelman <adamg@canonical.com> | 2012-01-26 12:36:55 -0800 |
|---|---|---|
| committer | Adam Gandelman <adamg@canonical.com> | 2012-01-30 22:33:09 -0800 |
| commit | ea2c8c8b363dceb3c73be8f02f078d7b78b2c712 (patch) | |
| tree | bd0f3012f42de8d86c9db4ad02ced72b80db39be | |
| parent | c9ac6e1671df689c3ba4a4d55f8740bd8f2e8f0e (diff) | |
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
| -rw-r--r-- | nova/virt/libvirt/volume.py | 11 |
1 files 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'): |
