[Qemu-devel] qemu 1.1.0 says 1.1.50

2012-06-04 Thread MATSUDA, Daiki
I tried qemu-1.1.0. But it says 1.1.50 and
$ echo VERSION
1.1.50

Is it correct ?

Regards
MATSUDA Daiki



Re: [Qemu-devel] [BUG] qemu-ga: failed to fsfreeze-thaw on RHEL 5.8 Guest

2012-05-27 Thread MATSUDA, Daiki
I researched the source of the bug.

qemu-ga calls guest_fsfreeze_build_mount_list from
qemp_guest_fsreeze_thaw in qga/commands-posix.c. And it tries to read
/etc/mtab (= MOUNTED) to get mounted filesystems. But when they are
frozen, getmntent(fp) is not finished in the situation /etc/mtab in
frozen filesystem.

I suggest to read the list from not frozen filesystem file or on-memory
data, e.g. /proc/mounts.

Regards
MATSUDA Daiki

--- qga/commands-posix.c.orig   2012-05-28 08:10:47.842332018 +0900
+++ qga/commands-posix.c2012-05-28 08:11:01.598340937 +0900
@@ -347,7 +347,7 @@ static int guest_fsfreeze_build_mount_li
 {
 struct mntent *ment;
 GuestFsfreezeMount *mount;
-char const *mtab = MOUNTED;
+char const *mtab = "/proc/mounts";
 FILE *fp;

 fp = setmntent(mtab, "r");

> I encountered the serious bug on QEMU Guest Agent.
> 
> environment
> Guest OS : RHEL 5.8 / 5.7 (i686)
> Guest Agent Version : qemu-1.1.0rc2 and rc3
> 
> I am trying to take snapshot via virsh snapshot-create-as command. And
> to freeze guest's filesystem and take snapshot is succeed. But after
> sending the thaw command to Guest, time error occurs on libvirt qemu
> agent because of not catch Guest's answer.
> In addition, its situation is worst because the Guest Filesystem is kept
> as frozen.
> 
> The problem does not occur on RHEL 6.2 Guest OS and in about qemu-1.0 it
> does not occur.
> 
> Regards
> MATSUDA Daiki
> 
> 
> 
> 




[Qemu-devel] [BUG] qemu-ga: failed to fsfreeze-thaw on RHEL 5.8 Guest

2012-05-24 Thread MATSUDA, Daiki
I encountered the serious bug on QEMU Guest Agent.

environment
Guest OS : RHEL 5.8 / 5.7 (i686)
Guest Agent Version : qemu-1.1.0rc2 and rc3

I am trying to take snapshot via virsh snapshot-create-as command. And
to freeze guest's filesystem and take snapshot is succeed. But after
sending the thaw command to Guest, time error occurs on libvirt qemu
agent because of not catch Guest's answer.
In addition, its situation is worst because the Guest Filesystem is kept
as frozen.

The problem does not occur on RHEL 6.2 Guest OS and in about qemu-1.0 it
does not occur.

Regards
MATSUDA Daiki



Re: [Qemu-devel] [PATCH v2 2/8] qemu-ga: move channel/transport functionalit

2012-02-13 Thread MATSUDA, Daiki

(2012/02/14 6:37), Michael Roth wrote:

On Mon, Feb 13, 2012 at 11:14:03AM +0900, MATSUDA, Daiki wrote:

And in this week, I tried your Windows Guest Agent patches. It is a
little hard way.

At the first I wrote my work.
0. my node OS is RHEL 6.1.
1. build some mingw packages (mingw32-gcc, mingw-32-glib2...)
2. apply your patches to qemu-kvm HEAD source. There is no error.
3. boot WinXP SP3 and Win Server 2008 R2 with VirtIO Console and
Guest Agent options.
4. install VirtIO Serial driver for Windows in
http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/virtio-win-0.1-15.iso
5. communicate to node OS with viosel-test.exe included upper iso file is OK
6. copy qemu-ga.exe with some dlls included in mingw32 packages
7. 'qemu-ga --service install' does not work well. but 'qemu-ga -s
install' works well.


I see the problem, small bug in the getopt_long() usage that wasn't
triggering on POSIX. I'll fix that up shortly.


8. qemu-ga.exe works. And get good response for guest-info command.
9. But after 30 seconds, qemu-ga.exe displays following and not work
correctly.
1328840605.265625: critical: error retrieving overlapped result: 995
1328840605.296875: critical: channel error, removing source

If possible, could you point my work?


Can you reproduce with the -v option added and post the the output? I
haven't encountered this error code and the documentation for it seems
strange. Does this occur with both WinXP and 2008?


Yes, it occurs with both WinXP and 2008.
And pastes the log with '-v'
C:\qemu-ga>qemuga.exe -v
1329094617.593750: debug: prepare
1329094618.109375: debug: check
 repeat sometimes ...
1329094623.171875: debug: prepare
1329094623.625000: debug: check
1329094623.625000: critical: error retrieving overlapped result: 995
1329094623.640625: debug: dispatch
1329094623.640625: warninng: error reading channel
1329094623.640625: critical: channel error, removing source


If it's not too much trouble, can you try to reproduce with qemu.git
(for WinXP SP3)? Wondering if qemu vs. qemu-kvm is affecting the
virtio-serial driver.


Yes. I am using the qemu.git from
http://repo.or.cz/w/qemu.git.

In addition, now I change the hypervisor from RHEL 6.1 default to
qemu git tree. But same problem occurs.


Strange, I can't seem to get the virtio-win-0.1-15.iso vioser drivers
working with either qemu.git or qemu-kvm.git. I thought I was using them
for XP SP3, but apparently I had switched over to using RHEL6ga drivers
at some point (virtio-win-1.1.16.iso), which I believe are older than the
Fedora ones you're using.

However, there was an issue with the RHEL6ga drivers where an
ERROR_SYSTEM_NO_RESOURCES was sometimes being reported in place of what
where I'd normally expect an EOF with the linux drivers. So my guess is
that has since been changed to report ERROR_OPERATION_ABORTED instead, so
please also apply the following patches and see if these fix the issues
you're having:

1) qemu-ga: fix incorrect getopt_long() usage
https://github.com/mdroth/qemu/commit/b5f4349763936007e1a33ba99d9ffb6b75a49b36

