[Qemu-devel] guest-fsfreeze-freeze: Does it allow for any guest-fsfreeze_hook in Windows guest machine.

2014-07-10 Thread Puneet Bakshi
Hi,

When guest agent command guest-fsfreeze-freeze is invoked on a linux VM,
a hook is provided to do execute any pre-script before actually doing a
freeze.


int64_t qmp_guest_fsfreeze_freeze(Error **errp)
{
:::
execute_fsfreeze_hook(FSFREEZE_HOOK_FREEZE, local_err);
:::
}

Can the same thing be done in case of Windows guest machine? I could not
find similar thing in case of Windows
(qga_vss_fsfreeze()-requester_freeze()) where I can put a script (a
hook) to do some preprocessing.

Regards,
~Puneet


Re: [Qemu-devel] [libvirt] Where to get precompiled qga-vss.dll from ?

2014-07-08 Thread Puneet Bakshi
​
Hi,

[Rephrasing my earlier post with more clarity.]

I need to work with guest-fsfreeze-* commands in Windows 2008 guest VM
(Host is CentOS 6.4) to quisce the applications.

*Windows 2008 Guest Machine*

1. Windows 2008 is running following services
- QEMU Guest Agent
- QEMU Guest Agent VSS Provider

2. C:\ vssadmin list providers
  ...
  Provider name: 'QEMU Guest Agent VSS Provider
   
   Version: 0.12.1

  Provider name: 'Microsoft Software Shadow Copy provider 1.0'

Version: 1.0.0.7



*Host (CentOS 6.4)*
When guest-fsfreeze-* commands are invoked from host, response
received from guest is This is not supported. Since QEMU Guest Agent VSS
Provider was already running in Guest VM, I was expecting these commands
to succeed and quisce  Windows applications, but they were reported as
unsupported.

[root@sdsr720-14 Downloads]# virsh qemu-agent-command vm_win_06 '{
execute: guest-fsfreeze-status}'
{error:{class:Unsupported,desc:this feature or command is not
currently supported,data:{}}}

[root@sdsr720-14 Downloads]# virsh qemu-agent-command vm_win_06 '{
execute: guest-fsfreeze-freeze}'
{error:{class:Unsupported,desc:this feature or command is not
currently supported,data:{}}}


*Is missing qga-vss.dll the reason?*
I searched my system for this dll and could not find it and suspected that
missing qga-vss.dll is the reason for this. I took suggestions from
following post which advised to cross-compile qemu code to get qga-vss.dll

http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg01963.html.

But I faced a lot of issues while building i686-w64-mingw32-* in CentOS 6.4
and had to eventually give up building i686-w64-mingw32-* and move to
getting pre-compiled QEMU guest agent (with VSS support), which I can
install on Windows to quisce the applications.


*What I need *
If I can get pre-compiled qga-vss.dll, I can copy it to Windows8 guest VM
and hopefully work with guest-fsfreeze-* commands to quisce the
applications.

Can somebody point me to pre-compiled QEMU guest agent with VSS support
(and qga-vss.dll) so that I can quisce the Windows guest VM applications?

Regards,
~Puneet


On Tue, Jul 8, 2014 at 3:27 AM, Eric Blake ebl...@redhat.com wrote:

 On 07/07/2014 02:32 AM, Puneet Bakshi wrote:
  Hi,
 
  I want to work with guest-fsfreeze-* commands in Windows 2008 guest VM.
  Host is CentOS 6.4.
 
  Windows 2008 is running QEMU VSS provider. When guest-fsfreeze-*
 commands
  are invoked from host, response received is This is not supported.
 
  I am following
  http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg01963.html.

 The libvirt list is the wrong place to be asking this question; qemu is
 better.

 The spice-devel list has done some pre-packaged virt stack builds for
 Windows; maybe they might be a better resource to ask (for example, see
 http://lists.freedesktop.org/archives/spice-devel/2014-February/016100.html
 )
 - but I don't follow that list closely enough to know if they have
 pre-built qga.

 You could always download the mingw cross-compiler and try to build qga
 yourself, instead of relying on someone else to provide a pre-built binary.

 --
 Eric Blake   eblake redhat com+1-919-301-3266
 Libvirt virtualization library http://libvirt.org




