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

upgrade: Add support for --pull-only and --deploy-only #642

Closed

Conversation

cgwalters
Copy link
Member

This makes it easier to script downloading updates in the background,
and only do deployments just before rebooting.

Partially addresses #640

@cgwalters
Copy link
Member Author

I didn't test this locally yet, and would definitely need test suite additions.

@cgwalters
Copy link
Member Author

cgwalters commented Jan 5, 2017

One major piece this is also missing is that --deploy --reboot will always do a deployment and reboot, even if there are no updates.

@paulvt
Copy link

paulvt commented Jan 5, 2017

I'd say that --reboot conflicts with --pull-only (why would you do that?) and also with --deploy-only.
I see --reboot as a mechanism for rebooting conditionallly when something was pulled and then deployed. (Same as I wrongly considered ostree admin upgrade to pull and deploy if and only if something was pulled.)

@cgwalters cgwalters force-pushed the upgrade-split-pull-deploy branch from 47cfd4a to 22810f4 Compare January 5, 2017 17:01
@cgwalters
Copy link
Member Author

cgwalters commented Jan 5, 2017

Okay, took a crack at fixing the gap by adding a "synthetic" pull flag that's used with --deploy-only. This gets us the proper changed handling, so ostree admin upgrade --deploy-only will say "No changes" if there are no pending updates.

