Skip to content

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

Open
vipinparashar wants to merge 1 commit intoDatera:masterfrom
vipinparashar:utils_arch
Open

utils.py: Fix logic for determining word size#21
vipinparashar wants to merge 1 commit intoDatera:masterfrom
vipinparashar:utils_arch

Conversation

@vipinparashar
Copy link
Copy Markdown

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.

Currently list_eth_names() checks architecture width to determine
offset for interface array name lookup. This gets broken for ppc64le
architecture. Changing this logic to use 'sys.maxsize'. This issue
got exposed with 'targetcli' command.

Signed-off-by: Vipin K Parashar <vipin@linux.vnet.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
@vaibhav92
Copy link
Copy Markdown

This fixes issue #20 identified on powerpc64_le arch

@vaibhav92
Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants