@@ -132,7 +132,8 @@ def get_args_parser():
132132 -------
133133 The commandline argparse namespace.
134134 """
135- parser = argparse .ArgumentParser (description = 'Utility for listing or configuring iSCSI devices on an OCI instance.' )
135+ parser = argparse .ArgumentParser (prog = 'oci-iscsi-config' ,
136+ description = 'Utility for listing or configuring iSCSI devices on an OCI instance.' )
136137 subparser = parser .add_subparsers (dest = 'command' )
137138 #
138139 # sync
@@ -757,6 +758,8 @@ def display_attached_volumes(oci_sess, iscsiadm_session, disks, output_mode, det
757758 _logger .debug ('Cannot get all volumes of this instance : %s' , str (e ))
758759
759760 if not iscsiadm_session and len (oci_vols ) > 0 :
761+ #
762+ # iscsiadm does not show volumes, oci_api.session does, attached volumes but not connected.
760763 print ("Local iSCSI info not available." )
761764 print ("List info from Cloud instead(No boot volume)." )
762765 print ("" )
@@ -1869,6 +1872,20 @@ def get_max_volumes():
18691872 return max_vol
18701873
18711874
1875+ def get_iscsiadm_session ():
1876+ """
1877+ Find the attached block volumes with exception of the boot volume.
1878+
1879+ Returns
1880+ -------
1881+ dict: the attached block volumes and their data.
1882+ """
1883+
1884+ all_volumes = iscsiadm .session ()
1885+ iscsiadmsession = dict ((iqn , all_volumes [iqn ]) for iqn in all_volumes if 'boot:uefi' not in iqn )
1886+ return iscsiadmsession
1887+
1888+
18721889def do_oci_vol_attach_ocid (oci_session , compatibility_mode , volume_iqn , use_chap_secrets ):
18731890 """
18741891 Collect data for attaching an iSCSI volume to this instance based on an ocid.
@@ -2196,6 +2213,9 @@ def main():
21962213 #
21972214 # collect iscsi volume information
21982215 system_disks = lsblk .list_blk_dev ()
2216+ #
2217+ # we are not touching boot volume in iscsi config
2218+ # iscsiadm_session = get_iscsiadm_session()
21992219 iscsiadm_session = iscsiadm .session ()
22002220 #
22012221 # the show option
0 commit comments