[libvirt] [PATCH 0/9] Add sysfs_prefix to nodeinfo.c API's
by John Ferlan
This series adds/processes a sysfs_prefix for the nodeinfo.c API's.
Although the nodeinfotest.c passes a local test directory path, it was
never used.
This was all brought to light by patch 9 in this series which is
essentially Kothapally Madhu Pavan's v3 patch:
http://www.redhat.com/archives/libvir-list/2015-June/msg00395.html
With the adjustment to call nodeGetPresentCPUBitmap and virNodeParseNode
with the sysfs prefix.
Without the first 5 patches, the patch as posted caused nodeinfotest
failure in my test environment which doesn't have the "larger" environments
that the test tried to set up because the test environment used my
present mask file.
John Ferlan (8):
nodeinfo: Introduce local linuxGetCPUPresentPath
nodeinfo: Add sysfs_prefix to nodeGetCPUCount
nodeinfo: Add sysfs_prefix to nodeGetPresentCPUBitmap
nodeinfo: Add sysfs_prefix to nodeGetCPUBitmap
nodeinfo: Add sysfs_prefix to nodeGetCPUMap
nodeinfo: Add sysfs_prefix to nodeGetInfo
nodeinfo: Add sysfs_prefix to nodeCapsInitNUMA
nodeinfo: Add sysfs_prefix to nodeGetMemoryStats
Kothapally Madhu Pavan (1):
nodeinfo: fix to parse present cpus rather than possible cpus
src/bhyve/bhyve_capabilities.c | 2 +-
src/bhyve/bhyve_driver.c | 6 +-
src/lxc/lxc_conf.c | 2 +-
src/lxc/lxc_controller.c | 2 +-
src/lxc/lxc_driver.c | 6 +-
src/nodeinfo.c | 159 +++++++++++++++++++++++++++++------------
src/nodeinfo.h | 16 +++--
src/openvz/openvz_conf.c | 4 +-
src/openvz/openvz_driver.c | 6 +-
src/phyp/phyp_driver.c | 2 +-
src/qemu/qemu_capabilities.c | 4 +-
src/qemu/qemu_driver.c | 16 ++---
src/qemu/qemu_process.c | 2 +-
src/uml/uml_conf.c | 2 +-
src/uml/uml_driver.c | 6 +-
src/util/vircgroup.c | 2 +-
src/vbox/vbox_common.c | 4 +-
src/vmware/vmware_conf.c | 2 +-
src/vz/vz_driver.c | 10 +--
src/vz/vz_sdk.c | 2 +-
tests/vircgrouptest.c | 4 +-
21 files changed, 166 insertions(+), 93 deletions(-)
--
2.1.0
9 years, 4 months
[libvirt] [PATCH 1/2] configure: Move Virtuozzo checks to a specific module
by Michal Privoznik
Eventually, every driver will be moved to a special module.
But for today the winner is Virtuozzo driver.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
configure.ac | 24 ++----------------------
m4/virt-driver-vz.m4 | 46 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 22 deletions(-)
create mode 100644 m4/virt-driver-vz.m4
diff --git a/configure.ac b/configure.ac
index 6533b88..71c3bb6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -562,10 +562,6 @@ AC_ARG_WITH([hyperv],
[AS_HELP_STRING([--with-hyperv],
[add Hyper-V support @<:@default=check@:>@])])
m4_divert_text([DEFAULTS], [with_hyperv=check])
-AC_ARG_WITH([vz],
- [AS_HELP_STRING([--with-vz],
- [add Virtuozzo support @<:@default=check@:>@])])
-m4_divert_text([DEFAULTS], [with_vz=check])
AC_ARG_WITH([test],
[AS_HELP_STRING([--with-test],
[add test driver support @<:@default=yes@:>@])])
@@ -1081,23 +1077,7 @@ dnl
dnl Checks for the Parallels driver
dnl
-
-if test "$with_vz" = "yes" ||
- test "$with_vz" = "check"; then
- PKG_CHECK_MODULES([PARALLELS_SDK], [parallels-sdk],
- [PARALLELS_SDK_FOUND=yes], [PARALLELS_SDK_FOUND=no])
-
- if test "$with_vz" = "yes" && test "$PARALLELS_SDK_FOUND" = "no"; then
- AC_MSG_ERROR([Parallels Virtualization SDK is needed to build the Parallels driver.])
- fi
-
- with_vz=$PARALLELS_SDK_FOUND
- if test "$with_vz" = "yes"; then
- AC_DEFINE_UNQUOTED([WITH_VZ], 1,
- [whether vz driver is enabled])
- fi
-fi
-AM_CONDITIONAL([WITH_VZ], [test "$with_vz" = "yes"])
+LIBVIRT_DRIVER_CHECK_VZ
dnl
dnl Checks for bhyve driver
@@ -2833,7 +2813,7 @@ AC_MSG_NOTICE([ LXC: $with_lxc])
AC_MSG_NOTICE([ PHYP: $with_phyp])
AC_MSG_NOTICE([ ESX: $with_esx])
AC_MSG_NOTICE([ Hyper-V: $with_hyperv])
-AC_MSG_NOTICE([ vz: $with_vz])
+LIBVIRT_DRIVER_RESULT_VZ
LIBVIRT_DRIVER_RESULT_BHYVE
AC_MSG_NOTICE([ Test: $with_test])
AC_MSG_NOTICE([ Remote: $with_remote])
diff --git a/m4/virt-driver-vz.m4 b/m4/virt-driver-vz.m4
new file mode 100644
index 0000000..704976e
--- /dev/null
+++ b/m4/virt-driver-vz.m4
@@ -0,0 +1,46 @@
+dnl The Virtuozzo driver
+dnl
+dnl Copyright (C) 2005-2015 Red Hat, Inc.
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License, or (at your option) any later version.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library. If not, see
+dnl <http://www.gnu.org/licenses/>.
+dnl
+
+AC_DEFUN([LIBVIRT_DRIVER_CHECK_VZ],[
+ AC_ARG_WITH([vz],
+ [AS_HELP_STRING([--with-vz],
+ [add Virtuozzo support @<:@default=check@:>@])])
+ m4_divert_text([DEFAULTS], [with_vz=check])
+
+ if test "$with_vz" = "yes" ||
+ test "$with_vz" = "check"; then
+ PKG_CHECK_MODULES([PARALLELS_SDK], [parallels-sdk],
+ [PARALLELS_SDK_FOUND=yes], [PARALLELS_SDK_FOUND=no])
+
+ if test "$with_vz" = "yes" && test "$PARALLELS_SDK_FOUND" = "no"; then
+ AC_MSG_ERROR([Parallels Virtualization SDK is needed to build the Virtuozzo driver.])
+ fi
+
+ with_vz=$PARALLELS_SDK_FOUND
+ if test "$with_vz" = "yes"; then
+ AC_DEFINE_UNQUOTED([WITH_VZ], 1,
+ [whether vz driver is enabled])
+ fi
+ fi
+ AM_CONDITIONAL([WITH_VZ], [test "$with_vz" = "yes"])
+])
+
+AC_DEFUN([LIBVIRT_DRIVER_RESULT_VZ],[
+ AC_MSG_NOTICE([ vz: $with_vz])
+])
--
2.3.6
9 years, 4 months
[libvirt] [libvirt-python][PATCH] examples: Introduce nodestats example
by Michal Privoznik
So, this is an exercise to show libvirt capabilities. Firstly, for
each host NUMA nodes some statistics are printed out, i.e. total
memory and free memory. Then, for each running domain, that has memory
strictly bound to certain host nodes, a small statistics of how much
memory it takes is printed out too. For instance:
# ./nodestats.py
NUMA stats
NUMA nodes: 0 1 2 3
MemTotal: 3950 3967 3937 3943
MemFree: 434 674 149 216
Dom 'gentoo': 1048576 1048576 1048576 1048576
We can see 4 host NUMA nodes, all of them having roughly 4GB of RAM.
Yeah, some of them has nearly all the memory consumed. Then, there's
only one running domain, called 'gentoo', and it has 1GB per each NUMA
node configured.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
examples/nodestats.py | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 106 insertions(+)
create mode 100755 examples/nodestats.py
diff --git a/examples/nodestats.py b/examples/nodestats.py
new file mode 100755
index 0000000..dbf5593
--- /dev/null
+++ b/examples/nodestats.py
@@ -0,0 +1,106 @@
+#!/usr/bin/env python
+# Print some host NUMA node statistics
+#
+# Authors:
+# Michal Privoznik <mprivozn(a)redhat.com
+
+import libvirt
+import sys
+from xml.dom import minidom
+import libxml2
+
+class virBitmap:
+ def __init__(self):
+ self.bitmap = 0
+
+ def setBit(self, offset):
+ mask = 1 << offset
+ self.bitmap = self.bitmap | mask
+
+ def clearBit(self, offset):
+ mask = ~(1 << offset)
+ self.bitmap = self.bitmap & mask
+
+ def isSet(self, offset):
+ mask = 1 << offset
+ return(self.bitmap & mask)
+
+ def setRange(self, start, end):
+ while (start <= end):
+ self.setBit(start)
+ start = start + 1
+
+ def parse(self, string):
+ for s in string.split(','):
+ list = s.split('-', 2)
+ start = int(list[0])
+ if len(list) == 2:
+ end = int(list[1])
+ else:
+ end = start
+ self.setRange(start, end)
+
+def xpath_eval(ctxt, path):
+ res = ctxt.xpathEval(path)
+ if res is None or len(res) == 0:
+ value = None
+ else:
+ value = res[0].content
+ return value
+
+try:
+ conn = libvirt.openReadOnly(None)
+except libvirt.libvirtError:
+ print('Failed to connect to the hypervisor')
+ sys.exit(1)
+
+try:
+ capsXML = conn.getCapabilities()
+except libvirt.libvirtError:
+ print('Failed to request capabilities')
+ sys.exit(1)
+
+caps = minidom.parseString(capsXML)
+cells = caps.getElementsByTagName('cells')[0]
+
+nodesIDs = [ int(proc.getAttribute('id'))
+ for proc in cells.getElementsByTagName('cell') ]
+
+nodesMem = [ conn.getMemoryStats(int(proc))
+ for proc in nodesIDs]
+
+doms = conn.listAllDomains(libvirt.VIR_CONNECT_LIST_DOMAINS_ACTIVE)
+domsStrict = [ proc
+ for proc in doms
+ if proc.numaParameters()['numa_mode'] == libvirt.VIR_DOMAIN_NUMATUNE_MEM_STRICT ]
+
+domsStrictCfg = {}
+
+for dom in domsStrict:
+ xmlStr = dom.XMLDesc()
+ doc = libxml2.parseDoc(xmlStr)
+ ctxt = doc.xpathNewContext()
+
+ domsStrictCfg[dom] = [ 0 for node in nodesIDs ]
+
+ for memnode in ctxt.xpathEval("/domain/numatune/memnode"):
+ ctxt.setContextNode(memnode)
+ cellid = xpath_eval(ctxt, "@cellid")
+ mode = xpath_eval(ctxt, "@mode")
+ nodeset = xpath_eval(ctxt, "@nodeset")
+
+ bitmap = virBitmap()
+ bitmap.parse(nodeset)
+ for node in nodesIDs:
+ if bitmap.isSet(int(node)):
+ mem = xpath_eval(ctxt, "/domain/cpu/numa/cell[@id='%s']/@memory" % cellid)
+ domsStrictCfg[dom][int(node)] += int(mem)
+
+print("NUMA stats")
+print("NUMA nodes:\t\t" + "\t".join(str(node) for node in nodesIDs))
+print("MemTotal:\t\t" + "\t".join(str(i.get('total') / 1024) for i in nodesMem))
+print("MemFree:\t\t" + "\t".join(str(i.get('free') / 1024) for i in nodesMem))
+
+for dom in domsStrictCfg:
+ sys.stdout.write("Dom '%s':\t\t" % dom.name())
+ print("\t".join(map(str, domsStrictCfg[dom][:])))
--
2.3.6
9 years, 4 months
[libvirt] [PATCH] qemuProcessHandleMigrationStatus: Update migration status on ASYNC_JOB_SAVE too
by Michal Privoznik
After Jirka's migration patches libvirt is listening on migration
events from qemu instead of actively polling on the monitor. There is,
however, a little regression (introduced in 6d2edb6a42d0d41). The
problem is, the current status of migration job is updated in
qemuProcessHandleMigrationStatus if and only if migration job was
started. But we have a separate job type for saving a domain into a
file: QEMU_ASYNC_JOB_SAVE. Therefore, since this job is not strictly a
migration job, internal state was not updated and later checks failed:
virsh # save fedora22 /tmp/fedora22_ble.save
error: Failed to save domain fedora22 to /tmp/fedora22_ble.save
error: operation failed: domain save job: is not active
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_process.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 2a529f7..16d39b2 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1521,29 +1521,30 @@ static int
qemuProcessHandleMigrationStatus(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virDomainObjPtr vm,
int status,
void *opaque ATTRIBUTE_UNUSED)
{
qemuDomainObjPrivatePtr priv;
virObjectLock(vm);
VIR_DEBUG("Migration of domain %p %s changed state to %s",
vm, vm->def->name,
qemuMonitorMigrationStatusTypeToString(status));
priv = vm->privateData;
if (priv->job.asyncJob != QEMU_ASYNC_JOB_MIGRATION_OUT &&
- priv->job.asyncJob != QEMU_ASYNC_JOB_MIGRATION_IN) {
+ priv->job.asyncJob != QEMU_ASYNC_JOB_MIGRATION_IN &&
+ priv->job.asyncJob != QEMU_ASYNC_JOB_SAVE) {
VIR_DEBUG("got MIGRATION event without a migration job");
goto cleanup;
}
priv->job.current->status.status = status;
virDomainObjBroadcast(vm);
cleanup:
virObjectUnlock(vm);
return 0;
}
--
2.3.6
9 years, 4 months
[libvirt] [PATCH] RFC: audit: add shmem resource type
by Marc-André Lureau
Provide information about shared memory resources in audit log.
Notes:
- the same shm used several times will add up. This is a very uncommon
case, but we may want to account only the different shm names instead.
- the shm may exist before the VMs was started, so the shm may not
actually be created by the VM (it can be there before, or created by
the server for instance).
https://bugzilla.redhat.com/show_bug.cgi?id=1218603
Signed-off-by: Marc-André Lureau <marcandre.lureau(a)redhat.com>
---
docs/auditlog.html.in | 17 +++++++++++++++++
src/conf/domain_audit.c | 10 ++++++++++
src/conf/domain_audit.h | 6 ++++++
src/conf/domain_conf.c | 21 +++++++++++++++++++++
src/conf/domain_conf.h | 1 +
src/libvirt_private.syms | 2 ++
6 files changed, 57 insertions(+)
diff --git a/docs/auditlog.html.in b/docs/auditlog.html.in
index 8a007ca..a6e5f6d 100644
--- a/docs/auditlog.html.in
+++ b/docs/auditlog.html.in
@@ -172,6 +172,23 @@
<dd>Updated memory size in bytes</dd>
</dl>
+ <h4><a name="typeresourceshmem">Shared Memory</a></h4>
+
+ <p>
+ The <code>msg</code> field will include the following sub-fields
+ </p>
+
+ <dl>
+ <dt>reason</dt>
+ <dd>The reason which caused the resource to be assigned to happen</dd>
+ <dt>resrc</dt>
+ <dd>The type of resource assigned. Set to <code>shmem</code></dd>
+ <dt>old-shmem</dt>
+ <dd>Original memory size in bytes, or 0</dd>
+ <dt>new-shmem</dt>
+ <dd>Updated memory size in bytes</dd>
+ </dl>
+
<h4><a name="typeresourcedisk">Disk</a></h4>
<p>
The <code>msg</code> field will include the following sub-fields
diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index caebdba..bc81aec 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -783,6 +783,14 @@ virDomainAuditMemory(virDomainObjPtr vm,
}
void
+virDomainAuditShmem(virDomainObjPtr vm,
+ unsigned long long oldmem, unsigned long long newmem,
+ const char *reason, bool success)
+{
+ return virDomainAuditResource(vm, "shmem", oldmem, newmem, reason, success);
+}
+
+void
virDomainAuditVcpu(virDomainObjPtr vm,
unsigned int oldvcpu, unsigned int newvcpu,
const char *reason, bool success)
@@ -885,6 +893,8 @@ virDomainAuditStart(virDomainObjPtr vm, const char *reason, bool success)
virDomainAuditMemory(vm, 0, virDomainDefGetMemoryActual(vm->def),
"start", true);
+ virDomainAuditShmem(vm, 0, virDomainDefGetShmem(vm->def),
+ "start", true);
virDomainAuditVcpu(vm, 0, vm->def->vcpus, "start", true);
if (vm->def->iothreads)
virDomainAuditIOThread(vm, 0, vm->def->iothreads, "start", true);
diff --git a/src/conf/domain_audit.h b/src/conf/domain_audit.h
index 97dadca..3db6ace 100644
--- a/src/conf/domain_audit.h
+++ b/src/conf/domain_audit.h
@@ -96,6 +96,12 @@ void virDomainAuditMemory(virDomainObjPtr vm,
const char *reason,
bool success)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
+void virDomainAuditShmem(virDomainObjPtr vm,
+ unsigned long long oldmem,
+ unsigned long long newmem,
+ const char *reason,
+ bool success)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
void virDomainAuditVcpu(virDomainObjPtr vm,
unsigned int oldvcpu,
unsigned int newvcpu,
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 5a9a88d..378aa1a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7575,6 +7575,27 @@ virDomainDefGetMemoryActual(virDomainDefPtr def)
}
+/**
+ * virDomainDefGetShmem:
+ * @def: domain definition
+ *
+ * Returns the current shared memory size usable by the domain described by
+ * @def.
+ */
+unsigned long long
+virDomainDefGetShmem(virDomainDefPtr def)
+{
+ unsigned long long ret = 0;
+ size_t i;
+
+ for (i = 0; i < def->nshmems; i++) {
+ ret += def->shmems[i]->size;
+ }
+
+ return ret;
+}
+
+
static int
virDomainControllerModelTypeFromString(const virDomainControllerDef *def,
const char *model)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 50750c1..041d619 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2287,6 +2287,7 @@ struct _virDomainDef {
unsigned long long virDomainDefGetMemoryInitial(virDomainDefPtr def);
void virDomainDefSetMemoryInitial(virDomainDefPtr def, unsigned long long size);
unsigned long long virDomainDefGetMemoryActual(virDomainDefPtr def);
+unsigned long long virDomainDefGetShmem(virDomainDefPtr def);
typedef enum {
VIR_DOMAIN_KEY_WRAP_CIPHER_NAME_AES,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 720afdf..0bb4513 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -134,6 +134,7 @@ virDomainAuditNetDevice;
virDomainAuditRedirdev;
virDomainAuditRNG;
virDomainAuditSecurityLabel;
+virDomainAuditShmem;
virDomainAuditStart;
virDomainAuditStop;
virDomainAuditVcpu;
@@ -214,6 +215,7 @@ virDomainDefGetDefaultEmulator;
virDomainDefGetMemoryActual;
virDomainDefGetMemoryInitial;
virDomainDefGetSecurityLabelDef;
+virDomainDefGetShmem;
virDomainDefHasDeviceAddress;
virDomainDefMaybeAddController;
virDomainDefMaybeAddInput;
--
2.4.3
9 years, 4 months
[libvirt] [PATCH] vz: fix cleanup of nets of bridged type
by Dmitry Guryanov
We create a virtual network of special type, which
has the same name as bridge name to create bridged
network adapter in vz. So when we delete such an
adapter we have to remove corresponding virtual
network.
So let's rename prlsdkDelNet to prlsdkCleanupBridgedNet
and don't check for return value.
Signed-off-by: Dmitry Guryanov <dguryanov(a)parallels.com>
---
src/vz/vz_sdk.c | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index a312990..d1bc312 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -2986,20 +2986,15 @@ static int prlsdkAddNet(PRL_HANDLE sdkdom,
return ret;
}
-static int
-prlsdkDelNet(vzConnPtr privconn, virDomainNetDefPtr net)
+static void
+prlsdkCleanupBridgedNet(vzConnPtr privconn, virDomainNetDefPtr net)
{
- int ret = -1;
PRL_RESULT pret;
PRL_HANDLE vnet = PRL_INVALID_HANDLE;
PRL_HANDLE job = PRL_INVALID_HANDLE;
- if (net->type != VIR_DOMAIN_NET_TYPE_BRIDGE) {
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
- _("unplugging network device of type %s is not supported"),
- virDomainNetTypeToString(net->type));
- return ret;
- }
+ if (net->type != VIR_DOMAIN_NET_TYPE_BRIDGE)
+ return;
pret = PrlVirtNet_Create(&vnet);
prlsdkCheckRetGoto(pret, cleanup);
@@ -3011,11 +3006,8 @@ prlsdkDelNet(vzConnPtr privconn, virDomainNetDefPtr net)
if (PRL_FAILED(pret = waitJob(job)))
goto cleanup;
- ret = 0;
-
cleanup:
PrlHandle_Free(vnet);
- return ret;
}
int prlsdkAttachNet(virDomainObjPtr dom,
@@ -3107,8 +3099,7 @@ int prlsdkDetachNet(virDomainObjPtr dom,
if (sdknet == PRL_INVALID_HANDLE)
goto cleanup;
- if (prlsdkDelNet(privconn, net) < 0)
- goto cleanup;
+ prlsdkCleanupBridgedNet(privconn, net);
pret = PrlVmDev_Remove(sdknet);
prlsdkCheckRetGoto(pret, cleanup);
@@ -3530,7 +3521,7 @@ prlsdkDoApplyConfig(virConnectPtr conn,
if (olddef) {
for (i = 0; i < olddef->nnets; i++)
- prlsdkDelNet(conn->privateData, olddef->nets[i]);
+ prlsdkCleanupBridgedNet(conn->privateData, olddef->nets[i]);
}
for (i = 0; i < def->nnets; i++) {
@@ -3575,7 +3566,7 @@ prlsdkDoApplyConfig(virConnectPtr conn,
VIR_FREE(mask);
for (i = 0; i < def->nnets; i++)
- prlsdkDelNet(conn->privateData, def->nets[i]);
+ prlsdkCleanupBridgedNet(conn->privateData, def->nets[i]);
return -1;
}
@@ -3722,7 +3713,7 @@ prlsdkUnregisterDomain(vzConnPtr privconn, virDomainObjPtr dom)
size_t i;
for (i = 0; i < dom->def->nnets; i++)
- prlsdkDelNet(privconn, dom->def->nets[i]);
+ prlsdkCleanupBridgedNet(privconn, dom->def->nets[i]);
job = PrlVm_Unreg(privdom->sdkdom);
if (PRL_FAILED(waitJob(job)))
--
2.4.3
9 years, 4 months
[libvirt] [PATCH] libxl: set dom0 state to running
by Jim Fehlig
Commit 45697fe5 added dom0 to driver->domains, but missed
setting its state to 'running'
> virsh list
Id Name State
----------------------------------------------------
0 Domain-0 shut off
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/libxl/libxl_driver.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index e72b12d..5f69b49 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -549,6 +549,7 @@ libxlAddDom0(libxlDriverPrivatePtr driver)
def = NULL;
+ virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_BOOTED);
vm->def->vcpus = d_info.vcpu_online;
vm->def->maxvcpus = d_info.vcpu_max_id + 1;
vm->def->mem.cur_balloon = d_info.current_memkb;
--
2.1.4
9 years, 4 months
[libvirt] [PATCH] Fix qemu-nbd cleanup crashes
by Cédric Bosdonnat
The virLXCControllerAppendNBDPids function didn't properly initialize
pids and npids. In case of failure it was crashing when freeing those.
The nbd device pid file doesn't appear immediately after starting
qemu-nbd: adding a small loop to wait for it.
---
src/lxc/lxc_controller.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 828b8a8..78d3eee 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -533,16 +533,31 @@ static int virLXCControllerAppendNBDPids(virLXCControllerPtr ctrl,
const char *dev)
{
char *pidpath = NULL;
- pid_t *pids;
- size_t npids;
+ pid_t *pids = NULL;
+ size_t npids = 0;
size_t i;
int ret = -1;
+ size_t loops = 0;
pid_t pid;
if (!STRPREFIX(dev, "/dev/") ||
virAsprintf(&pidpath, "/sys/devices/virtual/block/%s/pid", dev + 5) < 0)
goto cleanup;
+ /* Wait for the pid file to appear */
+ while (!virFileExists(pidpath)) {
+ /* wait for 100ms before checking again, but don't do it for ever */
+ if (errno == ENOENT && loop < 10) {
+ usleep(100 * 1000);
+ loop++;
+ } else {
+ virReportSystemError(errno,
+ _("Cannot check NBD device %s pid"),
+ dev + 5);
+ goto cleanup;
+ }
+ }
+
if (virPidFileReadPath(pidpath, &pid) < 0)
goto cleanup;
--
2.1.4
9 years, 4 months
[libvirt] [PATCH 0/4] Improve migration errors
by Jiri Denemark
When QEMU exits on destination during migration, the source reports
either success (if the failure happened at the very end) or unhelpful
"unexpectedly failed" error message, only the destination host knows
more about the error, but usually there's no way to get the error back
to the source because the domain is already gone at the time
virDomainMigrateFinish* is called.
This series changes libvirt to remember incoming migration errors so
that they can be sent back to a source host.
https://bugzilla.redhat.com/show_bug.cgi?id=1090093
Jiri Denemark (4):
Introduce virHashLockable
qemu: Remember incoming migration errors
qemu: Don't report false error from MigrateFinish
qemu: Use error from Finish instead of "unexpectedly failed"
include/libvirt/virterror.h | 1 +
src/libvirt-domain.c | 21 ++++++++++-
src/libvirt_private.syms | 3 ++
src/qemu/qemu_conf.h | 3 ++
src/qemu/qemu_driver.c | 31 +++++++++++----
src/qemu/qemu_migration.c | 91 +++++++++++++++++++++++++++++++++++++++++++--
src/qemu/qemu_migration.h | 7 ++++
src/qemu/qemu_monitor.c | 19 ++++++++++
src/qemu/qemu_monitor.h | 2 +
src/qemu/qemu_process.c | 4 ++
src/util/virerror.c | 3 ++
src/util/virhash.c | 81 ++++++++++++++++++++++++++++++++++++++++
src/util/virhash.h | 10 +++++
13 files changed, 263 insertions(+), 13 deletions(-)
--
2.4.5
9 years, 4 months