Skip to contentSkip to conversation

qemu-ga: change default state dir to /var/run

PATCH Superseded Luiz Capitulino 3 participants 13 messages Oct 3, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover qemu-ga: change default state dir to /var/run

Also allow users to change the default at configure time. Please, check individual patches for more details.

Luiz Capitulino (3):
configure: guest_agent -> qemuga
configure: add --guest-agent-statedir
qemu-ga: use state dir from CONFIG_QEMUGA_STATEDIR

 configure | 16 +++++++++++-----
 qemu-ga.c |  4 ++--
 2 files changed, 13 insertions(+), 7 deletions(-)
Signature · 1 line
1.7.12.315.g682ce8b
#1 lore raw

PATCH 1/3 configure: guest_agent -> qemuga

Next commit will add a new qemu-ga variable in configure, having guest_agent as a prefix is too long, let's use qemuga instead.

---
 configure | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
configure +5 -5
index 8f99b7b..4cfcdc6 100755
@@ -214,7 +214,7 @@ smartcard_nss=""
 usb_redir=""
 opengl=""
 zlib="yes"
-guest_agent="yes"
+qemuga="yes"
 want_tools="yes"
 libiscsi=""
 coroutine=""
@@ -844,9 +844,9 @@ for opt do
   ;;
   --disable-zlib-test) zlib="no"
   ;;
-  --enable-guest-agent) guest_agent="yes"
+  --enable-guest-agent) qemuga="yes"
   ;;
-  --disable-guest-agent) guest_agent="no"
+  --disable-guest-agent) qemuga="no"
   ;;
   --enable-tools) want_tools="yes"
   ;;
@@ -3059,7 +3059,7 @@ if test "$softmmu" = yes ; then
     fi
   fi
   if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
-    if [ "$guest_agent" = "yes" ]; then
+    if [ "$qemuga" = "yes" ]; then
       tools="qemu-ga\$(EXESUF) $tools"
     fi
   fi
@@ -3167,7 +3167,7 @@ echo "nss used          $smartcard_nss"
 echo "usb net redir     $usb_redir"
 echo "OpenGL support    $opengl"
 echo "libiscsi support  $libiscsi"
-echo "build guest agent $guest_agent"
+echo "build guest agent $qemuga"
 echo "seccomp support   $seccomp"
 echo "coroutine backend $coroutine_backend"
 
Signature · 1 line
1.7.12.315.g682ce8b
Acked-by on v1 1/3
#2 lore raw

Re: [Qemu-devel] [PATCH 1/3] configure: guest_agent -> qemuga

Quoted 4 lines · Luiz Capitulino

Next commit will add a new qemu-ga variable in configure, having guest_agent as a prefix is too long, let's use qemuga instead.

Quoted 51 lines
---
 configure | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
configure +5 -5
index 8f99b7b..4cfcdc6 100755
@@ -214,7 +214,7 @@ smartcard_nss=""
 usb_redir=""
 opengl=""
 zlib="yes"
-guest_agent="yes"
+qemuga="yes"
 want_tools="yes"
 libiscsi=""
 coroutine=""
@@ -844,9 +844,9 @@ for opt do
   ;;
   --disable-zlib-test) zlib="no"
   ;;
-  --enable-guest-agent) guest_agent="yes"
+  --enable-guest-agent) qemuga="yes"
   ;;
-  --disable-guest-agent) guest_agent="no"
+  --disable-guest-agent) qemuga="no"
   ;;
   --enable-tools) want_tools="yes"
   ;;
@@ -3059,7 +3059,7 @@ if test "$softmmu" = yes ; then
     fi
   fi
   if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
-    if [ "$guest_agent" = "yes" ]; then
+    if [ "$qemuga" = "yes" ]; then
       tools="qemu-ga\$(EXESUF) $tools"
     fi
   fi
@@ -3167,7 +3167,7 @@ echo "nss used          $smartcard_nss"
 echo "usb net redir     $usb_redir"
 echo "OpenGL support    $opengl"
 echo "libiscsi support  $libiscsi"
-echo "build guest agent $guest_agent"
+echo "build guest agent $qemuga"
 echo "seccomp support   $seccomp"
 echo "coroutine backend $coroutine_backend"
 
Signature · 1 line
1.7.12.315.g682ce8b
#3 lore raw

PATCH 2/3 configure: add --guest-agent-statedir

In reply to Luiz Capitulino

Defaults to /var/run.