[Qemu-devel] Where to get precompiled qga-vss.dll from ?

2014-07-07 Thread Puneet Bakshi
Hi,

I want to work with guest-fsfreeze-* commands in Windows 2008 guest VM.
Host is CentOS 6.4.

Windows 2008 is running QEMU VSS provider. When guest-fsfreeze-* commands
are invoked from host, response received is This is not supported.

I am following
http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg01963.html.

Regards,
~Puneet


Re: [Qemu-devel] [libvirt] Not able to run virsh qemu-agent-command when socat is working

2014-07-05 Thread Puneet Bakshi
Sorry, that was a typo. But, it is still not working. (For some reason, I
had to move to Windows2012 with name vm_win_05).

[root@sdsr720-14 virtio-win]# echo {'execute':'guest-ping'} | socat
stdio,ignoreeof /var/lib/libvirt/qemu/g05.agent
{return: {}}

[root@sdsr720-14 virtio-win]# virsh qemu-agent-command vm_win_05 '{
execute:guest-ping}'

[root@sdsr720-14 virtio-win]#

Regards,
~Puneet


On Wed, Jul 2, 2014 at 10:09 PM, Eric Blake ebl...@redhat.com wrote:

 On 07/02/2014 01:13 AM, Puneet Bakshi wrote:
  Hi,
 
  I am running qemu guest agent in Windows 2k8. I am able to execute
  qemu-agent-commands using socat but not through virsh
  qemu-agent-command.
 

  *Host CentOS system*
 
  socat returns response appropriately.
  [root@sdsr720-14 ~]# echo {'execute':'guest-ping'} | socat
  stdio,ignoreeof /var/lib/libvirt/qemu/g06.agent
  {return: {}}

 Note your spelling...

 
  *virsh qemu-agent-command returns blank.*
 
  [root@sdsr720-14 ~]# virsh qemu-agent-command vm_win_06 '{
 execute:
  guest_ping}'

 and compare it to here.  There is no guest_ping command, only
 guest-ping.  It's a bug in libvirt that guest-agent-command doesn't
 output a useful error message when attempting to run a non-existing
 command, but you'll never hit that bug if you pass valid commands to the
 agent in the first place.

 --
 Eric Blake   eblake redhat com+1-919-301-3266
 Libvirt virtualization library http://libvirt.org




[Qemu-devel] Not able to run virsh qemu-agent-command when socat is working

2014-07-02 Thread Puneet Bakshi
Hi,

I am running qemu guest agent in Windows 2k8. I am able to execute
qemu-agent-commands using socat but not through virsh
qemu-agent-command.


*Guest VM xml*

controller type='virtio-serial' index='0'
  alias name='virtio-serial0'/
  address type='pci' domain='0x' bus='0x00' slot='0x05'
function='0x0'/
/controller

channel type='unix'
  source mode='bind' path='/var/lib/libvirt/qemu/g06.agent'/
  target type='virtio' name='org.qemu.guest_agent.1'/
  alias name='channel0'/
  address type='virtio-serial' controller='0' bus='0' port='1'/
/channel


*Guest win2k8 is running following command*

C:\qemu-ga qemu-ga.exe -t c:\qemu-ga -p
\\.Global\org.qemu.guest_agent.1


*Host CentOS system*

socat returns response appropriately.
[root@sdsr720-14 ~]# echo {'execute':'guest-ping'} | socat
stdio,ignoreeof /var/lib/libvirt/qemu/g06.agent
{return: {}}

*virsh qemu-agent-command returns blank.*

[root@sdsr720-14 ~]# virsh qemu-agent-command vm_win_06 '{ execute:
guest_ping}'

[root@sdsr720-14 ~]#


Why virsh qemu-agent-command is not working? Am I doing something wrong
here?

Regards,
~Puneet


[Qemu-devel] Facing problems in running QEMU guest agents in Windows 2008 guest machine.

2014-07-01 Thread Puneet Bakshi
Hi,

I have a CenOS host machine running KVM and a Windows 2008 guest machine. I
am able to run qemu-monitor-command but not qemu-agent-command.