(I still didn't test this much sorry, typing some code here while waiting for some tests to run)

This makes it easier to script downloading updates in the background,
and only do deployments just before rebooting.

Partially addresses ostreedev#640
@cgwalters cgwalters force-pushed the upgrade-split-pull-deploy branch from 00aa835 to 47f08ff Compare February 13, 2017 21:04
@cgwalters cgwalters removed the WIP label Feb 13, 2017
@cgwalters
Copy link
Member Author

Rebased 🏄, now with docs 📚 and tests ✅.

@cgwalters
Copy link
Member Author

Removing WIP.

@@ -85,7 +85,8 @@ gboolean ostree_sysroot_upgrader_check_timestamps (OstreeRepo *repo,

typedef enum {
OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_NONE = 0,
OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_ALLOW_OLDER = (1 << 0)
OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_ALLOW_OLDER = (1 << 0),
OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_SYNTHETIC = (1 << 1) /* Don't actually do a pull, just check timestamps/changed */
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this flag though? Seems like it would be cleaner to just seed new_revision with the refspec on upgrader init (similar to what we do in rpm-ostree) and then just not call ostree_sysroot_upgrader_pull() at all, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

The equivalent of RPMOSTREE_TRANSACTION_DEPLOY_FLAG_NO_PULL_BASE? So...yeah, I guess we could do that, but I like keeping the timestamp check in there, and I'd argue we should probably do the same in rpm-ostree.

What if e.g. someone did a raw ostree pull --commit-metadata-only or something, which won't do timestamp checks and hence could be more easily MITM'd - then later an admin does ostree admin upgrade --deploy-only, we'd be skipping the timestamp check.

* compatiblity, we only do cleanup if a user specifies the new --pull-only
* option. Otherwise, we would break the case of trying to deploy a commit
* that isn't directly referenced.
*/
Copy link
Member

Choose a reason for hiding this comment

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

I'm still not sure I understand this. Is there any risk to leaving the intermediate data until the cleanup that happens after deployment? Isn't this making us lose potential static delta jumps between consecutive --pull-only operations?

Copy link
Member Author

Choose a reason for hiding this comment

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

If a pull is successful, it will set the ref. Let's call this the "new pulled base", as distinct from creating a new deployment. ostree_sysroot_cleanup won't reset the ref.

Hence we should (though this isn't explicitly tested right now) keep deltas, since we still have the ref. Now, that's all the argument for why this won't break anything.

Why I wanted to do this is - think about a scenario where due to a flaky internet connection we do a pull, it gets interrupted, do another pull, it gets interrupted, repeat. If this happens a lot, we will endlessly accumulate partial new commits.

With this change, we'll trigger the one-day-timeout on staged commit data. Now...perhaps we should really do the cleanup after an unsuccessful pull, to ensure that we will always reuse downloaded-but-not-consumed deltas? Will look at that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved some of that to #713

@jlebon
Copy link
Member

jlebon commented Feb 27, 2017

Looks good!
@rh-atomic-bot r+ 7e9cd67

@rh-atomic-bot
Copy link

⌛ Testing commit 7e9cd67 with merge 36b28cb...

@rh-atomic-bot
Copy link

☀️ Test successful - status-atomicjenkins
Approved by: jlebon
Pushing 36b28cb to master...

jlebon added a commit to jlebon/rpm-ostree that referenced this pull request Oct 10, 2017
As @cgwalters mentioned in coreos#1035, the new `--cache-only` implemented
only the rpmmd half of the story. Here we complete that story by also
ensuring that when in cache-only mode, we don't download new ostree data
nor new packages. We try to complete the requested operation with what
we have.

To do this, we add support for the same `SYNTHETIC` pull that was added
in ostree[1] so that we don't actually pull, but still perform timestamp
checking.

On the pkgcache side, we disable all remote repos and instead insert all
our cached RPMs into the `DnfSack`. Care is taken to still perform
SHA256 verification for local pkg installs/replacements.

[1] ostreedev/ostree#642
jlebon added a commit to jlebon/rpm-ostree that referenced this pull request Oct 12, 2017
As Colin mentioned in coreos#1035, the new `--cache-only` implemented only the
rpmmd half of the story. Here we complete that story by also ensuring
that when in cache-only mode, we don't download new ostree data nor new
packages. We try to complete the requested operation with what we have.

To do this, we add support for the same `SYNTHETIC` pull that was added
in ostree[1] so that we don't actually pull, but still perform timestamp
checking.

On the pkgcache side, we disable all remote repos and instead insert all
our cached RPMs into the `DnfSack`. Care is taken to still perform
SHA256 verification for local pkg installs/replacements.

[1] ostreedev/ostree#642
jlebon added a commit to jlebon/rpm-ostree that referenced this pull request Oct 13, 2017
As Colin mentioned in coreos#1035, the new `--cache-only` implemented only the
rpmmd half of the story. Here we complete that story by also ensuring
that when in cache-only mode, we don't download new ostree data nor new
packages. We try to complete the requested operation with what we have.

To do this, we add support for the same `SYNTHETIC` pull that was added
in ostree[1] so that we don't actually pull, but still perform timestamp
checking.

On the pkgcache side, we disable all remote repos and instead insert all
our cached RPMs into the `DnfSack`. Care is taken to still perform
SHA256 verification for local pkg installs/replacements.

[1] ostreedev/ostree#642
jlebon added a commit to jlebon/rpm-ostree that referenced this pull request Oct 13, 2017
As Colin mentioned in coreos#1035, the new `--cache-only` implemented only the
rpmmd half of the story. Here we complete that story by also ensuring
that when in cache-only mode, we don't download new ostree data nor new
packages. We try to complete the requested operation with what we have.

To do this, we add support for the same `SYNTHETIC` pull that was added
in ostree[1] so that we don't actually pull, but still perform timestamp
checking.

On the pkgcache side, we disable all remote repos and instead insert all
our cached RPMs into the `DnfSack`. Care is taken to still perform
SHA256 verification for local pkg installs/replacements.

[1] ostreedev/ostree#642

Closes: coreos#687
jlebon added a commit to jlebon/rpm-ostree that referenced this pull request Oct 13, 2017
As Colin mentioned in coreos#1035, the new `--cache-only` implemented only the
rpmmd half of the story. Here we complete that story by also ensuring
that when in cache-only mode, we don't download new ostree data nor new
packages. We try to complete the requested operation with what we have.

To do this, we add support for the same `SYNTHETIC` pull that was added
in ostree[1] so that we don't actually pull, but still perform timestamp
checking.

On the pkgcache side, we disable all remote repos and instead insert all
our cached RPMs into the `DnfSack`. Care is taken to still perform
SHA256 verification for local pkg installs/replacements.

[1] ostreedev/ostree#642

Closes: coreos#687
rh-atomic-bot pushed a commit to coreos/rpm-ostree that referenced this pull request Oct 16, 2017
As Colin mentioned in #1035, the new `--cache-only` implemented only the
rpmmd half of the story. Here we complete that story by also ensuring
that when in cache-only mode, we don't download new ostree data nor new
packages. We try to complete the requested operation with what we have.

To do this, we add support for the same `SYNTHETIC` pull that was added
in ostree[1] so that we don't actually pull, but still perform timestamp
checking.

On the pkgcache side, we disable all remote repos and instead insert all
our cached RPMs into the `DnfSack`. Care is taken to still perform
SHA256 verification for local pkg installs/replacements.

[1] ostreedev/ostree#642

Closes: #687

Closes: #1049
Approved by: cgwalters
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