2) qemu-ga: win32, treat ERROR_OPERATION_ABORTED as EOF
https://github.com/mdroth/qemu/commit/7418bbf903e639ec22c394771f5ff03f18bd1275

Thanks


I confirmed that 2 bugs are fixed by your 2 patches. And now Windows 
Guest OS works well over 1 hour.


Thanks for your working, Michael.





Re: [Qemu-devel] [PATCH v2 2/8] qemu-ga: move channel/transport functionalit

2012-02-12 Thread MATSUDA, Daiki

(2012/02/10 13:51), Michael Roth wrote:

On Fri, Feb 10, 2012 at 11:26:32AM +0900, MATSUDA, Daiki wrote:

(2012/02/04 2:07), Michael Roth wrote:

On 02/02/2012 10:25 PM, MATSUDA, Daiki wrote:

Hi, Michael!
Thank you for your working.

And I have a question the process id written in pid file.
If qemu-ga is ran as daemon, the parent process id not child is written
in pid file. So, id gotten by 'ps' command is different. Is it correct
work? Many other daemon writes child process id.

Regards
MATSUDA Daiki



Hi Matsuda,

Thank you for testing!

In the become_daemon() function, the parent exits immediately after the
fork(), so only the child has the opportunity to write to the pid file.
It calls getpid() to get the pid to write, which should be it's own
lwpid. So I'm not seeing where there's an opportunity for the parent pid
to be written.

Can you confirm? It seems to behave as expected for me:

[root@vm ~]# /home/mdroth/w/qemu-build/qemu-ga -d
** (process:7441): DEBUG: starting daemon
[root@vm ~]# ps aux | grep qemu-ga
root 7442 0.0 0.0 13792 348 ? Ss 10:56 0:00
/home/mdroth/w/qemu-build/qemu-ga -d
root 7471 0.0 0.1 109108 816 pts/2 R+ 11:00 0:00 grep --color=auto qemu-ga
[root@vm ~]# cat /var/run/qemu-ga.pid
7442



Hi, Michael.

Sorry, it will be my mistake. The child process id is written in pid file.

And in this week, I tried your Windows Guest Agent patches. It is a
little hard way.

At the first I wrote my work.
0. my node OS is RHEL 6.1.
1. build some mingw packages (mingw32-gcc, mingw-32-glib2...)
2. apply your patches to qemu-kvm HEAD source. There is no error.
3. boot WinXP SP3 and Win Server 2008 R2 with VirtIO Console and
Guest Agent options.
4. install VirtIO Serial driver for Windows in
http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/virtio-win-0.1-15.iso
5. communicate to node OS with viosel-test.exe included upper iso file is OK
6. copy qemu-ga.exe with some dlls included in mingw32 packages
7. 'qemu-ga --service install' does not work well. but 'qemu-ga -s
install' works well.


I see the problem, small bug in the getopt_long() usage that wasn't
triggering on POSIX. I'll fix that up shortly.


8. qemu-ga.exe works. And get good response for guest-info command.
9. But after 30 seconds, qemu-ga.exe displays following and not work
correctly.
1328840605.265625: critical: error retrieving overlapped result: 995
1328840605.296875: critical: channel error, removing source

If possible, could you point my work?


Can you reproduce with the -v option added and post the the output? I
haven't encountered this error code and the documentation for it seems
strange. Does this occur with both WinXP and 2008?


Yes, it occurs with both WinXP and 2008.
And pastes the log with '-v'
C:\qemu-ga>qemuga.exe -v
1329094617.593750: debug: prepare
1329094618.109375: debug: check
 repeat sometimes ...
1329094623.171875: debug: prepare
1329094623.625000: debug: check
1329094623.625000: critical: error retrieving overlapped result: 995
1329094623.640625: debug: dispatch
1329094623.640625: warninng: error reading channel
1329094623.640625: critical: channel error, removing source


If it's not too much trouble, can you try to reproduce with qemu.git
(for WinXP SP3)? Wondering if qemu vs. qemu-kvm is affecting the
virtio-serial driver.


Yes. I am using the qemu.git from
http://repo.or.cz/w/qemu.git.

In addition, now I change the hypervisor from RHEL 6.1 default to qemu 
git tree. But same problem occurs.





Re: [Qemu-devel] [PATCH v2 2/8] qemu-ga: move channel/transport functionalit

2012-02-09 Thread MATSUDA, Daiki

(2012/02/04 2:07), Michael Roth wrote:

On 02/02/2012 10:25 PM, MATSUDA, Daiki wrote:

Hi, Michael!
Thank you for your working.

And I have a question the process id written in pid file.
If qemu-ga is ran as daemon, the parent process id not child is written
in pid file. So, id gotten by 'ps' command is different. Is it correct
work? Many other daemon writes child process id.

Regards
MATSUDA Daiki



Hi Matsuda,

Thank you for testing!

In the become_daemon() function, the parent exits immediately after the
fork(), so only the child has the opportunity to write to the pid file.
It calls getpid() to get the pid to write, which should be it's own
lwpid. So I'm not seeing where there's an opportunity for the parent pid
to be written.

Can you confirm? It seems to behave as expected for me:

[root@vm ~]# /home/mdroth/w/qemu-build/qemu-ga -d
** (process:7441): DEBUG: starting daemon
[root@vm ~]# ps aux | grep qemu-ga
root 7442 0.0 0.0 13792 348 ? Ss 10:56 0:00
/home/mdroth/w/qemu-build/qemu-ga -d
root 7471 0.0 0.1 109108 816 pts/2 R+ 11:00 0:00 grep --color=auto qemu-ga
[root@vm ~]# cat /var/run/qemu-ga.pid
7442