[root@sdsr720-14 Windows_ISO]# virsh qemu-monitor-command --hmp vm_win_05
'info network'
Devices not on any VLAN:
  hostnet0: fd=23 peer=net0
  net0: model=virtio-net-pci,macaddr=52:54:00:7f:4a:5b peer=hostnet0

[root@sdsr720-14 Windows_ISO]# virsh qemu-agent-command vm_win_05
'{execute:guest-ping}'

[root@sdsr720-14 Windows_ISO]#


[QEMU guest installation]
To install QEMU guest agent, I followed steps mentioned at following URL
http://wiki.qemu.org/Features/QAPI/GuestAgent#Example_usage


[Problem-1]
qemu-ga.exe -s install runs silently, net start qemu-ga gave error.

Following is the snippet from Windows shell.

PS C:\puneet .\qemu-ga.exe -s install

PS C:\puneet net start qemu-ga
The service name is invalid.

More help is available by typing NET HELPMSG 2185.

PS C:\puneet[root@sdsr720-14 Windows_ISO]#


[Problem-2]
When I double click the qemu-ga.exe, it gives the following error.

The application was unable to start correctly (0xc07b). Click Ok to
close the application.

I tried some other possible ways also but could not get them working.


Regards,
~Puneet


Re: [Qemu-devel] Facing problems in running QEMU guest agents in Windows 2008 guest machine.

2014-07-01 Thread Puneet Bakshi
Can somebody point me to the working way of installing quemu guest agents
in Windows 2008 guest machine?

Regards,
~Puneet


On Tue, Jul 1, 2014 at 3:57 PM, Puneet Bakshi bakshi.pun...@gmail.com
wrote:

 Hi,

 I have a CenOS host machine running KVM and a Windows 2008 guest machine.
 I am able to run qemu-monitor-command but not qemu-agent-command.


 [root@sdsr720-14 Windows_ISO]# virsh qemu-monitor-command --hmp vm_win_05
 'info network'
 Devices not on any VLAN:
   hostnet0: fd=23 peer=net0
   net0: model=virtio-net-pci,macaddr=52:54:00:7f:4a:5b peer=hostnet0

 [root@sdsr720-14 Windows_ISO]# virsh qemu-agent-command vm_win_05
 '{execute:guest-ping}'

 [root@sdsr720-14 Windows_ISO]#


 [QEMU guest installation]
 To install QEMU guest agent, I followed steps mentioned at following URL
 http://wiki.qemu.org/Features/QAPI/GuestAgent#Example_usage


 [Problem-1]
 qemu-ga.exe -s install runs silently, net start qemu-ga gave error.

 Following is the snippet from Windows shell.

 PS C:\puneet .\qemu-ga.exe -s install

 PS C:\puneet net start qemu-ga
 The service name is invalid.

 More help is available by typing NET HELPMSG 2185.

 PS C:\puneet[root@sdsr720-14 Windows_ISO]#


 [Problem-2]
 When I double click the qemu-ga.exe, it gives the following error.

 The application was unable to start correctly (0xc07b). Click Ok to
 close the application.

 I tried some other possible ways also but could not get them working.


 Regards,
 ~Puneet



[Qemu-devel] Regarding guest-file-write

2014-06-24 Thread Puneet Bakshi
Hi,

From host, I wrote 26 alphabets in guest file (/tmp/testqga) using
guest-file-write guest agent command (logs pasted below). I faced 2 issues
when doing that.

1a. It could wrote only 18bytes! Why could it not write all 26 characters?
Are we supposed to track how much data is written and need to resend the
remaining one?

1b. What is the limit of data, I can send in one guest-file-write command?

2. In the guest, file data seems to be different. Am I doing something
wrong here?


Host (file write)

