On Thu, Mar 15, 2018 at 2:26 PM, Sergey Vavilov <sergey@vavilov.org> wrote:
Hello!

I'm wondering
how can I run a cmd.exe command (or powershell) inside windows guest virtual machine by
ovirt-agent from outside (from ovirt-engine or from host)?
What's ovirt's analogue for
virsh qemu-agent-command
?
Actually, I want to setup ip on virtual NIC.
So I can't run a command via windows' protocols.
ovirt-agent service works in windows virtual machine and successfully reports its state to ovirt engine.
But it looks like ovirt-agent isn't suitable to run commands in virtual machines?
Or am I wrong?
Should I configure a coexistence of ovirt-agent and qemu-agent inside vm somehow?
How did you solve such task before?

Thank you, all!


--
Sergey Vavilov


Hi Sergey,
I recently had a need for a Windows 2008 R2 x86_64 VM that I moved from vSphere to RHV (but the considerations below are the same for oVirt).
In my case I had to run a backup of an Oracle database that is in NOARCHIVELOG mode, due to performance reasons: it is an RDBMS used for BI that is refreshed every day and doesn't need a point in time recovery but only a consistent state before the "new day" processing is run at 01:00 in the night.
In vSphere the backup of the VM was implemented with Veeam, that uses snaphsot technology and interacts with VSS layer of M$ operating systems.
Oracle fully supports on Windows the backup of database using VSS only if it is in ARCHIVELOG mode.
https://docs.oracle.com/cd/E11882_01/win.112/e10845/vss.htm#NTQRF475

Veeam automatically executed shutdown / snapshot / start of the dabatase because I think it implements what in the link above is called as PRE_SQLCMD in OnPrepareBackup callback (through the VeeamGuestHelper.exe executable).

Coming back to oVirt, the interaction with Windows VSS layer is indeed done by "QEMU guest agent"too; you have to install it together with the oVirt Guest Agent when you install oVirt Guest Tools

So in my case I would need for Windows something similar to the "fsfreeze/thaw hooks" I have in Linux QEMU guest agent.
But searching through the code it seems this functionality is only present in Linux component...
In fact some days ago I wrote to the qemu-devel mailing list to ask for possible implementation:
http://lists.nongnu.org/archive/html/qemu-devel/2018-03/msg02823.html

No answer so far. Feel free (you and others) to contribute to the thread if you think it can help...
It could also be useful to have at least writer control commands implementation in VSS interaction of QEMU Guest Agent in Windows, so that one could do something similar to what Veeam on vSphere already does...

Based on what I have wrote above, I doubt you could interact at all through the QEMU guest agent on Windows to run any command...
And also for Linux guests, I think you are restricted to the default actions (eg shutdown) or forced to use as a workaround the approach to run a snapshot (that then you delete) and "attach" the desired command to the freeze (or thaw) hook...

HIH,
Gianluca