Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrades: use the management address type from old install #41

Open
wants to merge 2 commits into
base: 10.10.19-8.3
Choose a base branch
from

Conversation

gthvn1
Copy link

@gthvn1 gthvn1 commented Sep 23, 2024

No description provided.

@gthvn1 gthvn1 changed the base branch from master to 10.10.19-8.3 September 23, 2024 17:01
@gthvn1 gthvn1 changed the base branch from 10.10.19-8.3 to 10.10.16-8.3 September 23, 2024 17:02
util.py Outdated Show resolved Hide resolved
@gthvn1 gthvn1 marked this pull request as draft September 24, 2024 14:30
@gthvn1
Copy link
Author

gthvn1 commented Sep 24, 2024

It is really strange. When doing a fresh install using IPv6 static only my installation ends with IPv4. And the /etc/xensource-inventory has:

MANAGEMENT_INTERFACE=''
MANAGEMENT_ADDRESS_TYPE='IPv4'

I will add some logs to understand why it doesn't work...

backend.py Show resolved Hide resolved
@gthvn1 gthvn1 marked this pull request as ready for review September 25, 2024 08:06
@gthvn1 gthvn1 requested a review from stormi September 25, 2024 08:07
@gthvn1
Copy link
Author

gthvn1 commented Sep 25, 2024

It is really strange. When doing a fresh install using IPv6 static only my installation ends with IPv4. And the /etc/xensource-inventory has:

MANAGEMENT_INTERFACE=''
MANAGEMENT_ADDRESS_TYPE='IPv4'

I will add some logs to understand why it doesn't work...

So the issue was as expected because the management address type is always set. By default it is set to IPv4. So we use it only when no modes are selected (and it is the case during an upgrade for example). I tested a fresh install and in this case we are either in IPv4 mode or IPv6 mode. If the mode is IPv6 only we are in IPv6 and if it is set to both we use IPv4. And as said during an upgrade we are using the one set in /etc/xensource-inventory.
I tested:

  • fresh install in IPv6 (static and autoconf)
  • fresh install in IPv4 (dhcp)
  • upgrade from IPv6 static

@stormi stormi requested a review from ydirson September 25, 2024 10:01
@stormi stormi changed the title use former mgmtaddrtype Upgrades: use the management address type from old install Sep 25, 2024
@stormi
Copy link
Member

stormi commented Sep 25, 2024

Adding Yann to the review. Please all review this very carefully, as we don't want to introduce a regression at this stage of the release. If we doubt we can guarantee this, then we'll take more time for testing this change and release without. We need to decide today and package the updated installer in the afternoon.

An upstream PR is needed, too.

Copy link
Collaborator

@ydirson ydirson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is not obvious at first read, it would be useful to give a few details about the change in the commit message

backend.py Outdated
Comment on lines 1662 to 1666
# if no modes are configured then use mgmtAddrType
if not (admin_config.mode or admin_config.modev6):
inv.write("MANAGEMENT_ADDRESS_TYPE='%s'\n" % mgmtAddrType)
# Default to IPv4 unless we have only got an IPv6 admin interface
if ((not admin_config.mode) and admin_config.modev6):
elif (not admin_config.mode) and admin_config.modev6:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be more readable to have a single if not admin_config.mode around all of this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that cases are more readable like this but I can modify it no worries.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe with the updated logic we can still use elif to get get things more readable?

@gthvn1 gthvn1 force-pushed the gtn-use-former-mgmtaddrtype branch 2 times, most recently from 9c29926 to 265ed12 Compare September 25, 2024 12:07
Copy link
Collaborator

@ydirson ydirson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really sure to get it:

  • mgmtAddrType() seems to be used to set a default value, but only for install (would be useful to make it explicit in the code)
  • prepareUpgrade() states MANAGEMENT_ADDRESS_TYPE must be present in xensource-inventory , but looks at the default value (as well as the uuids!?), even though exceptions are rised if they cannot get overriden by getInventoryValue() calls?

@stormi
Copy link
Member

stormi commented Oct 17, 2024

Unless I'm wrong, I believe this PR is waiting for @gthvn1 after Yann's comments.

@gthvn1
Copy link
Author

gthvn1 commented Oct 17, 2024

Unless I'm wrong, I believe this PR is waiting for @gthvn1 after Yann's comments.

Yes right I missed it. But I'm not sure to understand the remark. As far as I understand it we will always in the case where no mode is selected we must have a value in the inventory from previous install so it will be overwritten with the value found in the inventory. And as the default case is "IPv4" I set it by default but yes maybe it is not needed. I don't remember exactly but I think when I tested it it didn't work without this definition.

@gthvn1
Copy link
Author

gthvn1 commented Oct 17, 2024

I will give it a try and keep you in touch. Probably today.

@gthvn1 gthvn1 changed the base branch from 10.10.16-8.3 to 10.10.19-8.3 October 17, 2024 11:36
@gthvn1 gthvn1 force-pushed the gtn-use-former-mgmtaddrtype branch from 265ed12 to fd143d1 Compare October 17, 2024 11:36
@gthvn1
Copy link
Author

gthvn1 commented Oct 17, 2024

I will give it a try and keep you in touch. Probably today.

So when removing def mgmtAddrType(): from util.py I have an error because "module" object has no attribute. So I added it. And without my patch the issue is that when upgrading an IPv6 only host the /etc/xensource-inventory has MANAGEMENT_ADDRESS_TYPE=IPv4...
@ydirson any ideas how to fix it?
In fact I'd like to follow what is done for "controlID" but for some reason it doesn't work. I'm sure I'm doing something wrong...

@gthvn1
Copy link
Author

gthvn1 commented Oct 17, 2024

@ydirson Ok I found why I added the def mgmtAddrType. It is because of Task(util.mgmtAddrType, As(ans), ['management-address-type']),. And I did that because 'management-address-type' was added to Task(writeInventory... So I followed what is done for 'control-domain-uuid' but as I cannot use the same Task(util.getUUID, As(ans), ['control-domain-uuid']), I created one for management address...

The two parameters are read from the xensource inventory so no need to
pass them as parameters of the prepareUpgrade function.

Signed-off-by: Guillaume <[email protected]>
During an upgrade if no modes are selected we need to use the management
address from the previous installation read from
/etc/xensource-inventory. By default it is set to IPv4. If a mode is selected
then we are using it. It both modes are selected (IPv4 abd IPv6) then we
are using IPv4.

Signed-off-by: Guillaume <[email protected]>
@gthvn1 gthvn1 force-pushed the gtn-use-former-mgmtaddrtype branch from fd143d1 to f1169e6 Compare October 18, 2024 16:41
@gthvn1
Copy link
Author

gthvn1 commented Oct 18, 2024

I have splitted the PR in two commits. The first commit can be upstreamed.

@gthvn1 gthvn1 requested a review from ydirson October 18, 2024 16:44
@gthvn1
Copy link
Author

gthvn1 commented Oct 18, 2024

  • testing upgrade from IPv6 only
  • testing upgrade from IPv4 only
  • test a fresh install with IPv6
    • Only tested using autoconf. Tried with dhcp but as our dhc6p server is not setup properly I'm not sure if the error is caused by our setup...
  • test a fresh install with IPv4

@stormi
Copy link
Member

stormi commented Oct 29, 2024

I have split the PR in two commits. The first commit can be upstreamed.

The second commit can also be upstreamed as part of Benjamin's IPv6 PR, can't it?

@gthvn1
Copy link
Author

gthvn1 commented Oct 29, 2024

Ah yes maybe 👍

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.

4 participants