[libvirt] [PATCH] [PATCH] vcpupin: add clear feature
by Yi Wang
We can't clear vcpupin settings of XML once we did vcpupin
command, this is not convenient under some condition such
as migration.
This patch introduces clear feature, which can clear vcpuin
setting of XML.
Signed-off-by: Yi Wang <wang.yi59(a)zte.com.cn>
Signed-off-by: Xi Xu <xu.xi8(a)zte.com.cn>
---
include/libvirt/libvirt-domain.h | 1 +
src/qemu/qemu_driver.c | 24 +++++++++++++++++++-----
tools/virsh-domain.c | 5 ++++-
tools/virsh.pod | 1 +
4 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 4048acf..7b171df 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -1837,6 +1837,7 @@ typedef enum {
VIR_DOMAIN_VCPU_MAXIMUM = (1 << 2), /* Max rather than current count */
VIR_DOMAIN_VCPU_GUEST = (1 << 3), /* Modify state of the cpu in the guest */
VIR_DOMAIN_VCPU_HOTPLUGGABLE = (1 << 4), /* Make vcpus added hot(un)pluggable */
+ VIR_DOMAIN_VCPU_CLEAR = (1 << 5), /* Clear vcpus pin info */
} virDomainVcpuFlags;
int virDomainSetVcpus (virDomainPtr domain,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 97b194b..9e8759f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5001,7 +5001,7 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm,
int vcpu,
virQEMUDriverPtr driver,
virQEMUDriverConfigPtr cfg,
- virBitmapPtr cpumap)
+ virBitmapPtr cpumap, bool clear)
{
virBitmapPtr tmpmap = NULL;
virDomainVcpuDefPtr vcpuinfo;
@@ -5049,7 +5049,12 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm,
}
virBitmapFree(vcpuinfo->cpumask);
- vcpuinfo->cpumask = tmpmap;
+ if (clear) {
+ virBitmapFree(tmpmap);
+ vcpuinfo->cpumask = NULL;
+ } else {
+ vcpuinfo->cpumask = tmpmap;
+ }
tmpmap = NULL;
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
@@ -5093,9 +5098,11 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
virBitmapPtr pcpumap = NULL;
virDomainVcpuDefPtr vcpuinfo = NULL;
virQEMUDriverConfigPtr cfg = NULL;
+ bool clear = false;
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
- VIR_DOMAIN_AFFECT_CONFIG, -1);
+ VIR_DOMAIN_AFFECT_CONFIG |
+ VIR_DOMAIN_VCPU_CLEAR, -1);
cfg = virQEMUDriverGetConfig(driver);
@@ -5111,6 +5118,8 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0)
goto endjob;
+ clear = !!(flags & VIR_DOMAIN_VCPU_CLEAR);
+
if ((def && def->virtType == VIR_DOMAIN_VIRT_QEMU) ||
(persistentDef && persistentDef->virtType == VIR_DOMAIN_VIRT_QEMU)) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
@@ -5136,12 +5145,17 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
}
if (def &&
- qemuDomainPinVcpuLive(vm, def, vcpu, driver, cfg, pcpumap) < 0)
+ qemuDomainPinVcpuLive(vm, def, vcpu, driver, cfg, pcpumap, clear) < 0)
goto endjob;
if (persistentDef) {
virBitmapFree(vcpuinfo->cpumask);
- vcpuinfo->cpumask = pcpumap;
+ if (clear) {
+ virBitmapFree(pcpumap);
+ vcpuinfo->cpumask = NULL;
+ } else {
+ vcpuinfo->cpumask = pcpumap;
+ }
pcpumap = NULL;
ret = virDomainSaveConfig(cfg->configDir, driver->caps, persistentDef);
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 93cb020..4bad9e7 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6860,7 +6860,7 @@ virshParseCPUList(vshControl *ctl, int *cpumaplen,
unsigned char *cpumap = NULL;
virBitmapPtr map = NULL;
- if (cpulist[0] == 'r') {
+ if (cpulist[0] == 'r' || STREQ("clear", cpulist)) {
if (!(map = virBitmapNew(maxcpu)))
return NULL;
virBitmapSetAll(map);
@@ -6938,6 +6938,9 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
+ if (STREQ(cpulist, "clear"))
+ flags |= VIR_DOMAIN_VCPU_CLEAR;
+
/* Pin mode: pinning specified vcpu to specified physical cpus*/
if (!(cpumap = virshParseCPUList(ctl, &cpumaplen, cpulist, maxcpu)))
goto cleanup;
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 69cc423..caaa230 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -2857,6 +2857,7 @@ I<cpulist> is a list of physical CPU numbers. Its syntax is a comma
separated list and a special markup using '-' and '^' (ex. '0-4', '0-3,^2') can
also be allowed. The '-' denotes the range and the '^' denotes exclusive.
For pinning the I<vcpu> to all physical cpus specify 'r' as a I<cpulist>.
+For clearing pinning info, specify 'clear' as a I<cpulist>.
If I<--live> is specified, affect a running guest.
If I<--config> is specified, affect the next boot of a persistent guest.
If I<--current> is specified, affect the current guest state.
--
1.8.3.1
6 years, 10 months
[libvirt] [PATCH v2 0/2] Enable pseries machine's max-cpu-compat parameter
by Shivaprasad G Bhat
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1519146
---
Shivaprasad G Bhat (2):
qemu: Add capability for pseries machine's max-cpu-compat= parameter
qemu: Add support for pseries machine's max-cpu-compat= parameter
src/qemu/qemu_capabilities.c | 7 +++++++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 11 ++++++++++
tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 1 +
.../pseries-machine-max-cpu-compat.args | 21 ++++++++++++++++++++
.../pseries-machine-max-cpu-compat.xml | 17 ++++++++++++++++
tests/qemuxml2argvtest.c | 5 +++++
7 files changed, 62 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/pseries-machine-max-cpu-compat.args
create mode 100644 tests/qemuxml2argvdata/pseries-machine-max-cpu-compat.xml
--
Signature
6 years, 10 months
[libvirt] [PATCH] nodedev: update mdev_types caps before dumpxml
by Wu Zongyong
Wu Zongyong (1):
nodedev: update mdev_types caps before dumpxml
src/node_device/node_device_linux_sysfs.c | 42 +++++++++++++++++++++++++++++++
src/node_device/node_device_udev.c | 11 ++++++--
src/node_device/node_device_udev.h | 8 ++++++
3 files changed, 59 insertions(+), 2 deletions(-)
--
1.9.1
6 years, 10 months
[libvirt] [PATCH] qemuDomainDiskChangeSupported: Forbid alias change
by Michal Privoznik
Since we have user aliases it may happen that users want to
change it using 'update-device'. Instead of ignoring it silently,
error out loudly.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_domain.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 347fc0742..00d6c41c9 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6762,6 +6762,14 @@ qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
return false;
}
+ if (disk->info.alias &&
+ STRNEQ_NULLABLE(disk->info.alias, orig_disk->info.alias)) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
+ _("cannot modify field '%s' of the disk"),
+ "alias");
+ return false;
+ }
+
CHECK_EQ(info.bootIndex, "boot order", true);
CHECK_EQ(rawio, "rawio", true);
CHECK_EQ(sgio, "sgio", true);
--
2.13.6
6 years, 10 months
[libvirt] [PATCH] qemuDomainAttachDeviceMknodHelper: Remove symlink before creating it
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1528502
So imagine you have /dev/blah symlink which points to /dev/sda.
You attach /dev/blah as disk to your domain. Libvirt correctly
creates the /dev/blah -> /dev/sda symlink in the qemu namespace.
However, then you detach the disk, change the symlink so that it
points to /dev/sdb and tries to attach the disk again. This time,
however, the attach fails (well, qemu attaches wrong disk)
because the code assumes that symlinks don't change. Well they
do.
This is inspired by test fix written by Eduardo Habkost.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_domain.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 70fb40650..5f29d1ad5 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9737,13 +9737,23 @@ qemuDomainAttachDeviceMknodHelper(pid_t pid ATTRIBUTE_UNUSED,
if (isLink) {
VIR_DEBUG("Creating symlink %s -> %s", data->file, data->target);
+
+ /* First, unlink the symlink target. Symlinks change and
+ * therefore we have no guarantees that pre-existing
+ * symlink is still valid. */
+ if (unlink(data->file) < 0 &&
+ errno != ENOENT) {
+ virReportSystemError(errno,
+ _("Unable to remove symlink %s"),
+ data->file);
+ goto cleanup;
+ }
+
if (symlink(data->target, data->file) < 0) {
- if (errno != EEXIST) {
- virReportSystemError(errno,
- _("Unable to create symlink %s"),
- data->target);
- goto cleanup;
- }
+ virReportSystemError(errno,
+ _("Unable to create symlink %s"),
+ data->target);
+ goto cleanup;
} else {
delDevice = true;
}
--
2.13.6
6 years, 10 months
[libvirt] [PATCH 0/2] Enable pseries machine's max-cpu-compat parameter
by Shivaprasad G Bhat
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1519146
---
Shivaprasad G Bhat (2):
qemu: Add capability for pseries machine's max-cpu-compat= parameter
qemu: Add support for pseries machine's max-cpu-compat= parameter
src/qemu/qemu_capabilities.c | 7 ++++++
src/qemu/qemu_capabilities.h | 2 ++
src/qemu/qemu_command.c | 14 ++++++++++--
tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 1 +
.../pseries-machine-max-cpu-compat.args | 23 ++++++++++++++++++++
.../pseries-machine-max-cpu-compat.xml | 21 ++++++++++++++++++
tests/qemuxml2argvtest.c | 5 ++++
7 files changed, 70 insertions(+), 3 deletions(-)
create mode 100644 tests/qemuxml2argvdata/pseries-machine-max-cpu-compat.args
create mode 100644 tests/qemuxml2argvdata/pseries-machine-max-cpu-compat.xml
--
Signature
6 years, 10 months
[libvirt] [PATCH] Fixed documentation for destroy storage pool
by frankie@telecos.upc.edu
From: Francesc Guasch <frankie(a)telecos.upc.edu>
---
lib/Sys/Virt/StoragePool.pm | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/lib/Sys/Virt/StoragePool.pm b/lib/Sys/Virt/StoragePool.pm
index 0bc1d50..2ba5101 100644
--- a/lib/Sys/Virt/StoragePool.pm
+++ b/lib/Sys/Virt/StoragePool.pm
@@ -115,14 +115,11 @@ C<define_storage_pool> method in L<Sys::Virt>.
Remove the configuration associated with a storage pool previously defined
with the C<define_storage pool> method in L<Sys::Virt>. If the storage pool is
-running, you probably want to use the C<shutdown> or C<destroy>
-methods instead.
+running, you probably want to use the C<destroy> method instead.
=item $pool->destroy()
-Immediately terminate the machine, and remove it from the virtual
-machine monitor. The C<$pool> handle is invalid after this call
-completes and should not be used again.
+Immediately stop the storage pool.
=item $flag = $pool->get_autostart();
--
2.14.1
6 years, 10 months
[libvirt] [REBASE PATCH v2 0/8] Implement query-dump command
by John Ferlan
Previous rebase:
https://www.redhat.com/archives/libvir-list/2017-December/msg00124.html
Rebase after pushing first 2 ACK'd patches and for recent capabilities
adjustments. Plus it's been a month...
Original v2:
https://www.redhat.com/archives/libvir-list/2017-November/msg00779.html
Rebase due to additional capabilitiies
v2 Cover:
v1: https://www.redhat.com/archives/libvir-list/2017-November/msg00731.html
Differences from v1 (besides more patches)
Rather than use a timing loop in order to fetch the dump stats and
the presence of the 'query-dump' command, let's use the DUMP_COMPLETED
event and wire that up in order to determine when the dump has been
completed. In the mean time, the previous timing loop is converted into
a qemuDomainGetJobInfoDumpStats to be called if the "right conditions"
exist. Also found/fixed a couple of minor issues from v1 regarding
usage "dumpformat" instead of just "format" from my patch 2 adjustment
and a type for qemuMonitorDumpStatus (was qemuMontiorDumpStatus in v1).
NB: (from v1 cover):
Details in the patches. Essentially though QEMU 2.6 added the ability
to perform the 'dump-guest-memory' via a thread by adding a 'detach'
boolean to the command. In order to watch the progress of the thread
the 'query-dump' command was added. The query-dump will return just
the current status, the total size to be dumped, and the current
progress. So using the migrate stats data in the DomainJobInfo we
can then save our current progress allowing tools such as virsh to
watch that progress. As an added benefit, the dump-guest-memory is
now truly asynchronous.
John Ferlan (8):
qemu: Add support for DUMP_COMPLETED event
qemu: Introduce qemuProcessHandleDumpCompleted
qemu: Introduce qemuMonitor[JSON]QueryDump
qemu: Add new parameter to qemuMonitorDumpToFd
qemu: Introduce qemuDomainGetJobInfoMigrationStats
qemu: Introduce qemuDomainGetJobInfoDumpStats
qemu: Add dump completed event to the capabilities
qemu: Allow showing the dump progress for memory only dump
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_domain.c | 2 +
src/qemu/qemu_domain.h | 2 +
src/qemu/qemu_driver.c | 146 ++++++++++++++++++---
src/qemu/qemu_monitor.c | 39 +++++-
src/qemu/qemu_monitor.h | 33 ++++-
src/qemu/qemu_monitor_json.c | 104 ++++++++++++++-
src/qemu/qemu_monitor_json.h | 7 +-
src/qemu/qemu_process.c | 23 ++++
.../caps_2.10.0-gicv2.aarch64.xml | 1 +
.../caps_2.10.0-gicv3.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 +
.../caps_2.6.0-gicv2.aarch64.xml | 1 +
.../caps_2.6.0-gicv3.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 +
tests/qemumonitorjsontest.c | 3 +-
27 files changed, 352 insertions(+), 26 deletions(-)
--
2.13.6
6 years, 10 months
[libvirt] [PATCH v4 0/2] qemu: Add support for hot unplugging redirdev
by Chen Hanxiao
v4:
update commit messages and news
v3:
use helper qemuDomainDelChardevTLSObjects and address some comments
v2:
rebased on master
Chen Hanxiao (2):
qemu: Add support for hot unplugging redirdev device which can use the
detach-device --live
news: add change of hot unplug redirdev
docs/news.xml | 5 +++
src/qemu/qemu_driver.c | 4 ++-
src/qemu/qemu_hotplug.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_hotplug.h | 4 +++
4 files changed, 102 insertions(+), 1 deletion(-)
--
2.14.3
6 years, 10 months