---
 configure | 6 ++++++
 1 file changed, 6 insertions(+)
configure +6 -0
index 4cfcdc6..4f3d2ed 100755
@@ -215,6 +215,7 @@ usb_redir=""
 opengl=""
 zlib="yes"
 qemuga="yes"
+qemuga_statedir="/var/run"
 want_tools="yes"
 libiscsi=""
 coroutine=""
@@ -628,6 +629,8 @@ for opt do
   ;;
   --sysconfdir=*) sysconfdir="$optarg"
   ;;
+  --guest-agent-statedir=*) qemuga_statedir="$optarg"
+  ;;
   --sbindir=*|--sharedstatedir=*|--localstatedir=*|\
   --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
   --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
@@ -1022,6 +1025,7 @@ echo "  --datadir=PATH           install firmware in PATH$confsuffix"
 echo "  --docdir=PATH            install documentation in PATH$confsuffix"
 echo "  --bindir=PATH            install binaries in PATH"
 echo "  --sysconfdir=PATH        install config in PATH$confsuffix"
+echo "  --guest-agent-statedir=PATH   set Guest Agent state directory to PATH"
 echo "  --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]"
 echo "  --enable-debug-tcg       enable TCG debugging"
 echo "  --disable-debug-tcg      disable TCG debugging (default)"
@@ -3086,6 +3090,7 @@ echo "library directory `eval echo $libdir`"
 echo "libexec directory `eval echo $libexecdir`"
 echo "include directory `eval echo $includedir`"
 echo "config directory  `eval echo $sysconfdir`"
+echo "qemu-ga state directory  $qemuga_statedir"
 if test "$mingw32" = "no" ; then
 echo "Manual directory  `eval echo $mandir`"
 echo "ELF interp prefix $interp_prefix"
@@ -3196,6 +3201,7 @@ echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
 echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
 echo "CONFIG_QEMU_HELPERDIR=\"$libexecdir\"" >> $config_host_mak
 
+echo "CONFIG_QEMUGA_STATEDIR=\"$qemuga_statedir\"" >> $config_host_mak
 echo "ARCH=$ARCH" >> $config_host_mak
 if test "$debug_tcg" = "yes" ; then
   echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
Signature · 1 line
1.7.12.315.g682ce8b
#4 lore raw

Re: [Qemu-devel] [PATCH 2/3] configure: add --guest-agent-statedir

Quoted 37 lines · Luiz Capitulino

Defaults to /var/run.

---
 configure | 6 ++++++
 1 file changed, 6 insertions(+)
configure +4 -0
index 4cfcdc6..4f3d2ed 100755
@@ -215,6 +215,7 @@ usb_redir=""
 opengl=""
 zlib="yes"
 qemuga="yes"
+qemuga_statedir="/var/run"
 want_tools="yes"
 libiscsi=""
 coroutine=""
@@ -628,6 +629,8 @@ for opt do
   ;;
   --sysconfdir=*) sysconfdir="$optarg"
   ;;
+  --guest-agent-statedir=*) qemuga_statedir="$optarg"
+  ;;
   --sbindir=*|--sharedstatedir=*|--localstatedir=*|\
   --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
   --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
@@ -1022,6 +1025,7 @@ echo "  --datadir=PATH           install firmware in PATH$confsuffix"
 echo "  --docdir=PATH            install documentation in PATH$confsuffix"
 echo "  --bindir=PATH            install binaries in PATH"
 echo "  --sysconfdir=PATH        install config in PATH$confsuffix"
+echo "  --guest-agent-statedir=PATH   set Guest Agent state directory to PATH"
 echo "  --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]"
 echo "  --enable-debug-tcg       enable TCG debugging"
 echo "  --disable-debug-tcg      disable TCG debugging (default)"

configure echo "library directory `eval echo $libdir`" · line 3093

Quoted 4 lines
configure +1 -0
@@ -3086,6 +3090,7 @@ echo "library directory `eval echo $libdir`"
 echo "libexec directory `eval echo $libexecdir`"
 echo "include directory `eval echo $includedir`"
 echo "config directory  `eval echo $sysconfdir`"
+echo "qemu-ga state directory  $qemuga_statedir"

Would prefer this get moved down, under "build guest agent"

Looks good otherwise.

Quoted 14 lines
configure +1 -0
 if test "$mingw32" = "no" ; then
 echo "Manual directory  `eval echo $mandir`"
 echo "ELF interp prefix $interp_prefix"
