[libvirt] [PATCH v2 0/2] Use huge pages on UMA guests widely
by Michal Privoznik
*** BLURB HERE ***
Michal Privoznik (2):
conf: Disallow nonexistent NUMA nodes for hugepages
qemu: Honor hugepages for UMA domains
src/qemu/qemu_command.c | 49 ++++++++++++++++++++--
.../qemuxml2argv-hugepages-pages4.xml | 45 ++++++++++++++++++++
.../qemuxml2argv-hugepages-pages5.args | 7 ++++
.../qemuxml2argv-hugepages-pages5.xml | 32 ++++++++++++++
tests/qemuxml2argvtest.c | 3 ++
5 files changed, 132 insertions(+), 4 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages4.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages5.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages5.xml
--
1.8.5.5
10 years, 1 month
[libvirt] [PATCH 0/4] bulk stats: QEMU implementation polishing
by Francesco Romani
This patchset does polishing on the QEMU bulk stats implementation.
The main issue this patchset addresses is that, unless a critical
error is found, bulk stats should be silent and ignore errors.
To do so, virResetLastError() is used in a few places, but this
is not enough since errors are logged anyway.
A better approach is to avoid to report error entirely.
The patchset is organized as follows:
- patches 1 to 3 enhances the functions used in the bulk stats
path(s) adding a 'bool report' flag, to let the caller optionally
suppress error reporting.
- patch 4 is a general polishing patch which reduces repetition
of the code in the block stats collection.
Francesco Romani (4):
qemu: make qemuDomainHelperGetVcpus silent
make virNetInterfaceStats silent
qemu: make qemuMonitorGetAllBlockStatsInfo silent
qemu: json monitor: reduce duplicated code
src/lxc/lxc_driver.c | 2 +-
src/openvz/openvz_driver.c | 2 +-
src/qemu/qemu_driver.c | 32 +++++-----
src/qemu/qemu_monitor.c | 12 ++--
src/qemu/qemu_monitor.h | 3 +-
src/qemu/qemu_monitor_json.c | 136 ++++++++++++++++++++-----------------------
src/qemu/qemu_monitor_json.h | 3 +-
src/util/virstats.c | 21 ++++---
src/util/virstats.h | 3 +-
src/xen/xen_hypervisor.c | 2 +-
10 files changed, 111 insertions(+), 105 deletions(-)
--
1.9.3
10 years, 1 month
[libvirt] [PATCH] qemu: raise an error when trying to use readonly sata disks
by Giuseppe Scrivano
commit 72f919f558902968bd0cf9f99f25ac62cbfe3ac6 introduced an user
friendly error message when trying to use IDE disks as readonly.
Do the same thing for the SATA bus.
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1112939
Signed-off-by: Giuseppe Scrivano <gscrivan(a)redhat.com>
---
src/qemu/qemu_command.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 86e0290..ca1b6cb 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3508,11 +3508,17 @@ qemuBuildDriveStr(virConnectPtr conn,
virBufferAddLit(&opt, ",boot=on");
if (disk->src->readonly &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_READONLY)) {
- if (disk->bus == VIR_DOMAIN_DISK_BUS_IDE &&
- disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("readonly ide disks are not supported"));
- goto error;
+ if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
+ if (disk->bus == VIR_DOMAIN_DISK_BUS_IDE) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("readonly ide disks are not supported"));
+ goto error;
+ }
+ if (disk->bus == VIR_DOMAIN_DISK_BUS_SATA) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("readonly sata disks are not supported"));
+ goto error;
+ }
}
virBufferAddLit(&opt, ",readonly=on");
}
--
1.9.3
10 years, 1 month
[libvirt] [PATCHv2] qemu: hook: Provide hook when restoring a domain save image
by Peter Krempa
---
docs/hooks.html.in | 11 ++++++++
src/qemu/qemu_driver.c | 70 +++++++++++++++++++++++++++++++++++++++++++++-----
src/util/virhook.c | 3 ++-
src/util/virhook.h | 1 +
4 files changed, 78 insertions(+), 7 deletions(-)
diff --git a/docs/hooks.html.in b/docs/hooks.html.in
index 07b9d49..1aae00c 100644
--- a/docs/hooks.html.in
+++ b/docs/hooks.html.in
@@ -177,6 +177,17 @@
script returns failure or the output XML is not valid, incoming
migration will be canceled. This hook may be used, e.g., to change
location of disk images for incoming domains.</li>
+ <li><span class="since">Since 1.2.9</span>, the qemu hook script is
+ also called when restoring a saved image either via the API or
+ automatically when restoring a managed save machine. It is called
+ as: <pre>/etc/libvirt/hooks/qemu guest_name restore begin -</pre>
+ with domain XML sent to standard input of the script. In this case,
+ the script acts as a filter and is supposed to modify the domain
+ XML and print it out on its standard output. Empty output is
+ identical to copying the input XML without changing it. In case the
+ script returns failure or the output XML is not valid, restore of the
+ image will be aborted. This hook may be used, e.g., to change
+ location of disk images for restored domains.</li>
<li><span class="since">Since 0.9.13</span>, the qemu hook script
is also called when the libvirtd daemon restarts and reconnects
to previously running QEMU processes. If the script fails, the
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ee542bf..e73d4f9 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5644,20 +5644,24 @@ qemuDomainRestoreFlags(virConnectPtr conn,
unsigned int flags)
{
virQEMUDriverPtr driver = conn->privateData;
+ qemuDomainObjPrivatePtr priv = NULL;
virDomainDefPtr def = NULL;
- virDomainDefPtr newdef = NULL;
virDomainObjPtr vm = NULL;
+ char *xml = NULL;
+ char *xmlout = NULL;
+ const char *newxml = dxml;
int fd = -1;
int ret = -1;
virQEMUSaveHeader header;
virFileWrapperFdPtr wrapperFd = NULL;
+ bool hook_taint = false;
virCheckFlags(VIR_DOMAIN_SAVE_BYPASS_CACHE |
VIR_DOMAIN_SAVE_RUNNING |
VIR_DOMAIN_SAVE_PAUSED, -1);
- fd = qemuDomainSaveImageOpen(driver, path, &def, &header, NULL,
+ fd = qemuDomainSaveImageOpen(driver, path, &def, &header, &xml,
(flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) != 0,
&wrapperFd, false, false);
if (fd < 0)
@@ -5666,12 +5670,31 @@ qemuDomainRestoreFlags(virConnectPtr conn,
if (virDomainRestoreFlagsEnsureACL(conn, def) < 0)
goto cleanup;
- if (dxml) {
- if (!(newdef = qemuDomainSaveImageUpdateDef(driver, def, dxml)))
+ if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) {
+ int hookret;
+
+ if ((hookret = virHookCall(VIR_HOOK_DRIVER_QEMU, def->name,
+ VIR_HOOK_QEMU_OP_RESTORE,
+ VIR_HOOK_SUBOP_BEGIN,
+ NULL,
+ dxml ? dxml : xml,
+ &xmlout)) < 0)
+ goto cleanup;
+
+ if (hookret == 0 && xmlout) {
+ VIR_DEBUG("Using hook-filtered domain XML: %s", xmlout);
+ hook_taint = true;
+ newxml = xmlout;
+ }
+ }
+
+ if (newxml) {
+ virDomainDefPtr tmp;
+ if (!(tmp = qemuDomainSaveImageUpdateDef(driver, def, newxml)))
goto cleanup;
virDomainDefFree(def);
- def = newdef;
+ def = tmp;
}
if (!(vm = virDomainObjListAdd(driver->domains, def,
@@ -5687,6 +5710,11 @@ qemuDomainRestoreFlags(virConnectPtr conn,
else if (flags & VIR_DOMAIN_SAVE_PAUSED)
header.was_running = 0;
+ if (hook_taint) {
+ priv = vm->privateData;
+ priv->hookRun = true;
+ }
+
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup;
@@ -5705,6 +5733,8 @@ qemuDomainRestoreFlags(virConnectPtr conn,
cleanup:
virDomainDefFree(def);
VIR_FORCE_CLOSE(fd);
+ VIR_FREE(xml);
+ VIR_FREE(xmlout);
virFileWrapperFdFree(wrapperFd);
if (vm)
virObjectUnlock(vm);
@@ -5842,12 +5872,15 @@ qemuDomainObjRestore(virConnectPtr conn,
bool bypass_cache)
{
virDomainDefPtr def = NULL;
+ qemuDomainObjPrivatePtr priv = vm->privateData;
int fd = -1;
int ret = -1;
+ char *xml = NULL;
+ char *xmlout = NULL;
virQEMUSaveHeader header;
virFileWrapperFdPtr wrapperFd = NULL;
- fd = qemuDomainSaveImageOpen(driver, path, &def, &header, NULL,
+ fd = qemuDomainSaveImageOpen(driver, path, &def, &header, &xml,
bypass_cache, &wrapperFd, false, true);
if (fd < 0) {
if (fd == -3)
@@ -5855,6 +5888,29 @@ qemuDomainObjRestore(virConnectPtr conn,
goto cleanup;
}
+ if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) {
+ int hookret;
+
+ if ((hookret = virHookCall(VIR_HOOK_DRIVER_QEMU, def->name,
+ VIR_HOOK_QEMU_OP_RESTORE,
+ VIR_HOOK_SUBOP_BEGIN,
+ NULL, xml, &xmlout)) < 0)
+ goto cleanup;
+
+ if (hookret == 0 && xmlout) {
+ virDomainDefPtr tmp;
+
+ VIR_DEBUG("Using hook-filtered domain XML: %s", xmlout);
+
+ if (!(tmp = qemuDomainSaveImageUpdateDef(driver, def, xmlout)))
+ goto cleanup;
+
+ virDomainDefFree(def);
+ def = tmp;
+ priv->hookRun = true;
+ }
+ }
+
if (STRNEQ(vm->def->name, def->name) ||
memcmp(vm->def->uuid, def->uuid, VIR_UUID_BUFLEN)) {
char vm_uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -5878,6 +5934,8 @@ qemuDomainObjRestore(virConnectPtr conn,
VIR_WARN("Failed to close %s", path);
cleanup:
+ VIR_FREE(xml);
+ VIR_FREE(xmlout);
virDomainDefFree(def);
VIR_FORCE_CLOSE(fd);
virFileWrapperFdFree(wrapperFd);
diff --git a/src/util/virhook.c b/src/util/virhook.c
index ac7b40f..25d0783 100644
--- a/src/util/virhook.c
+++ b/src/util/virhook.c
@@ -77,7 +77,8 @@ VIR_ENUM_IMPL(virHookQemuOp, VIR_HOOK_QEMU_OP_LAST,
"migrate",
"started",
"reconnect",
- "attach")
+ "attach",
+ "restore")
VIR_ENUM_IMPL(virHookLxcOp, VIR_HOOK_LXC_OP_LAST,
"start",
diff --git a/src/util/virhook.h b/src/util/virhook.h
index 5bc0a5f..550ef84 100644
--- a/src/util/virhook.h
+++ b/src/util/virhook.h
@@ -60,6 +60,7 @@ typedef enum {
VIR_HOOK_QEMU_OP_STARTED, /* domain has started */
VIR_HOOK_QEMU_OP_RECONNECT, /* domain is being reconnected by libvirt */
VIR_HOOK_QEMU_OP_ATTACH, /* domain is being attached to be libvirt */
+ VIR_HOOK_QEMU_OP_RESTORE, /* domain is being restored */
VIR_HOOK_QEMU_OP_LAST,
} virHookQemuOpType;
--
2.1.0
10 years, 1 month
[libvirt] [PATCH 0/5] Refactor save image opening and add restore hook
by Peter Krempa
This series refactors (splits) the save image open function into separate chunks
and introduces a filter-hook that is called when restoring a save image.
Peter Krempa (5):
qemu: save image: Split out user provided XML checker
qemu: save image: Add possibility to return XML stored in the image
qemu: save image: Split out new definition check/update
qemu: save image: Split out checks done only when editing the save img
qemu: hook: Provide hook when restoring a domain save image
docs/hooks.html.in | 11 +++
src/qemu/qemu_driver.c | 261 ++++++++++++++++++++++++++++++++++---------------
src/util/virhook.c | 3 +-
src/util/virhook.h | 1 +
4 files changed, 195 insertions(+), 81 deletions(-)
--
2.1.0
10 years, 1 month
[libvirt] [PATCH] rng: validating tap and vhost attributes separately
by Jianwei Hu
When using virt-xml-validate to check tap and vhost attributes
in <interface> of domain xml, should validate them separately,
don't combine to check them, we can ignore/specify any of them.
---
docs/schemas/domaincommon.rng | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 36bc184..b6b309d 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2313,12 +2313,16 @@
</optional>
<optional>
<element name="backend">
+ <optional>
<attribute name='tap'>
<ref name='absFilePath'/>
</attribute>
+ </optional>
+ <optional>
<attribute name='vhost'>
<ref name='absFilePath'/>
</attribute>
+ </optional>
</element>
</optional>
<optional>
--
1.8.3.1
10 years, 1 month
[libvirt] [PATCH] docs: vhost-net should instead of net-vhost
by Jianwei Hu
It's a minor typo issue, /dev/vhost-net is a default device.
# ll /dev/vhost-net
crw-------. 1 root root 10, 238 Sep 22 20:30 /dev/vhost-net
---
docs/formatdomain.html.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 5e2b65a..eefdd5e 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3989,7 +3989,7 @@ qemu-kvm -net nic,model=? /dev/null
<source network='default'/>
<target dev='vnet1'/>
<model type='virtio'/>
- <b><backend tap='/dev/net/tun' vhost='/dev/net-vhost'/></b>
+ <b><backend tap='/dev/net/tun' vhost='/dev/vhost-net'/></b>
<driver name='vhost' txmode='iothread' ioeventfd='on' event_idx='off' queues='5'/>
</interface>
</devices>
--
1.8.3.1
10 years, 1 month
[libvirt] [PATCH] qemu: Pass file descriptor when using TPM passthrough
by Stefan Berger
From: Stefan Berger <stefanb(a)linux.vnet.ibm.com>
Pass the TPM file descriptor to QEMU via command line.
Instead of passing /dev/tpm0 we now pass /dev/fdset/10 and the additional
parameters -add-fd set=10,fd=20.
This addresses the use case when QEMU is started with non-root privileges
and QEMU cannot open /dev/tpm0 for example.
One problem is that for the passing of the file descriptor set to work,
virCommandReorderFDs must not be called on the virCommand. This is prevented
by setting a flag in the virCommandPassFDGetFDIndex that is checked to be
clear when virCommandReorderFDs is run.
Signed-off-by: Stefan Berger <stefanb(a)linux.vnet.ibm.com>
---
src/libvirt_private.syms | 1 +
src/qemu/qemu_command.c | 132 ++++++++++++++++++++++++++++++++++++++++++++---
src/util/vircommand.c | 33 ++++++++++++
src/util/vircommand.h | 3 ++
4 files changed, 162 insertions(+), 7 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 10ebd12..b203398 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1149,6 +1149,7 @@ virCommandNewArgList;
virCommandNewArgs;
virCommandNonblockingFDs;
virCommandPassFD;
+virCommandPassFDGetFDIndex;
virCommandPassListenFDs;
virCommandRawStatus;
virCommandRequireHandshake;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7b87a31..950d212 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -157,6 +157,58 @@ VIR_ENUM_IMPL(qemuNumaPolicy, VIR_DOMAIN_NUMATUNE_MEM_LAST,
"interleave");
/**
+ * qemuVirCommandGetFDSet:
+ * @cmd: the command to modify
+ * @fd: fd to reassign to the child
+ *
+ * Get the parameters for the QEMU -add-fd command line option
+ * for the given file descriptor. The file descriptor must previously
+ * have been 'transferred' in a virCommandPassFD() call.
+ * This function for example returns "set=10,fd=20".
+ */
+static char *
+qemuVirCommandGetFDSet(virCommandPtr cmd, int fd)
+{
+ char *result = NULL;
+ int idx = virCommandPassFDGetFDIndex(cmd, fd);
+
+ if (idx >= 0) {
+ ignore_value(virAsprintf(&result, "set=%d,fd=%d", idx, fd) < 0);
+ } else {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("file descriptor %d has not been transferred"), fd);
+ }
+
+ return result;
+}
+
+/**
+ * qemuVirCommandGetDevSet:
+ * @cmd: the command to modify
+ * @fd: fd to reassign to the child
+ *
+ * Get the parameters for the QEMU path= parameter where a file
+ * descriptor is accessed via a file descriptor set, for example
+ * /dev/fdset/10. The file descriptor must previously have been
+ * 'transferred' in a virCommandPassFD() call.
+ */
+static char *
+qemuVirCommandGetDevSet(virCommandPtr cmd, int fd)
+{
+ char *result = NULL;
+ int idx = virCommandPassFDGetFDIndex(cmd, fd);
+
+ if (idx >= 0) {
+ ignore_value(virAsprintf(&result, "/dev/fdset/%d", idx) < 0);
+ } else {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("file descriptor %d has not been transferred"), fd);
+ }
+ return result;
+}
+
+
+/**
* qemuPhysIfaceConnect:
* @def: the definition of the VM (needed by 802.1Qbh and audit)
* @driver: pointer to the driver instance
@@ -5779,14 +5831,20 @@ qemuBuildRNGDeviceArgs(virCommandPtr cmd,
static char *qemuBuildTPMBackendStr(const virDomainDef *def,
+ virCommandPtr cmd,
virQEMUCapsPtr qemuCaps,
- const char *emulator)
+ const char *emulator,
+ int *tpmfd, int *cancelfd)
{
const virDomainTPMDef *tpm = def->tpm;
virBuffer buf = VIR_BUFFER_INITIALIZER;
const char *type = virDomainTPMBackendTypeToString(tpm->type);
- char *cancel_path;
+ char *cancel_path = NULL;
const char *tpmdev;
+ char *devset = NULL, *cancel_devset = NULL;
+
+ *tpmfd = -1;
+ *cancelfd = -1;
virBufferAsprintf(&buf, "%s,id=tpm-%s", type, tpm->info.alias);
@@ -5799,11 +5857,47 @@ static char *qemuBuildTPMBackendStr(const virDomainDef *def,
if (!(cancel_path = virTPMCreateCancelPath(tpmdev)))
goto error;
- virBufferAddLit(&buf, ",path=");
- virBufferEscape(&buf, ',', ",", "%s", tpmdev);
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_ADD_FD)) {
+ *tpmfd = open(tpmdev, O_RDWR);
+ if (*tpmfd < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not open TPM device %s"), tpmdev);
+ goto error;
+ }
+
+ virCommandPassFD(cmd, *tpmfd,
+ VIR_COMMAND_PASS_FD_CLOSE_PARENT);
+ devset = qemuVirCommandGetDevSet(cmd, *tpmfd);
+ if (devset == NULL)
+ goto error;
+
+ *cancelfd = open(cancel_path, O_WRONLY);
+ if (*cancelfd < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not open TPM device's cancel path "
+ "%s"), cancel_path);
+ goto error;
+ }
+
+ virCommandPassFD(cmd, *cancelfd,
+ VIR_COMMAND_PASS_FD_CLOSE_PARENT);
+ cancel_devset = qemuVirCommandGetDevSet(cmd, *cancelfd);
+ if (cancel_devset == NULL)
+ goto error;
+
+ virBufferAddLit(&buf, ",path=");
+ virBufferEscape(&buf, ',', ",", "%s", devset);
- virBufferAddLit(&buf, ",cancel-path=");
- virBufferEscape(&buf, ',', ",", "%s", cancel_path);
+ virBufferAddLit(&buf, ",cancel-path=");
+ virBufferEscape(&buf, ',', ",", "%s", cancel_devset);
+ } else {
+ /* all test cases will use this path */
+ virBufferAddLit(&buf, ",path=");
+ virBufferEscape(&buf, ',', ",", "%s", tpmdev);
+
+ virBufferAddLit(&buf, ",cancel-path=");
+ virBufferEscape(&buf, ',', ",", "%s", cancel_path);
+ }
VIR_FREE(cancel_path);
break;
@@ -5823,6 +5917,10 @@ static char *qemuBuildTPMBackendStr(const virDomainDef *def,
emulator, type);
error:
+ VIR_FREE(devset);
+ VIR_FREE(cancel_devset);
+ VIR_FREE(cancel_path);
+
virBufferFreeAndReset(&buf);
return NULL;
}
@@ -8770,13 +8868,33 @@ qemuBuildCommandLine(virConnectPtr conn,
if (def->tpm) {
char *optstr;
+ int tpmfd = -1;
+ int cancelfd = -1;
+ char *fdset;
- if (!(optstr = qemuBuildTPMBackendStr(def, qemuCaps, emulator)))
+ if (!(optstr = qemuBuildTPMBackendStr(def, cmd, qemuCaps, emulator,
+ &tpmfd, &cancelfd)))
goto error;
virCommandAddArgList(cmd, "-tpmdev", optstr, NULL);
VIR_FREE(optstr);
+ if (tpmfd >= 0) {
+ fdset = qemuVirCommandGetFDSet(cmd, tpmfd);
+ if (!fdset)
+ goto error;
+
+ virCommandAddArgList(cmd, "-add-fd", fdset, NULL);
+ }
+
+ if (cancelfd >= 0) {
+ fdset = qemuVirCommandGetFDSet(cmd, cancelfd);
+ if (!fdset)
+ goto error;
+
+ virCommandAddArgList(cmd, "-add-fd", fdset, NULL);
+ }
+
if (!(optstr = qemuBuildTPMDevStr(def, qemuCaps, emulator)))
goto error;
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index cbe94f8..fd70e78 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -67,6 +67,7 @@ enum {
VIR_EXEC_RUN_SYNC = (1 << 3),
VIR_EXEC_ASYNC_IO = (1 << 4),
VIR_EXEC_LISTEN_FDS = (1 << 5),
+ VIR_EXEC_FIXED_FDS = (1 << 6),
};
typedef struct _virCommandFD virCommandFD;
@@ -214,6 +215,12 @@ virCommandReorderFDs(virCommandPtr cmd)
if (!cmd || cmd->has_error || !cmd->npassfd)
return;
+ if ((cmd->flags & VIR_EXEC_FIXED_FDS)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("The fds are fixed and cannot be reordered"));
+ goto error;
+ }
+
for (i = 0; i < cmd->npassfd; i++)
maxfd = MAX(cmd->passfd[i].fd, maxfd);
@@ -1020,6 +1027,32 @@ virCommandPassListenFDs(virCommandPtr cmd)
cmd->flags |= VIR_EXEC_LISTEN_FDS;
}
+/*
+ * virCommandPassFDGetFDIndex:
+ * @cmd: pointer to virCommand
+ * @fd: FD to get index of
+ *
+ * Determine the index of the FD in the transfer set.
+ *
+ * Returns index >= 0 if @set contains @fd,
+ * -1 otherwise.
+ */
+int
+virCommandPassFDGetFDIndex(virCommandPtr cmd, int fd)
+{
+ size_t i = 0;
+
+ while (i < cmd->npassfd) {
+ if (cmd->passfd[i].fd == fd) {
+ cmd->flags |= VIR_EXEC_FIXED_FDS;
+ return i;
+ }
+ i++;
+ }
+
+ return -1;
+}
+
/**
* virCommandSetPidFile:
* @cmd: the command to modify
diff --git a/src/util/vircommand.h b/src/util/vircommand.h
index bf65de4..198da2f 100644
--- a/src/util/vircommand.h
+++ b/src/util/vircommand.h
@@ -62,6 +62,9 @@ void virCommandPassFD(virCommandPtr cmd,
void virCommandPassListenFDs(virCommandPtr cmd);
+int virCommandPassFDGetFDIndex(virCommandPtr cmd,
+ int fd);
+
void virCommandSetPidFile(virCommandPtr cmd,
const char *pidfile) ATTRIBUTE_NONNULL(2);
--
1.9.3
10 years, 1 month
[libvirt] [PATCH v2 0/9] qemu: Introduce support for new the block_set_io_throttle parameters add in the version 1.7 of qemu.
by Matthias Gatto
This series of patches add support for bps_max, bps_rd_max, bps_wr_max,
bps_max, bps_rd_max, bps_wr_max, and iops_size in the functions qemuDomainSetBlockIoTune and qemuDomainGetBlockIoTune.
The last patch add support for terse parameters to the virsh blkdeviotune command.
v2: spellfix
Matthias Gatto (9):
qemu: Add defines for the news throttle options
qemu: Add news throttle options to the structure
_virDomainBlockIoTuneInfo.
qemu: Add the capabilitie to detect if the qemu binary have the
capability to use bps_max and friends
qemu: Add bps_max and friends qemu driver
qemu: Add bps_max and friend to domain_conf
qemu: Add bps_max and friends QMP suport
qemu: Add bps_max and friends "text" support
qemu: add bps_max and friends to qemu command generation
virsh: Add bps_max and friends to virsh
include/libvirt/libvirt.h.in | 54 +++++++++++++++
src/conf/domain_conf.c | 89 +++++++++++++++++++++++-
src/conf/domain_conf.h | 8 +++
src/qemu/qemu_capabilities.c | 6 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 49 ++++++++++++++
src/qemu/qemu_driver.c | 158 +++++++++++++++++++++++++++++++++++++++++--
src/qemu/qemu_monitor_json.c | 58 +++++++++++++---
src/qemu/qemu_monitor_text.c | 75 ++++++++++++++++++--
tests/qemumonitorjsontest.c | 2 +-
tools/virsh-domain.c | 119 ++++++++++++++++++++++++++++++++
11 files changed, 595 insertions(+), 24 deletions(-)
--
1.8.3.1
10 years, 1 month
[libvirt] [PATCH v1 00/10] Keep original security label
by Michal Privoznik
I know I've sent several versions like ages ago, so this should
not start with v1, but hey, this is completely new approach, so
I'm gonna start from 1.
Here, the virtlockd is misused to hold the original seclabels
(although only DAC label is implemented so far). Even more, it
does a reference counting, so that only the last label restore
does the job, not the previous ones.
Michal Privoznik (10):
locking: Allow seclabel remembering
locking: Implement seclabel stubs for NOP
domain_lock: Introduce seclabel APIs
locking: Add virLockSeclabelProtocol
driver_lockd: Implement seclabel APIs
lock_daemon: Implement server dispatch
lock_daemon: Implement seclabel APIs
security_dac: Cleanup virSecurityDACSetOwnershipInternal usage
virSecurityManagerNew: Add virLockManagerPluginPtr
security_dac: Keep original label
.gitignore | 2 +
src/Makefile.am | 34 ++-
src/libvirt_private.syms | 4 +
src/lock_seclabel_protocol-structs | 21 ++
src/locking/domain_lock.c | 65 ++++++
src/locking/domain_lock.h | 10 +
src/locking/lock_daemon.c | 388 ++++++++++++++++++++++++++++++++++-
src/locking/lock_daemon.h | 8 +
src/locking/lock_daemon_dispatch.c | 77 +++++++
src/locking/lock_daemon_dispatch.h | 3 +
src/locking/lock_driver.h | 43 ++++
src/locking/lock_driver_lockd.c | 118 ++++++++++-
src/locking/lock_driver_nop.c | 22 ++
src/locking/lock_manager.c | 26 +++
src/locking/lock_manager.h | 9 +
src/locking/lock_seclabel_protocol.x | 53 +++++
src/lxc/lxc_controller.c | 2 +-
src/lxc/lxc_driver.c | 3 +-
src/qemu/qemu_driver.c | 7 +-
src/security/security_dac.c | 145 ++++++++++---
src/security/security_manager.c | 25 ++-
src/security/security_manager.h | 6 +-
tests/Makefile.am | 1 +
tests/qemuhotplugtest.c | 2 +-
tests/seclabeltest.c | 2 +-
tests/securityselinuxlabeltest.c | 2 +-
tests/securityselinuxtest.c | 2 +-
27 files changed, 1028 insertions(+), 52 deletions(-)
create mode 100644 src/lock_seclabel_protocol-structs
create mode 100644 src/locking/lock_seclabel_protocol.x
--
1.8.5.5
10 years, 1 month