This is something I haven’t really researched well, but I could not immediately find an answer.
Would it be possible to automate snapshots of my Ha virtual machine, which runs on a Linux host in Virtualbox, from within HA? An example use case is to do this automatically before any HaOS update.
I know there are methods toaautomate and periodically take snapshots in VirtualBox itself, but my question is specifically about a trick to do this from the HA user interface on demand and/or in an automation.
I did some tries and I can ssh into the host PC from the ssh terminal add-on in HA. So I will see if it works to make a script that will do this automatically based on the shell command integration. Not sure if the login will work though…
Interesting idea. Surely this can be done. The question is whether Virtual Box will reply with the result of the snapshot when it completes and HA can receive it. You don’t want the update to start until the snapshot is complete. Mind that vms network connectivity is sometimes disrupted during snapshot taking.
Yes, according to Virtualbox documentation, the VM is paused during snapshot taking, though there is a ‘live’ flag you can use in the command, I’m not sure exactly what that does. The problem for me to figure out right now is how to log in to the host computer. I can issue a shell command to ssh but I cannot type in the password via the shel_command service AFAICT. Virtualbox also has other ways to control it remotely, but I don’t want to do this via the internet.
Most likely you need to go in Virtual Box and allow HA to communicate with it. Hypervisors by default don’t let vms talk to them.
Well, the way i am doing it now virtualbox has no idea it’s the guest talking. I ssh into the shell of the host machine via my local network, logging in with
the same account I used to set up the VM. But I can’t find a way to automate that in HA. I’ll let it rest for now unless someone comes up with a great idea. I’m taking daily snapshots through cron anyway, and the 11.5rc1 OS update was a good reminder to take manual snapshots before any (and certainly beta) os updates