@@ -3196,6 +3201,7 @@ echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
 echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
 echo "CONFIG_QEMU_HELPERDIR=\"$libexecdir\"" >> $config_host_mak
 
+echo "CONFIG_QEMUGA_STATEDIR=\"$qemuga_statedir\"" >> $config_host_mak
 echo "ARCH=$ARCH" >> $config_host_mak
 if test "$debug_tcg" = "yes" ; then
   echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
Signature · 1 line
1.7.12.315.g682ce8b
#5 lore raw

Re: [Qemu-devel] [PATCH 2/3] configure: add --guest-agent-statedir

In reply to Luiz Capitulino
Quoted 3 lines · Luiz Capitulino

Defaults to /var/run.

Since this has the effect of changing both the default directory for state and well as the pid file, maybe we should s@state@state/pidfile@ the human-readable descriptions?

Quoted 52 lines
---
 configure | 6 ++++++
 1 file changed, 6 insertions(+)
configure +6 -0
index 4cfcdc6..4f3d2ed 100755
@@ -215,6 +215,7 @@ usb_redir=""
 opengl=""
 zlib="yes"
 qemuga="yes"
+qemuga_statedir="/var/run"
 want_tools="yes"
 libiscsi=""
 coroutine=""
@@ -628,6 +629,8 @@ for opt do
   ;;
   --sysconfdir=*) sysconfdir="$optarg"
   ;;
+  --guest-agent-statedir=*) qemuga_statedir="$optarg"
+  ;;
   --sbindir=*|--sharedstatedir=*|--localstatedir=*|\
   --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
   --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
@@ -1022,6 +1025,7 @@ echo "  --datadir=PATH           install firmware in PATH$confsuffix"
 echo "  --docdir=PATH            install documentation in PATH$confsuffix"
 echo "  --bindir=PATH            install binaries in PATH"
 echo "  --sysconfdir=PATH        install config in PATH$confsuffix"
+echo "  --guest-agent-statedir=PATH   set Guest Agent state directory to PATH"
 echo "  --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]"
 echo "  --enable-debug-tcg       enable TCG debugging"
 echo "  --disable-debug-tcg      disable TCG debugging (default)"
@@ -3086,6 +3090,7 @@ echo "library directory `eval echo $libdir`"
 echo "libexec directory `eval echo $libexecdir`"
 echo "include directory `eval echo $includedir`"
 echo "config directory  `eval echo $sysconfdir`"
+echo "qemu-ga state directory  $qemuga_statedir"
 if test "$mingw32" = "no" ; then
 echo "Manual directory  `eval echo $mandir`"
 echo "ELF interp prefix $interp_prefix"
@@ -3196,6 +3201,7 @@ echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
 echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
 echo "CONFIG_QEMU_HELPERDIR=\"$libexecdir\"" >> $config_host_mak
 
+echo "CONFIG_QEMUGA_STATEDIR=\"$qemuga_statedir\"" >> $config_host_mak
 echo "ARCH=$ARCH" >> $config_host_mak
 if test "$debug_tcg" = "yes" ; then
   echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
Signature · 1 line
1.7.12.315.g682ce8b
#6 lore raw

Re: [Qemu-devel] [PATCH 2/3] configure: add --guest-agent-statedir

In reply to Luiz Capitulino

Il 03/10/2012 19:24, Luiz Capitulino ha scritto:

Quoted 1 line

Defaults to /var/run.

Please add instead --localstatedir (defaulting to ${prefix}/var), and make the guest agent's directory /run inside that one. Packagers already know to override --localstatedir=/var, in some cases macros even do it automatically.

Paolo

Quoted 51 lines
---
 configure | 6 ++++++
 1 file changed, 6 insertions(+)
configure +6 -0
index 4cfcdc6..4f3d2ed 100755
@@ -215,6 +215,7 @@ usb_redir=""
 opengl=""
 zlib="yes"
 qemuga="yes"
+qemuga_statedir="/var/run"
 want_tools="yes"
 libiscsi=""
 coroutine=""
@@ -628,6 +629,8 @@ for opt do
   ;;
   --sysconfdir=*) sysconfdir="$optarg"
   ;;
+  --guest-agent-statedir=*) qemuga_statedir="$optarg"
+  ;;
   --sbindir=*|--sharedstatedir=*|--localstatedir=*|\
   --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
   --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
