Communicating VM management commands from one VM to another

This is for discussing general topics about how to use VirtualBox.
Post Reply
vLoto
Posts: 2
Joined: 17. Sep 2019, 19:39

Communicating VM management commands from one VM to another

Post by vLoto »

Hi all,

I'm working on a project for my work, and I'm running into a scenario whereby I need to control a VM from another VM. Specifically, I need to be able to tell a VM to revert back to a snapshot, and I need to send that command from another VM.

The layout is this: I have one physical machine running Windows 10, and the latest version of VirtualBox is installed on it. I have a CentOS VM and a Windows 10 VM created in Virtual Box, both residing as guests of the host. I need to send the "revert" command from the CentOS VM to the Windows 10 VM.

I have done some research, and of course I've seen a lot of the documentation for VBoxManage, but all of the posts and documentation are for communicating from the host OS through VBoxManage to the VM, not from VM-to-VM. Is there any way to do what I want to do?

Sorry if this has been asked before, I did search on the forum before hand but could not find any information related to what I wanted, and I hope this is an acceptable place to ask this.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Communicating VM management commands from one VM to another

Post by socratis »

vLoto wrote:but all of the posts and documentation are for communicating from the host OS through VBoxManage to the VM, not from VM-to-VM. Is there any way to do what I want to do?
Not really... How would you handle this if on a physical setup?
vLoto wrote:I need to be able to tell a VM to revert back to a snapshot
And how exactly are you planning to revert to a snapshot from within the VM? The only related options that you have available are:
VBoxControl takesnapshot
VBoxControl savestate
VBoxControl suspend
VBoxControl poweroff
So, how exactly are you going to revert a running VM? You can't even do that for a running VM from the host, let alone from within the VM!

Are you running some sort of scripted task? Can you share the details so we know a little better how to approach this?
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
vLoto
Posts: 2
Joined: 17. Sep 2019, 19:39

Re: Communicating VM management commands from one VM to another

Post by vLoto »

Hi socratis,

Thanks for the reply. So yes, this is a scripted scenario. I want to run a script on one VM that will shutdown another completely separate VM and then revert that VM's state to a snapshot.

So as I tried to explain before, I have one physical machine running virtual box. On this physical machine is a host OS of windows 10. There are two guest OSs installed via VirtualBox, one CentOS VM and one Windows 10 VM. The CentOS will act as a master, and the Windows 10 VM will act as a slave. The CentOS vm is running a script. It will tell the slave VM to run some action. It will then tell the slave VM to shutdown and revert to a snapshot. This process will repeat several times.

Hopefully that makes more sense. Please see the below diagram to help clarify what I am wanting to do. (Apparently I cant post URLs yet, so you will have to add the dots and such)

i (dot) imgur (dot) com / nRAAOPN (dot) png
Last edited by socratis on 18. Sep 2019, 17:19, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Communicating VM management commands from one VM to another

Post by scottgus1 »

Images can be posted from the first post on the first day, with the forum's Upload Attachment tab, cropped & resized to get under the forum's 128kB size limit. PNG is best.

Snapshot modifying can only be done from the host. You should make a .cmd batch file on your W10 host that uses vboxmanage commands to shut down the guest and do whatever you want the snapshots to do then restart the guest.

Virtualbox contains a way for a host PC to run a command inside a guest OS, if the Guest Additions are installed in the guest OS. But there is no way for a guest to tell the host or another guest to run a command. You will need 3rd-party software or your own scripts to have the CentOS guest tell the host to run the snapshotting .cmd on the other guest.

There is a Microsoft Sysinternals program called PSexec which can enable one Windows OS to start commands on another Windows OS, but I don't know if there is a Linux equivalent, or if there is a Linux-master-Windows-slave equivalent.

I would have a running-in-a-loop script (perhaps a VBscript so it can run invisibly) on the Windows host that monitors a shared folder for a certain file. When that file appears, it deletes the file then starts the snapshot script. Then I would initiate the whole process by having the CentOS guest write the file to the shared folder on the host OS.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Communicating VM management commands from one VM to another

Post by socratis »

scottgus1 wrote:I would have a running-in-a-loop script (perhaps a VBscript so it can run invisibly) on the Windows host that monitors a shared folder for a certain file
Or "VBoxManage guestproperty", whichever floats your boat. But as 'scottgus1' said, actions such as shutting down a VM or reverting to a snapshot can only be performed by the host, not another VM.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply