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

Introduce ex livefs for layering newly added packages 🗱 #652

Closed
wants to merge 3 commits into from

Conversation

cgwalters
Copy link
Member

@cgwalters cgwalters commented Mar 2, 2017

WIP due to missing tests and docs.

But I've been playing with this interactively, and it's at a useful place
already. The primary target here is supporting live addition of new packages,
while also allowing people to do completely arbitrary replacement if that's
what they want.

Depends:

Closes: #639

@cgwalters cgwalters added the WIP label Mar 2, 2017
@cgwalters
Copy link
Member Author

Demo:

[root@localhost ~]# rpm-ostree install cowsay
...
Transaction complete; bootconfig swap: no deployment count change: 0
Added:
  cowsay-3.04-4.fc25.noarch
...
  perl-Carp-1.40-365.fc25.noarch
  perl-Data-Dumper-2.161-1.fc25.x86_64
  (and like 5 million other perl deps)
...
Run "systemctl reboot" to start a reboot
[root@localhost ~]# rpm-ostree status
State: idle
Deployments:
  hacking
           Timestamp: 2017-03-02 03:39:47
          BaseCommit: 2ccf10b97719203d8b87c062e8dffb17b24dd13415e56c7e17200433f0d3749b
              Commit: bb78eb713479299500edde8c5a35c9161ea6474da4c198bc9ad2bcaf46ad080d
              OSName: fedora-atomic
     LayeredPackages: cowsay

● hacking
           Timestamp: 2017-03-02 03:37:08
              Commit: 2ccf10b97719203d8b87c062e8dffb17b24dd13415e56c7e17200433f0d3749b
              OSName: fedora-atomic
[root@localhost ~]# rpm-ostree livefs
notice: livefs is an experimental command and subject to change.
warning: livefs would change configuration in /etc
error: livefs update would perform changes beyond new files in /usr, and partial updates not enabled
[root@localhost ~]# rpm-ostree livefs --help
notice: livefs is an experimental command and subject to change.
Usage:
  rpm-ostree livefs [OPTION...] - Apply pending deployment changes to booted deployment

Help Options:
  -h, --help            Show help options

Application Options:
  -n, --dry-run         Only perform analysis, do not make changes
  --allow-replace       Allow replacing existing files
  --accept-partial      Continue even on partial updates
  --sysroot=SYSROOT     Use system root SYSROOT (default: /)
  --peer                Force a peer-to-peer connection instead of using the system message bus
  --version             Print version information and exit

[root@localhost ~]# rpm-ostree livefs --accept-partial
notice: livefs is an experimental command and subject to change.
warning: livefs would change configuration in /etc
Overlaying /usr... done
[root@localhost ~]# cowsay hi
 ____
< hi >
 ----
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
[root@localhost ~]# rpm -q cowsay
cowsay-3.04-4.fc25.noarch
[root@localhost ~]# 

@giuseppe
Copy link
Contributor

giuseppe commented Mar 2, 2017

This looks great!

It will be very useful for projectatomic/atomic#767

@giuseppe
Copy link
Contributor

giuseppe commented Mar 3, 2017

will it be possible to support removal of an rpm as well?

I am asking as that would be helpful for supporting containers update here.

@rh-atomic-bot
Copy link

☔ The latest upstream changes (presumably 710ea30) made this pull request unmergeable. Please resolve the merge conflicts.

@cgwalters
Copy link
Member Author

src/daemon/rpmostreed-utils.c:673:70: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]

Nice, thanks clang!

@cgwalters cgwalters force-pushed the live-updates branch 2 times, most recently from 3e5184f to 3018e3d Compare March 20, 2017 19:04
@cgwalters
Copy link
Member Author

🆕 commits.

Also, a fun twist: ostree admin unlock + livefs is pretty broken because lowerdir mutation is undefined. This kind of breaks my dev workflow for this 😦. I'm thinking about a variant of ostree admin unlock which is more like unshare -m && mount overlayfs / usr && exec rpm-ostreed or so. Will play.

@rh-atomic-bot
Copy link

☔ The latest upstream changes (presumably 19b093e) made this pull request unmergeable. Please resolve the merge conflicts.

@rh-atomic-bot
Copy link

☔ The latest upstream changes (presumably 1c42102) made this pull request unmergeable. Please resolve the merge conflicts.