@@ -1022,6 +1025,7 @@ echo "  --datadir=PATH           install firmware in PATH$confsuffix"
 echo "  --docdir=PATH            install documentation in PATH$confsuffix"
 echo "  --bindir=PATH            install binaries in PATH"
 echo "  --sysconfdir=PATH        install config in PATH$confsuffix"
+echo "  --guest-agent-statedir=PATH   set Guest Agent state directory to PATH"
 echo "  --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]"
 echo "  --enable-debug-tcg       enable TCG debugging"
 echo "  --disable-debug-tcg      disable TCG debugging (default)"
@@ -3086,6 +3090,7 @@ echo "library directory `eval echo $libdir`"
 echo "libexec directory `eval echo $libexecdir`"
 echo "include directory `eval echo $includedir`"
 echo "config directory  `eval echo $sysconfdir`"
+echo "qemu-ga state directory  $qemuga_statedir"
 if test "$mingw32" = "no" ; then
 echo "Manual directory  `eval echo $mandir`"
 echo "ELF interp prefix $interp_prefix"
@@ -3196,6 +3201,7 @@ echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
 echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
 echo "CONFIG_QEMU_HELPERDIR=\"$libexecdir\"" >> $config_host_mak
 
+echo "CONFIG_QEMUGA_STATEDIR=\"$qemuga_statedir\"" >> $config_host_mak
 echo "ARCH=$ARCH" >> $config_host_mak
 if test "$debug_tcg" = "yes" ; then
   echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
#7 lore raw

Re: [Qemu-devel] [PATCH 2/3] configure: add --guest-agent-statedir

Quoted 7 lines · On Wed, 03 Oct 2012 20:32:21 +0200 Paolo Bonzini <[email protected]> wrote:

Il 03/10/2012 19:24, Luiz Capitulino ha scritto:

Quoted 1 line

Defaults to /var/run.

Please add instead --localstatedir (defaulting to ${prefix}/var), and make the guest agent's directory /run inside that one. Packagers already know to override --localstatedir=/var, in some cases macros even do it automatically.

Well, that was my first version but I discarded it for two reasons.

First, --localstatedir is a host-side setting but qemu-ga is not supposed to run in the host. What if I want a different setting for guests?

Second, having /run appended to --localstatedir (or whatever we choose) may have a bad effect if qemu is built with --localstatedir=, where qemu-ga's state will be "/run" (good for Fedora, but might not be good for other distros or other unixes).

I'm not strong about this though, it just was my reasoning while doing this.

#8 lore raw

Re: [Qemu-devel] [PATCH 2/3] configure: add --guest-agent-statedir

Il 03/10/2012 20:53, Luiz Capitulino ha scritto:

Quoted 11 lines
Quoted 7 lines · On Wed, 03 Oct 2012 20:32:21 +0200 Paolo Bonzini <[email protected]> wrote:

Il 03/10/2012 19:24, Luiz Capitulino ha scritto:

Quoted 1 line

Defaults to /var/run.

Please add instead --localstatedir (defaulting to ${prefix}/var), and make the guest agent's directory /run inside that one. Packagers already know to override --localstatedir=/var, in some cases macros even do it automatically.

Quoted 4 lines

Well, that was my first version but I discarded it for two reasons.

First, --localstatedir is a host-side setting but qemu-ga is not supposed to run in the host. What if I want a different setting for guests?

Then you should build twice, like you do when the guest is a completely different OS.

Quoted 4 lines

Second, having /run appended to --localstatedir (or whatever we choose) may have a bad effect if qemu is built with --localstatedir=, where qemu-ga's state will be "/run" (good for Fedora, but might not be good for other distros or other unixes).

I'm not sure I follow, it would be --localstatedir=/var usually. Even Fedora would not use --localstatedir=.

Paolo

Quoted 4 lines

I'm not strong about this though, it just was my reasoning while doing this.

#9 lore raw

Re: [Qemu-devel] [PATCH 2/3] configure: add --guest-agent-statedir

Quoted 12 lines · On Wed, 03 Oct 2012 20:56:31 +0200 Paolo Bonzini <[email protected]> wrote:

Il 03/10/2012 20:53, Luiz Capitulino ha scritto:

Quoted 11 lines
Quoted 7 lines · On Wed, 03 Oct 2012 20:32:21 +0200 Paolo Bonzini <[email protected]> wrote:

Il 03/10/2012 19:24, Luiz Capitulino ha scritto:

Quoted 1 line

Defaults to /var/run.

