churchers / vm-bhyve

Shell based, minimal dependency bhyve manager
BSD 2-Clause "Simplified" License
825 stars 174 forks source link

restart does apply new config, maybe intended? #521

Open mike-pt opened 1 year ago

mike-pt commented 1 year ago

vm-bhyve: Bhyve virtual machine management v1.5 (rev. 105102)

Took me a bit to figure it out, but I was changing a few configs (adding disks i.e.) and it didn't seem to change after "vm restart vm-name"

After trying a few times I issued (service vm restart) which stops all vms ofc and then starts them and now the config was applied.

It seems just issuing "vm restart" is not enough for config to apply ??

I changed to nvme i.e also added graphical=yes... or even the fact that there is a new custom disk added and none of this applied after vm restart plex-linux until I actually used "service vm restart"`

LOG:

Jul 31 11:53:44:  [bhyve devices: -s 0,hostbridge -s 31,lpc -s 4:0,virtio-blk,/dev/zvol/zroot/vms/plex-linux/disk0 -s 5:0,virtio-blk,/dev/zvol/zroot/vms/plex-linux/disk1 -s 6:0,virtio-net,tap0,mac=xx:xx:xx:xx:xx:xx -s 7:0,passthru,0/2/0]
Jul 31 12:33:11:  [bhyve devices: -s 0,hostbridge -s 31,lpc -s 4:0,virtio-blk,/dev/zvol/zroot/vms/plex-linux/disk0 -s 5:0,virtio-blk,/dev/zvol/zroot/vms/plex-linux/disk1 -s 6:0,virtio-net,tap0,mac=xx:xx:xx:xx:xx:xx -s 7:0,passthru,0/2/0]
Jul 31 12:36:21:  [bhyve devices: -s 0,hostbridge -s 31,lpc -s 4:0,virtio-blk,/dev/zvol/zroot/vms/plex-linux/disk0 -s 5:0,virtio-blk,/dev/zvol/zroot/vms/plex-linux/disk1 -s 6:0,virtio-net,tap0,mac=xx:xx:xx:xx:xx:xx -s 7:0,passthru,0/2/0]
Jul 31 12:39:44:  [bhyve devices: -s 0,hostbridge -s 31,lpc -s 4:0,nvme,/dev/zvol/zroot/vms/plex-linux/disk0,nocache -s 5:0,nvme,/dev/zvol/zroot/vms/plex-linux/disk1,nocache -s 6:0,nvme,/dev/zvol/zroot/data-zvol,nocache -s 7:0,virtio-net,tap0,mac=xx:xx:xx:xx:xx:xx -s 8:0,passthru,0/2/0 -s 9:0,fbuf,tcp=0.0.0.0:5900]

The add custom disk section however sugests this is possible (https://github.com/churchers/vm-bhyve#adding-custom-disks)

Adding custom disks

Scenario: If you have a vm on one zpool and would like to add a new virtual disk to it that resides on a different zpool.

Manually create a sparse-zvol (in this case 50G in size).

zfs create -sV 50G -o volmode=dev "zpool2/vm/yourvm/disk1"

Add it to your vm config file. Please note, for Windows guests the type will need to be ahci-hd, as it does not have virtio-blk drivers.

vm configure yourvm

disk1_name="/dev/zvol/zpool2/vm/yourvm/disk1" disk1_type="virtio-blk" disk1_dev="custom"

Restart your vm.

Perhaps this is just not supported and the README needs to be clarified, there is another section that states using configure requires "A full shutdown and restart of the vm".

From my tests it seems clear that we need to fully STOP and START the vm (not restart), if this is intended I think its fine we should update the readme to match this.