On Thu, Mar 15, 2018 at 3:26 PM, Gianluca Cecchi <gianluca.cecchi@gmail.com> wrote:
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.

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:

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
  


Hello,
in an off-list message it appears that the qemu guest agent offers a "guest-exec" command, but that it is not enabled into the build at
https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.141-1/

can anyone confirm this and its reasons (security? isolation?...)
Could the policy change and for example allow a choice to have it or not at runtime?
Any hint on how to recompile enabling the feature?

Thanks,
Gianluca