Created
October 10, 2018 02:12
-
-
Save grahamc/5afa89eabf62905553605dd653b24d90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
activation-time import: | |
1. create a zvol for the disk image based on the `import/hash-name` of the | |
image file in the store | |
2. qemu-img dd the data from the `.qcow2` to the zvol | |
3. snapshot zvol to `import/hash-name:import` | |
4. For each `import/*` see if their path is live, if not: delete the | |
snapshot and zvol (via: `nix-store --query --roots /nix/store/hash-name` | |
run-time code: | |
pre-start: create the volume named `execute/hash-name` if it doesn't | |
already exist | |
pre-start: roll-back `execute/hash-name` to the snapshot for | |
`import/hash-name:import` | |
start: execute qemu with the parameters like this: | |
<disk type='block' device='disk'> | |
<driver name='qemu' type='raw' cache='none'/> | |
<source dev='/dev/zd0'/> | |
<target dev='vda' bus='virtio'/> | |
<alias name='virtio-disk0'/> | |
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> | |
</disk> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment