Datera / rtslib

The Linux SCSI Target API
http://linux-iscsi.org
Apache License 2.0
19 stars 17 forks source link

utils.py: Fix logic for determining word size #21

Open vipinparashar opened 7 years ago

vipinparashar commented 7 years ago

Currently function list_eth_names determines arch word size by checking for suffix '_64' in os.uname() arch string. This doesn't work on ppc64le platform as the architecture string is reported as 'ppc64le'. Hence the function when executed on ppc64le machine incorrectly assumes that its running on a 32-bit platform. This results in incorrect interface names being evaluated and finally results in error "ValueError: You must specify a valid interface name." during network portal creation.

This patch changes function list_eth_names to use sys.maxsize value to determine word size of the architecture and ultimately use an appropriate offset value in struct ifconf returned from ioctl call.

vaibhav92 commented 7 years ago

This fixes issue #20 identified on powerpc64_le arch

vaibhav92 commented 7 years ago

An alternative is proposed in #18 that gets rid of function list_eth_names entirely.