Hi, Michael.

Sorry, it will be my mistake. The child process id is written in pid file.

And in this week, I tried your Windows Guest Agent patches. It is a 
little hard way.


At the first I wrote my work.
0. my node OS is RHEL 6.1.
1. build some mingw packages (mingw32-gcc, mingw-32-glib2...)
2. apply your patches to qemu-kvm HEAD source. There is no error.
3. boot WinXP SP3 and Win Server 2008 R2 with VirtIO Console and Guest 
Agent options.

4. install VirtIO Serial driver for Windows in
http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/virtio-win-0.1-15.iso
5. communicate to node OS with viosel-test.exe included upper iso file is OK
6. copy qemu-ga.exe with some dlls included in mingw32 packages
7. 'qemu-ga --service install' does not work well. but 'qemu-ga -s 
install' works well.

8. qemu-ga.exe works. And get good response for guest-info command.
9. But after 30 seconds, qemu-ga.exe displays following and not work 
correctly.

1328840605.265625: critical: error retrieving overlapped result: 995
1328840605.296875: critical: channel error, removing source

If possible, could you point my work?

MATSUDA Daiki



Re: [Qemu-devel] [PATCH v2 2/8] qemu-ga: move channel/transport functionalit

2012-02-03 Thread MATSUDA, Daiki
Hi, Michael!
Thank you for your working.

And I have a question the process id written in pid file.
If qemu-ga is ran as daemon, the parent process id not child is written
in pid file. So, id gotten by 'ps' command is different. Is it correct
work? Many other daemon writes child process id.

Regards
MATSUDA Daiki



[Qemu-devel] [PATCH] GuestAgent: PIDFILE remains when daemon start fails

2012-01-05 Thread MATSUDA, Daiki
Hi, all.

I am trying QEMU Guest Agent and encountered a small bug. It is that the
PIDFILE remains when daemon start fails. And maybe forgotton to g_free().

MATSUDA, Daiki


diff -uNrp qemu/qemu-ga.c 
qemu-c47f3223658119219bbe0b8d09da733d1c06e76f/qemu-ga.c
--- qemu/qemu-ga.c  2012-01-05 01:06:25.0 +0900
+++ qemu-c47f3223658119219bbe0b8d09da733d1c06e76f/qemu-ga.c 2012-01-06 
07:07:03.807872085 +0900
@@ -49,6 +49,13 @@ struct GAState {
 };
 
 static struct GAState *ga_state;