@cgwalters cgwalters force-pushed the live-updates branch 3 times, most recently from 30a139b to 7c178d0 Compare March 24, 2017 21:59
@cgwalters cgwalters changed the title WIP: livefs WIP: livefs 🗱 Mar 25, 2017
@rh-atomic-bot
Copy link

☔ The latest upstream changes (presumably 75d91a1) made this pull request unmergeable. Please resolve the merge conflicts.

@rh-atomic-bot
Copy link

⌛ Testing commit 4f3a70d with merge f3b71ca...

rh-atomic-bot pushed a commit that referenced this pull request May 11, 2017
There are a few different use cases here. First, for layering new packages,
there's no good reason for us to force a reboot. Second, we want some support
for cherry-picking security updates and allowing admins to restart services.  Finally,
at some point we should offer support for entirely replacing the running tree
if that's what the user wants.

Until now we've been very conservative, but there's a spectrum here. In
particular, this patch changes things so we push a rollback before we start
doing anything live. I think in practice, many use cases would be totally fine
with doing most changes live, and falling back to the rollback if something went
wrong.

This initial code drop *only* supports live layering of new packages.  However,
a lot of the base infrastructure is laid for future work.

For now, this will be classified as an experimental feature, hence `ex livefs`.

Part of: #639

Closes: #652
Approved by: jlebon
@rh-atomic-bot
Copy link

💔 Test failed - status-atomicjenkins

@jlebon
Copy link
Member

jlebon commented May 11, 2017

Hmm, looks like the /etc checkout isn't quite working:

+ vm_cmd cat /etc/test-livefs-with-etc.conf
+ ssh -o User=root -o ControlMaster=auto -o ControlPath=/var/tmp/checkout/ssh-vmcheck1.sock -o ControlPersist=yes vmcheck1 cat /etc/test-livefs-with-etc.conf
cat: /etc/test-livefs-with-etc.conf: No such file or directory
+ _cleanup_tmpdir
+ test -z ''
+ test -f /var/tmp/checkout/tests/vmcheck/test.zWXsLD/.test
+ rm /var/tmp/checkout/tests/vmcheck/test.zWXsLD -rf
FAIL

assert_livefs_ok
vm_rpmostree ex livefs
vm_cmd rpm -q foo test-livefs-with-etc > rpmq.txt
assert_file_has_content rpmq.txt foo-1.0-1 test-livefs-with-etc-1.0-1
Copy link
Member

Choose a reason for hiding this comment

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

Actually, looking at the test output now, I just realized assert_file_has_content doesn't actually handle arguments past $2.

There are a few different use cases here. First, for layering new packages,
there's no good reason for us to force a reboot. Second, we want some support
for cherry-picking security updates and allowing admins to restart services.  Finally,
at some point we should offer support for entirely replacing the running tree
if that's what the user wants.

Until now we've been very conservative, but there's a spectrum here. In
particular, this patch changes things so we push a rollback before we start
doing anything live. I think in practice, many use cases would be totally fine
with doing most changes live, and falling back to the rollback if something went
wrong.

This initial code drop *only* supports live layering of new packages.  However,
a lot of the base infrastructure is laid for future work.

For now, this will be classified as an experimental feature, hence `ex livefs`.

Part of: coreos#639
cgwalters added a commit to cgwalters/ostree that referenced this pull request May 12, 2017
This is what caused the merge of
coreos/rpm-ostree#652
to blow up, since ostreedev#848
landed right before we tried to merge it.

When I was writing that PR I remember having an uncertain feeling
since we were doing a `mkdirat` above, but at the time I thought
we'd have test suite coverage...turns out we didn't.

For backwards compatibility, we need to continue to do a `mkdirat` here of the
parent. However...I can't think of a reason anyone would *want* that behavior.
Hence, let's add a special trick - if the destination name is `.`, we skip
`mkdirat()`. That way rpm-ostree for example can open a dfd for `/etc` and avoid
the `mkdir`.

Fold the subpath tests into `test-basic.sh` since it's not worth a separate
file. Add a test case for checking out a file.
@cgwalters
Copy link
Member Author

ostreedev/ostree#854

rh-atomic-bot pushed a commit to ostreedev/ostree that referenced this pull request May 12, 2017
This is what caused the merge of
coreos/rpm-ostree#652
to blow up, since #848
landed right before we tried to merge it.

