livefs: Require deployment staging

Staging fixes the `/etc` bug for livefs.  There's actually more
we could do here around taking advantage of staging for livefs;
for example, I think once the livefs is complete, we could just delete
the staged deployment.  And then we don't need to render on the next
boot the live status, etc.

Anyways, all that can come in the future.  This is prep for
enabling staging by default.

Closes: #1430
Approved by: jlebon
This commit is contained in:
Colin Walters 2018-07-13 11:52:27 -04:00 committed by Atomic Bot
parent e1b62d0f7d
commit 44b39a7340
3 changed files with 14 additions and 6 deletions

View File

@ -677,6 +677,8 @@ livefs_transaction_execute_inner (LiveFsTransaction *self,
*/
if (origin_merge_deployment == booted_deployment)
return glnx_throw (error, "No pending deployment");
if (!ostree_deployment_is_staged (origin_merge_deployment))
return glnx_throw (error, "livefs requires staged deployments");
/* Open a fd for the booted deployment */
g_autofree char *deployment_path = ostree_sysroot_get_deployment_dirpath (sysroot, booted_deployment);
@ -877,10 +879,6 @@ livefs_transaction_execute_inner (LiveFsTransaction *self,
return FALSE;
}
/* XXX: right now we don't have a good solution for this:
* https://github.com/projectatomic/rpm-ostree/issues/40 */
rpmostree_output_message ("WARNING: any changes to /etc will be lost on next reboot");
/* Write out the origin as having completed this */
if (!write_livefs_state (sysroot, booted_deployment, NULL, target_csum, error))
return FALSE;

View File

@ -24,6 +24,11 @@ set -euo pipefail
set -x
# Uses livefs
vm_cmd 'echo "[Experimental]" >> /etc/rpm-ostreed.conf'
vm_cmd 'echo StageDeployments=true >> /etc/rpm-ostreed.conf'
vm_rpmostree reload
# SUMMARY: check that RPM scripts are properly handled during package layering
# do a bunch of tests together so that we only have to reboot once

View File

@ -24,6 +24,10 @@ set -euo pipefail
set -x
vm_cmd 'echo "[Experimental]" >> /etc/rpm-ostreed.conf'
vm_cmd 'echo StageDeployments=true >> /etc/rpm-ostreed.conf'
vm_rpmostree reload
vm_assert_layered_pkg foo absent
vm_build_rpm foo
@ -40,7 +44,8 @@ assert_livefs_ok() {
}
assert_livefs_ok
vm_assert_status_jq '.deployments|length == 2' '.deployments[0]["live-replaced"]|not' \
vm_assert_status_jq '.deployments|length == 2' \
'.deployments[0]["live-replaced"]|not' \
'.deployments[1]["live-replaced"]|not'
vm_rpmostree ex livefs
vm_cmd rpm -q foo > rpmq.txt
@ -110,7 +115,7 @@ echo "ok livefs preserved rollback"
# Reset to rollback, undeploy pending
reset() {
vm_rpmostree rollback
vm_rpmostree ex reset
vm_reboot
vm_rpmostree cleanup -r
vm_assert_status_jq '.deployments|length == 1' '.deployments[0]["live-replaced"]|not'