[libvirt] [PATCH 1/2] qemu: migration:Release nbd port from migrationPorts instead of remotePorts
by weiwei li
commit 3e1e16aa8d4238241a1806cb9bdb3b9ad60db777(Use a port from the
migration range for NBD as well) change ndb port allocation from
remotePorts to migrationPorts, but does not change the port releasing
process, which makes an error when migration seveal times(above 64).
Signed-off-by: Weiwei Li <nuonuoli(a)tencent.com>
---
src/qemu/qemu_migration.c | 8 ++++----
src/qemu/qemu_process.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index ca70e35..0ad8054 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1351,7 +1351,7 @@ qemuMigrationStartNBDServer(virQEMUDriverPtr driver,
unsigned short port = 0;
char *diskAlias = NULL;
size_t i;
-
+ VIR_DEBUG("DEBUG: in qemuMigrationStartNBDServer");
for (i = 0; i < vm->def->ndisks; i++) {
virDomainDiskDefPtr disk = vm->def->disks[i];
@@ -1389,7 +1389,7 @@ qemuMigrationStartNBDServer(virQEMUDriverPtr driver,
cleanup:
VIR_FREE(diskAlias);
if (ret < 0)
- virPortAllocatorRelease(driver->remotePorts, port);
+ virPortAllocatorRelease(driver->migrationPorts, port);
return ret;
}
@@ -1595,7 +1595,7 @@ qemuMigrationStopNBDServer(virQEMUDriverPtr driver,
qemuDomainObjExitMonitor(driver, vm);
- virPortAllocatorRelease(driver->remotePorts, priv->nbdPort);
+ virPortAllocatorRelease(driver->migrationPorts, priv->nbdPort);
priv->nbdPort = 0;
}
@@ -2813,7 +2813,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
VIR_FORCE_CLOSE(dataFD[1]);
if (vm) {
if (ret < 0) {
- virPortAllocatorRelease(driver->remotePorts, priv->nbdPort);
+ virPortAllocatorRelease(driver->migrationPorts, priv->nbdPort);
priv->nbdPort = 0;
}
if (ret >= 0 || vm->persistent)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ef258cf..ba8ba82 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4839,7 +4839,7 @@ void qemuProcessStop(virQEMUDriverPtr driver,
}
}
- virPortAllocatorRelease(driver->remotePorts, priv->nbdPort);
+ virPortAllocatorRelease(driver->migrationPorts, priv->nbdPort);
priv->nbdPort = 0;
if (priv->agent) {
--
1.7.1
10 years
[libvirt] [PATCH 0/3] Avoid rare race with virDomainUndefine()
by Martin Kletzander
First patch just fixes 'virsh list' for a rare case that is similar to
the one fixed in the third patch. Second patch is just a helper for
reproducing the race.
This was found in qemu driver but is fixed on upper level, so it
should be more general.
Martin Kletzander (3):
virsh: don't list unknown domains
DO NOT APPLY UPSTREAM: Reproducer helper
Avoid rare race when undefining domain
src/conf/domain_conf.c | 26 +++++++++++++++++++++++---
src/conf/domain_conf.h | 1 +
tools/virsh-domain-monitor.c | 5 +++++
3 files changed, 29 insertions(+), 3 deletions(-)
--
2.1.2
10 years
[libvirt] [PATCH] Do not probe for power mgmt capabilities in lxc emulator
by Ján Tomko
It fails after 30 seconds with this error:
error : virDBusCall:1429 : error from service: CanSuspend:
Did not receive a reply. Possible causes include: the remote
application did not send a reply, the message bus security
policy blocked the reply, the reply timeout expired, or the
network connection was broken.
Only probe for the power mgmt capabilities when driver is non-NULL.
This speeds up domain startup by 30 seconds.
https://bugzilla.redhat.com/show_bug.cgi?id=1159227
---
src/lxc/lxc_conf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c
index 17df7a8..e713ff8 100644
--- a/src/lxc/lxc_conf.c
+++ b/src/lxc/lxc_conf.c
@@ -82,7 +82,9 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver)
VIR_WARN("Failed to query host NUMA topology, disabling NUMA capabilities");
}
- if (virNodeSuspendGetTargetMask(&caps->host.powerMgmt) < 0)
+ /* Only probe for power management capabilities in the driver,
+ * not in the emulator */
+ if (driver && virNodeSuspendGetTargetMask(&caps->host.powerMgmt) < 0)
VIR_WARN("Failed to get host power management capabilities");
if (virGetHostUUID(caps->host.host_uuid)) {
--
2.0.4
10 years
[libvirt] [PATCH] qemu: make advice from numad available when building commandline
by Martin Kletzander
Particularly in qemuBuildNumaArgStr(), there was a need for the advice
due to memory backing, which needs to know the nodeset it will be pinned
to. With newer qemu this caused the following error when starting
domain:
error: internal error: Advice from numad is needed in case of
automatic numa placement
even when starting perfectly valid domain, e.g.:
...
<vcpu placement='auto'>4</vcpu>
<numatune>
<memory mode='strict' placement='auto'/>
</numatune>
<cpu>
<numa>
<cell id='0' cpus='0' memory='524288'/>
<cell id='1' cpus='1' memory='524288'/>
</numa>
</cpu>
...
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1138545
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/qemu/qemu_command.c | 10 ++++++----
src/qemu/qemu_command.h | 3 ++-
src/qemu/qemu_driver.c | 3 ++-
src/qemu/qemu_process.c | 3 ++-
tests/qemuxml2argvtest.c | 3 ++-
tests/qemuxmlnstest.c | 2 +-
6 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2e5af4f..207e2b0 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6636,7 +6636,8 @@ static int
qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
const virDomainDef *def,
virCommandPtr cmd,
- virQEMUCapsPtr qemuCaps)
+ virQEMUCapsPtr qemuCaps,
+ virBitmapPtr nodeset)
{
size_t i, j;
virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -6796,7 +6797,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
virBufferAsprintf(&buf, ",size=%dM,id=ram-node%zu", cellmem, i);
- if (virDomainNumatuneMaybeFormatNodeset(def->numatune, NULL,
+ if (virDomainNumatuneMaybeFormatNodeset(def->numatune, nodeset,
&nodemask, i) < 0)
goto cleanup;
@@ -7764,7 +7765,8 @@ qemuBuildCommandLine(virConnectPtr conn,
virNetDevVPortProfileOp vmop,
qemuBuildCommandLineCallbacksPtr callbacks,
bool standalone,
- bool enableFips)
+ bool enableFips,
+ virBitmapPtr nodeset)
{
virErrorPtr originalError = NULL;
size_t i, j;
@@ -7992,7 +7994,7 @@ qemuBuildCommandLine(virConnectPtr conn,
}
if (def->cpu && def->cpu->ncells)
- if (qemuBuildNumaArgStr(cfg, def, cmd, qemuCaps) < 0)
+ if (qemuBuildNumaArgStr(cfg, def, cmd, qemuCaps, nodeset) < 0)
goto error;
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_UUID))
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index aa40c9e..f7d3c2d 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -79,7 +79,8 @@ virCommandPtr qemuBuildCommandLine(virConnectPtr conn,
virNetDevVPortProfileOp vmop,
qemuBuildCommandLineCallbacksPtr callbacks,
bool forXMLToArgv,
- bool enableFips)
+ bool enableFips,
+ virBitmapPtr nodeset)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(11);
/* Generate '-device' string for chardev device */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 373daab..5ac638a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6472,7 +6472,8 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
&buildCommandLineCallbacks,
true,
- qemuCheckFips())))
+ qemuCheckFips(),
+ NULL)))
goto cleanup;
ret = virCommandToString(cmd);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ef258cf..6cbd608 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4362,7 +4362,8 @@ int qemuProcessStart(virConnectPtr conn,
priv->monJSON, priv->qemuCaps,
migrateFrom, stdin_fd, snapshot, vmop,
&buildCommandLineCallbacks, false,
- qemuCheckFips())))
+ qemuCheckFips(),
+ nodemask)))
goto cleanup;
/* now that we know it is about to start call the hook if present */
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 0e9fab9..9b8e3e2 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -362,7 +362,8 @@ static int testCompareXMLToArgvFiles(const char *xml,
migrateFrom, migrateFd, NULL,
VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
&testCallbacks, false,
- (flags & FLAG_FIPS)))) {
+ (flags & FLAG_FIPS),
+ NULL))) {
if (!virtTestOOMActive() &&
(flags & FLAG_EXPECT_FAILURE)) {
ret = 0;
diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c
index b3a608c..2f37a26 100644
--- a/tests/qemuxmlnstest.c
+++ b/tests/qemuxmlnstest.c
@@ -119,7 +119,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
vmdef, &monitor_chr, json, extraFlags,
migrateFrom, migrateFd, NULL,
VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
- &testCallbacks, false, false)))
+ &testCallbacks, false, false, NULL)))
goto fail;
if (!virtTestOOMActive()) {
--
2.1.2
10 years
[libvirt] [PATCH 0/2] Improve error messages about blkio values
by Martin Kletzander
There was one message used for all parsing errors in the blkio code.
This series fixes it in both qemu and lxc drivers where the code is
used.
Martin Kletzander (2):
qemu: improve error message for invalid blkiotune settings
lxc: improve error message for invalid blkiotune settings
src/lxc/lxc_driver.c | 29 +++++++++++++++++++----------
src/qemu/qemu_driver.c | 29 +++++++++++++++++++----------
2 files changed, 38 insertions(+), 20 deletions(-)
--
2.1.2
10 years
[libvirt] [PATCH v3 0/3] add nodeset check in numatune
by Chen Fan
when setting elements memnode and nodeset in attribute numatune more
than the host nodes in XML file, VM boot should fail. so add check for
that.
Chen Fan (3):
numatune: add check for numatune nodeset range
lxc controller: add check for numatune
virnuma: remove redundant check for numanode
src/conf/numatune_conf.c | 28 +++++++++++++
src/conf/numatune_conf.h | 1 +
src/libvirt_private.syms | 2 +
src/lxc/lxc_controller.c | 1 +
src/qemu/qemu_command.c | 3 ++
src/qemu/qemu_command.h | 1 +
src/util/virbitmap.c | 49 ++++++++++++++++++++++
src/util/virbitmap.h | 3 ++
src/util/virnuma.c | 48 ++++++++++++++-------
src/util/virnuma.h | 2 +
...rgv-numatune-static-nodeset-exceed-hostnode.xml | 35 ++++++++++++++++
tests/qemuxml2argvmock.c | 9 ++++
tests/qemuxml2argvtest.c | 1 +
tests/virbitmaptest.c | 26 +++++++++++-
14 files changed, 193 insertions(+), 16 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-numatune-static-nodeset-exceed-hostnode.xml
--
1.9.3
10 years
[libvirt] virsh migrate
by Chateigner Nicolas
Hi,
I would like to use this command to backup my virtual machine on my
secondary server
virsh migrate --live --suspend --copy-storage-inc virtual_machine
qemu+ssh://root@secondary_server/system
But we don't have option to disable shut off the virtual machine on the
source server.
Would you add an option to offer this functionality ?
Best regards
Nicolas Chateigner
<http://www.inserm.fr>
10 years
[libvirt] virStorageFileGetMetadata bug?
by Serge Hallyn
Hi,
I'm looking into why virt-aa-helper isn't adding allow rules for
backing stores nested deeper than 1. So if I do
qemu-img create -f qcow2 l1.img 10G
qemu-img create -f qcow2 -b l1.img l2.img
and use l2.img in a domain, then virt-aa-helper will add allow
rules for the domain to access both l1.img and l2.img. But if I
qemu-img create -f qcow2 -b l2.img l3.img
and use l3.img in the domain, then l3.img will not get an allow rule.
Looking at src/security/virt-aa-helper.c:get_files(), it is doing:
if (!disk->src->backingStore) {
bool probe = ctl->allowDiskFormatProbing;
virStorageFileGetMetadata(disk->src, -1, -1, probe, false);
}
if (virDomainDiskDefForeachPath(disk, true, add_file_path, &buf) < 0)
goto cleanup;
and virStorageFileGetMetadata in turn calls virStorageFileGetMetadataRecurse().
So it seems like l3.img *should* be geting hit in virDomainDiskDefForeachPath,
but it's not. Am I misunderstanding something in how these helpers should be
used?
thanks,
-serge
10 years
[libvirt] [PATCH] conf: use proper maximum for parsing memory values
by Martin Kletzander
The value is stored in unsigned long long, so ULLONG_MAX is the proper
upper limit to use.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
Even though this is a build-breaker (for 32bit systems
memtune-unlimited fails to parse), I'm not pushing it as one because
it feels odd that such change wouldn't break anything else.
src/conf/domain_conf.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a351382..beb3d26 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6388,16 +6388,10 @@ virDomainParseMemory(const char *xpath, xmlXPathContextPtr ctxt,
unsigned long long *mem, bool required)
{
int ret = -1;
- unsigned long long bytes, max;
-
- /* On 32-bit machines, our bound is 0xffffffff * KiB. On 64-bit
- * machines, our bound is off_t (2^63). */
- if (sizeof(unsigned long) < sizeof(long long))
- max = 1024ull * ULONG_MAX;
- else
- max = LLONG_MAX;
+ unsigned long long bytes;
- ret = virDomainParseScaledValue(xpath, ctxt, &bytes, 1024, max, required);
+ ret = virDomainParseScaledValue(xpath, ctxt, &bytes, 1024,
+ ULLONG_MAX, required);
if (ret < 0)
goto cleanup;
--
2.1.2
10 years