[libvirt] [PATCH] qemu: Don't update count of vCPUs if hot-unplug has failed
by Peter Krempa
After live change of cpu counts, the number of processor threads is
verified. This patch makes use of this approach to check if qemu ignored
the request for cpu hot-unplug and report an appropriate message.
---
src/qemu/qemu_driver.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 39175f4..c4be130 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3697,6 +3697,15 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
goto cleanup;
}
+ /* check if hotplug has failed */
+ if (vcpus < oldvcpus && ncpupids == oldvcpus) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("qemu didn't unplug the vCPUs properly"));
+ vcpus = oldvcpus;
+ ret = -1;
+ goto cleanup;
+ }
+
if (ncpupids != vcpus) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("got wrong number of vCPU pids from QEMU monitor. "
--
1.8.1
11 years, 10 months
[libvirt] [PATCH 00/10] Resolve CHECKED_RETURN errors found by Coverity
by John Ferlan
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=880388
This set of patches resolves the "CHECKED_RETURN (CWE-252)" errors found
by Coverity.
John Ferlan (10):
interface: Check and handle error for virAsprintf() calls.
parallels: Check and handle error for virAsprintf() calls. Ignore the return
inparallelsMakePoolName() since subsequent check validates name
was allocated.
rpc: Check status when attempting to set SO_REUSEADDR flag on outgoing
connection. On failure, VIR_WARN(), but continue to connect.
vmware: Ignore the return status check for vmwareUpdateVMStatus in
convenience routine vmwareDomainObjListUpdateDomain
xen: Check return status for setting TCP_NODELAY option and generate a
VIR_DEBUG message on failure. Allow connection to continue.
virlockspacetest: Check return on mkdir for LOCKSPACE_DIR
vmx2xmltest: Check and handle error for virAsprintf() calls.
xml2vmxtest: Check and handle error for virAsprintf() calls.
virsh: Ignore error returns for virBufferTrim().
phyp: Check and handle select() errors from waitsocket().
src/interface/interface_backend_udev.c | 5 ++--
src/parallels/parallels_storage.c | 5 ++--
src/phyp/phyp_driver.c | 42 ++++++++++++++++++++++++++--------
src/rpc/virnetsocket.c | 4 +++-
src/vmware/vmware_driver.c | 2 +-
src/xen/xend_internal.c | 6 +++--
tests/virlockspacetest.c | 3 ++-
tests/vmx2xmltest.c | 7 ++++--
tests/xml2vmxtest.c | 5 ++--
tools/virsh.c | 4 ++--
10 files changed, 56 insertions(+), 27 deletions(-)
--
1.7.11.7
11 years, 10 months
[libvirt] [PATCH] libvirt: lxc: don't mkdir when selinux is disabled
by Gao feng
libvirt lxc will fail to start when selinux is disabled.
error: Failed to start domain noroot
error: internal error guest failed to start: PATH=/bin:/sbin TERM=linux container=lxc-libvirt container_uuid=b9873916-3516-c199-8112-1592ff694a9e LIBVIRT_LXC_UUID=b9873916-3516-c199-8112-1592ff694a9e LIBVIRT_LXC_NAME=noroot /bin/sh
2013-01-09 11:04:05.384+0000: 1: info : libvirt version: 1.0.1
2013-01-09 11:04:05.384+0000: 1: error : lxcContainerMountBasicFS:546 : Failed to mkdir /sys/fs/selinux: No such file or directory
2013-01-09 11:04:05.384+0000: 7536: info : libvirt version: 1.0.1
2013-01-09 11:04:05.384+0000: 7536: error : virLXCControllerRun:1466 : error receiving signal from container: Input/output error
2013-01-09 11:04:05.404+0000: 7536: error : virCommandWait:2287 : internal error Child process (ip link del veth1) unexpected exit status 1: Cannot find device "veth1"
fix this problem by checking if selinuxfs is mounted
in host before we try to create dir /sys/fs/selinux.
Signed-off-by: Gao feng <gaofeng(a)cn.fujitsu.com>
---
src/lxc/lxc_container.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 9f22923..d7f4960 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -540,13 +540,6 @@ static int lxcContainerMountBasicFS(bool pivotRoot,
VIR_DEBUG("Processing %s -> %s",
mnts[i].src, mnts[i].dst);
- if (virFileMakePath(mnts[i].dst) < 0) {
- virReportSystemError(errno,
- _("Failed to mkdir %s"),
- mnts[i].src);
- goto cleanup;
- }
-
srcpath = mnts[i].src;
/* Skip if mount doesn't exist in source */
@@ -554,6 +547,13 @@ static int lxcContainerMountBasicFS(bool pivotRoot,
(access(srcpath, R_OK) < 0))
continue;
+ if (virFileMakePath(mnts[i].dst) < 0) {
+ virReportSystemError(errno,
+ _("Failed to mkdir %s"),
+ mnts[i].src);
+ goto cleanup;
+ }
+
VIR_DEBUG("Mount %s on %s type=%s flags=%x, opts=%s",
srcpath, mnts[i].dst, mnts[i].type, mnts[i].mflags, mnts[i].opts);
if (mount(srcpath, mnts[i].dst, mnts[i].type, mnts[i].mflags, mnts[i].opts) < 0) {
--
1.7.11.7
11 years, 10 months
[libvirt] [PATCH v2] Add 'lxc-enter-namespace' command to virsh
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Add a 'lxc-enter-namespace' command which accepts a domain name
and then a command + args to run, attached to the container
eg
virsh -c lxc:/// lxc-enter-namespace demo -- /bin/ps -auxf
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
tools/Makefile.am | 1 +
tools/virsh-domain.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/virsh.pod | 8 +++++
3 files changed, 103 insertions(+)
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 878a114..8a0429c 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -133,6 +133,7 @@ virsh_LDADD = \
$(STATIC_BINARIES) \
$(WARN_CFLAGS) \
../src/libvirt.la \
+ ../src/libvirt-lxc.la \
../src/libvirt-qemu.la \
../gnulib/lib/libgnu.la \
$(LIBXML_LIBS) \
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index e91939c..1fee681 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -43,11 +43,13 @@
#include "conf/domain_conf.h"
#include "console.h"
#include "viralloc.h"
+#include "vircommand.h"
#include "virutil.h"
#include "virfile.h"
#include "virjson.h"
#include "virkeycode.h"
#include "virmacaddr.h"
+#include "virprocess.h"
#include "virstring.h"
#include "virsh-domain-monitor.h"
#include "virerror.h"
@@ -6771,6 +6773,97 @@ cleanup:
}
/*
+ * "lxc-enter-namespace" namespace
+ */
+static const vshCmdInfo info_lxc_enter_namespace[] = {
+ {"help", N_("LXC Guest Enter Namespace")},
+ {"desc", N_("Run an arbitrary lxc guest enter namespace; use at your own risk")},
+ {NULL, NULL}
+};
+
+static const vshCmdOptDef opts_lxc_enter_namespace[] = {
+ {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
+ {NULL, 0, 0, NULL}
+};
+
+static bool
+cmdLxcEnterNamespace(vshControl *ctl, const vshCmd *cmd)
+{
+ virDomainPtr dom = NULL;
+ bool ret = false;
+ const vshCmdOpt *opt = NULL;
+ char **cmdargv = NULL;
+ size_t ncmdargv = 0;
+ pid_t pid;
+ int nfdlist;
+ int *fdlist;
+ size_t i;
+
+ dom = vshCommandOptDomain(ctl, cmd, NULL);
+ if (dom == NULL)
+ goto cleanup;
+
+ while ((opt = vshCommandOptArgv(cmd, opt))) {
+ if (VIR_EXPAND_N(cmdargv, ncmdargv, 1) < 0) {
+ vshError(ctl, _("%s: %d: failed to allocate argv"),
+ __FILE__, __LINE__);
+ }
+ cmdargv[ncmdargv-1] = opt->data;
+ }
+ if (VIR_EXPAND_N(cmdargv, ncmdargv, 1) < 0) {
+ vshError(ctl, _("%s: %d: failed to allocate argv"),
+ __FILE__, __LINE__);
+ }
+ cmdargv[ncmdargv - 1] = NULL;
+
+ if ((nfdlist = virDomainLxcOpenNamespace(dom, &fdlist, 0)) < 0)
+ goto cleanup;
+
+ /* Fork once because we don't want to affect
+ * virsh's namespace itself
+ */
+ if (virFork(&pid) < 0)
+ goto cleanup;
+ if (pid == 0) {
+ if (virDomainLxcEnterNamespace(dom,
+ nfdlist,
+ fdlist,
+ NULL,
+ NULL,
+ 0) < 0)
+ _exit(255);
+
+ /* Fork a second time because entering the
+ * pid namespace only takes effect after fork
+ */
+ if (virFork(&pid) < 0)
+ _exit(255);
+ if (pid == 0) {
+ execv(cmdargv[0], cmdargv);
+ _exit(255);
+ } else {
+ if (virProcessWait(pid, NULL) < 0)
+ _exit(255);
+ }
+ _exit(0);
+ } else {
+ for (i = 0 ; i < nfdlist ; i++)
+ VIR_FORCE_CLOSE(fdlist[i]);
+ VIR_FREE(fdlist);
+ if (virProcessWait(pid, NULL) < 0)
+ goto cleanup;
+ }
+
+ ret = true;
+
+cleanup:
+ if (dom)
+ virDomainFree(dom);
+ VIR_FREE(cmdargv);
+ return ret;
+}
+
+/*
* "dumpxml" command
*/
static const vshCmdInfo info_dumpxml[] = {
@@ -8760,6 +8853,7 @@ const vshCmdDef domManagementCmds[] = {
{"inject-nmi", cmdInjectNMI, opts_inject_nmi, info_inject_nmi, 0},
{"send-key", cmdSendKey, opts_send_key, info_send_key, 0},
{"send-process-signal", cmdSendProcessSignal, opts_send_process_signal, info_send_process_signal, 0},
+ {"lxc-enter-namespace", cmdLxcEnterNamespace, opts_lxc_enter_namespace, info_lxc_enter_namespace, 0},
{"managedsave", cmdManagedSave, opts_managedsave, info_managedsave, 0},
{"managedsave-remove", cmdManagedSaveRemove, opts_managedsaveremove,
info_managedsaveremove, 0},
diff --git a/tools/virsh.pod b/tools/virsh.pod
index c9ebc8f..e2a2aec 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -3056,6 +3056,14 @@ When I<--aysnc> is given, the command waits for timeout whether success or
failed. And when I<--block> is given, the command waits forever with blocking
timeout.
+=item B<lxc-enter-namespace> I<domain> -- /path/to/binary [arg1, [arg2, ...]]
+
+Enter the namespace of I<domain> and execute the command C</path/to/binary>
+passing the requested args. The binary path is relative to the container
+root filesystem, not the host root filesystem. The binary will inherit the
+environment variables / console visible to virsh. This command only works
+when connected to the LXC hypervisor driver.
+
=back
=head1 ENVIRONMENT
--
1.7.11.7
11 years, 10 months
[libvirt] [PATCH] build: add new file, for lxc_protocol checking
by Eric Blake
Commit 509eb51 added lxc_protocol.x; but without the initial
checkin of src/lxc_protocol-structs, 'make check' would fail for
anyone with pdwtags installed:
make[3]: *** No rule to make target `lxc_protocol-structs', needed by `check-protocol'. Stop.
* src/lxc_protocol-structs: New file.
---
Pushing under the build-breaker rule.
src/lxc_protocol-structs | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100644 src/lxc_protocol-structs
diff --git a/src/lxc_protocol-structs b/src/lxc_protocol-structs
new file mode 100644
index 0000000..eb54172
--- /dev/null
+++ b/src/lxc_protocol-structs
@@ -0,0 +1,13 @@
+/* -*- c -*- */
+struct remote_nonnull_domain {
+ remote_nonnull_string name;
+ remote_uuid uuid;
+ int id;
+};
+struct lxc_domain_open_namespace_args {
+ remote_nonnull_domain dom;
+ u_int flags;
+};
+enum lxc_procedure {
+ LXC_PROC_DOMAIN_OPEN_NAMESPACE = 1,
+};
--
1.8.0.2
11 years, 10 months
[libvirt] [PATCH 0/8] *Persistent vHBA support in storage pool
by Osier Yang
This is the 3rd part to implement NPIV migration support [1].
Part 1:
https://www.redhat.com/archives/libvir-list/2013-January/msg00859.html
Part 2: (Already ACKed by Michal)
https://www.redhat.com/archives/libvir-list/2013-January/msg00859.html
The patches are based on Part 2.
The new XMLs might be too long, might be deserved to have them as
sub-elements of <adapter>. But I'd like to see the feedback first.
Osier Yang (8):
New XML attributes for storage pool source adapter
storage: Make the adapter name be consistent with node device driver
storage: Move virStorageBackendSCSIGetHostNumber into iscsi backend
phyp: Prohibit fc_host adapter for phyp driver
util: Add helper to get the scsi host name by iterating over sysfs
util: Fix bug of managing vport
storage: Add startPool and stopPool for scsi backend
storage: Guess the parent if it's not specified for vHBA
docs/formatstorage.html.in | 15 ++-
docs/schemas/storagepool.rng | 33 +++++-
src/conf/storage_conf.c | 123 ++++++++++++++++--
src/conf/storage_conf.h | 23 +++-
src/libvirt_private.syms | 4 +
src/phyp/phyp_driver.c | 15 ++-
src/storage/storage_backend_iscsi.c | 39 ++++++-
src/storage/storage_backend_scsi.c | 190 +++++++++++++++++++--------
src/storage/storage_backend_scsi.h | 3 -
src/util/virutil.c | 196 +++++++++++++++++++++++++++-
src/util/virutil.h | 7 +
tests/storagepoolxml2xmlin/pool-scsi.xml | 2 +-
tests/storagepoolxml2xmlin/pool-scsi1.xml | 15 ++
tests/storagepoolxml2xmlout/pool-scsi.xml | 2 +-
tests/storagepoolxml2xmlout/pool-scsi1.xml | 18 +++
tests/storagepoolxml2xmltest.c | 1 +
16 files changed, 602 insertions(+), 84 deletions(-)
create mode 100644 tests/storagepoolxml2xmlin/pool-scsi1.xml
create mode 100644 tests/storagepoolxml2xmlout/pool-scsi1.xml
[1] https://www.redhat.com/archives/libvir-list/2012-November/msg00826.html
Regards,
Osier
11 years, 10 months
[libvirt] [PATCH 0/2] Add total number of physical cores to the capabilities output
by Peter Krempa
https://bugzilla.redhat.com/show_bug.cgi?id=888503
The values added by this patch help avoid management applications the dodgy
approach of multiplying values in the nodeinfo structure to gather data needed
for their management decisions.
Peter Krempa (2):
nodeinfo: Gather total number of physical cores and fix tests
capabilities: Add total number of cores and threads to the XML
docs/formatcaps.html.in | 2 +-
docs/schemas/capability.rng | 8 +++++++
src/conf/cpu_conf.c | 4 ++++
src/conf/cpu_conf.h | 2 ++
src/libvirt_private.syms | 1 +
src/nodeinfo.c | 37 ++++++++++++++++++++++-------
src/nodeinfo.h | 2 ++
src/qemu/qemu_capabilities.c | 3 ++-
tests/nodeinfodata/linux-x86-test1.expected | 2 +-
tests/nodeinfodata/linux-x86-test2.expected | 2 +-
tests/nodeinfodata/linux-x86-test3.expected | 2 +-
tests/nodeinfodata/linux-x86-test4.expected | 2 +-
tests/nodeinfodata/linux-x86-test5.expected | 2 +-
tests/nodeinfodata/linux-x86-test6.expected | 2 +-
tests/nodeinfodata/linux-x86-test7.expected | 2 +-
tests/nodeinfodata/linux-x86-test8.expected | 2 +-
tests/nodeinfotest.c | 11 +++++----
tests/testutilsqemu.c | 2 ++
18 files changed, 66 insertions(+), 22 deletions(-)
--
1.8.1
11 years, 10 months
[libvirt] Libvirt node is not getting booted through network
by Varun Bhatnagar
Hi,
I am trying to boot my node through network with the following
configuration:
But I am getting an error message saying:
Even my network setting is not getting reflected in the Virtualbox.
Can anyone suggest me what is wrong with this configuration. I think to
boot a node from network we need to define a boot server but where shall I
add that, I am confused....
Any help will be appreciated. Thanks in advance.
Regards,
Varun
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
11 years, 10 months
[libvirt] [PATCH] .gitignore: Sort alphabetically
by Michal Privoznik
---
Pushed under trivial rule
.gitignore | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
index f71c30c..be83e28 100644
--- a/.gitignore
+++ b/.gitignore
@@ -63,8 +63,8 @@
/docs/devhelp/libvirt.devhelp
/docs/hvsupport.html.in
/docs/libvirt-api.xml
-/docs/libvirt-qemu-*.xml
/docs/libvirt-lxc-*.xml
+/docs/libvirt-qemu-*.xml
/docs/libvirt-refs.xml
/docs/search.php
/docs/todo.html.in
@@ -161,8 +161,8 @@
/tests/reconnect
/tests/secaatest
/tests/seclabeltest
-/tests/securityselinuxtest
/tests/securityselinuxlabeltest
+/tests/securityselinuxtest
/tests/sexpr2xmltest
/tests/shunloadtest
/tests/sockettest
--
1.8.0.2
11 years, 10 months
[libvirt] [PATCH 0/4 v3] New API virNodeDeviceLookupSCSIHostByWWN
by Osier Yang
For easy reviewing, this is splitted from [1].
v2 - v3:
* Validate the specified wwnn,wwpn pair before applying it
to the new API in virsh-nodedev.c
v1 - v2:
* Per Daniel's suggestion, change the API name from
virNodeDeviceLookupByWWN into
virNodeDeviceLookupSCSIHostByWWN.
Osier Yang (4):
Introduce API virNodeDeviceLookupSCSIHostByWWN
remote: Wire up the remote protocol
nodedev: Implement virNodeDeviceLookupSCSIHostByWWN
virsh: Use virNodeDeviceLookupSCSIHostByWWN
include/libvirt/libvirt.h.in | 5 ++
src/driver.h | 6 ++
src/libvirt.c | 46 ++++++++++++++++
src/libvirt_public.syms | 1 +
src/node_device/node_device_driver.c | 13 +++--
src/node_device/node_device_driver.h | 4 ++
src/node_device/node_device_hal.c | 1 +
src/node_device/node_device_udev.c | 1 +
src/remote/remote_driver.c | 1 +
src/remote/remote_protocol.x | 13 ++++-
src/remote_protocol-structs | 9 +++
src/rpc/gendispatch.pl | 5 ++-
tools/virsh-nodedev.c | 97 ++++++++++++++++++++++++++--------
tools/virsh.pod | 15 +++--
14 files changed, 181 insertions(+), 36 deletions(-)
[1] https://www.redhat.com/archives/libvir-list/2013-January/msg00328.html
Regards,
Osier
11 years, 10 months