openmainframeproject / feilong

Feilong is a open source z/VM cloud connector project under the Open Mainframe Project umbrella that will accelerate the z/VM adoption, extending its ecosystem and its user experience. It provides a set of APIs to operate z/VM including guest, image, network, volume etc.
https://www.openmainframeproject.org/projects/feilong
Apache License 2.0
35 stars 70 forks source link

API call GetGuestInfo() returns a float instead of an int for max_mem_kb #766

Closed Bischoff closed 9 months ago

Bischoff commented 10 months ago

What happens

According to the Feilong 1.6.5 documentation:

max_mem_kb  body    integer The maximum memory in KBytes can be allocated for this guest.

However Feilong returns value 4194304.0, which is not an integer, but a floating point number, in case of a maximum memory of 4 GiB.

This produces an error when you try to unmarshal that value.

What should happen

GetGuestInfo() should return an integer for field max_mem_kb.

The other field mem_kb is an integer as expected.

jichenjc commented 10 months ago

reasonable request to me , we will check with folks and see whether it's an old bug or regression introduced recently

jichenjc commented 10 months ago

https://github.com/openmainframeproject/feilong/blob/master/zvmsdk/vmops.py#L112 this has (int) force but this doesn't https://github.com/openmainframeproject/feilong/blob/master/zvmsdk/vmops.py#L136

can you add (int) in front of line 136 and see whether it fix the problem?

bjhuangr commented 10 months ago

@Bischoff Was the guest in power off state? when getting the info.

Bischoff commented 10 months ago

Thanks for the quick replies.

| can you add (int) in front of line 136 and see whether it fix the problem?

I will ask to the person who deployed the Feilong instance, I currently do not have access to this machine. I will get back to you.

| @Bischoff Was the guest in power off state? when getting the info.

Yes, it was powered off. I will check what happens if I power it on.

Bischoff commented 10 months ago

@bjhuangr Indeed, after the guest is powered on, I get an integer as expected.

@jichenjc Indeed, after I add int() on line 136, the issue is solved

Bischoff commented 10 months ago

I don't manage to push to gerrit:

 ! [remote rejected]   get-guest-info-max-mem-kb-type -> get-guest-info-max-mem-kb-type (prohibited by Gerrit: not permitted: create)

despite my remote is correct:

ebischoff@kool:~/SCM/github/Bischoff/feilong> git remote -v
gerrit  ssh://Bischoff@review.gerrithub.io:29418/openmainframeproject/python-zvm-sdk (fetch)
gerrit  ssh://Bischoff@review.gerrithub.io:29418/openmainframeproject/python-zvm-sdk (push)
(...)

I'm sorry but I cannot create the PR.

bjhuangr commented 10 months ago

@Bischoff thanks for attempting to submit a PR to fix this. If the gerrit process not work for you, you can just submit the PR with general github process - like you did https://github.com/openmainframeproject/feilong/pull/768, you can just reopen it.

Bischoff commented 10 months ago

ok, doing that, thanks @bjhuangr .

Bischoff commented 10 months ago

Merge please? ...

Bischoff commented 9 months ago

Thank you.