+const char *pidfile = QGA_PIDFILE_DEFAULT;
+
+static void cleanup(void)
+{
+g_free(ga_state);
+unlink(pidfile);
+}
 
 static void quit_handler(int sig)
 {
@@ -70,6 +77,7 @@ static void register_signal_handlers(voi
 ret = sigaction(SIGINT, &sigact, NULL);
 if (ret == -1) {
 g_error("error configuring signal handler: %s", strerror(errno));
+cleanup();
 exit(EXIT_FAILURE);
 }
 ret = sigaction(SIGTERM, &sigact, NULL);
@@ -485,6 +493,7 @@ static void init_guest_agent(GAState *s)
 if (s->path == NULL) {
 if (strcmp(s->method, "virtio-serial") != 0) {
 g_critical("must specify a path for this channel");
+cleanup();
 exit(EXIT_FAILURE);
 }
 /* try the default path for the virtio-serial port */
@@ -496,17 +505,20 @@ static void init_guest_agent(GAState *s)
 fd = qemu_open(s->path, O_RDWR | O_NONBLOCK | O_ASYNC);
 if (fd == -1) {
 g_critical("error opening channel: %s", strerror(errno));
+cleanup();
 exit(EXIT_FAILURE);
 }
 ret = conn_channel_add(s, fd);
 if (ret) {
 g_critical("error adding channel to main loop");
+cleanup();
 exit(EXIT_FAILURE);
 }
 } else if (strcmp(s->method, "isa-serial") == 0) {
 fd = qemu_open(s->path, O_RDWR | O_NOCTTY);
 if (fd == -1) {
 g_critical("error opening channel: %s", strerror(errno));
+cleanup();
 exit(EXIT_FAILURE);
 }
 tcgetattr(fd, &tio);
@@ -533,15 +545,18 @@ static void init_guest_agent(GAState *s)
 fd = unix_listen(s->path, NULL, strlen(s->path));
 if (fd == -1) {
 g_critical("error opening path: %s", strerror(errno));
+cleanup();
 exit(EXIT_FAILURE);
 }
 ret = listen_channel_add(s, fd, true);
 if (ret) {
 g_critical("error binding/listening to specified socket");
+cleanup();
 exit(EXIT_FAILURE);
 }
 } else {
 g_critical("unsupported channel method/type: %s", s->method);
+cleanup();
 exit(EXIT_FAILURE);
 }
 
@@ -552,7 +567,7 @@ static void init_guest_agent(GAState *s)
 int main(int argc, char **argv)
 {
 const char *sopt = "hVvdm:p:l:f:b:";
-const char *method = NULL, *path = NULL, *pidfile = QGA_PIDFILE_DEFAULT;
+const char *method = NULL, *path = NULL;
 const struct option lopt[] = {
 { "help", 0, NULL, 'h' },
 { "version", 0, NULL, 'V' },
@@ -662,7 +677,7 @@ int main(int argc, char **argv)
 g_main_loop_run(ga_state->main_loop);
 
 ga_command_state_cleanup_all(ga_state->command_state);
-unlink(pidfile);
+cleanup();
 
 return 0;
 }


[Qemu-devel] [PATCH] GuestAgent: PIDFILE remains when daemon start fails

2012-01-05 Thread MATSUDA, Daiki
Hi, all.

I am trying QEMU Guest Agent and encountered a small bug. It is that the
PIDFILE remains when daemon start fails. And maybe forgotton to g_free().

MATSUDA, Daiki

diff -uNrp qemu/qemu-ga.c
qemu-c47f3223658119219bbe0b8d09da733d1c06e76f/qemu-ga.c
--- qemu/qemu-ga.c  2012-01-05 01:06:25.0 +0900
+++ qemu-c47f3223658119219bbe0b8d09da733d1c06e76f/qemu-ga.c 2012-01-06
07:07:03.807872085 +0900
@@ -49,6 +49,13 @@ struct GAState {
 };

 static struct GAState *ga_state;
+const char *pidfile = QGA_PIDFILE_DEFAULT;
+
+static void cleanup(void)
+{
+g_free(ga_state);
+unlink(pidfile);
+}

 static void quit_handler(int sig)
 {
@@ -70,6 +77,7 @@ static void register_signal_handlers(voi
 ret = sigaction(SIGINT, &sigact, NULL);
 if (ret == -1) {
 g_error("error configuring signal handler: %s", strerror(errno));
+cleanup();
 exit(EXIT_FAILURE);
 }
 ret = sigaction(SIGTERM, &sigact, NULL);
@@ -485,6 +493,7 @@ static void init_guest_agent(GAState *s)
 if (s->path == NULL) {
 if (strcmp(s->method, "virtio-serial") != 0) {
 g_critical("must specify a path for this channel");
+cleanup();
 exit(EXIT_FAILURE);
 }
 /* try the default path for the virtio-serial port */
@@ -496,17 +505,20 @@ static void init_guest_agent(GAState *s)
 fd = qemu_open(s->path, O_RDWR | O_NONBLOCK | O_ASYNC);
 if (fd == -1) {
 g_critical("error opening channel: %s", strerror(errno));
+cleanup();
 exit(EXIT_FAILURE);
 }
 ret = conn_channel_add(s, fd);
 if (ret) {
 g_critical("error adding channel to main loop");
+cleanup();
 exit(EXIT_FAILURE);
 }