[root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{
execute:guest-file-open, arguments:{path:/tmp/testqga,mode:w
+}}'

{return:1000}


[root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{
execute:guest-file-write,
arguments:{handle:1000,buf-b64:abcdefghijklmnopqrstuvwxyz}}'

{return:{count:18,eof:false}}


[root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{
execute:guest-file-close, arguments:{handle:1000}}'

{return:{}}


Host (file read)

[root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{
execute:guest-file-open, arguments:{path:/tmp/testqga,mode:r}}'

{return:1001}


[root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{
execute:guest-file-read, arguments:{handle:1001,count:18}}'

{return:{count:18,buf-b64:abcdefghijklmnopqrstuvwx,eof:false}}


[root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{
execute:guest-file-close, arguments:{handle:1001}}'

{return:{}}

Guest

[root@vm04 qga]# ll /tmp/testqga

-rw-rw-rw-. 1 root root 18 Jun 24 15:06 /tmp/testqga


[root@vm04 qga]# cat /tmp/testqga

i�^]y�!�9%�z)��-��1[root@vm04 qga]#


[root@vm04 qga]# od -x /tmp/testqga

000 b769 791d 21f8 398a 9a25 297a bbaa ba2d

020 31fc

022

 [root@vm04 qga]# strings /tmp/testqga

 [root@vm04 qga]# hexdump /tmp/testqga
 000 b769 791d 21f8 398a 9a25 297a bbaa ba2d
 010 31fc
 012

 [root@vm04 qga]# hexdump -c /tmp/testqga
 000   i 267 035   y 370   ! 212   9   % 232   z   ) 252 273   - 272
 010 374   1
 012
 [root@vm04 qga]#

Regards,
~Puneet


Re: [Qemu-devel] [libvirt] Regarding guest-file-write

2014-06-24 Thread Puneet Bakshi
1. In that case, I hope it allow sending binary data (non-ASCII) also.

2. If I encode my data in base-64 form, is there a limit on size of the
data I can pass (or I can pass arbitrarily large amount of data).

​Regards​,
~Puneet

On Tue, Jun 24, 2014 at 6:27 PM, Daniel P. Berrange berra...@redhat.com
wrote:

 On Tue, Jun 24, 2014 at 06:20:16PM +0530, Puneet Bakshi wrote:
  Hi,
 
  From host, I wrote 26 alphabets in guest file (/tmp/testqga) using
  guest-file-write guest agent command (logs pasted below). I faced 2
 issues
  when doing that.
 
  1a. It could wrote only 18bytes! Why could it not write all 26
 characters?
  Are we supposed to track how much data is written and need to resend the
  remaining one?
 
  1b. What is the limit of data, I can send in one guest-file-write
 command?
 
  2. In the guest, file data seems to be different. Am I doing something
  wrong here?

 Yes, the command does not take raw data, it takes base-64 encoded data.
 So those 26 characters you specified were base64 decoded which gives
 you 18 bytes of raw data.

 The clue is in the variable name 'buf-b64' - a shorthand for base64:

  [root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{
  execute:guest-file-write,
  arguments:{handle:1000,buf-b64:abcdefghijklmnopqrstuvwxyz}}'
 
  {return:{count:18,eof:false}}

 Regards,
 Daniel
 --
 |: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/
 :|
 |: http://libvirt.org  -o- http://virt-manager.org
 :|
 |: http://autobuild.org   -o- http://search.cpan.org/~danberr/
 :|
 |: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc
 :|



[Qemu-devel] (no subject)

2014-06-13 Thread Puneet Bakshi
Hi,

I want to be able to install RPM packages (available in host system at some
path) to the online guest VM and want this facility to be available as a
tool.

I am thinking of having a gemu guest agent (qemu-ga) running inside guest
VM. I did not find any available command (virsh qemu-agent-command
guest_vm ...) which can do the same.

I am planning to implement a command in qemu guest agent, which I can
invoke from virsh like below.

virsh qemu-agent-command vm_01  \
'{execute:guest-rpm-
install, \
  arguments:{path:/usr/local/bin/ABC.rpm}}

I am able to pass arguments from host to guest VM but how am I supposed to
pass the whole RPM image from host to guest (which the guest agent can
receive and install)?

Basically, I want to know how can we do following in QEMU environment.

1. take some bulky file from host to guest
2. perform some operation on that file
3. get the result of that operation.

Regards,
~Puneet


Re: [Qemu-devel] [Qemu-discuss] How can we install RPMs in guest VM from host machine using QEMU guest agents

2014-06-13 Thread Puneet Bakshi
Including qemu-devel also.

I have a project environment where guest VMs are getting created and
destroyed based on some (irrelevant) parameters (these guest VMs are
instantiated with QEMU guest agent running and with any possible changes in
that). There is a module in host which is controlling all this. I need to
do following things from within that module.

1. Whenever a new guest VM is created, take (predefined) RPM packages from
host to guest VM and install them.

2. Start a script in guest VM (at certain events).

3. Start a process in guest VM (at certain events).

I thought to address above issues by having a QEMU guest agent running
inside guest VM which has one new command, to which I somehow pass RPMs
using virsh qemu-guest-agent ... command.

virsh qemu-agent-command vm_01  \
'{execute:guest-rpm-install, \
  arguments:{path:/usr/local/bin/ABC.rpm}}

In existing qemu-ga code, I saw some examples where they fork() and
execle() some stuff. I think I can achieve [2] and [3] using the same way.

But, I was getting stuck at [1] in how to transfer files from host to guest
and do something with them. I thought I should be able to transfer files
using channel like socket/virtio, but was not getting the clue on how to
use them. Basically how can I do following.

1. take some bulky file from host to guest
2. perform some operation on that file
3. get the result of that operation.

Regards,
~Puneet


On Thu, Jun 12, 2014 at 9:37 PM, Puneet Bakshi bakshi.pun...@gmail.com
wrote:

 Forgot to mention that these guest VMs can be UNIX based or Windows.


 On Thu, Jun 12, 2014 at 9:36 PM, Puneet Bakshi bakshi.pun...@gmail.com
 wrote:

 Thanks Dale for responding.

 Actually, these guest VMs may or may not have scp, ftp, etc. What is
 assured is that they have the QEMU guest agent running and there is a
 possibility of having additional commands if required.

 Let me put up my problem.

 I have a project environment where guest VMs are getting created and
 destroyed based on some (irrelevant) parameters (these guest VMs are
 instantiated with QEMU guest agent running and with any possible changes in
 that). There is a module in host which is controlling all this. I need to
 do following things from within that module.

 1. Whenever a new guest VM is created, take (predefined) RPM packages
 from host to guest VM and install them.

 2. Start a script in guest VM (at certain events).

 3. Start a process in guest VM (at certain events).

 I thought to address above issues by having a QEMU guest agent running
 inside guest VM which has one new command, to which I somehow pass RPMs
 using virsh qemu-guest-agent ... command.

 In existing qemu-ga code, I saw some examples where they fork() and
 execle() some stuff. I though I can achieve [2] and [3] using the same way.

 But, I was getting stuck at [1] in how to transfer files from host to
 guest and do something with them. I thought I should be able to transfer
 files using channel like socket/virtio, but was not getting the clue on how
 to use them.

 Regards,


 On Thu, Jun 12, 2014 at 8:42 PM, Dale R. Worley wor...@alum.mit.edu
 wrote:

  From: Puneet bakshi.pun...@gmail.com

  I am able to pass arguments from host to guest VM but how am I
 supposed to
  pass the whole RPM image from host to guest (which the guest agent can
  receive and install)?

 What occurs to me is:

 scp /usr/local/bin/ABC.rpm root@guest:/usr/local/bin/ABC.rpm
 ssh root@guest rpm --install -p /usr/local/bin/ABC.rpm

 Dale






[Qemu-devel] [QEMU guest agent] How to transfer file from host to guest and do some operation on that

2014-06-13 Thread Puneet Bakshi
Adding subject.


On Thu, Jun 12, 2014 at 8:15 PM, Puneet Bakshi bakshi.pun...@gmail.com
wrote:

 Hi,

 I want to be able to install RPM packages (available in host system at
 some path) to the online guest VM and want this facility to be available as
 a tool.

 I am thinking of having a gemu guest agent (qemu-ga) running inside guest
 VM. I did not find any available command (virsh qemu-agent-command
 guest_vm ...) which can do the same.

 I am planning to implement a command in qemu guest agent, which I can
 invoke from virsh like below.

 virsh qemu-agent-command vm_01  \
 '{execute:guest-rpm-
 install, \
   arguments:{path:/usr/local/bin/ABC.rpm}}

 I am able to pass arguments from host to guest VM but how am I supposed to
 pass the whole RPM image from host to guest (which the guest agent can
 receive and install)?

 Basically, I want to know how can we do following in QEMU environment.

 1. take some bulky file from host to guest
 2. perform some operation on that file
 3. get the result of that operation.

 Regards,
 ~Puneet