Skip to content

sources/azure: report ready in local phase#1265

Merged
TheRealFalcon merged 4 commits into
canonical:mainfrom
cjp256:azure-report-ready-local-phase
Feb 15, 2022
Merged

sources/azure: report ready in local phase#1265
TheRealFalcon merged 4 commits into
canonical:mainfrom
cjp256:azure-report-ready-local-phase

Conversation

@cjp256
Copy link
Copy Markdown
Contributor

@cjp256 cjp256 commented Feb 14, 2022

Pre-provisioned instances report ready early in the local phase and
again in the non-local phase, during setup(). Non-PPS only reports
ready during non-local phase.

Update the process to report ready during the local phase for all
cases. Only attempt to do so if networking is up to prevent stalling
boot. We've already waited at least 20 minutes for DHCP if we're
provisioning, or 5 minutes for DHCP on normal boot requesting updated
network configuration.

  • Extend _report_ready() with pubkey_info and raise exception
    on error to consolidate reporting done in _negotiate() and
    _report_ready().

  • Remove setup(), moving relevant logic into crawl_metadata().

  • Move remaining _negotiate() logic into _cleanup_markers() and
    _determine_wireserver_pubkey_info().

These changes effectively fix two issues that were present:

(1) _negotiated is incorrectly set to True

When failing to report ready. _negotiate() squashed the exception and
the return value was not checked. This was probably masked due to the
forced removal of obj.pkl on Ubuntu instances, but would be preferable
once we start persisting it to prevent unnecessary re-negotiation.

(2) provisioning media is not ejected for non-PPS

_negotiate() did not pass iso_dev parameter when reporting ready. The
host will ensure this operation takes place, but it is preferable to
eject /dev/sr0 from within the guest when we're done with it.

Lastly, this removes any need for lease file parsing as the wireserver
addressed is tracked for ephemeral DHCP. A follow-up PR will remove
this now-unused logic.

Signed-off-by: Chris Patterson cpatterson@microsoft.com

@cjp256 cjp256 force-pushed the azure-report-ready-local-phase branch from 92bd8dd to d60fee1 Compare February 14, 2022 13:41
Pre-provisioned instances report ready early in the local phase and
again in the non-local phase, during setup().  Non-PPS only reports
ready during non-local phase.

Update the process to report ready during the local phase for all
cases.  Only attempt to do so if networking is up to prevent stalling
boot. We've already waited at least 20 minutes for DHCP if we're
provisioning, or 5 minutes for DHCP on normal boot requesting updated
network configuration.

- Extend _report_ready() with pubkey_info and raise exception
  on error to consolidate reporting done in _negotiate() and
  _report_ready().

- Remove setup(), moving relevant logic into crawl_metadata().

- Move remaining _negotiate() logic into _cleanup_markers() and
  _determine_wireserver_pubkey_info().

These changes effectively fix two issues that were present:

(1) _negotiated is incorrectly set to True

When failing to report ready.  _negotiate() squashed the exception and
the return value was not checked.  This was probably masked due to the
forced removal of obj.pkl on Ubuntu instances, but would be preferable
once we start persisting it to prevent unnecessary re-negotiation.

(2) provisioning media is not ejected for non-PPS

_negotiate() did not pass iso_dev parameter when reporting ready.  The
host will ensure this operation takes place, but it is preferable to
eject /dev/sr0 from within the guest when we're done with it.

Lastly, this removes any need for lease file parsing as the wireserver
addressed is tracked for ephemeral DHCP.  A follow-up PR will remove
this now-unused logic.

Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
@cjp256 cjp256 force-pushed the azure-report-ready-local-phase branch 2 times, most recently from 31a8ea7 to 94bc44c Compare February 15, 2022 13:27
@cjp256 cjp256 marked this pull request as ready for review February 15, 2022 13:28
@cjp256 cjp256 force-pushed the azure-report-ready-local-phase branch 2 times, most recently from 76bcad5 to ad709f6 Compare February 15, 2022 13:51
Copy link
Copy Markdown
Contributor

@anhvoms anhvoms left a comment

Choose a reason for hiding this comment

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

LGTM

@cjp256
Copy link
Copy Markdown
Contributor Author

cjp256 commented Feb 15, 2022

@TheRealFalcon any chance can we get this one in prior to release?

@TheRealFalcon
Copy link
Copy Markdown
Contributor

I'll start reviewing it.

Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
@cjp256 cjp256 force-pushed the azure-report-ready-local-phase branch from ad709f6 to 37d3a35 Compare February 15, 2022 16:55
@TheRealFalcon TheRealFalcon merged commit 101a62f into canonical:main Feb 15, 2022
@cjp256 cjp256 deleted the azure-report-ready-local-phase branch February 15, 2022 17:53
self._ephemeral_dhcp_ctx = None
if not hasattr(self, "iso_dev"):
self.iso_dev = None
self._iso_dev = None
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@TheRealFalcon @cjp256 Hrm, if my cached obj.pkl pickle already has self._iso_dev set to something other than none, this unpickle will clear it's value. Does this break us?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It would not break anything. We don't want to persist it anymore :)

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