[PATCH] virsh: Add virshKeycodeNameCompleter
by Kristina Hanicova
Signed-off-by: Kristina Hanicova <khanicov(a)redhat.com>
---
tools/virsh-completer-domain.c | 72 ++++++++++++++++++++++++++++++++++
tools/virsh-completer-domain.h | 8 +++-
tools/virsh-domain.c | 1 +
3 files changed, 79 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c
index fc4d7b2e52..15993064fa 100644
--- a/tools/virsh-completer-domain.c
+++ b/tools/virsh-completer-domain.c
@@ -32,6 +32,9 @@
#include "virperf.h"
#include "virbitmap.h"
#include "virkeycode.h"
+#include "virkeynametable_linux.h"
+#include "virkeynametable_osx.h"
+#include "virkeynametable_win32.h"
char **
virshDomainNameCompleter(vshControl *ctl,
@@ -800,3 +803,72 @@ virshCodesetNameCompleter(vshControl *ctl G_GNUC_UNUSED,
return g_steal_pointer(&tmp);
}
+
+
+char **
+virshKeycodeNameCompleter(vshControl *ctl,
+ const vshCmd *cmd,
+ unsigned int flags)
+{
+ g_auto(GStrv) tmp = NULL;
+ size_t i = 0;
+ size_t j = 0;
+ const char *codeset_option;
+ int codeset;
+ const char **names = NULL;
+ size_t len;
+
+ virCheckFlags(0, NULL);
+
+ if (vshCommandOptStringQuiet(ctl, cmd, "codeset", &codeset_option) <= 0)
+ codeset_option = "linux";
+
+ if (STREQ(codeset_option, "rfb"))
+ codeset_option = "qnum";
+
+ codeset = virKeycodeSetTypeFromString(codeset_option);
+
+ if (codeset < 0)
+ return NULL;
+
+ switch ((virKeycodeSet) codeset) {
+ case VIR_KEYCODE_SET_LINUX:
+ names = virKeyNameTable_linux;
+ len = virKeyNameTable_linux_len;
+ break;
+ case VIR_KEYCODE_SET_OSX:
+ names = virKeyNameTable_osx;
+ len = virKeyNameTable_osx_len;
+ break;
+ case VIR_KEYCODE_SET_WIN32:
+ names = virKeyNameTable_win32;
+ len = virKeyNameTable_win32_len;
+ break;
+ case VIR_KEYCODE_SET_XT:
+ case VIR_KEYCODE_SET_ATSET1:
+ case VIR_KEYCODE_SET_ATSET2:
+ case VIR_KEYCODE_SET_ATSET3:
+ case VIR_KEYCODE_SET_XT_KBD:
+ case VIR_KEYCODE_SET_USB:
+ case VIR_KEYCODE_SET_QNUM:
+ case VIR_KEYCODE_SET_LAST:
+ break;
+ }
+
+ if (!names)
+ return NULL;
+
+ tmp = g_new0(char *, len + 1);
+
+ for (i = 0; i < len; i++) {
+ if (!names[i])
+ continue;
+
+ tmp[j] = g_strdup(names[i]);
+ j++;
+ }
+
+ tmp = g_renew(char *, tmp, j + 1);
+
+ return g_steal_pointer(&tmp);
+}
diff --git a/tools/virsh-completer-domain.h b/tools/virsh-completer-domain.h
index 4c01b0ca1f..04a3705ff9 100644
--- a/tools/virsh-completer-domain.h
+++ b/tools/virsh-completer-domain.h
@@ -112,5 +112,9 @@ char ** virshDomainLifecycleActionCompleter(vshControl *ctl,
unsigned int flags);
char ** virshCodesetNameCompleter(vshControl *ctl,
- const vshCmd *cmd,
- unsigned int flags);
+ const vshCmd *cmd,
+ unsigned int flags);
+
+char ** virshKeycodeNameCompleter(vshControl *ctl,
+ const vshCmd *cmd,
+ unsigned int flags);
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index d40995f44d..df33467646 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -8802,6 +8802,7 @@ static const vshCmdOptDef opts_send_key[] = {
{.name = "keycode",
.type = VSH_OT_ARGV,
.flags = VSH_OFLAG_REQ,
+ .completer = virshKeycodeNameCompleter,
.help = N_("the key code")
},
{.name = NULL}
--
2.29.2
3 years, 6 months
[PATCH 00/19] qemu: migrate block bitmaps when migrating storage
by Peter Krempa
When we are copying storage we should also preserve the block dirty
bitmaps. This series implements their migration.
For standard migration with shared storage we let qemu flush the bitmaps
to disk and reload them on destination. There is possibility to migrate
them using the migration stream too but it's not implemented in this
series.
Note that the first patch depends on the following qemu patches:
https://lists.gnu.org/archive/html/qemu-devel/2021-02/msg03659.html
We can now also formulate the condition for enabling incremental backup
feature, but it still depends on stabilization of 'blockdev-reopen'.
Peter Krempa (19):
qemucapabilitiesdata: Update test data for qemu-6.0 on x86_64
qemu: capabilities: Introduce
QEMU_CAPS_MIGRATION_PARAM_BLOCK_BITMAP_MAPPING
qemu: Probe whether an image is 'qcow2 v2' from
query-named-block-nodes
virDomainMigrateVersion3Full: Don't set 'cancelled' to the same value
qemuMigrationSrcPerformPeer2Peer3: Don't leak 'dom_xml' on cleanup
testutils: virTestRewrapFile: Rewrap also '.argv' files
storagevolxml2argvdata: Rewrap all output files
storage: Format qcow2v3 volumes by default
qemu: monitor: Introduce qemuMonitorBitmapRemove
qemu: blockjob: Use qemuMonitorBitmapRemove for single bitmap removal
qemu: migration_params: Add infrastructure for 'dirty-bitmaps'
migration feature
qemu: migration_cookie: Add XML handling for setting up bitmap
migration
qemu: migration_cookie: Add helpers for transforming the cookie into
migration params
qemu: domain: Store list of temporary bitmaps for migration in status
XML
tests: qemustatusxml2xml: Add status XML from migration with bitmaps
tests: qemumigrationcookie: Add testing for block dirty bitmap
migration
qemu: migration: Clean up temporary bitmaps when cancelling a
migration
qemu: migration: Migrate block dirty bitmaps corresponding to
checkpoints
qemu: capabilities: Enable QEMU_CAPS_INCREMENTAL_BACKUP
src/libvirt-domain.c | 2 -
src/qemu/qemu_blockjob.c | 24 +-
src/qemu/qemu_capabilities.c | 8 +-
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_domain.c | 90 ++-
src/qemu/qemu_domain.h | 15 +
src/qemu/qemu_migration.c | 366 ++++++++++-
src/qemu/qemu_migration_cookie.c | 249 ++++++++
src/qemu/qemu_migration_cookie.h | 41 ++
src/qemu/qemu_migration_params.c | 24 +
src/qemu/qemu_migration_params.h | 5 +
src/qemu/qemu_monitor.c | 13 +
src/qemu/qemu_monitor.h | 8 +
src/qemu/qemu_monitor_json.c | 35 ++
src/qemu/qemu_monitor_json.h | 6 +
src/storage/storage_util.c | 2 +-
tests/meson.build | 2 +-
tests/qemublocktest.c | 2 +
tests/qemublocktestdata/bitmap/synthetic.json | 2 +-
tests/qemublocktestdata/bitmap/synthetic.out | 1 +
.../caps_6.0.0.x86_64.replies | 510 +++++++++-------
.../caps_6.0.0.x86_64.xml | 16 +-
.../nbd-bitmaps-xml2xml-in.xml | 52 ++
.../nbd-bitmaps-xml2xml-migparams.json | 25 +
.../nbd-bitmaps-xml2xml-out.xml | 51 ++
tests/qemumigrationcookiexmltest.c | 166 ++++-
tests/qemumonitorjsontest.c | 2 +
.../migration-out-nbd-bitmaps-in.xml | 574 ++++++++++++++++++
.../migration-out-nbd-bitmaps-out.xml | 1 +
tests/qemustatusxml2xmltest.c | 1 +
tests/storagevolxml2argvdata/iso-input.argv | 6 +-
tests/storagevolxml2argvdata/iso.argv | 4 +-
.../logical-from-qcow2.argv | 6 +-
tests/storagevolxml2argvdata/luks-cipher.argv | 8 +-
.../luks-convert-encrypt.argv | 23 +-
.../luks-convert-encrypt2fileqcow2.argv | 21 +-
.../luks-convert-encrypt2fileraw.argv | 20 +-
.../luks-convert-qcow2.argv | 21 +-
.../storagevolxml2argvdata/luks-convert.argv | 20 +-
tests/storagevolxml2argvdata/luks.argv | 8 +-
tests/storagevolxml2argvdata/qcow2-1.1.argv | 8 +-
.../storagevolxml2argvdata/qcow2-compat.argv | 8 +-
.../qcow2-from-logical-compat.argv | 8 +-
tests/storagevolxml2argvdata/qcow2-lazy.argv | 9 +-
.../qcow2-luks-convert-encrypt.argv | 2 +-
.../qcow2-luks-convert-encrypt2fileqcow2.argv | 2 +-
tests/storagevolxml2argvdata/qcow2-luks.argv | 2 +-
...ow2-nobacking-convert-prealloc-compat.argv | 10 +-
.../qcow2-nobacking-prealloc-compat.argv | 8 +-
.../qcow2-nocapacity-convert-prealloc.argv | 9 +-
.../qcow2-nocapacity.argv | 6 +-
.../qcow2-nocow-compat.argv | 9 +-
tests/storagevolxml2argvdata/qcow2-nocow.argv | 9 +-
.../qcow2-zerocapacity.argv | 5 +-
tests/testutils.c | 1 +
55 files changed, 2170 insertions(+), 357 deletions(-)
create mode 100644 tests/qemumigrationcookiexmldata/nbd-bitmaps-xml2xml-in.xml
create mode 100644 tests/qemumigrationcookiexmldata/nbd-bitmaps-xml2xml-migparams.json
create mode 100644 tests/qemumigrationcookiexmldata/nbd-bitmaps-xml2xml-out.xml
create mode 100644 tests/qemustatusxml2xmldata/migration-out-nbd-bitmaps-in.xml
create mode 120000 tests/qemustatusxml2xmldata/migration-out-nbd-bitmaps-out.xml
--
2.29.2
3 years, 6 months
[libvirt PATCH 0/4] Coverity diaries
by Ján Tomko
Ján Tomko (4):
security: dac: remove leftover virPCIDeviceFree
qemu: saveimage: only steal domXML on success
qemu: monitor: clear cpu props properly in CPUInfoClear
hyperv: check return value of virUUIDGenerate
src/hyperv/hyperv_driver.c | 4 +++-
src/qemu/qemu_monitor.c | 1 +
src/qemu/qemu_saveimage.c | 3 +--
src/security/security_dac.c | 5 ++---
4 files changed, 7 insertions(+), 6 deletions(-)
--
2.26.2
3 years, 6 months
[PATCH] qemu_driver.c: Coverity fix in qemuNodeDeviceDetachFlags()
by Daniel Henrique Barboza
Commit 76f47889326c4 made qemuNodeDeviceDetachFlags() unusable due to an
'if then else if' chain that will always results in a 'return -1',
regardless of 'driverName' input. This slipped through review process
and Gitlab CI, making it clear now that there is no unit tests
exercising this code ATM.
LUckily John Ferlan caught this up with his Coverity scan and spared us
from an unneeded headache later on.
Fixes: 76f47889326c45d2732711bc6dd5751aaf6e5194
Reported-by: John Ferlan <jferlan(a)redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/qemu/qemu_driver.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f1035a536e..b9bbdf8d48 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11998,7 +11998,6 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev,
unsigned int flags)
{
virQEMUDriverPtr driver = dev->conn->privateData;
- bool vfio = qemuHostdevHostSupportsPassthroughVFIO();
virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
virCheckFlags(0, -1);
@@ -12006,22 +12005,27 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev,
if (!driverName)
driverName = "vfio";
- if (STREQ(driverName, "vfio") && !vfio) {
- virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
- _("VFIO device assignment is currently not "
- "supported on this system"));
- return -1;
- } else if (STREQ(driverName, "kvm")) {
+ /* Only the 'vfio' driver is supported and a special error message for
+ * the previously supported 'kvm' driver is provided below. */
+ if (STRNEQ(driverName, "vfio") && STRNEQ(driverName, "kvm")) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("unknown driver name '%s'"), driverName);
+ return -1;
+ }
+
+ if (STREQ(driverName, "kvm")) {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
_("KVM device assignment is no longer "
"supported on this system"));
return -1;
- } else {
- virReportError(VIR_ERR_INVALID_ARG,
- _("unknown driver name '%s'"), driverName);
- return -1;
}
+ if (!qemuHostdevHostSupportsPassthroughVFIO()) {
+ virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+ _("VFIO device assignment is currently not "
+ "supported on this system"));
+ return -1;
+ }
/* virNodeDeviceDetachFlagsEnsureACL() is being called by
* virDomainDriverNodeDeviceDetachFlags() */
--
2.29.2
3 years, 6 months
[libvirt PATCH] esx: use g_autofree for datastoreRelatedPath
by Ján Tomko
Reported by Coverity.
Fixes: 213662813cd846d045be8857dc7b917d33a40989
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
Pushed as trivial.
src/esx/esx_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index e49975de86..96cc8bda0d 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -2886,7 +2886,7 @@ esxDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
g_autofree char *escapedName = NULL;
g_auto(virBuffer) buffer = VIR_BUFFER_INITIALIZER;
g_autofree char *url = NULL;
- char *datastoreRelatedPath = NULL;
+ g_autofree char *datastoreRelatedPath = NULL;
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *hostSystem = NULL;
esxVI_ManagedObjectReference *resourcePool = NULL;
--
2.26.2
3 years, 6 months
[PATCH v2 00/10] reduce code duplication in NodeDevice driver
by Daniel Henrique Barboza
changes from v1:
- added Jano's R-b in patches 1-9
- Patch 08:
* clarified why the 'Flags' suffix was kept in the helper name
- (new) Patch 10: change check-aclrules to verify ACL checks in
domain_driver.c
v1 link: https://www.redhat.com/archives/libvir-list/2021-February/msg00065.html
Daniel Henrique Barboza (10):
qemu, libxl, hypervisor: use virDomainDriverNodeDeviceReset() helper
datatypes.h: register AUTOPTR_CLEANUP_FUNC for virNodeDevicePtr
domain_driver.c: use g_auto* in virDomainDriverNodeDeviceReset()
qemu, libxl, hypervisor: use virDomainDriverNodeDeviceReAttach()
helper
domain_driver.c: use g_auto* in virDomainDriverNodeDeviceReAttach()
libxl_driver.c: validate 'driverName' earlier in
libxlNodeDeviceDetachFlags()
qemu_driver.c: validate 'driverName' earlier in
qemuNodeDeviceDetachFlags()
qemu, libxl, hypervisor: use virDomainDriverNodeDeviceDetachFlags()
helper
domain_driver.c: use g_auto* in virDomainDriverNodeDeviceDetachFlags()
scripts/check-aclrules.py: check ACL for domain_driver.c ACL callers
scripts/check-aclrules.py | 25 ++++-
src/datatypes.h | 2 +
src/hypervisor/domain_driver.c | 147 +++++++++++++++++++++++++++++
src/hypervisor/domain_driver.h | 11 +++
src/hypervisor/meson.build | 3 +
src/libvirt_private.syms | 3 +
src/libxl/libxl_driver.c | 164 +++------------------------------
src/qemu/qemu_driver.c | 164 ++++-----------------------------
8 files changed, 218 insertions(+), 301 deletions(-)
--
2.26.2
3 years, 6 months
Plans for the next release
by Jiri Denemark
We are getting close to the next release of libvirt. To aim for the
release on Mar 01 I suggest entering the freeze on Monday Feb 22 and
tagging RC2 on Thursday Feb 25.
I hope this works for everyone.
Jirka
3 years, 6 months
[PATCH] qemuBlockDiskDetectNodes: just return when alias is null
by Yi Li
Just Return when alias is null and Remove the 'ret' variable.
Signed-off-by: Yi Li <yili(a)winhong.com>
---
src/qemu/qemu_block.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 0b8ca2a3f5..32b6500a3d 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -280,25 +280,22 @@ qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk,
qemuBlockNodeNameBackingChainDataPtr entry = NULL;
virStorageSourcePtr src = disk->src;
g_autofree char *alias = NULL;
- int ret = -1;
/* don't attempt the detection if the top level already has node names */
if (src->nodeformat || src->nodestorage)
return 0;
if (!(alias = qemuAliasDiskDriveFromDisk(disk)))
- goto cleanup;
+ return 0;
- if (!(entry = virHashLookup(disktable, alias))) {
- ret = 0;
- goto cleanup;
- }
+ if (!(entry = virHashLookup(disktable, alias)))
+ return 0;
while (virStorageSourceIsBacking(src) && entry) {
if (src->nodeformat || src->nodestorage) {
if (STRNEQ_NULLABLE(src->nodeformat, entry->nodeformat) ||
STRNEQ_NULLABLE(src->nodestorage, entry->nodestorage))
- goto cleanup;
+ goto error;
break;
} else {
@@ -310,13 +307,11 @@ qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk,
src = src->backingStore;
}
- ret = 0;
-
- cleanup:
- if (ret < 0)
- qemuBlockDiskClearDetectedNodes(disk);
+ return 0;
- return ret;
+ error:
+ qemuBlockDiskClearDetectedNodes(disk);
+ return -1;
}
--
2.25.3
3 years, 6 months
[PATCH v3 0/1] rpc: avoid crash when system time jump back
by BiaoxiangYe
From: BiaoXiang Ye <yebiaoxiang(a)huawei.com>
use G_USEC_PER_SEC instead of self-defining macro
v2:
- using monotonic timer instead of detecting a jump backwards
BiaoXiang Ye (1):
rpc: avoid crash when system time jump back
src/rpc/virkeepalive.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
--
2.23.0
3 years, 6 months
[libvirt PATCH] qemu_validate: Allow kvm hint-dedicated on non-passthrough VMs
by Tim Wiederhake
A VM defined similar to:
...
<features><kvm><hint-dedicated state='on'/></kvm></features>
<cpu mode="host-model"/>
...
is currently invalid, as hint-dedicated is only allowed if cpu mode
is host-passthrough. This restriction is unnecessary, see
https://bugzilla.redhat.com/show_bug.cgi?id=1857671.
Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/qemu/qemu_validate.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index a060bd98ba..c58d221cf8 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -253,16 +253,6 @@ qemuValidateDomainDefFeatures(const virDomainDef *def,
}
break;
- case VIR_DOMAIN_FEATURE_KVM:
- if (def->kvm_features[VIR_DOMAIN_KVM_DEDICATED] == VIR_TRISTATE_SWITCH_ON &&
- (!def->cpu || def->cpu->mode != VIR_CPU_MODE_HOST_PASSTHROUGH)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("kvm-hint-dedicated=on is only applicable "
- "for cpu host-passthrough"));
- return -1;
- }
- break;
-
case VIR_DOMAIN_FEATURE_VMPORT:
if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT &&
!virQEMUCapsSupportsVmport(qemuCaps, def)) {
@@ -335,6 +325,7 @@ qemuValidateDomainDefFeatures(const virDomainDef *def,
}
break;
+ case VIR_DOMAIN_FEATURE_KVM:
case VIR_DOMAIN_FEATURE_XEN:
case VIR_DOMAIN_FEATURE_ACPI:
case VIR_DOMAIN_FEATURE_PAE:
--
2.26.2
3 years, 6 months