Feature: draksetup modify-vm0 utility #924
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces
draksetup modify-vm0
command that allows to safely modify vm-0 state and rollback changes in case of failure. Right now documentation recommendsdrakplayground 0
which is very hacky way to modify VM and it's really easy to desynchronize snapshot of memory/CPU statesnapshot.sav
with storage contents. It usually leads to irreversible damage to the file system (due to unexpected errors resulting from buffers and file caching combined with changed file-system layout) and various issues that are really difficult to debug.Command uses snapshot features that are already used by ZFS, LVM and QCoW backends. vm-0 modification consists of two phases:
snapshot.sav
is made, VM state is restored tovm-1
and kernel/DLL profiles are recreated.Actual implementation depends on the storage backend:
zfs storage backend already maintains a proper snapshot
vm-0@booted
, so we can safely modifyvm-0
volume as all vm's originate on that snapshot. In case of commit: we delete vm-n storage state and create newvm-0@booted
snapshot from currentvm-0
state. In case of rollback: we're doing a rollback ofvm-0@botted
ontovm-0
.for qcow storage backend we create
vm-0-modify.img
withvm-0.img
as backing file, and then run vm-0 usingvm-0-modify.img
image. In case of commit we mergevm-0-modify.img
withvm-0.img
usingqemu-img commit
command. In case of rollback we just delete thevm-0-modify.img
file.lvm storage backend is similar to the qcow case. We create a snapshot
vm-0-modify
that is then merged or deleted. LVM implementation had its own issues e.g. hardcoded 1GB size of a snapshot orvm-0-snap
snapshot that have never been used. The second issue was fixed in this PR, the first one needs proper configuration field.Other changes include:
create_vm_profile
and is made fromvm-1
. In case of vm-0 modification we need to regenerate kernel profile as well. I'm also not sure why usermode profiles are opt-out, I think it's much more useful to opt-out from apivector profiles.Manual tests:
Edit: I also modified the drakplayground to not setup network and restore/destroy VM for vm-0