From 74717f1ac2e59a302f068b770170dd4bca204d72 Mon Sep 17 00:00:00 2001 From: "Swartz, Nathan" Date: Fri, 22 Feb 2019 11:20:54 -0600 Subject: [PATCH] Fix hosts with same lun number conflict in netapp_e_lun_mapping. This patch fixes an issue of when multiple hosts are created and then subsequently volume(s) are mapped to them using the same specified number. --- lib/ansible/modules/storage/netapp/netapp_e_lun_mapping.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/storage/netapp/netapp_e_lun_mapping.py b/lib/ansible/modules/storage/netapp/netapp_e_lun_mapping.py index 576718a4420..fc715712969 100644 --- a/lib/ansible/modules/storage/netapp/netapp_e_lun_mapping.py +++ b/lib/ansible/modules/storage/netapp/netapp_e_lun_mapping.py @@ -202,9 +202,10 @@ class LunMapping(object): # Verify that when a lun is specified that it does not match an existing lun value unless it is associated with # the specified volume (ie for an update) if self.lun and any((self.lun == lun_mapping["lun"] and + self.target == self.mapping_info["target_by_reference"][lun_mapping["map_reference"]] and self.volume != self.mapping_info["volume_by_reference"][lun_mapping["volume_reference"]] ) for lun_mapping in self.mapping_info["lun_mapping"]): - self.module.fail_json(msg="Option lun value is already in use! Id [%s]." % self.ssid) + self.module.fail_json(msg="Option lun value is already in use for target! Array Id [%s]." % self.ssid) # Verify that when target_type is specified then it matches the target's actually type if self.target and self.target_type and self.target in self.mapping_info["target_type_by_name"].keys() and \