[libvirt] [PATCH V2 0/2] enhance capabilities mode hostdev process
by Jincheng Miao
hostdev has mode "capabilities" for LXC, from formatdomain.html:
"
Block / character devices from the host can be passed through to
the guest using the hostdev element.
This is only possible with container based virtualization.
since after 1.0.1 for LXC
"
So forbid capabilities mode hostdev if domain is not LXC.
Althrough this patch only constrains qemu currently, the more
non-container based hypervisor should also apply this rule.
V2: move the hyervisor type checking to qemuBuildCommandLine().
Jincheng Miao (2):
qemu: forbid define a capabilities mode hostdev
docs: fix some typos in formatdomain.html
docs/formatdomain.html.in | 4 ++--
src/qemu/qemu_command.c | 8 ++++++++
2 files changed, 10 insertions(+), 2 deletions(-)
--
1.8.3.1
10 years, 5 months
[libvirt] [PATCH v2] virsh: fix broken code in freepages
by Eric Blake
Commit 9e3efe53 broke the build under valgrind or clang, by writing
8 bytes through an allocation of 4 bytes. It also risks multiplication
overflow when mallocing (that's a pervasive problem that needs an
audit in the rest of the code, but we might as well fix this one while
we are here), and had a typo.
* tools/virsh-host.c (cmdFreepages): Avoid integer overflow and
undefined behavior.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under the build-breaker rule. v1 was:
https://www.redhat.com/archives/libvir-list/2014-June/msg00937.html
tools/virsh-host.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 2d6cb00..13d4c5c 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -1,7 +1,7 @@
/*
* virsh-host.c: Commands in "Host and Hypervisor" group.
*
- * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
+ * Copyright (C) 2005, 2007-2014 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -214,7 +214,7 @@ static const vshCmdOptDef opts_freepages[] = {
},
{.name = "pagesize",
.type = VSH_OT_INT,
- .help = N_("page size (in kibibites)")
+ .help = N_("page size (in kibibytes)")
},
{.name = "all",
.type = VSH_OT_BOOL,
@@ -229,6 +229,7 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd)
bool ret = false;
unsigned int npages;
unsigned int *pagesize = NULL;
+ unsigned long long tmp;
int cell;
unsigned long long *counts = NULL;
size_t i, j;
@@ -261,7 +262,7 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
- pagesize = vshMalloc(ctl, nodes_cnt * sizeof(*pagesize));
+ pagesize = vshCalloc(ctl, nodes_cnt, sizeof(*pagesize));
for (i = 0; i < nodes_cnt; i++) {
char *val = virXMLPropString(nodes[i], "size");
@@ -278,7 +279,7 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd)
npages = nodes_cnt;
VIR_FREE(nodes);
- counts = vshMalloc(ctl, npages * sizeof(*counts));
+ counts = vshCalloc(ctl, npages, sizeof(*counts));
nodes_cnt = virXPathNodeSet("/capabilities/host/topology/cells/cell",
ctxt, &nodes);
@@ -319,15 +320,13 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
- pagesize = vshMalloc(ctl, sizeof(*pagesize));
- if (vshCommandOptScaledInt(cmd, "pagesize", (unsigned long long *) pagesize,
- 1, UINT_MAX) < 0) {
+ if (vshCommandOptScaledInt(cmd, "pagesize", &tmp, 1, UINT_MAX) < 0) {
vshError(ctl, "%s", _("page size has to be a number"));
goto cleanup;
}
-
/* page size is expected in kibibytes */
- pagesize[0] /= 1024;
+ pagesize = vshMalloc(ctl, sizeof(*pagesize));
+ *pagesize = tmp / 1024;
if (!pagesize[0]) {
vshError(ctl, "%s", _("page size must be at least 1KiB"));
--
1.9.3
10 years, 5 months
[libvirt] [PATCH v2 0/7] Expose host's huge pages capability
by Michal Privoznik
diff to v1:
- Expose all page size not only huge ones
Michal Privoznik (7):
virnuma: Introduce virNumaNodeIsAvailable
nodeinfo: Rename nodeGetFreeMemory to nodeGetMemory
virnuma: Introduce pages helpers
virCaps: expose pages info
Introduce virNodeGetFreePages
virsh: Expose virNodeGetFreePages
nodeinfo: Implement nodeGetFreePages
daemon/remote.c | 52 +++++++
docs/schemas/capability.rng | 21 +++
include/libvirt/libvirt.h.in | 7 +
src/bhyve/bhyve_driver.c | 7 +-
src/conf/capabilities.c | 25 ++-
src/conf/capabilities.h | 15 +-
src/driver.h | 10 ++
src/internal.h | 12 ++
src/libvirt.c | 95 ++++++++++++
src/libvirt_private.syms | 6 +-
src/libvirt_public.syms | 4 +
src/libxl/libxl_conf.c | 1 +
src/lxc/lxc_driver.c | 26 +++-
src/nodeinfo.c | 170 ++++++++++++++++----
src/nodeinfo.h | 8 +-
src/openvz/openvz_driver.c | 5 +-
src/qemu/qemu_capabilities.c | 29 +++-
src/qemu/qemu_driver.c | 26 +++-
src/remote/remote_driver.c | 50 ++++++
src/remote/remote_protocol.x | 20 ++-
src/remote_protocol-structs | 16 ++
src/test/test_driver.c | 2 +-
src/uml/uml_driver.c | 26 +++-
src/util/virnuma.c | 361 ++++++++++++++++++++++++++++++++++++++++++-
src/util/virnuma.h | 11 ++
src/vbox/vbox_tmpl.c | 21 ++-
src/xen/xend_internal.c | 1 +
tests/vircaps2xmltest.c | 3 +-
tests/vircapstest.c | 1 +
tools/virsh-host.c | 167 ++++++++++++++++++++
tools/virsh.pod | 8 +
31 files changed, 1161 insertions(+), 45 deletions(-)
--
1.8.5.5
10 years, 5 months
[libvirt] [PATCH] Fix cast error in virsh-host.c
by Roman Bogorodskiy
Build with clang fails on virsh-host.c:
virsh-host.c:323:53: error: cast from 'unsigned int *' to 'unsigned long long *' increases required alignment from 4 to 8 [-Werror,-Wcast-align]
if (vshCommandOptScaledInt(cmd, "pagesize", (unsigned long long *) pagesize,
Fix that by casting pagesize to void* first.
---
tools/virsh-host.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 2d6cb00..05e3fea 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -320,7 +320,7 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd)
}
pagesize = vshMalloc(ctl, sizeof(*pagesize));
- if (vshCommandOptScaledInt(cmd, "pagesize", (unsigned long long *) pagesize,
+ if (vshCommandOptScaledInt(cmd, "pagesize", (unsigned long long *)(void *) pagesize,
1, UINT_MAX) < 0) {
vshError(ctl, "%s", _("page size has to be a number"));
goto cleanup;
--
1.9.0
10 years, 5 months
[libvirt] [PATCH 0/2] enhance capabilities mode hostdev process
by Jincheng Miao
hostdev has mode "capabilities" for LXC, from formatdomain.html:
"
Block / character devices from the host can be passed through to
the guest using the hostdev element.
This is only possible with container based virtualization.
since after 1.0.1 for LXC
"
So forbid capabilities mode hostdev if domain is not LXC.
The related bug is:
https://bugzilla.redhat.com/show_bug.cgi?id=1111044
Jincheng Miao (2):
conf: only accept capabilities mode hostdev in LXC.
docs: fix some typos in formatdomain.html
docs/formatdomain.html.in | 4 ++--
src/conf/domain_conf.c | 10 ++++++++--
2 files changed, 10 insertions(+), 4 deletions(-)
--
1.8.3.1
10 years, 5 months
[libvirt] [PATCH python] Correct virDomainMigrateToURI3 definition
by Jason Andryuk
dconnuri is a string, so update the definition to match. Without this,
the generated python would fail when passed a string.
---
libvirt-override-api.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml
index d5b25b5..935e04d 100644
--- a/libvirt-override-api.xml
+++ b/libvirt-override-api.xml
@@ -562,7 +562,7 @@
<info>Migrate the domain object from its current host to the destination host
given by URI.</info>
<arg name='domain' type='virDomainPtr' info='a domain object'/>
- <arg name='dconnuri' type='virConnectPtr' info='URI for target libvirtd if @flags includes VIR_MIGRATE_PEER2PEER'/>
+ <arg name='dconnuri' type='char *' info='URI for target libvirtd if @flags includes VIR_MIGRATE_PEER2PEER'/>
<arg name='params' type='char *' info='dictionary with migration parameters'/>
<arg name='flags' type='unsigned int' info='an OR'ed set of virDomainMigrateFlags'/>
<return type='int' info='0 in case of success, -1 in case of failure.'/>
--
1.8.3.1
10 years, 5 months
[libvirt] [python PATCH] build: provide wrapper makefile
by Eric Blake
After years of finger training, I'm so used to 'make check' just
working, that I lose quite a bit of time re-learning that in this
project, it is spelled 'python setup.py build check'. A shim
makefile bridges the gap.
* Makefile: New file.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
I'd like to add this to the repo, but even if it gets rejected,
I'll still keep it in my local tree :)
Makefile | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
create mode 100644 Makefile
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6c8da0a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,18 @@
+# Shim wrapper around setup.py to allow for familiar build targets
+
+PYTHON ?= python
+
+all:
+ $(PYTHON) setup.py build
+
+install: all
+ $(PYTHON) setup.py install
+
+clean:
+ $(PYTHON) setup.py clean
+
+check: all
+ $(PYTHON) setup.py test
+
+rpm:
+ $(PYTHON) setup.py rpm
--
1.9.3
10 years, 5 months
[libvirt] [PATCH v3] blockjob: use stable disk string in job event
by Eric Blake
When the block job event was first added, it was for block pull,
where the active layer of the disk remains the same name. It was
also in a day where we only cared about local files, and so we
always had a canonical absolute file name. But two things have
changed since then: we now have network disks, where determining
a single absolute string does not really make sense; and we have
two-phase jobs (copy and active commit) where the name of the
active layer changes between the first event (ready, on the old
name) and second (complete, on the pivoted name).
Adam Litke reported that having an unstable string between events
makes life harder for clients. Furthermore, all of our API that
operate on a particular disk of a domain accept multiple strings:
not only the absolute name of the active layer, but also the
destination device name (such as 'vda'). As this latter name is
stable, even for network sources, it serves as a better string
to supply in block job events.
But backwards-compatibility demands that we should not change the
name handed to users unless they explicitly request it. Therefore,
this patch adds a new event, BLOCK_JOB_2 (alas, I couldn't think of
any nicer name - but at least Migrate2 and Migrate3 are precedent
for a number suffix). We must double up on emitting both old-style
and new-style events according to what clients have registered for
(see also how IOError and IOErrorReason emits double events, but
there the difference was a larger struct rather than changed
meaning of one of the struct members).
Unfortunately, adding a new event isn't something that can easily
be broken into pieces, so the commit is rather large.
* include/libvirt/libvirt.h.in (virDomainEventID): Add a new id
for VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2.
(virConnectDomainEventBlockJobCallback): Document new semantics.
* src/conf/domain_event.c (_virDomainEventBlockJob): Rename field,
to ensure we catch all clients.
(virDomainEventBlockJobNew): Add parameter.
(virDomainEventBlockJobDispose)
(virDomainEventBlockJobNewFromObj)
(virDomainEventBlockJobNewFromDom)
(virDomainEventDispatchDefaultFunc): Adjust clients.
(virDomainEventBlockJob2NewFromObj)
(virDomainEventBlockJob2NewFromDom): New functions.
* src/conf/domain_event.h: Add new prototypes.
* src/libvirt_private.syms (domain_event.h): Export new functions.
* src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Generate two
different events.
* src/qemu/qemu_process.c (qemuProcessHandleBlockJob): Likewise.
* src/remote/remote_protocol.x
(remote_domain_event_block_job_2_msg): New struct.
(REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_2): New RPC.
* src/remote/remote_driver.c
(remoteDomainBuildEventBlockJob2): New handler.
(remoteEvents): Register new event.
* daemon/remote.c (remoteRelayDomainEventBlockJob2): New handler.
(domainEventCallbacks): Register new event.
* tools/virsh-domain.c (vshEventCallbacks): Likewise.
(vshEventBlockJobPrint): Adjust client.
* src/remote_protocol-structs: Regenerate.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
v3: don't do s/path/disk/ on code that is not shared; s/disk/dst/ on
new code that is not shared; touch up libvirt.c docs, actually test
with python bindings
daemon/remote.c | 39 +++++++++++++++++++++++++++++++++++++++
include/libvirt/libvirt.h.in | 19 ++++++++++++++++---
src/conf/domain_event.c | 44 +++++++++++++++++++++++++++++++++++---------
src/conf/domain_event.h | 11 +++++++++++
src/libvirt_private.syms | 2 ++
src/qemu/qemu_driver.c | 8 +++++++-
src/qemu/qemu_process.c | 7 +++++++
src/remote/remote_driver.c | 31 +++++++++++++++++++++++++++++++
src/remote/remote_protocol.x | 16 +++++++++++++++-
src/remote_protocol-structs | 8 ++++++++
tools/virsh-domain.c | 7 +++++--
11 files changed, 176 insertions(+), 16 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 34c96c9..7199764 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -931,6 +931,44 @@ remoteRelayDomainEventDeviceRemoved(virConnectPtr conn,
}
+static int
+remoteRelayDomainEventBlockJob2(virConnectPtr conn,
+ virDomainPtr dom,
+ const char *dst,
+ int type,
+ int status,
+ void *opaque)
+{
+ daemonClientEventCallbackPtr callback = opaque;
+ remote_domain_event_block_job_2_msg data;
+
+ if (callback->callbackID < 0 ||
+ !remoteRelayDomainEventCheckACL(callback->client, conn, dom))
+ return -1;
+
+ VIR_DEBUG("Relaying domain block job 2 event %s %d %s %i, %i, callback %d",
+ dom->name, dom->id, dst, type, status, callback->callbackID);
+
+ /* build return data */
+ memset(&data, 0, sizeof(data));
+ data.callbackID = callback->callbackID;
+ if (VIR_STRDUP(data.dst, dst) < 0)
+ goto error;
+ data.type = type;
+ data.status = status;
+ make_nonnull_domain(&data.dom, dom);
+
+ remoteDispatchObjectEventSend(callback->client, remoteProgram,
+ REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_2,
+ (xdrproc_t)xdr_remote_domain_event_block_job_2_msg, &data);
+
+ return 0;
+ error:
+ VIR_FREE(data.dst);
+ return -1;
+}
+
+
static virConnectDomainEventGenericCallback domainEventCallbacks[] = {
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventLifecycle),
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventReboot),
@@ -948,6 +986,7 @@ static virConnectDomainEventGenericCallback domainEventCallbacks[] = {
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventBalloonChange),
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventPMSuspendDisk),
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventDeviceRemoved),
+ VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventBlockJob2),
};
verify(ARRAY_CARDINALITY(domainEventCallbacks) == VIR_DOMAIN_EVENT_ID_LAST);
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index dc88c40..eb62860 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -4852,13 +4852,25 @@ typedef enum {
* virConnectDomainEventBlockJobCallback:
* @conn: connection object
* @dom: domain on which the event occurred
- * @disk: fully-qualified filename of the affected disk
+ * @disk: name associated with the affected disk (filename or target
+ * device, depending on how the callback was registered)
* @type: type of block job (virDomainBlockJobType)
* @status: status of the operation (virConnectDomainEventBlockJobStatus)
* @opaque: application specified data
*
- * The callback signature to use when registering for an event of type
- * VIR_DOMAIN_EVENT_ID_BLOCK_JOB with virConnectDomainEventRegisterAny()
+ * The string returned for @disk can be used in any of the libvirt API
+ * that operate on a particular disk of the domain, and depends on what
+ * event type was registered with virConnectDomainEventRegisterAny().
+ * If the callback was registered using the older type of
+ * VIR_DOMAIN_EVENT_ID_BLOCK_JOB, then @disk contains the absolute file
+ * name of the host resource for the active layer of the disk; however,
+ * this name is unstable (pivoting via block copy or active block commit
+ * will change which file is active, giving a different name for the two
+ * events associated with the same job) and cannot be relied on if the
+ * active layer is associated with a network resource. If the callback
+ * was registered using the newer type of VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2,
+ * then @disk will contain the device target shorthand (the <target
+ * dev='...'/> sub-element, such as "vda").
*/
typedef void (*virConnectDomainEventBlockJobCallback)(virConnectPtr conn,
virDomainPtr dom,
@@ -5062,6 +5074,7 @@ typedef enum {
VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE = 13, /* virConnectDomainEventBalloonChangeCallback */
VIR_DOMAIN_EVENT_ID_PMSUSPEND_DISK = 14, /* virConnectDomainEventPMSuspendDiskCallback */
VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED = 15, /* virConnectDomainEventDeviceRemovedCallback */
+ VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2 = 16, /* virConnectDomainEventBlockJobCallback */
#ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_EVENT_ID_LAST
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index b565732..73ae289 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -128,7 +128,7 @@ typedef virDomainEventIOError *virDomainEventIOErrorPtr;
struct _virDomainEventBlockJob {
virDomainEvent parent;
- char *path;
+ char *disk; /* path or dst, depending on event id */
int type;
int status;
};
@@ -364,7 +364,7 @@ virDomainEventBlockJobDispose(void *obj)
virDomainEventBlockJobPtr event = obj;
VIR_DEBUG("obj=%p", event);
- VIR_FREE(event->path);
+ VIR_FREE(event->disk);
}
static void
@@ -775,10 +775,11 @@ virDomainEventGraphicsNewFromObj(virDomainObjPtr obj,
}
static virObjectEventPtr
-virDomainEventBlockJobNew(int id,
+virDomainEventBlockJobNew(int event,
+ int id,
const char *name,
unsigned char *uuid,
- const char *path,
+ const char *disk,
int type,
int status)
{
@@ -788,11 +789,11 @@ virDomainEventBlockJobNew(int id,
return NULL;
if (!(ev = virDomainEventNew(virDomainEventBlockJobClass,
- VIR_DOMAIN_EVENT_ID_BLOCK_JOB,
+ event,
id, name, uuid)))
return NULL;
- if (VIR_STRDUP(ev->path, path) < 0) {
+ if (VIR_STRDUP(ev->disk, disk) < 0) {
virObjectUnref(ev);
return NULL;
}
@@ -808,7 +809,8 @@ virDomainEventBlockJobNewFromObj(virDomainObjPtr obj,
int type,
int status)
{
- return virDomainEventBlockJobNew(obj->def->id, obj->def->name,
+ return virDomainEventBlockJobNew(VIR_DOMAIN_EVENT_ID_BLOCK_JOB,
+ obj->def->id, obj->def->name,
obj->def->uuid, path, type, status);
}
@@ -818,11 +820,34 @@ virDomainEventBlockJobNewFromDom(virDomainPtr dom,
int type,
int status)
{
- return virDomainEventBlockJobNew(dom->id, dom->name, dom->uuid,
+ return virDomainEventBlockJobNew(VIR_DOMAIN_EVENT_ID_BLOCK_JOB,
+ dom->id, dom->name, dom->uuid,
path, type, status);
}
virObjectEventPtr
+virDomainEventBlockJob2NewFromObj(virDomainObjPtr obj,
+ const char *dst,
+ int type,
+ int status)
+{
+ return virDomainEventBlockJobNew(VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2,
+ obj->def->id, obj->def->name,
+ obj->def->uuid, dst, type, status);
+}
+
+virObjectEventPtr
+virDomainEventBlockJob2NewFromDom(virDomainPtr dom,
+ const char *dst,
+ int type,
+ int status)
+{
+ return virDomainEventBlockJobNew(VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2,
+ dom->id, dom->name, dom->uuid,
+ dst, type, status);
+}
+
+virObjectEventPtr
virDomainEventControlErrorNewFromDom(virDomainPtr dom)
{
virObjectEventPtr ev;
@@ -1250,12 +1275,13 @@ virDomainEventDispatchDefaultFunc(virConnectPtr conn,
goto cleanup;
case VIR_DOMAIN_EVENT_ID_BLOCK_JOB:
+ case VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2:
{
virDomainEventBlockJobPtr blockJobEvent;
blockJobEvent = (virDomainEventBlockJobPtr)event;
((virConnectDomainEventBlockJobCallback)cb)(conn, dom,
- blockJobEvent->path,
+ blockJobEvent->disk,
blockJobEvent->type,
blockJobEvent->status,
cbopaque);
diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h
index 9c41090..a3330ca 100644
--- a/src/conf/domain_event.h
+++ b/src/conf/domain_event.h
@@ -127,6 +127,17 @@ virDomainEventBlockJobNewFromDom(virDomainPtr dom,
int status);
virObjectEventPtr
+virDomainEventBlockJob2NewFromObj(virDomainObjPtr obj,
+ const char *dst,
+ int type,
+ int status);
+virObjectEventPtr
+virDomainEventBlockJob2NewFromDom(virDomainPtr dom,
+ const char *dst,
+ int type,
+ int status);
+
+virObjectEventPtr
virDomainEventDiskChangeNewFromObj(virDomainObjPtr obj,
const char *oldSrcPath,
const char *newSrcPath,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 29a9ed1..9e25b8a 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -439,6 +439,8 @@ virDomainXMLOptionNew;
# conf/domain_event.h
virDomainEventBalloonChangeNewFromDom;
virDomainEventBalloonChangeNewFromObj;
+virDomainEventBlockJob2NewFromDom;
+virDomainEventBlockJob2NewFromObj;
virDomainEventBlockJobNewFromDom;
virDomainEventBlockJobNewFromObj;
virDomainEventControlErrorNewFromDom;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4ab5a7b..ca58d6b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15027,6 +15027,7 @@ qemuDomainBlockJobImpl(virDomainObjPtr vm,
int ret = -1;
bool async = false;
virObjectEventPtr event = NULL;
+ virObjectEventPtr event2 = NULL;
int idx;
virDomainDiskDefPtr disk;
virStorageSourcePtr baseSource = NULL;
@@ -15130,11 +15131,14 @@ qemuDomainBlockJobImpl(virDomainObjPtr vm,
if (mode == BLOCK_JOB_ABORT) {
if (!async) {
/* Older qemu that lacked async reporting also lacked
- * active commit, so we can hardcode the event to pull */
+ * active commit, so we can hardcode the event to pull.
+ * We have to generate two variants of the event. */
int type = VIR_DOMAIN_BLOCK_JOB_TYPE_PULL;
int status = VIR_DOMAIN_BLOCK_JOB_CANCELED;
event = virDomainEventBlockJobNewFromObj(vm, disk->src->path, type,
status);
+ event2 = virDomainEventBlockJob2NewFromObj(vm, disk->dst, type,
+ status);
} else if (!(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC)) {
while (1) {
/* Poll every 50ms */
@@ -15178,6 +15182,8 @@ qemuDomainBlockJobImpl(virDomainObjPtr vm,
virObjectUnlock(vm);
if (event)
qemuDomainEventQueue(driver, event);
+ if (event2)
+ qemuDomainEventQueue(driver, event2);
return ret;
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e4845ba..f1c0041 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1013,6 +1013,7 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
{
virQEMUDriverPtr driver = opaque;
virObjectEventPtr event = NULL;
+ virObjectEventPtr event2 = NULL;
const char *path;
virDomainDiskDefPtr disk;
@@ -1020,8 +1021,12 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
disk = qemuProcessFindDomainDiskByAlias(vm, diskAlias);
if (disk) {
+ /* Have to generate two variants of the event for old vs. new
+ * client callbacks */
path = virDomainDiskGetSource(disk);
event = virDomainEventBlockJobNewFromObj(vm, path, type, status);
+ event2 = virDomainEventBlockJob2NewFromObj(vm, disk->dst, type,
+ status);
/* XXX If we completed a block pull or commit, then recompute
* the cached backing chain to match. Better would be storing
* the chain ourselves rather than reprobing, but this
@@ -1048,6 +1053,8 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
if (event)
qemuDomainEventQueue(driver, event);
+ if (event2)
+ qemuDomainEventQueue(driver, event2);
return 0;
}
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 85fe597..de75702 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -321,6 +321,11 @@ remoteDomainBuildEventCallbackDeviceRemoved(virNetClientProgramPtr prog,
void *evdata, void *opaque);
static void
+remoteDomainBuildEventBlockJob2(virNetClientProgramPtr prog,
+ virNetClientPtr client,
+ void *evdata, void *opaque);
+
+static void
remoteNetworkBuildEventLifecycle(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
virNetClientPtr client ATTRIBUTE_UNUSED,
void *evdata, void *opaque);
@@ -467,6 +472,10 @@ static virNetClientProgramEvent remoteEvents[] = {
remoteDomainBuildEventCallbackDeviceRemoved,
sizeof(remote_domain_event_callback_device_removed_msg),
(xdrproc_t)xdr_remote_domain_event_callback_device_removed_msg },
+ { REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_2,
+ remoteDomainBuildEventBlockJob2,
+ sizeof(remote_domain_event_block_job_2_msg),
+ (xdrproc_t)xdr_remote_domain_event_block_job_2_msg },
};
@@ -5048,6 +5057,28 @@ remoteDomainBuildEventCallbackBlockJob(virNetClientProgramPtr prog ATTRIBUTE_UNU
remote_domain_event_callback_block_job_msg *msg = evdata;
remoteDomainBuildEventBlockJobHelper(conn, &msg->msg, msg->callbackID);
}
+static void
+remoteDomainBuildEventBlockJob2(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
+ virNetClientPtr client ATTRIBUTE_UNUSED,
+ void *evdata, void *opaque)
+{
+ virConnectPtr conn = opaque;
+ remote_domain_event_block_job_2_msg *msg = evdata;
+ struct private_data *priv = conn->privateData;
+ virDomainPtr dom;
+ virObjectEventPtr event = NULL;
+
+ dom = get_nonnull_domain(conn, msg->dom);
+ if (!dom)
+ return;
+
+ event = virDomainEventBlockJob2NewFromDom(dom, msg->dst, msg->type,
+ msg->status);
+
+ virDomainFree(dom);
+
+ remoteEventQueue(priv, event, msg->callbackID);
+}
static void
remoteDomainBuildEventGraphicsHelper(virConnectPtr conn,
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index ab9b83d..ce28607 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -2948,6 +2948,14 @@ struct remote_domain_event_callback_device_removed_msg {
remote_domain_event_device_removed_msg msg;
};
+struct remote_domain_event_block_job_2_msg {
+ int callbackID;
+ remote_nonnull_domain dom;
+ remote_nonnull_string dst;
+ int type;
+ int status;
+};
+
struct remote_connect_get_cpu_model_names_args {
remote_nonnull_string arch;
int need_results;
@@ -5338,5 +5346,11 @@ enum remote_procedure {
* @generate: both
* @acl: domain:set_time
*/
- REMOTE_PROC_DOMAIN_SET_TIME = 338
+ REMOTE_PROC_DOMAIN_SET_TIME = 338,
+
+ /**
+ * @generate: none
+ * @acl: none
+ */
+ REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_2 = 339
};
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index 5b22049..0854021 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -2413,6 +2413,13 @@ struct remote_domain_event_callback_device_removed_msg {
int callbackID;
remote_domain_event_device_removed_msg msg;
};
+struct remote_domain_event_block_job_2_msg {
+ int callbackID;
+ remote_nonnull_domain dom;
+ remote_nonnull_string dst;
+ int type;
+ int status;
+};
struct remote_connect_get_cpu_model_names_args {
remote_nonnull_string arch;
int need_results;
@@ -2802,4 +2809,5 @@ enum remote_procedure {
REMOTE_PROC_DOMAIN_FSTHAW = 336,
REMOTE_PROC_DOMAIN_GET_TIME = 337,
REMOTE_PROC_DOMAIN_SET_TIME = 338,
+ REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_2 = 339,
};
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 6b3dd70..d136862 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -10921,8 +10921,9 @@ vshEventBlockJobPrint(virConnectPtr conn ATTRIBUTE_UNUSED,
if (!data->loop && *data->count)
return;
- vshPrint(data->ctl, _("event 'block-job' for domain %s: %s for %s %s\n"),
- virDomainGetName(dom), vshDomainBlockJobToString(type),
+ vshPrint(data->ctl, _("event '%s' for domain %s: %s for %s %s\n"),
+ data->cb->name, virDomainGetName(dom),
+ vshDomainBlockJobToString(type),
disk, vshDomainBlockJobStatusToString(status));
(*data->count)++;
if (!data->loop)
@@ -11049,6 +11050,8 @@ static vshEventCallback vshEventCallbacks[] = {
VIR_DOMAIN_EVENT_CALLBACK(vshEventPMChangePrint), },
{ "device-removed",
VIR_DOMAIN_EVENT_CALLBACK(vshEventDeviceRemovedPrint), },
+ { "block-job-2",
+ VIR_DOMAIN_EVENT_CALLBACK(vshEventBlockJobPrint), },
};
verify(VIR_DOMAIN_EVENT_ID_LAST == ARRAY_CARDINALITY(vshEventCallbacks));
--
1.9.3
10 years, 5 months
[libvirt] [PATCH] Fix xmconfigtest
by Jim Fehlig
Commit ac63014c introduced a regression in the conversion of Xen
xm config to XML by emitting an empty <cmdline>. Prior to this
commit, <cmdline> was omitted if the xm config was missing (or
contained an empty) 'extra='.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
Pushing under the build breaker rule.
src/xenxs/xen_xm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 745041b..2cd6d4c 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -350,7 +350,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
goto cleanup;
if (xenXMConfigCopyStringOpt(conf, "ramdisk", &def->os.initrd) < 0)
goto cleanup;
- if (xenXMConfigGetString(conf, "extra", &extra, "") < 0)
+ if (xenXMConfigGetString(conf, "extra", &extra, NULL) < 0)
goto cleanup;
if (xenXMConfigGetString(conf, "root", &root, NULL) < 0)
goto cleanup;
--
1.8.4.5
10 years, 5 months
Re: [libvirt] [php PATCH] Fix compiler warnings after int to long conversion
by Michal Novotny
Hi Dawid,
thanks for the information. Well, please rebase to the latest commit of my
master branch and resend, thanks a lot!
Michal
2014-06-18 22:05 GMT+02:00 Dawid Zamirski <dzamirski(a)dattobackup.com>:
> Ugh, now I know what happened - my local master branch has commits I
> have not sent pull requests for yet so it wasn't in 100% in sync with
> remote. Do you want me to resend the patch to the ML?
>
> On Wed, 2014-06-18 at 16:02 -0400, Dawid Zamirski wrote:
> > Hi Michal,
> >
> > I'm pretty sure I did git pull right before sending the patch. Here's
> > what I did exactly:
> >
> > On master branch:
> >
> > git pull
> > git checkout -b parse-param-fix origin/master
> > created original patch & commit
> > git format-patch -1
> > git send-email --no-chain-reply-to --annotate
> 0001-Use-long-variable-type-for-zend_parse_parameters.patch
> >
> > then I've noticed the warnings (still on parse-param-fix branch)
> > create patch & commit
> > git fetch --all
> > git pull --rebase
> > git send-email --no-chain-reply-to --annotate origin/master
> >
> > I guess that before starting the waring fix patch I should have create a
> > new local branch:
> > git checkout master
> > git pull
> > git checkout -b warning-fix origin/master
> >
> > and then work from there.
> >
> > Regards,
> > Dawid
> >
> >
> > On Wed, 2014-06-18 at 21:28 +0200, Michal Novotny wrote:
> > > Hi Dawid,
> > >
> > >
> > > thanks for the patch, I'll apply it when I have time to do so.
> > > However, the patch is not critical as it's in the DPRINTF debug macro
> > > (for production environment you should disable the DEBUG macro).
> > >
> > >
> > > Also, please make sure you are you the latest git tree (by running git
> > > pull before writing the patch) as I'm having issues applying some of
> > > the patches cleanly.
> > >
> > >
> > > Thanks,
> > > Michal
> > >
> > >
> > > 2014-06-18 21:09 GMT+02:00 Dawid Zamirski <dzamirski(a)dattobackup.com>:
> > > The previous patch [1] caused compiler warnings after variable
> > > types
> > > were changed from int to long and this patch fixes this.
> > >
> > > [1]
> > >
> https://www.redhat.com/archives/libvir-list/2014-June/msg00835.html
> > > ---
> > > src/libvirt-php.c | 8 ++++----
> > > 1 file changed, 4 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/src/libvirt-php.c b/src/libvirt-php.c
> > > index 224943d..6d6fa81 100644
> > > --- a/src/libvirt-php.c
> > > +++ b/src/libvirt-php.c
> > > @@ -3928,7 +3928,7 @@
> > > PHP_FUNCTION(libvirt_domain_send_pointer_event)
> > > RETURN_FALSE;
> > > }
> > >
> > > - DPRINTF("%s: x = %d, y = %d, clicked = %d, release = %
> > > d, hostname = %s...\n", PHPFUNC, pos_x, pos_y, clicked,
> > > release, hostname);
> > > + DPRINTF("%s: x = %d, y = %d, clicked = %d, release = %
> > > d, hostname = %s...\n", PHPFUNC, (int) pos_x, (int) pos_y,
> > > (int) clicked, release, hostname);
> > > ret = vnc_send_pointer_event(hostname, tmp, pos_x,
> > > pos_y, clicked, release);
> > > if (ret == 0) {
> > > DPRINTF("%s: Pointer event result is %d\n",
> > > PHPFUNC, ret);
> > > @@ -4428,7 +4428,7 @@ PHP_FUNCTION(libvirt_domain_new)
> > > numNets = i;
> > >
> > > snprintf(tmpname, sizeof(tmpname), "%s-install",
> > > name);
> > > - DPRINTF("%s: Name is '%s', memMB is %d, maxmemMB is %d
> > > \n", PHPFUNC, tmpname, memMB, maxmemMB);
> > > + DPRINTF("%s: Name is '%s', memMB is %d, maxmemMB is %d
> > > \n", PHPFUNC, tmpname, (int) memMB, (int) maxmemMB);
> > > tmp = installation_get_xml(1,
> > > conn->conn, tmpname, memMB, maxmemMB,
> > > NULL /* arch */, NULL, vcpus, iso_image,
> > > vmDisks, numDisks, vmNetworks,
> > > numNets,
> > > @@ -6272,7 +6272,7 @@
> > > PHP_FUNCTION(libvirt_domain_snapshot_delete)
> > > GET_SNAPSHOT_FROM_ARGS("r|l",&zsnapshot, &flags);
> > >
> > > retval = virDomainSnapshotDelete(snapshot->snapshot,
> > > flags);
> > > - DPRINTF("%s: virDomainSnapshotDelete(%p, %d) returned
> > > %d\n", PHPFUNC, snapshot->snapshot, flags, retval);
> > > + DPRINTF("%s: virDomainSnapshotDelete(%p, %d) returned
> > > %d\n", PHPFUNC, snapshot->snapshot, (int) flags, retval);
> > > if (retval == -1) RETURN_FALSE;
> > > RETURN_TRUE;
> > > }
> > > @@ -6772,7 +6772,7 @@
> > > PHP_FUNCTION(libvirt_storagevolume_delete)
> > > GET_VOLUME_FROM_ARGS("r|l",&zvolume,&flags);
> > >
> > > retval = virStorageVolDelete(volume->volume, flags);
> > > - DPRINTF("%s: virStorageVolDelete(%p, %d) returned %d
> > > \n", PHPFUNC, volume->volume, flags, retval);
> > > + DPRINTF("%s: virStorageVolDelete(%p, %d) returned %d
> > > \n", PHPFUNC, volume->volume, (int) flags, retval);
> > > if (retval != 0) {
> > > set_error_if_unset("Cannot delete storage
> > > volume" TSRMLS_CC);
> > > RETURN_FALSE;
> > > --
> > > 1.9.3
> > >
> > > --
> > > libvir-list mailing list
> > > libvir-list(a)redhat.com
> > > https://www.redhat.com/mailman/listinfo/libvir-list
> > >
> > >
> >
> >
>
>
>
10 years, 5 months