[libvirt] [PATCH] util: Don't try to fchown files opened as non-root
by Jiri Denemark
When virFileOpenAs is called with VIR_FILE_OPEN_AS_UID flag and uid/gid
different from root/root while libvirtd is running as root, we fork a
new child, change its effective UID/GID to uid/gid and run
virFileOpenAsNoFork. It doesn't make any sense to fchown() the opened
file in this case since we already know that uid/gid can access the file
when open succeeds and one of the following situations may happen:
- the file is already owned by uid/gid and we skip fchown even before
this patch
- the file is owned by uid but not gid because it was created in a
directory with SETGID set, in which case it is desirable not to change
the group
- the file may be owned by a completely different user and/or group
because it was created on a root-squashed or even all-squashed NFS
filesystem, in which case fchown would most likely fail anyway
---
src/util/util.c | 31 +++++++++++++++++++------------
1 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/src/util/util.c b/src/util/util.c
index 3d0ceea..8ff25da 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -652,7 +652,6 @@ virFileOpenAsNoFork(const char *path, int openflags, mode_t mode,
{
int fd = -1;
int ret = 0;
- struct stat st;
if ((fd = open(path, openflags, mode)) < 0) {
ret = -errno;
@@ -660,18 +659,25 @@ virFileOpenAsNoFork(const char *path, int openflags, mode_t mode,
path);
goto error;
}
- if (fstat(fd, &st) == -1) {
- ret = -errno;
- virReportSystemError(errno, _("stat of '%s' failed"), path);
- goto error;
- }
- if (((st.st_uid != uid) || (st.st_gid != gid))
- && (fchown(fd, uid, gid) < 0)) {
- ret = -errno;
- virReportSystemError(errno, _("cannot chown '%s' to (%u, %u)"),
- path, (unsigned int) uid, (unsigned int) gid);
- goto error;
+
+ /* VIR_FILE_OPEN_AS_UID in flags means we are running in a child process
+ * owned by uid and gid */
+ if (!(flags & VIR_FILE_OPEN_AS_UID)) {
+ struct stat st;
+ if (fstat(fd, &st) == -1) {
+ ret = -errno;
+ virReportSystemError(errno, _("stat of '%s' failed"), path);
+ goto error;
+ }
+ if (((st.st_uid != uid) || (st.st_gid != gid))
+ && (fchown(fd, uid, gid) < 0)) {
+ ret = -errno;
+ virReportSystemError(errno, _("cannot chown '%s' to (%u, %u)"),
+ path, (unsigned int) uid, (unsigned int) gid);
+ goto error;
+ }
}
+
if ((flags & VIR_FILE_OPEN_FORCE_PERMS)
&& (fchmod(fd, mode) < 0)) {
ret = -errno;
@@ -757,6 +763,7 @@ virFileOpenAs(const char *path, int openflags, mode_t mode,
if ((!(flags & VIR_FILE_OPEN_AS_UID))
|| (getuid() != 0)
|| ((uid == 0) && (gid == 0))) {
+ flags &= ~VIR_FILE_OPEN_AS_UID;
return virFileOpenAsNoFork(path, openflags, mode, uid, gid, flags);
}
--
1.7.6
13 years, 5 months
[libvirt] [PATCH] qemu: Don't chown files on NFS share if dynamic_ownership is off
by Michal Privoznik
When dynamic ownership is disabled we don't want to chown any files,
not just local.
---
src/qemu/qemu_driver.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 52b7dfd..968865f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2163,11 +2163,10 @@ static int qemudDomainSaveFlag(struct qemud_driver *driver, virDomainPtr dom,
is_reg = true;
} else {
is_reg = !!S_ISREG(sb.st_mode);
- /* If the path is regular local file which exists
+ /* If the path is regular file which exists
* already and dynamic_ownership is off, we don't
* want to change it's ownership, just open it as-is */
- if (is_reg && !driver->dynamicOwnership &&
- virStorageFileIsSharedFS(path) == 0) {
+ if (is_reg && !driver->dynamicOwnership) {
uid=sb.st_uid;
gid=sb.st_gid;
}
--
1.7.5.rc3
13 years, 5 months
[libvirt] [PATCH 1/1] microblaze: Add architecture support
by John Williams
Add libvirt support for MicroBlaze architecture as a QEMU target. Based on mips/mipsel pattern.
Signed-off-by: John Williams <john.williams(a)petalogix.com>
---
docs/drvqemu.html.in | 2 ++
docs/schemas/capability.rng | 2 ++
examples/apparmor/libvirt-qemu | 4 ++++
src/qemu/qemu_capabilities.c | 2 ++
tests/capabilityschemadata/caps-qemu-kvm.xml | 24 ++++++++++++++++++++++++
5 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/docs/drvqemu.html.in b/docs/drvqemu.html.in
index 7230cae..e0e44eb 100644
--- a/docs/drvqemu.html.in
+++ b/docs/drvqemu.html.in
@@ -16,6 +16,8 @@
<li>
<strong>QEMU emulators</strong>: The driver will probe <code>/usr/bin</code>
for the presence of <code>qemu</code>, <code>qemu-system-x86_64</code>,
+ <code>qemu-system-microblaze</code>,
+ <code>qemu-system-microblazeel</code>,
<code>qemu-system-mips</code>,<code>qemu-system-mipsel</code>,
<code>qemu-system-sparc</code>,<code>qemu-system-ppc</code>. The results
of this can be seen from the capabilities XML output.
diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng
index f894b09..99b4a9a 100644
--- a/docs/schemas/capability.rng
+++ b/docs/schemas/capability.rng
@@ -325,6 +325,8 @@
<value>arm</value>
<value>i686</value>
<value>ia64</value>
+ <value>microblaze</value>
+ <value>microblazeel</value>
<value>mips</value>
<value>mipsel</value>
<value>ppc64</value>
diff --git a/examples/apparmor/libvirt-qemu b/examples/apparmor/libvirt-qemu
index faf8636..3251536 100644
--- a/examples/apparmor/libvirt-qemu
+++ b/examples/apparmor/libvirt-qemu
@@ -69,6 +69,8 @@
/usr/bin/qemu-system-cris rmix,
/usr/bin/qemu-system-i386 rmix,
/usr/bin/qemu-system-m68k rmix,
+ /usr/bin/qemu-system-microblaze rmix,
+ /usr/bin/qemu-system-microblazeel rmix,
/usr/bin/qemu-system-mips rmix,
/usr/bin/qemu-system-mips64 rmix,
/usr/bin/qemu-system-mips64el rmix,
@@ -87,6 +89,8 @@
/usr/bin/qemu-cris rmix,
/usr/bin/qemu-i386 rmix,
/usr/bin/qemu-m68k rmix,
+ /usr/bin/qemu-microblaze rmix,
+ /usr/bin/qemu-microblazeel rmix,
/usr/bin/qemu-mips rmix,
/usr/bin/qemu-mipsel rmix,
/usr/bin/qemu-ppc rmix,
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index ad62a07..2c037ce 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -160,6 +160,8 @@ static const struct qemu_arch_info const arch_info_hvm[] = {
{ "x86_64", 64, NULL, "qemu-system-x86_64",
NULL, arch_info_x86_64_flags, 2 },
{ "arm", 32, NULL, "qemu-system-arm", NULL, NULL, 0 },
+ { "microblaze", 32, NULL, "qemu-system-microblaze", NULL, NULL, 0 },
+ { "microblazeel", 32, NULL, "qemu-system-microblazeel", NULL, NULL, 0 },
{ "mips", 32, NULL, "qemu-system-mips", NULL, NULL, 0 },
{ "mipsel", 32, NULL, "qemu-system-mipsel", NULL, NULL, 0 },
{ "sparc", 32, NULL, "qemu-system-sparc", NULL, NULL, 0 },
diff --git a/tests/capabilityschemadata/caps-qemu-kvm.xml b/tests/capabilityschemadata/caps-qemu-kvm.xml
index 47accde..dc6fb76 100644
--- a/tests/capabilityschemadata/caps-qemu-kvm.xml
+++ b/tests/capabilityschemadata/caps-qemu-kvm.xml
@@ -113,6 +113,30 @@
<guest>
<os_type>hvm</os_type>
+ <arch name='microblaze'>
+ <wordsize>32</wordsize>
+ <emulator>/usr/bin/qemu-system-microblaze</emulator>
+ <machine>petalogix-s3adsp1800</machine>
+ <machine>microblaze-fdt</machine>
+ <domain type='qemu'>
+ </domain>
+ </arch>
+ </guest>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name='microblazeel'>
+ <wordsize>32</wordsize>
+ <emulator>/usr/bin/qemu-system-microblazeel</emulator>
+ <machine>petalogix-s3adsp1800</machine>
+ <machine>microblaze-fdt</machine>
+ <domain type='qemu'>
+ </domain>
+ </arch>
+ </guest>
+
+ <guest>
+ <os_type>hvm</os_type>
<arch name='mips'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-mips</emulator>
--
1.7.0.4
13 years, 5 months
[libvirt] [PATCH] virsh: make destroy sound less scary
by Eric Blake
Destroy has a rather negative English connotation. Try to reduce
the impact, so newbies aren't as scared to use it.
* tools/virsh.c: Tweak all destroy documentation.
* tools/virsh.pod: Likewise.
---
tools/virsh.c | 20 +++++++++++---------
tools/virsh.pod | 16 +++++++++-------
2 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 9a189fd..3b6f0ff 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -2264,8 +2264,9 @@ cmdReboot(vshControl *ctl, const vshCmd *cmd)
* "destroy" command
*/
static const vshCmdInfo info_destroy[] = {
- {"help", N_("destroy a domain")},
- {"desc", N_("Destroy a given domain.")},
+ {"help", N_("destroy (stop) a domain")},
+ {"desc",
+ N_("Forcefully stop a given domain, but leave its resources intact.")},
{NULL, NULL}
};
@@ -4887,8 +4888,8 @@ cmdNetworkDefine(vshControl *ctl, const vshCmd *cmd)
* "net-destroy" command
*/
static const vshCmdInfo info_network_destroy[] = {
- {"help", N_("destroy a network")},
- {"desc", N_("Destroy a given network.")},
+ {"help", N_("destroy (stop) a network")},
+ {"desc", N_("Forcefully stop a given network.")},
{NULL, NULL}
};
@@ -5734,7 +5735,7 @@ cmdInterfaceStart(vshControl *ctl, const vshCmd *cmd)
*/
static const vshCmdInfo info_interface_destroy[] = {
{"help", N_("destroy a physical host interface (disable it / \"if-down\")")},
- {"desc", N_("destroy a physical host interface.")},
+ {"desc", N_("forcefully stop a physical host interface.")},
{NULL, NULL}
};
@@ -6293,9 +6294,9 @@ cmdNodeDeviceCreate(vshControl *ctl, const vshCmd *cmd)
* "nodedev-destroy" command
*/
static const vshCmdInfo info_node_device_destroy[] = {
- {"help", N_("destroy a device on the node")},
+ {"help", N_("destroy (stop) a device on the node")},
{"desc", N_("Destroy a device on the node. Note that this "
- "command destroys devices on the physical host ")},
+ "command destroys devices on the physical host")},
{NULL, NULL}
};
@@ -6583,8 +6584,9 @@ cmdPoolBuild(vshControl *ctl, const vshCmd *cmd)
* "pool-destroy" command
*/
static const vshCmdInfo info_pool_destroy[] = {
- {"help", N_("destroy a pool")},
- {"desc", N_("Destroy a given pool.")},
+ {"help", N_("destroy (stop) a pool")},
+ {"desc",
+ N_("Forcefully stop a given pool. Raw data in the pool is untouched")},
{NULL, NULL}
};
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 736b919..8b820d2 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -405,7 +405,9 @@ but not started.
Immediately terminate the domain domain-id. This doesn't give the domain
OS any chance to react, and it's the equivalent of ripping the power
cord out on a physical machine. In most cases you will want to use
-the B<shutdown> command instead.
+the B<shutdown> command instead. However, this does not delete any
+storage volumes used by the guest, and if the domain is persistent, it
+can be restarted later.
=item B<domblkstat> I<domain> I<block-device>
@@ -506,7 +508,7 @@ variables, and defaults to C<vi>.
=item B<managedsave> I<domain-id>
-Save and destroy a running domain, so it can be restarted from the same
+Save and destroy (stop) a running domain, so it can be restarted from the same
state at a later time. When the virsh B<start> command is next run for
the domain, it will automatically be started from this saved state.
@@ -957,8 +959,8 @@ not instantiated.
=item B<net-destroy> I<network>
-Destroy a given virtual network specified by its name or UUID. This takes
-effect immediately.
+Destroy (stop) a given virtual network specified by its name or UUID. This
+takes effect immediately.
=item B<net-dumpxml> I<network>
@@ -1032,7 +1034,7 @@ not started.
=item B<iface-destroy> I<interface>
-Destroy a given host interface, such as by running "if-down" to
+Destroy (stop) a given host interface, such as by running "if-down" to
disable that interface from active use. This takes effect immediately.
=item B<iface-dumpxml> I<interface> optional I<--inactive>
@@ -1162,7 +1164,7 @@ I<type>.
=item B<pool-destroy> I<pool-or-uuid>
-Destroy a given I<pool> object. Libvirt will no longer manage the
+Destroy (stop) a given I<pool> object. Libvirt will no longer manage the
storage described by the pool object, but the raw data contained in
the pool is not changed, and can be later recovered with
B<pool-create>.
@@ -1171,7 +1173,7 @@ B<pool-create>.
Destroy the resources used by a given I<pool> object. This operation
is non-recoverable. The I<pool> object will still exist after this
-command.
+command, ready for the creation of new storage volumes.
=item B<pool-dumpxml> I<pool-or-uuid>
--
1.7.4.4
13 years, 5 months
[libvirt] [PATCH] build: use gnulib pthread_sigmask
by Eric Blake
Gnulib finally learned how to do pthread_sigmask on mingw.
We still have to worry about optional signals, like SIGWINCH,
but overall, this makes for less conditional code.
* .gnulib: Update to latest, for pthread_sigmask.
* bootstrap.conf (gnulib_modules): Add pthread_sigmask.
* configure.ac (AC_CHECK_FUNCS): Drop redundant check.
* src/rpc/virnetclient.c (virNetClientSetTLSSession)
(virNetClientIOEventLoop): Make code unconditional.
* src/util/command.c (virFork): Likewise.
* tools/virsh.c (doMigrate, cmdMigrate): Likewise.
---
.gnulib | 2 +-
bootstrap.conf | 1 +
configure.ac | 2 +-
src/rpc/virnetclient.c | 24 ++++++++----------------
src/util/command.c | 10 ----------
tools/virsh.c | 10 ----------
6 files changed, 11 insertions(+), 38 deletions(-)
diff --git a/.gnulib b/.gnulib
index 8db4963..adc3a5b 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 8db49630deab35ffbce5c113aed093359a75091d
+Subproject commit adc3a5b0083c935f5dcd408983e37c78cb8ebd7c
diff --git a/bootstrap.conf b/bootstrap.conf
index d3ff150..a800534 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -68,6 +68,7 @@ pipe2
poll
posix-shell
pthread
+pthread_sigmask
recv
random_r
sched
diff --git a/configure.ac b/configure.ac
index 13b4afb..aa589d6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -130,7 +130,7 @@ dnl assumed). Because of $LIB_PTHREAD, we cannot use AC_CHECK_FUNCS_ONCE.
dnl LIB_PTHREAD was set during gl_INIT by gnulib.
old_LIBS=$LIBS
LIBS="$LIBS $LIB_PTHREAD"
-AC_CHECK_FUNCS([pthread_sigmask pthread_mutexattr_init])
+AC_CHECK_FUNCS([pthread_mutexattr_init])
LIBS=$old_libs
dnl Availability of various common headers (non-fatal if missing).
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 615de6c..6a112ee 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -273,14 +273,16 @@ int virNetClientSetTLSSession(virNetClientPtr client,
char buf[1];
int len;
struct pollfd fds[1];
-#ifdef HAVE_PTHREAD_SIGMASK
sigset_t oldmask, blockedsigs;
sigemptyset (&blockedsigs);
+#ifdef SIGWINCH
sigaddset (&blockedsigs, SIGWINCH);
+#endif
+#ifdef SIGCHLD
sigaddset (&blockedsigs, SIGCHLD);
- sigaddset (&blockedsigs, SIGPIPE);
#endif
+ sigaddset (&blockedsigs, SIGPIPE);
virNetClientLock(client);
@@ -311,18 +313,14 @@ int virNetClientSetTLSSession(virNetClientPtr client,
* after the call (RHBZ#567931). Same for SIGCHLD and SIGPIPE
* at the suggestion of Paolo Bonzini and Daniel Berrange.
*/
-#ifdef HAVE_PTHREAD_SIGMASK
ignore_value(pthread_sigmask(SIG_BLOCK, &blockedsigs, &oldmask));
-#endif
repoll:
ret = poll(fds, ARRAY_CARDINALITY(fds), -1);
if (ret < 0 && errno == EAGAIN)
goto repoll;
-#ifdef HAVE_PTHREAD_SIGMASK
ignore_value(pthread_sigmask(SIG_BLOCK, &oldmask, NULL));
-#endif
}
ret = virNetTLSContextCheckCertificate(tls, client->tls);
@@ -338,19 +336,15 @@ int virNetClientSetTLSSession(virNetClientPtr client,
fds[0].revents = 0;
fds[0].events = POLLIN;
-#ifdef HAVE_PTHREAD_SIGMASK
/* Block SIGWINCH from interrupting poll in curses programs */
ignore_value(pthread_sigmask(SIG_BLOCK, &blockedsigs, &oldmask));
-#endif
repoll2:
ret = poll(fds, ARRAY_CARDINALITY(fds), -1);
if (ret < 0 && errno == EAGAIN)
goto repoll2;
-#ifdef HAVE_PTHREAD_SIGMASK
ignore_value(pthread_sigmask(SIG_BLOCK, &oldmask, NULL));
-#endif
len = virNetTLSSessionRead(client->tls, buf, 1);
if (len < 0) {
@@ -800,9 +794,7 @@ static int virNetClientIOEventLoop(virNetClientPtr client,
virNetClientCallPtr tmp = client->waitDispatch;
virNetClientCallPtr prev;
char ignore;
-#ifdef HAVE_PTHREAD_SIGMASK
sigset_t oldmask, blockedsigs;
-#endif
int timeout = -1;
/* If we have existing SASL decoded data we
@@ -841,22 +833,22 @@ static int virNetClientIOEventLoop(virNetClientPtr client,
* after the call (RHBZ#567931). Same for SIGCHLD and SIGPIPE
* at the suggestion of Paolo Bonzini and Daniel Berrange.
*/
-#ifdef HAVE_PTHREAD_SIGMASK
sigemptyset (&blockedsigs);
+#ifdef SIGWINCH
sigaddset (&blockedsigs, SIGWINCH);
+#endif
+#ifdef SIGCHLD
sigaddset (&blockedsigs, SIGCHLD);
+#endif
sigaddset (&blockedsigs, SIGPIPE);
ignore_value(pthread_sigmask(SIG_BLOCK, &blockedsigs, &oldmask));
-#endif
repoll:
ret = poll(fds, ARRAY_CARDINALITY(fds), timeout);
if (ret < 0 && errno == EAGAIN)
goto repoll;
-#ifdef HAVE_PTHREAD_SIGMASK
ignore_value(pthread_sigmask(SIG_SETMASK, &oldmask, NULL));
-#endif
virNetClientLock(client);
diff --git a/src/util/command.c b/src/util/command.c
index 9fdeb0b..eae58b2 100644
--- a/src/util/command.c
+++ b/src/util/command.c
@@ -145,9 +145,7 @@ static int virClearCapabilities(void)
*/
int virFork(pid_t *pid) {
-# ifdef HAVE_PTHREAD_SIGMASK
sigset_t oldmask, newmask;
-# endif
struct sigaction sig_action;
int saved_errno, ret = -1;
@@ -157,7 +155,6 @@ int virFork(pid_t *pid) {
* Need to block signals now, so that child process can safely
* kill off caller's signal handlers without a race.
*/
-# ifdef HAVE_PTHREAD_SIGMASK
sigfillset(&newmask);
if (pthread_sigmask(SIG_SETMASK, &newmask, &oldmask) != 0) {
saved_errno = errno;
@@ -165,7 +162,6 @@ int virFork(pid_t *pid) {
"%s", _("cannot block signals"));
goto cleanup;
}
-# endif
/* Ensure we hold the logging lock, to protect child processes
* from deadlocking on another thread's inherited mutex state */
@@ -178,11 +174,9 @@ int virFork(pid_t *pid) {
virLogUnlock();
if (*pid < 0) {
-# ifdef HAVE_PTHREAD_SIGMASK
/* attempt to restore signal mask, but ignore failure, to
avoid obscuring the fork failure */
ignore_value (pthread_sigmask(SIG_SETMASK, &oldmask, NULL));
-# endif
virReportSystemError(saved_errno,
"%s", _("cannot fork child process"));
goto cleanup;
@@ -192,7 +186,6 @@ int virFork(pid_t *pid) {
/* parent process */
-# ifdef HAVE_PTHREAD_SIGMASK
/* Restore our original signal mask now that the child is
safely running */
if (pthread_sigmask(SIG_SETMASK, &oldmask, NULL) != 0) {
@@ -200,7 +193,6 @@ int virFork(pid_t *pid) {
virReportSystemError(errno, "%s", _("cannot unblock signals"));
goto cleanup;
}
-# endif
ret = 0;
} else {
@@ -237,7 +229,6 @@ int virFork(pid_t *pid) {
sigaction(i, &sig_action, NULL);
}
-# ifdef HAVE_PTHREAD_SIGMASK
/* Unmask all signals in child, since we've no idea
what the caller's done with their signal mask
and don't want to propagate that to children */
@@ -247,7 +238,6 @@ int virFork(pid_t *pid) {
virReportSystemError(errno, "%s", _("cannot unblock signals"));
goto cleanup;
}
-# endif
ret = 0;
}
diff --git a/tools/virsh.c b/tools/virsh.c
index 9a189fd..2e776ec 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -4400,14 +4400,12 @@ doMigrate (void *opaque)
const vshCmd *cmd = data->cmd;
const char *xmlfile = NULL;
char *xml = NULL;
-#if HAVE_PTHREAD_SIGMASK
sigset_t sigmask, oldsigmask;
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGINT);
if (pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask) < 0)
goto out_sig;
-#endif
if (!vshConnectionUsability (ctl, ctl->conn))
goto out;
@@ -4483,10 +4481,8 @@ doMigrate (void *opaque)
}
out:
-#if HAVE_PTHREAD_SIGMASK
pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL);
out_sig:
-#endif
if (dom) virDomainFree (dom);
VIR_FREE(xml);
ignore_value(safewrite(data->writefd, &ret, sizeof(ret)));
@@ -4534,12 +4530,10 @@ cmdMigrate (vshControl *ctl, const vshCmd *cmd)
struct timeval start, curr;
bool live_flag = false;
vshCtrlData data;
-#if HAVE_PTHREAD_SIGMASK
sigset_t sigmask, oldsigmask;
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGINT);
-#endif
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -4631,13 +4625,9 @@ repoll:
}
if (verbose) {
-#if HAVE_PTHREAD_SIGMASK
pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask);
-#endif
ret = virDomainGetJobInfo(dom, &jobinfo);
-#if HAVE_PTHREAD_SIGMASK
pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL);
-#endif
if (ret == 0)
print_job_progress(jobinfo.dataRemaining, jobinfo.dataTotal);
}
--
1.7.4.4
13 years, 5 months
[libvirt] [PATCHv3] build: fix virBufferVasprintf on mingw
by Eric Blake
Gnulib documents that mingw vsnprintf is broken (it returns -1
on out-of-space, instead of the count of what would have been
printed); but while we were using the snprintf wrapper, we had
not yet been using the vsnprintf wrapper.
Meanwhile, mingw (but not mingw64) has a replacement snprintf
that fixes return values, but still lacks %1$s support; so in
that case, gnulib didn't replace snprintf, but libintl then
went ahead and installed a version that supported %1$s but not
return values. Gnulib has since been fixed to guarantee that
the snprintf module will always guarantee the constraints needed
by libintl.
Also, we want to guarantee that strdup sets errno on failure.
* .gnulib: Update to latest, for vsnprintf fix.
* bootstrap.conf (gnulib_modules): Add vsnprintf, strdup-posix.
Reported by Matthias Bolte.
---
v3: more gnulib updates, also fix strdup
v2: see https://www.redhat.com/archives/libvir-list/2011-July/msg00042.html
* .gnulib 7269b35...8db4963 (23):
> sys_select: define sigset_t more portably
> * m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Poison pselect.
> pselect: Use pthread_sigmask, not sigprocmask.
> modules/pselect: Add Bruno and Jim to maintainers.
> * modules/pselect: Add select, LIBSOCKET.
> * lib/pselect.c (pselect): Use plain name, without "rpl_".
> pselect: document better
> pthread_sigmask: new module
> test-pselect: new module
> * tests/test-sys_select.c (sigset_t): Test for it, too.
> snprintf: guarantee %1$d, for libintl
> maint: exempt stdio-read.c and stdio-write.c from the cppi check
> maint: indent with spaces, not TABs, and add a rule to check this
> maint.mk: correct omissions in prohibit_argmatch_without_use check
> Comments about EINTR.
> autoupdate
> xnanosleep: Rewrite to use new dtotimespec module.
> timespec-add, timespec-sub: new modules
> dtotimespec: new module
> * lib/timespec.h (timespectod): New inline function.
> * lib/timespec.h (timespec_sign): New inline function.
> pselect: new module
> sys_select: don't depend on sys_socket
I'm also investigating how easy it would be to use gnulib's new
pthread_sigmask.
.gnulib | 2 +-
bootstrap.conf | 2 ++
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/.gnulib b/.gnulib
index 7269b35..8db4963 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 7269b35c8d9be1a6f97906b9e29b8c422b92fc31
+Subproject commit 8db49630deab35ffbce5c113aed093359a75091d
diff --git a/bootstrap.conf b/bootstrap.conf
index 581d60b..d3ff150 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -80,6 +80,7 @@ socket
stdarg
stpcpy
strchrnul
+strdup-posix
strndup
strerror
strerror_r-posix
@@ -97,6 +98,7 @@ usleep
vasprintf
verify
vc-list-files
+vsnprintf
waitpid
warnings
'
--
1.7.4.4
13 years, 5 months
[libvirt] [PATCH] Fix compilation of statstest.c during make check
by Jim Fehlig
---
tests/statstest.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tests/statstest.c b/tests/statstest.c
index d18bb0c..c989992 100644
--- a/tests/statstest.c
+++ b/tests/statstest.c
@@ -17,7 +17,7 @@ static void testQuietError(void *userData ATTRIBUTE_UNUSED,
static int testDevice(const char *path, int expect)
{
- int actual = xenLinuxDomainDeviceID(NULL, 1, path);
+ int actual = xenLinuxDomainDeviceID(1, path);
if (actual == expect) {
return 0;
--
1.7.5.4
13 years, 5 months
[libvirt] [PATCH] Do not drop kernel cmdline for xen pv domains
by Jim Fehlig
Kernel cmdline args can be passed to xen pv domains even when a
bootloader is specified. The current config-to-sxpr mapping
ignores cmdline when bootloader is present.
Since the xend sub-driver is used with many xen toolstack versions,
this patch takes conservative approach of adding an else block to
existing !def->os.bootloader, and only appends sxpr if def->os.cmdline
is non-NULL.
---
src/xenxs/xen_sxpr.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index 13ca015..bd770bc 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -2261,6 +2261,12 @@ xenFormatSxpr(virConnectPtr conn,
}
virBufferAddLit(&buf, "))");
+ } else {
+ /* PV domains accept kernel cmdline args */
+ if (def->os.cmdline) {
+ virBufferEscapeSexpr(&buf, "(image (linux (args '%s')))",
+ def->os.cmdline);
+ }
}
for (i = 0 ; i < def->ndisks ; i++)
--
1.7.5.4
13 years, 5 months
[libvirt] [PATCH] Skip bugs which are CLOSED in todo list
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
* docs/todo.pl: Skip closed bugs
---
docs/todo.pl | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/docs/todo.pl b/docs/todo.pl
index e6da418..1183ff5 100755
--- a/docs/todo.pl
+++ b/docs/todo.pl
@@ -47,6 +47,8 @@ my $trackers = BZ::Client::Bug->search($client, {'product' => $product,
my @trackers;
foreach my $tracker (@{$trackers}) {
+ next if $tracker->{'bug_status'} eq "CLOSED";
+
my $summary = $tracker->{'short_desc'};
$summary =~ s/^\s*RFE\s*:\s*//;
$summary =~ s/^\s*\[\s*RFE\s*\]\s*:?\s*//;
@@ -64,6 +66,8 @@ foreach my $tracker (@trackers) {
'blocked' => $tracker->{id}});
foreach my $feature (@{$features}) {
+ next if $feature->{'bug_status'} eq "CLOSED";
+
my $summary = $feature->{'short_desc'};
$summary =~ s/^\s*RFE\s*:\s*//;
$summary =~ s/^\s*\[\s*RFE\s*\]\s*:?\s*//;
--
1.7.6
13 years, 5 months