Please add instead --localstatedir (defaulting to ${prefix}/var), and make the guest agent's directory /run inside that one. Packagers already know to override --localstatedir=/var, in some cases macros even do it automatically.

Quoted 7 lines
Quoted 4 lines

Well, that was my first version but I discarded it for two reasons.

First, --localstatedir is a host-side setting but qemu-ga is not supposed to run in the host. What if I want a different setting for guests?

Then you should build twice, like you do when the guest is a completely different OS.

Fine with me if this is acceptable.

Quoted 7 lines
Quoted 4 lines

Second, having /run appended to --localstatedir (or whatever we choose) may have a bad effect if qemu is built with --localstatedir=, where qemu-ga's state will be "/run" (good for Fedora, but might not be good for other distros or other unixes).

I'm not sure I follow, it would be --localstatedir=/var usually. Even Fedora would not use --localstatedir=.

Which part you didn't follow, that no one would build with --localstatedir= or what is the problem if this is done?

If it's the former, then I buy that argument and will change the series.

#10 lore raw

PATCH 3/3 qemu-ga: use state dir from CONFIG_QEMUGA_STATEDIR

In reply to Luiz Capitulino

Has the side effect of changing the default directory used to save the freeze status file from /tmp to /var/run.

This is a beneficial change for two reasons:

1. FHS states that programs must not assume that files in /tmp will still exist between invocations of the program. This defeats the purpose of the freeze status file

2. FHS dictates that /var/run should be cleaned on boot, this automatically cleans up any stale file

---
 qemu-ga.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
qemu-ga.c +2 -2
index b747470..cbfd021 100644
@@ -40,8 +40,8 @@
 #else
 #define QGA_VIRTIO_PATH_DEFAULT "\\\\.\\Global\\org.qemu.guest_agent.0"
 #endif
-#define QGA_PIDFILE_DEFAULT "/var/run/qemu-ga.pid"
-#define QGA_STATEDIR_DEFAULT "/tmp"
+#define QGA_PIDFILE_DEFAULT  CONFIG_QEMUGA_STATEDIR "/qemu-ga.pid"
+#define QGA_STATEDIR_DEFAULT CONFIG_QEMUGA_STATEDIR
 #define QGA_SENTINEL_BYTE 0xFF
 
 struct GAState {
Signature · 1 line
1.7.12.315.g682ce8b
Acked-by on v1 3/3
#11 lore raw

Re: [Qemu-devel] [PATCH 3/3] qemu-ga: use state dir from CONFIG_QEMUGA_STATEDIR

Quoted 5 lines · Luiz Capitulino

Has the side effect of changing the default directory used to save the freeze status file from /tmp to /var/run.

This is a beneficial change for two reasons:

Quoted 8 lines

1. FHS states that programs must not assume that files in /tmp will still exist between invocations of the program. This defeats the purpose of the freeze status file

2. FHS dictates that /var/run should be cleaned on boot, this automatically cleans up any stale file

Quoted 23 lines
---
 qemu-ga.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
qemu-ga.c +2 -2
index b747470..cbfd021 100644
@@ -40,8 +40,8 @@
 #else
 #define QGA_VIRTIO_PATH_DEFAULT "\\\\.\\Global\\org.qemu.guest_agent.0"
 #endif
-#define QGA_PIDFILE_DEFAULT "/var/run/qemu-ga.pid"
-#define QGA_STATEDIR_DEFAULT "/tmp"
+#define QGA_PIDFILE_DEFAULT  CONFIG_QEMUGA_STATEDIR "/qemu-ga.pid"
+#define QGA_STATEDIR_DEFAULT CONFIG_QEMUGA_STATEDIR
 #define QGA_SENTINEL_BYTE 0xFF
 
 struct GAState {
Signature · 1 line
1.7.12.315.g682ce8b
#12 lore raw
In reply to Luiz Capitulino

Il 03/10/2012 19:24, Luiz Capitulino ha scritto:

Quoted 12 lines

Also allow users to change the default at configure time. Please, check individual patches for more details.

Luiz Capitulino (3):
configure: guest_agent -> qemuga
configure: add --guest-agent-statedir
qemu-ga: use state dir from CONFIG_QEMUGA_STATEDIR

 configure | 16 +++++++++++-----
 qemu-ga.c |  4 ++--
 2 files changed, 13 insertions(+), 7 deletions(-)

I have some comments on the autoconfyness of patch 2, otherwise looks good.

Paolo