When I was writing that PR I remember having an uncertain feeling
since we were doing a `mkdirat` above, but at the time I thought
we'd have test suite coverage...turns out we didn't.

For backwards compatibility, we need to continue to do a `mkdirat` here of the
parent. However...I can't think of a reason anyone would *want* that behavior.
Hence, let's add a special trick - if the destination name is `.`, we skip
`mkdirat()`. That way rpm-ostree for example can open a dfd for `/etc` and avoid
the `mkdir`.

Fold the subpath tests into `test-basic.sh` since it's not worth a separate
file. Add a test case for checking out a file.

Closes: #854
Approved by: jlebon
@cgwalters
Copy link
Member Author

Ok, fixup ⬆️

@jlebon
Copy link
Member

jlebon commented May 12, 2017

@rh-atomic-bot r+ 0060833

@rh-atomic-bot
Copy link

⌛ Testing commit 0060833 with merge 9379618...

rh-atomic-bot pushed a commit that referenced this pull request May 12, 2017
For a future patch.

Closes: #652
Approved by: jlebon
rh-atomic-bot pushed a commit that referenced this pull request May 12, 2017
There are a few different use cases here. First, for layering new packages,
there's no good reason for us to force a reboot. Second, we want some support
for cherry-picking security updates and allowing admins to restart services.  Finally,
at some point we should offer support for entirely replacing the running tree
if that's what the user wants.

Until now we've been very conservative, but there's a spectrum here. In
particular, this patch changes things so we push a rollback before we start
doing anything live. I think in practice, many use cases would be totally fine
with doing most changes live, and falling back to the rollback if something went
wrong.

This initial code drop *only* supports live layering of new packages.  However,
a lot of the base infrastructure is laid for future work.

For now, this will be classified as an experimental feature, hence `ex livefs`.

Part of: #639

Closes: #652
Approved by: jlebon
@rh-atomic-bot
Copy link

💔 Test failed - status-atomicjenkins

@cgwalters
Copy link
Member Author

@rh-atomic-bot retry

@rh-atomic-bot
Copy link

⌛ Testing commit 0060833 with merge 95e9aa4...

rh-atomic-bot pushed a commit that referenced this pull request May 12, 2017
There are a few different use cases here. First, for layering new packages,
there's no good reason for us to force a reboot. Second, we want some support
for cherry-picking security updates and allowing admins to restart services.  Finally,
at some point we should offer support for entirely replacing the running tree
if that's what the user wants.

Until now we've been very conservative, but there's a spectrum here. In
particular, this patch changes things so we push a rollback before we start
doing anything live. I think in practice, many use cases would be totally fine
with doing most changes live, and falling back to the rollback if something went
wrong.

This initial code drop *only* supports live layering of new packages.  However,
a lot of the base infrastructure is laid for future work.

For now, this will be classified as an experimental feature, hence `ex livefs`.

Part of: #639

Closes: #652
Approved by: jlebon
@rh-atomic-bot
Copy link

☀️ Test successful - status-atomicjenkins
Approved by: jlebon
Pushing 95e9aa4 to master...

@vtolstov
Copy link

Great! When the next release ?=) @cgwalters

cgwalters added a commit to cgwalters/ostree that referenced this pull request May 16, 2017
This is a de-scoping of work I did in preparation for
rpm-ostree [live updates](coreos/rpm-ostree#652).
Originally I was going to expose this as a public API.

However, I decided to do things differently, but the cleanup here for new code
style and fd-relative is nice to have anyways.

We rework things to use `OstreeDeployment*`, which the caller is expected to
already have, rather than `GFile*`s pointing to the config directories.
rh-atomic-bot pushed a commit to ostreedev/ostree that referenced this pull request May 24, 2017
This is a de-scoping of work I did in preparation for
rpm-ostree [live updates](coreos/rpm-ostree#652).
Originally I was going to expose this as a public API.

However, I decided to do things differently, but the cleanup here for new code
style and fd-relative is nice to have anyways.

We rework things to use `OstreeDeployment*`, which the caller is expected to
already have, rather than `GFile*`s pointing to the config directories.

Closes: #741
Approved by: jlebon
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.

None yet

5 participants