Muvirt: creating vm for rockstor

@mcbridematt @Krist To avoid polluting the other thread, decided to create new one.

Trying to create Rockstor vm in muvirt.

I have created /mnt/vm/rockstor.qcow2 with qemu-img command.

When using the following configuration

config vm 'rockstor'
        option numprocs '2'
        option memory '4096'
        option mac '52:54:00:55:48:df'
        list disks '/mnt/vm/rockstor.qcow2,serial=rroot'
        list disks '/dev/sda,serial=disk1'
        list disks '/dev/sdb,serial=disk2'
        option provinplace '1'
        option imageurl 'https://rockstor.com/downloads/installer/leap/15.3/aarch64/Rockstor-Leap15.3-ARM64EFI.aarch64-4.1.0-0.qcow2'
        option checksum 'sha256:91ba94169b40fa32ac0430148cfe041b7883d37724cf781f1fab9e0dea82952b'
        option imageformat 'qcow2'
        option _downloading '-1'

I get

root@openwrt:~# muvirt-provision rockstor
muvirt-provision: [rockstor] downloading https://rockstor.com/downloads/installer/leap/15.3/aarch64/Rockstor-Leap15.3-ARM64EFI.aarch64-4.1.0-0.qcow2 to /mnt/vm//rockstor/image.bin
...
Using image file /mnt/vm//rockstor/image.bin
qemu-img: Could not open '/mnt/vm/rockstor.qcow2,serial=rroot /dev/sda,serial=disk1 /dev/sdb,serial=disk2': Could not open '/mnt/vm/rockstor.qcow2,serial=rroot /dev/sda,serial=disk1 /dev/sdb,serial=disk2': No such file or directory
vm
muvirt-provision: [rockstor] ERROR: Provision in place - /mnt/vm/rockstor.qcow2,serial=rroot /dev/sda,serial=disk1 /dev/sdb,serial=disk2 does not exist

Trying various options for disks, even with single disk line like

list disks '/mnt/vm/rockstor.qcow2,serial=rroot'

fails like above.

Decided the simplest configuration for disks with the following line only in the configuration

list disks '/mnt/vm/rockstor.qcow2'

Trying to provision again

root@openwrt:~# muvirt-provision rockstor
muvirt-provision: [rockstor] downloading https://rockstor.com/downloads/installer/leap/15.3/aarch64/Rockstor-Leap15.3-ARM64EFI.aarch64-4.1.0-0.qcow2 to /mnt/vm//rockstor/image.bin
...
Using image file /mnt/vm//rockstor/image.bin
Writing image to /mnt/vm/rockstor.qcow2
Starting VM rockstor
vm
muvirt-provision: [rockstor] First time boot failed to launch qemu (possibly missing storage/files), check system log for details
vm
muvirt-provision: [rockstor] First VM boot failed

Trying to rescue this by changing configuration to

config vm 'rockstor'
        option numprocs '2'
        option memory '4096'
        option mac '52:54:00:55:48:df'
        list disks '/mnt/vm/rockstor.qcow2,serial=rroot'
        list disks '/dev/sda,serial=disk1'
        list disks '/dev/sdb,serial=disk2'
        option provinplace '1'
        option imageurl 'https://rockstor.com/downloads/installer/leap/15.3/aarch64/Rockstor-Leap15.3-ARM64EFI.aarch64-4.1.0-0.qcow2'
        option checksum 'sha256:91ba94169b40fa32ac0430148cfe041b7883d37724cf781f1fab9e0dea82952b'
        option imageformat 'qcow2'

(removed the downloading and oneshot indicators, re-added disks with serials)

Starting the vm, and it silently fails with logs

root@openwrt:~# logread | tail
...
Sun Jul 24 08:28:14 2022 user.notice muvirt: rpc start request for rockstor

Now, I am out of ideas. :face_with_monocle: :slight_smile:

This is an easier way to ‘copy’ an existing qcow2 image, for appliances/OS’es that don’t need cloud-init:

#download
curl https://rockstor.com/downloads/installer/leap/15.3/aarch64/Rockstor-Leap15.3-ARM64EFI.aarch64-4.1.0-0.qcow2 -o rockstor.qcow2
 # resize to your desired size 
qemu-img resize rockstor.qcow2 30G

Then set the following options:

    list disks '/mnt/vm/rockstor.qcow2,serial=rroot`
    option provisioned '1'
    option enable '1'

Should look like this at the end:

config vm 'rockstor'
	option numprocs '2'
	option memory '4096'
	option mac '52:54:00:55:48:df'
	list disks '/mnt/work2/rockstor.qcow2,serial=rroot'
	option enable '1'
	option provisioned '1'
	list network 'lan'

This worked for me

config vm 'rockstor'
        option numprocs '2'
        option memory '4096'
        option mac '52:54:00:55:48:df'
        option provisioned '1'
        option enable '1'
        list network 'lan'
        list disks '/mnt/vm/rockstor-vm.qcow2,serial=rroot'
        list disks '/dev/sda,serial=disk1'
        list disks '/dev/sdb,serial=disk2'

When it started, then use muvirt-console, and install qemu-guest-agent with zephyr.

@mcbridematt Thank you.

Hi all,

I’ve made a couple of changes to make deploying VMs to a qcow2 file easier. These are in the latest muvirt build (#650424633)

Bugs with muvirt-provision and serial number specifiers have been fixed.

A non-block path (like /mnt/storage/rockstor.qcow2) used with ‘provinplace’ will be created if it doesn’t exist.

This should now be all you need to do:

appstore-deploy \
--diskdevice="/mnt/storage/rockstor.qcow2,serial=ABCDEF" \ 
--disksize=20480 rocktest rockstor

/etc/init.d/muvirt start rocktest

(If you have sufficient RAM in your system, consider setting --memsize=4096 or higher, as well as --numprocs=2)

Once you have booted and setup the basic Rockstor system, you can shut down the VM and add your storage devices:

uci add_list virt.rockstor.disks='/dev/sda,serial=disk1'
uci add_list virt.rockstor.disks='/dev/sdb,serial=disk2'
uci commit virt
/etc/init.d/muvirt start rockstor

If the built in LVM storage system is used, all created volumes will now have a serial number added automatically.

Rockstor and Home Assistant OS are now listed in the appliance store as well.

I am considering a bigger revamp of the “provisioning” system to improve other issues identified here (like no download progress), but these will have to wait.