[PATCH v2 0/1] Expose availability of SEV-ES
by Takashi Kajinami
This introduces the new "model" field in sev elements so that clients can
check whether SEV-ES, the 2nd generation of AMD SEV, is available in
the taget hyprvisor. There is the maxESGuests field (along with the maxGuests
field) but this field does not explain whether SEV-ES is actually
enabled in KVM.
Takashi Kajinami (1):
Expose available AMD SEV models in domain capabilities
Changes since v1:
* Fixed one code path where available models are not added
* Fixed missing update of "report" flag
* Updated the documentation to explain the new model field in addition
to the existing but undocumanted cpu0Id field
Takashi Kajinami (1):
Expose available AMD SEV models in domain capabilities
docs/formatdomaincaps.rst | 5 ++
src/conf/domain_capabilities.c | 2 +
src/conf/domain_capabilities.h | 1 +
src/conf/domain_conf.c | 7 +++
src/conf/domain_conf.h | 8 ++++
src/qemu/qemu_capabilities.c | 84 +++++++++++++++++++++++++---------
6 files changed, 85 insertions(+), 22 deletions(-)
--
2.43.0
5 months
[PATCH] formatstorage: Document qcow2 default version change
by Peter Krempa
Based on discussion after commit f432114d9c was pushed it was pointed
out that the documentation still mentions the older version.
Fix the documentation to state the new version and introduce ambiguity
for future updates.
Fixes: f432114d9cf507a4047aa9dc1344b1c13356db08
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
Posting this documentation update to document what happened rather than
introduce (almost pointless) complication in adding a config file which
is unlikely to be ever used.
docs/formatstorage.rst | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/docs/formatstorage.rst b/docs/formatstorage.rst
index 86e167d9cb..9d9a4143eb 100644
--- a/docs/formatstorage.rst
+++ b/docs/formatstorage.rst
@@ -700,10 +700,15 @@ host filesystem. It can contain the following child elements:
Encryption <formatstorageencryption.html>`__ page for more information.
``compat``
Specify compatibility level. So far, this is only used for ``type='qcow2'``
- volumes. Valid values are ``0.10`` and ``1.1`` so far, specifying QEMU
- version the images should be compatible with. If the ``feature`` element is
- present, 1.1 is used. :since:`Since 1.1.0` If omitted, 0.10 is used.
- :since:`Since 1.1.2`
+ volumes. Valid values are ``0.10`` (QCOW2 v2) and ``1.1`` (QCOW2 v3) so far.
+ The values were meant to specify QEMU version the images should be compatible
+ with.
+
+ The default, if the ``feature`` element is present is ``1.1``. :since:`Since 1.1.0`
+ If ``feature`` is not present, ``0.10`` was used :since:`Since 1.1.2` and
+ :since:`Since 10.2.0` ``1.1`` is used as it's the default of ``qemu-img``.
+
+ Any tool depending on a specific version should specify this field explicitly.
``nocow``
Turn off COW of the newly created volume. So far, this is only valid for a
file image in btrfs file system. It will improve performance when the file
--
2.44.0
5 months
[PATCH v2 00/20] node_dev_udev: use workerpool and improve nodedev events
by Marc Hartmayer
When an udev event occurs for a mediated device (mdev) the mdev config data
requires an update via mdevctl as the udev event does not contain all config
data. This update needs to occur immediately and to be finished before the
libvirt nodedev event is issued to keep the API usage reliable.
Changelog:
v1->v2:
+ squashed old patches 3 and 17 (comments from Jonathon and Boris)
+ added r-b's from Jonathon and Boris
+ worked in comments from Jonathon to old patch 15
+ added comment why only one worker can currently be used
+ added patch `node_device_udev: remove incorrect G_GNUC_UNUSED`
RFCv1->v1:
+ removed some of my own s-o-b's that were accidentally inserted in the RFC
+ added r-b's from Boris and Jonathon
+ worked in comments from Boris and Jonathon, but I did not inline
"nodeDeviceDefResetMdevActiveConfig" as I'm not sure whether this improves
the readability
+ reworked patch "[RFC PATCH v1 11/15] node_device_udev: Use
`stateShutdownPrepare` and `stateShutdownWait`"
+ reworked patch "node_device_udev: Use a worker pool for processing events and
emitting nodedev event"
+ added patches:
- node_device_udev: Move responsibility to release `(init|udev)Thread` to `udevEventDataDispose`
- node_device_udev: Fix leak of mdevctlLock, udevThreadCond, and mdevCtlMonitor
- node_device_udev: nodeStateShutdownPrepare: Disconnect the signals explicitly
- node_device_udev: Pass the driver state as parameter in prepartion for the next commit
- node_device_udev: Add support for `g_autoptr` to `udevEventData
- node_device_udev: Pass the `udevEventData` via parameter and use refcounting
Boris Fiuczynski (3):
nodedev: fix mdev add udev event data handling
nodedev: immediate update of active config on udev events
nodedev: reset active config data on udev remove event
Marc Hartmayer (17):
node_device_udev: Set @def to NULL
node_device_udev: Remove the timeout if the data is disposed
node_device_udev: Test for mdevctlTimeout != -1
node_device_udev: Don't take `mdevctlLock` for `mdevctl list` and add
comments about locking
node_device_udev: Take lock if `driver->privateData` is modified
node_device_udev: Add prefix `udev` for udev related data
node_device_udev: Inline `udevRemoveOneDevice`
node_device_udev: Move responsibility to release `(init|udev)Thread`
to `udevEventDataDispose`
node_device_udev: Fix leak of mdevctlLock, udevThreadCond, and
mdevCtlMonitors
node_device_udev: Introduce and use `stateShutdownPrepare` and
`stateShutdownWait`
node_device_udev: nodeStateShutdownPrepare: Disconnect the signals
explicitly
node_device_udev: Pass the driver state as parameter in preparation
for the next commit
node_device_udev: Use a worker pool for processing events and emitting
nodedev event
node_device_udev: Make the code easier to read
node_device_udev: Add support for `g_autoptr` to `udevEventData`
node_device_udev: Pass the `udevEventData` via parameter and use
refcounting
node_device_udev: remove incorrect G_GNUC_UNUSED
src/node_device/node_device_driver.h | 5 +-
src/util/virmdev.h | 4 +
src/conf/node_device_conf.c | 10 +-
src/node_device/node_device_driver.c | 28 +-
src/node_device/node_device_udev.c | 516 ++++++++++++++++++---------
src/test/test_driver.c | 11 +-
src/util/virmdev.c | 20 ++
src/libvirt_private.syms | 2 +
8 files changed, 398 insertions(+), 198 deletions(-)
base-commit: c38720b337f74337ec94c0fe2e97a7c2c57188ae
--
2.34.1
6 months
[libvirt PATCH 00/28] native support for nftables in virtual network driver
by Laine Stump
This patch series enables libvirt to use nftables rules rather than
iptables *when setting up virtual networks* (it does *not* add
nftables support to the nwfilter driver). It accomplishes this by
abstracting several iptables functions (from viriptables.[ch] called
by the virtual network driver into a rudimentary "virNetfilter API"
(in virnetfilter.[ch], having the virtual network driver call the
virNetFilter API rather than calling the existing iptables functions
directly, and then finally adding an equivalent virNftables backend
that can be used instead of iptables (selected manually via a
network.conf setting, or automatically if iptables isn't found on the
host).
A first look at the result may have you thinking that it's filled with
a lot of bad decisions. While I would agree with that in many cases, I
think that overall they are the "least bad" decisions, or at least
"bad within acceptable limits / no worse than something else", and
point out that it's been done in a way that minimizes (actually
eliminates) the need for immediate changes to nwfilter (the other
consumer of iptables, which *also* needs to be updated to use native
nftables), and makes it much easier to change our mind about the
details in the future.
When I first started on this (long, protracted, repeatedly interrupted
for extended periods - many of these patches are > a year old) task, I
considered doing an all-at-once complete replacement of iptables with
nftables, since all the Linux distros we support have had nftables for
several years, and I'm pretty sure nobody has it disabled (not even
sure if it's possible to disable nftables while still enabling
iptables, since they both use xtables in the kernel). But due to
libvirt's use of "-t mangle -j CHECKSUM --checksum-fill" (see commit
fd5b15ff all the way back in July 2010 for details) which has no
equivalent in nftables rules (and we don't *want* it to!!), and the
desire to be able to easily switch back to iptables in case of an
unforeseen regression, we decided that both iptables and nftables need
to be supported (for now), with the default (for now) remaining as
iptables.
Just allowing for dual backends complicated matters, since it means
that we have to have a config file, a setting, detection of which
backends are available, and of course some sort of concept of an
abstracted frontend that can use either backend based on the config
setting (and/or auto-detection). Combining that with the fact that it
would just be "too big" of a project to switch over nwfilter's
iptables usage at the same time means that we have to keep around a
lot of existing code for compatibility's sake rather than just wiping
it all away and starting over.
So, what I've ended up with is:
1) a network.conf file (didn't exist before) with a single setting
"firewall_backend". If unset, the network driver tries to use iptables
on the backend, and if that's missing, then tries to use nftables.
2) a new (internal-only, so transient!) virNetFilterXXX API that is
used by the network driver in place of the iptablesXXX API, and calls
either iptablesXXX or:
3) a virNftablesXXX API that exactly replicates the filtering rules of
the existing iptablesXXX API (except in the custom "libvirt" base
table rather than the system "filter" and "nat" tables). This means
that:
4) when the nftables backend is used, the rules added are *exactly the
same* (functionally speaking) as we currently add for iptables (except
they are in the "libvirt" table).
We had spent some time in IRC discussing different ways of using new
functionality available in nftables to make a more
efficient/performant implemention of the desired filtering, and there
are some really great possibilities that need to be explored, but in
the end there were too many details up in the air, and I decided that
it would be more "accomplishable" (coined a new word there!) to first
replicate existing behavior with nftables, but do it inside a
framework that makes it easy to modify the details in the future (in
particular making it painless to switch back and forth between builds
with differing filter models at runtime) - this way we'll be able to
separate the infrastructure work from the details of the rules (which
we can then more easily work on and experiment with). (This implies
that the main objective right now is "get rid of iptables
dependencies", not "make the filtering faster and more efficient").
Notable features of this patchset:
* allows switching between iptables/nftables backends without
rebooting or restarting networks/guests.
Because the commands required to remove a network's filter rules are
now saved in the network status XML, each time libvirtd (or
virtnetworkd) is restarted, it will execute exactly the commands
needed to remove the filter rules that had been added by the
previous libvirtd/virtnetworkd (rather than just making a guess, as
we've always done up until now), and then add new rules using the
current backend+binary's set of rules (while also saving the info
needed for future removal of these new rules back into the network's
status XML).
* firewall_backend can be explicitly set in (new)
/etc/libvirt/network.conf, but if it's not explicitly set, libvirt
will default to the iptables backend if the iptables binary is
found, and otherwise fall back to nftables as long as the nft
binary is found; otherwise the first attempt to start a network will
fail with an appropriate error.
Things that seem ugly / that I would like to clean up / that I think
are just fine as they are:
* virFirewall does *not* provide a backend-agnostic interface [this is fine]
* We need to maintain a backward-compatible API for virFirewall so
that we don't have to touch nwfilter code. Trying to make its API
backend-agnostic would require individually considering/changing
every nwfilter use of virFirewall.
* instead virFirewall objects are just a way to build a collection
of commands to execute to build a firewall, then execute them
while collecting info for and building a collection of commands
that will tear down that firewall in the future.
Do I want to "fix" this in the future by making virFirewall a higher
level interface that accepts tokens describing the type of rule to
add (rather than backend-specific arguments to a backend-specific
command)? No. I think I like the way virFirewall works (as
described in that previous bullet-point), instead I'm thinking that
it is just slightly mis-named - I've lately been thinking of it as a
"virNetFilterCmdList". Similarly, the virFirewallRules that it has a
list of aren't really "rules", they are better described as commands
or actions, so maybe they should be renamed to virNetfilterCmd or
virNetfilterAction. But that is just cosmetic, so I didn't want to
get into it in these patches (especially in case someone disagrees,
or has a better idea for naming).
* Speaking of renaming - I should probably rename all the
"iptablesXXX" functions to "virIptablesXXX" to be consistent with so
much of our other code. I lost the ambition to deal with it right
now though, so I'm leaving that for later cleanup (or I could do it
now if it really makes someone's day :-).
* I could have chosen a higher place in the callchain to make the
virNetfilter abstraction, e.g. at the level of
"networkAddXXXFirewallRules()" rather than at the lower level of
iptablesXXX(). That is actually probably what will happen in the
future (since it will be necessary in order for an nftables-based
firewall to be significantly different in structure from an
iptables-based firewall). But that's the beauty of an API being
private - we can freely add/remove things as needed. the important
thing is that we now have the basic structure there.
For now, the split is just above the existing iptablesXXX API
(util/viriptables.[ch], which seems like a "narrow" enough
place. Most iptablesXXX functions are written in terms of just 10
*other* iptablesXXX functions that add iptables-specific commands -
I've just moved those functions into virnetfilter.[ch]
(appropriately renamed), and changed them to call the 10
virNetfilterXXX functions that will in-turn call those 10
iptablesXXX (or equivalent virNftablesXXX) functions.
* Some people may dislike that the 10 virNetfilterXXX functions are
each written with a switch statement that has cases to directly call
each backend, rather than each backend driver having a table of
pointers to API functions, with the virNetfilter API function
calling backends[fwBackend]->XXX() (ie the pattern for so many
drivers in libvirt). But for just 2 backends, that really seemed
like overkill and unnecessary obfuscation.
* As implemented here, I am storing a "<fwRemoval>" element in the
network status XML - it contains a serialized virFirewall object
that directly contains the commands necessary to remove the
firewall. I could instead just store "<firewall>", which would
include all the commands that were used to *create* the firewall in
addition to the commands needed to remove the firewall. The way it's
done currently takes up less space; switching to storing the full
firewall *might* be more informative to somebody, but on the other
hand would make the network status XML *very* long. If anybody has
an opinion about this, now is the time to bring it up - do you think
it's worth having a separate list of all the commands that were used
to create a network's firewall (keeping in mind that there is no
public API to access it)? Or is it enough to just store what's
needed to remove the firewall?
* Several months ago Eric Garver posted patches for a pure firewalld
backend, and I requested that they not be pushed because I wanted
that to be integrated with my nftables backend support. Due to the
fact that the firewalld backend is almost entirely implemented by
putting the bridge into a new firewalld "zone", with no individual
rules added, that won't happen as just another backend driver file
in parallel to iptables and nftables; it will instead work by
checking firewall_backend at a higher level in the network driver,
thus avoiding the calls to virNetfilterXXX() entirely. I have
locally merged Eric's patches over the top of these patches, and
there are surprisingly few conflicts, but since his patches didn't
account for a user-settable config (but instead just always used the
firewalld backend if firewalld was active), some of the patches are
going to require a bit of rework, which I'll take care of after
getting these patches in.
Laine Stump (28):
util: add -w/--concurrent when applying the rule rather than when
building it
util: new virFirewallRuleGet*() APIs
util: determine ignoreErrors value when creating rule, not when
applying
util: rename iptables helpers that will become the frontend for
ip&nftables
util: move backend-agnostic virNetfilter*() functions to their own
file
util: make netfilter action a proper typedefed (virFirewall) enum
util: #define the names used for private packet filter chains
util: move/rename virFirewallApplyRuleDirect to
virIptablesApplyFirewallRule
util/network: reintroduce virFirewallBackend, but different
network: add (empty) network.conf file to distribution files
network: allow setting firewallBackend from network.conf
network: do not add DHCP checksum mangle rule unless using iptables
network: call backend agnostic function to init private filter chains
util: setup functions in virnetfilter which will call appropriate
backend
build: add nft to the list of binaries we attempt to locate
util: add nftables backend to virnetfilter API used by network driver
tests: test cases for nftables backend
util: new functions to support adding individual rollback rules
util: check for 0 args when applying iptables rule
util: implement rollback rule autosave for iptables backend
util: implement rollback rule autosave for nftables backend
network: turn on auto-rollback for the rules added for virtual
networks
util: new function virFirewallNewFromRollback()
util: new functions virFirewallParseXML() and virFirewallFormat()
conf: add a virFirewall object to virNetworkObj
network: use previously saved list of firewall rules when removing
network: save network status when firewall rules are reloaded
network: improve log message when reloading virtual network firewall
rules
libvirt.spec.in | 5 +
meson.build | 1 +
po/POTFILES | 2 +
src/conf/virnetworkobj.c | 40 +
src/conf/virnetworkobj.h | 11 +
src/libvirt_private.syms | 68 +-
src/network/bridge_driver.c | 40 +-
src/network/bridge_driver_conf.c | 44 +
src/network/bridge_driver_conf.h | 3 +
src/network/bridge_driver_linux.c | 241 +++--
src/network/bridge_driver_nop.c | 6 +-
src/network/bridge_driver_platform.h | 6 +-
src/network/libvirtd_network.aug | 39 +
src/network/meson.build | 11 +
src/network/network.conf | 24 +
src/network/test_libvirtd_network.aug.in | 5 +
src/nwfilter/nwfilter_ebiptables_driver.c | 16 +-
src/util/meson.build | 2 +
src/util/virebtables.c | 4 +-
src/util/virfirewall.c | 490 ++++++++--
src/util/virfirewall.h | 51 +-
src/util/viriptables.c | 762 ++++-----------
src/util/viriptables.h | 222 ++---
src/util/virnetfilter.c | 892 ++++++++++++++++++
src/util/virnetfilter.h | 159 ++++
src/util/virnftables.c | 698 ++++++++++++++
src/util/virnftables.h | 118 +++
.../{base.args => base.iptables} | 0
tests/networkxml2firewalldata/base.nftables | 256 +++++
...-linux.args => nat-default-linux.iptables} | 0
.../nat-default-linux.nftables | 248 +++++
...pv6-linux.args => nat-ipv6-linux.iptables} | 0
.../nat-ipv6-linux.nftables | 384 ++++++++
...rgs => nat-ipv6-masquerade-linux.iptables} | 0
.../nat-ipv6-masquerade-linux.nftables | 456 +++++++++
...linux.args => nat-many-ips-linux.iptables} | 0
.../nat-many-ips-linux.nftables | 472 +++++++++
...-linux.args => nat-no-dhcp-linux.iptables} | 0
.../nat-no-dhcp-linux.nftables | 384 ++++++++
...ftp-linux.args => nat-tftp-linux.iptables} | 0
.../nat-tftp-linux.nftables | 274 ++++++
...inux.args => route-default-linux.iptables} | 0
.../route-default-linux.nftables | 162 ++++
tests/networkxml2firewalltest.c | 56 +-
tests/virfirewalltest.c | 20 +-
45 files changed, 5718 insertions(+), 954 deletions(-)
create mode 100644 src/network/libvirtd_network.aug
create mode 100644 src/network/network.conf
create mode 100644 src/network/test_libvirtd_network.aug.in
create mode 100644 src/util/virnetfilter.c
create mode 100644 src/util/virnetfilter.h
create mode 100644 src/util/virnftables.c
create mode 100644 src/util/virnftables.h
rename tests/networkxml2firewalldata/{base.args => base.iptables} (100%)
create mode 100644 tests/networkxml2firewalldata/base.nftables
rename tests/networkxml2firewalldata/{nat-default-linux.args => nat-default-linux.iptables} (100%)
create mode 100644 tests/networkxml2firewalldata/nat-default-linux.nftables
rename tests/networkxml2firewalldata/{nat-ipv6-linux.args => nat-ipv6-linux.iptables} (100%)
create mode 100644 tests/networkxml2firewalldata/nat-ipv6-linux.nftables
rename tests/networkxml2firewalldata/{nat-ipv6-masquerade-linux.args => nat-ipv6-masquerade-linux.iptables} (100%)
create mode 100644 tests/networkxml2firewalldata/nat-ipv6-masquerade-linux.nftables
rename tests/networkxml2firewalldata/{nat-many-ips-linux.args => nat-many-ips-linux.iptables} (100%)
create mode 100644 tests/networkxml2firewalldata/nat-many-ips-linux.nftables
rename tests/networkxml2firewalldata/{nat-no-dhcp-linux.args => nat-no-dhcp-linux.iptables} (100%)
create mode 100644 tests/networkxml2firewalldata/nat-no-dhcp-linux.nftables
rename tests/networkxml2firewalldata/{nat-tftp-linux.args => nat-tftp-linux.iptables} (100%)
create mode 100644 tests/networkxml2firewalldata/nat-tftp-linux.nftables
rename tests/networkxml2firewalldata/{route-default-linux.args => route-default-linux.iptables} (100%)
create mode 100644 tests/networkxml2firewalldata/route-default-linux.nftables
--
2.39.2
6 months, 1 week
[PATCH RFC v2 00/12] Support throttle block filters
by wucf@linux.ibm.com
From: Chun Feng Wu <wucf(a)linux.ibm.com>
Hi,
I am thinking to leverage "throttle block filter" in QEMU to support more flexible I/O limits(e.g. tiered I/O groups), one sample provided by QEMU doc is:
https://github.com/qemu/qemu/blob/master/docs/throttle.txt
"For example, let's say that we have three different drives and we want to set I/O limits for
each one of them and an additional set of limits for the combined I/O of all three drives."
The implementation idea is to
- Define throttle groups(limit) in domain
- Define throttle filter to reference throttle group within disk
- Within domain disk, throttle filters references multiple throttle groups to form filter chain to apply multiple limits in QEMU like above sample
- Add new virsh cmds for throttle group management:
throttlegroupset Add or update a throttling group.
throttlegroupdel Delete a throttling group.
throttlegroupinfo Get a throttling group.
throttlegrouplist list all domain throttlegroups
- Update "attach-disk" to add one more option "--throttle-groups" to apply throttle filters e.g. "virsh attach-disk $VM_ID ${DISK_PATH}/vm1_disk_2.qcow2 vdd --driver qemu --subdriver qcow2 --targetbus virtio --throttle-groups limit2,limit012"
- I chose above semantics as I felt they're appropriate, if there are better ones please kindly suggest.
This patchset includes:
- Throttle group and throttle filter definition in patch 1
- New QMP processing to update and get throttle group in patch 2
- New API definition and implementation in patch 3
- QEMU driver implementation in patch 4
- Hotplug and qemuProcessLaunch flow implemenation in patch 5,6
- Domain XML schema and doc(formatdomain.rst) change in patch 7
- Tests in patch 8,9
- Virsh cmd implementation in patch 10
- Other verification implementation in patch 11, 12
v2 changes:
- fix failure caused by "check-remote_protocol" between patch 3 and patch 9 in v1
- make sure coding style is consistent about function declaration
- patch 3 in v1 is splitted into two commits: "remote: New APIs for ThrottleGroup lifecycle management" and "qemu: Implement qemu driver for throttle API"
- replace "// comment" with "/* comment */"
- avoid empty 'cleanup' labels
- use "virJSONValueObjectAdd(&limits, "P:name", value)" to avoid introducing extra helper, and check return value
- preserve spacing between blocks of code which are not related
- remove "VSH_OT_ALIAS" section for new cmds in virsh_domain.c
From QMP perspective, the sample flow works this way:
- Throttle group creation:
virsh qemu-monitor-command 1 '{"execute":"object-add", "arguments":{"qom-type":"throttle-group","id":"limit0","limits":{"iops-total":200,"iops-read":0,"iops-total-max":200,"iops-total-max-length":1}}}'
virsh qemu-monitor-command 1 '{"execute":"object-add", "arguments":{"qom-type":"throttle-group","id":"limit1","limits":{"iops-total":250,"iops-read":0,"iops-total-max":250,"iops-total-max-length":1}}}'
virsh qemu-monitor-command 1 '{"execute":"object-add", "arguments":{"qom-type":"throttle-group","id":"limit2","limits":{"iops-total":300,"iops-read":0,"iops-total-max":300,"iops-total-max-length":1}}}'
virsh qemu-monitor-command 1 '{"execute":"object-add", "arguments":{"qom-type":"throttle-group","id":"limit012","limits":{"iops-total":400,"iops-read":0,"iops-total-max":400,"iops-total-max-length":1}}}'
- Chain up filters during attaching disk to apply two filters(limit0 and limit012):
virsh qemu-monitor-command 1 '{"execute":"blockdev-add", "arguments": {"driver":"file","filename":"/virt/disks/vm1_disk_1.qcow2","node-name":"test-3-storage","auto-read-only":true,"discard":"unmap"}}'
virsh qemu-monitor-command 1 '{"execute":"blockdev-add", "arguments":{"node-name":"test-3-format","read-only":false,"driver":"qcow2","file":"test-3-storage","backing":null}}'
virsh qemu-monitor-command 1 '{"execute":"blockdev-add", "arguments":{"driver":"throttle","node-name":"libvirt-5-filter","throttle-group": "limit0","file":"test-3-format"}}'
virsh qemu-monitor-command 1 '{"execute":"blockdev-add", "arguments": {"driver":"throttle","node-name":"libvirt-6-filter","throttle-group":"limit012","file":"libvirt-5-filter"}}'
virsh qemu-monitor-command 1 '{"execute": "device_add", "arguments": {"driver":"virtio-blk-pci","scsi":false,"bus":"pci.0","addr":"0x5","drive":"libvirt-6-filter","id":"virtio-disk1"}}'
Any comments/suggestions will be appriciated!
Chun Feng Wu (10):
config: Introduce ThrottleGroup and ThrottleFilter
qemu: monitor: Add support for ThrottleGroup operations
remote: New APIs for ThrottleGroup lifecycle management
qemu: Implement qemu driver for throttle API
qemu: hotplug: Support hot attach block disk along with throttle
filters
qemu: command: Support throttle groups and filters during
qemuProcessLaunch
schema: Add new domain elements to support multiple throttle filters
test: Test throttle group lifecycle APIs
tests: Test qemuMonitorJSONGetThrottleGroup and
qemuMonitorJSONUpdateThrottleGroup
virsh: Add support for throttle group operations
Hao Ning Xin (1):
config: validate: Verify throttle group fields
Yan Xiu Wu (1):
config: validate: Use "iotune" and "throttlefilters" exclusively for
specific disk
docs/formatdomain.rst | 48 ++
include/libvirt/libvirt-domain.h | 29 +
src/conf/domain_conf.c | 386 +++++++++++++
src/conf/domain_conf.h | 54 ++
src/conf/domain_validate.c | 120 ++--
src/conf/schemas/domaincommon.rng | 164 +++++-
src/conf/virconftypes.h | 4 +
src/driver-hypervisor.h | 22 +
src/libvirt-domain.c | 190 +++++++
src/libvirt_private.syms | 9 +
src/libvirt_public.syms | 7 +
src/qemu/qemu_block.c | 131 +++++
src/qemu/qemu_block.h | 53 ++
src/qemu/qemu_command.c | 158 ++++++
src/qemu/qemu_command.h | 9 +
src/qemu/qemu_domain.c | 85 +++
src/qemu/qemu_domain.h | 15 +
src/qemu/qemu_driver.c | 529 ++++++++++++++++++
src/qemu/qemu_hotplug.c | 24 +
src/qemu/qemu_monitor.c | 34 ++
src/qemu/qemu_monitor.h | 14 +
src/qemu/qemu_monitor_json.c | 151 +++++
src/qemu/qemu_monitor_json.h | 14 +
src/remote/remote_daemon_dispatch.c | 61 ++
src/remote/remote_driver.c | 49 ++
src/remote/remote_protocol.x | 50 +-
src/remote_protocol-structs | 30 +
src/test/test_driver.c | 382 +++++++++++++
tests/qemumonitorjsontest.c | 88 +++
.../qemustatusxml2xmldata/backup-pull-in.xml | 1 +
.../blockjob-blockdev-in.xml | 1 +
.../blockjob-mirror-in.xml | 1 +
.../migration-in-params-in.xml | 1 +
.../migration-out-nbd-bitmaps-in.xml | 1 +
.../migration-out-nbd-out.xml | 1 +
.../migration-out-nbd-tls-out.xml | 1 +
.../migration-out-params-in.xml | 1 +
tests/qemustatusxml2xmldata/modern-in.xml | 1 +
tests/qemustatusxml2xmldata/upgrade-out.xml | 1 +
.../qemustatusxml2xmldata/vcpus-multi-in.xml | 1 +
tools/virsh-completer-domain.c | 64 +++
tools/virsh-completer-domain.h | 10 +
tools/virsh-domain.c | 471 ++++++++++++++++
43 files changed, 3430 insertions(+), 36 deletions(-)
--
2.34.1
6 months, 1 week
[PATCH-for-9.1 v2 0/3] rdma: Remove RDMA subsystem and pvrdma device
by Philippe Mathieu-Daudé
Since v1:
- split in 3 (Thomas)
- justify gluster removal
Philippe Mathieu-Daudé (3):
hw/rdma: Remove pvrdma device and rdmacm-mux helper
migration: Remove RDMA protocol handling
block/gluster: Remove RDMA protocol handling
MAINTAINERS | 17 -
docs/about/deprecated.rst | 9 -
docs/about/removed-features.rst | 4 +
docs/devel/migration/main.rst | 6 -
docs/pvrdma.txt | 345 --
docs/rdma.txt | 420 --
docs/system/device-url-syntax.rst.inc | 4 +-
docs/system/loongarch/virt.rst | 2 +-
docs/system/qemu-block-drivers.rst.inc | 1 -
meson.build | 59 -
qapi/machine.json | 17 -
qapi/migration.json | 31 +-
qapi/qapi-schema.json | 1 -
qapi/rdma.json | 38 -
contrib/rdmacm-mux/rdmacm-mux.h | 61 -
hw/rdma/rdma_backend.h | 129 -
hw/rdma/rdma_backend_defs.h | 76 -
hw/rdma/rdma_rm.h | 97 -
hw/rdma/rdma_rm_defs.h | 146 -
hw/rdma/rdma_utils.h | 63 -
hw/rdma/trace.h | 1 -
hw/rdma/vmw/pvrdma.h | 144 -
hw/rdma/vmw/pvrdma_dev_ring.h | 46 -
hw/rdma/vmw/pvrdma_qp_ops.h | 28 -
hw/rdma/vmw/trace.h | 1 -
include/hw/rdma/rdma.h | 37 -
include/monitor/hmp.h | 1 -
.../infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h | 685 ---
.../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h | 348 --
.../standard-headers/rdma/vmw_pvrdma-abi.h | 310 --
migration/migration-stats.h | 6 +-
migration/migration.h | 9 -
migration/options.h | 2 -
migration/rdma.h | 69 -
block/gluster.c | 39 -
contrib/rdmacm-mux/main.c | 831 ----
hw/core/machine-qmp-cmds.c | 32 -
hw/rdma/rdma.c | 30 -
hw/rdma/rdma_backend.c | 1401 ------
hw/rdma/rdma_rm.c | 812 ----
hw/rdma/rdma_utils.c | 126 -
hw/rdma/vmw/pvrdma_cmd.c | 815 ----
hw/rdma/vmw/pvrdma_dev_ring.c | 141 -
hw/rdma/vmw/pvrdma_main.c | 735 ---
hw/rdma/vmw/pvrdma_qp_ops.c | 298 --
migration/migration-stats.c | 5 +-
migration/migration.c | 31 -
migration/options.c | 16 -
migration/qemu-file.c | 1 -
migration/ram.c | 86 +-
migration/rdma.c | 4184 -----------------
migration/savevm.c | 2 +-
monitor/qmp-cmds.c | 1 -
Kconfig.host | 3 -
contrib/rdmacm-mux/meson.build | 7 -
hmp-commands-info.hx | 13 -
hw/Kconfig | 1 -
hw/meson.build | 1 -
hw/rdma/Kconfig | 3 -
hw/rdma/meson.build | 12 -
hw/rdma/trace-events | 31 -
hw/rdma/vmw/trace-events | 17 -
meson_options.txt | 4 -
migration/meson.build | 1 -
migration/trace-events | 68 +-
qapi/meson.build | 1 -
qemu-options.hx | 6 -
.../org.centos/stream/8/build-environment.yml | 1 -
.../ci/org.centos/stream/8/x86_64/configure | 3 -
scripts/ci/setup/build-environment.yml | 4 -
scripts/coverity-scan/run-coverity-scan | 2 +-
scripts/meson-buildoptions.sh | 6 -
scripts/update-linux-headers.sh | 27 -
tests/lcitool/projects/qemu.yml | 3 -
tests/migration/guestperf/engine.py | 4 +-
75 files changed, 20 insertions(+), 12997 deletions(-)
delete mode 100644 docs/pvrdma.txt
delete mode 100644 docs/rdma.txt
delete mode 100644 qapi/rdma.json
delete mode 100644 contrib/rdmacm-mux/rdmacm-mux.h
delete mode 100644 hw/rdma/rdma_backend.h
delete mode 100644 hw/rdma/rdma_backend_defs.h
delete mode 100644 hw/rdma/rdma_rm.h
delete mode 100644 hw/rdma/rdma_rm_defs.h
delete mode 100644 hw/rdma/rdma_utils.h
delete mode 100644 hw/rdma/trace.h
delete mode 100644 hw/rdma/vmw/pvrdma.h
delete mode 100644 hw/rdma/vmw/pvrdma_dev_ring.h
delete mode 100644 hw/rdma/vmw/pvrdma_qp_ops.h
delete mode 100644 hw/rdma/vmw/trace.h
delete mode 100644 include/hw/rdma/rdma.h
delete mode 100644 include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h
delete mode 100644 include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h
delete mode 100644 include/standard-headers/rdma/vmw_pvrdma-abi.h
delete mode 100644 migration/rdma.h
delete mode 100644 contrib/rdmacm-mux/main.c
delete mode 100644 hw/rdma/rdma.c
delete mode 100644 hw/rdma/rdma_backend.c
delete mode 100644 hw/rdma/rdma_rm.c
delete mode 100644 hw/rdma/rdma_utils.c
delete mode 100644 hw/rdma/vmw/pvrdma_cmd.c
delete mode 100644 hw/rdma/vmw/pvrdma_dev_ring.c
delete mode 100644 hw/rdma/vmw/pvrdma_main.c
delete mode 100644 hw/rdma/vmw/pvrdma_qp_ops.c
delete mode 100644 migration/rdma.c
delete mode 100644 contrib/rdmacm-mux/meson.build
delete mode 100644 hw/rdma/Kconfig
delete mode 100644 hw/rdma/meson.build
delete mode 100644 hw/rdma/trace-events
delete mode 100644 hw/rdma/vmw/trace-events
--
2.41.0
6 months, 2 weeks
[PATCH] Сheck snapshot disk is not NULL when searching it in the VM config
by Fima Shevrin
When creating a snapshot of a VM with multiple hard disks,
the snapshot takes into account the presence of all disks
in the system. If, over time, one of the disks is deleted,
the snapshot will continue to store knowledge of the deleted disk.
This results in the fact that at the moment of deleting the snapshot,
at the validation stage, a disk from the snapshot will be searched which
is not in the VM configuration. As a result, vmdisk variable will
be equal to NULL. Dereferencing a null pointer at the time of calling
virStorageSourceIsSameLocation(vmdisk->src, disk->src) will result in SIGSEGV.
Signed-off-by: Fima Shevrin <efim.shevrin(a)virtuozzo.com>
---
src/qemu/qemu_snapshot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 09ec959f10..bf93cd485e 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -3806,7 +3806,7 @@ qemuSnapshotDeleteValidate(virDomainObj *vm,
vmdisk = qemuDomainDiskByName(vm->def, snapDisk->name);
disk = qemuDomainDiskByName(snapdef->parent.dom, snapDisk->name);
- if (!virStorageSourceIsSameLocation(vmdisk->src, disk->src)) {
+ if (vmdisk != NULL && !virStorageSourceIsSameLocation(vmdisk->src, disk->src)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("disk image '%1$s' for internal snapshot '%2$s' is not the same as disk image currently used by VM"),
snapDisk->name, snap->def->name);
--
2.34.1
7 months
[PATCH] network: add modify-or-add feature to net-update
by Abhiram Tilak
The current way of updating a network configuration uses `virsh
net-update` to add, delete or modify entries. But with such a mechansim
one should know if an entry with current info already exists. Adding
modify-or-add option automatically performs either modify or add
depending on the current state.
Fixes: https://gitlab.com/libvirt/libvirt/-/issues/363
Signed-off-by: Abhiram Tilak <atp.exp(a)gmail.com>
---
docs/manpages/virsh.rst | 5 +-
include/libvirt/libvirt-network.h | 2 +
src/conf/network_conf.c | 148 ++++++++++++++++++++++++------
tools/virsh-network.c | 4 +-
4 files changed, 126 insertions(+), 33 deletions(-)
diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 115b802c45..dc91ba895c 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -5908,7 +5908,10 @@ changes optionally taking effect immediately, without needing to
destroy and re-start the network.
*command* is one of "add-first", "add-last", "add" (a synonym for
-add-last), "delete", or "modify".
+add-last), "delete", "modify", "modify-or-add" (modify + add-last),
+"modify-or-add-first". The 'modify-or-add' commands perform modify or
+add operation depending on the given state, and can be useful for
+scripting.
*section* is one of "bridge", "domain", "ip", "ip-dhcp-host",
"ip-dhcp-range", "forward", "forward-interface", "forward-pf",
diff --git a/include/libvirt/libvirt-network.h b/include/libvirt/libvirt-network.h
index 58591be7ac..a6e132f407 100644
--- a/include/libvirt/libvirt-network.h
+++ b/include/libvirt/libvirt-network.h
@@ -181,6 +181,8 @@ typedef enum {
VIR_NETWORK_UPDATE_COMMAND_DELETE = 2, /* delete an existing element (Since: 0.10.2) */
VIR_NETWORK_UPDATE_COMMAND_ADD_LAST = 3, /* add an element at end of list (Since: 0.10.2) */
VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST = 4, /* add an element at start of list (Since: 0.10.2) */
+ VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_LAST = 5, /* if exists modify or add an element at end of list (Since: 0.10.2) */
+ VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST = 6, /* if exists modify or add an element at start of list (Since: 0.10.2) */
# ifdef VIR_ENUM_SENTINELS
VIR_NETWORK_UPDATE_COMMAND_LAST /* (Since: 0.10.2) */
# endif
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index cc92ed0b03..2835395385 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -2721,6 +2721,9 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDef *def,
virNetworkDHCPHostDef host = { 0 };
bool partialOkay = (command == VIR_NETWORK_UPDATE_COMMAND_DELETE);
+ /* added for modify-or-add feature */
+ bool modified = false;
+
if (virNetworkDefUpdateCheckElementName(def, ctxt->node, "host") < 0)
goto cleanup;
@@ -2826,7 +2829,34 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDef *def,
virNetworkDHCPHostDefClear(&ipdef->hosts[i]);
VIR_DELETE_ELEMENT(ipdef->hosts, i, ipdef->nhosts);
- } else {
+ } else if ((command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_LAST) ||
+ (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)) {
+
+ /* find entries with matching name/address/ip */
+ for (i = 0; i < ipdef->nhosts; i++) {
+ if ((host.mac && ipdef->hosts[i].mac &&
+ !virMacAddrCompare(host.mac, ipdef->hosts[i].mac)) ||
+ (host.name &&
+ STREQ_NULLABLE(host.name, ipdef->hosts[i].name)) ||
+ (VIR_SOCKET_ADDR_VALID(&host.ip) &&
+ virSocketAddrEqual(&host.ip, &ipdef->hosts[i].ip))) {
+
+ modified = true;
+ break;
+ }
+ }
+
+ /* if element is found then modify, or else add to beginning/end of list */
+ if (modified) {
+ virNetworkDHCPHostDefClear(&ipdef->hosts[i]);
+ ipdef->hosts[i] = host;
+ memset(&host, 0, sizeof(host));
+ } else if (VIR_INSERT_ELEMENT(ipdef->hosts,
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST
+ ? 0 : ipdef->nhosts,
+ ipdef->nhosts, host) < 0)
+ goto cleanup;
+ } else {
virNetworkDefUpdateUnknownCommand(command);
goto cleanup;
}
@@ -2885,7 +2915,9 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDef *def,
}
if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) ||
- (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST)) {
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST) ||
+ (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_LAST) ||
+ (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)) {
if (virNetworkDefUpdateCheckMultiDHCP(def, ipdef) < 0)
return -1;
@@ -2894,17 +2926,24 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDef *def,
g_autofree char *startip = virSocketAddrFormat(&range.addr.start);
g_autofree char *endip = virSocketAddrFormat(&range.addr.end);
- virReportError(VIR_ERR_OPERATION_INVALID,
- _("there is an existing dhcp range entry in network '%1$s' that matches \"<range start='%2$s' end='%3$s'/>\""),
- def->name,
- startip ? startip : "unknown",
- endip ? endip : "unknown");
+
+ if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) ||
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST))
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("there is an existing dhcp range entry in network '%1$s' that matches \"<range start='%2$s' end='%3$s'/>\""),
+ def->name,
+ startip ? startip : "unknown",
+ endip ? endip : "unknown");
+ else
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("dhcp ranges cannot be modified, only added or deleted"));
return -1;
}
/* add to beginning/end of list */
if (VIR_INSERT_ELEMENT(ipdef->ranges,
- command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)
? 0 : ipdef->nranges,
ipdef->nranges, range) < 0)
return -1;
@@ -2981,18 +3020,26 @@ virNetworkDefUpdateForwardInterface(virNetworkDef *def,
}
if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) ||
- (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST)) {
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST) ||
+ (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_LAST) ||
+ (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)) {
if (i < def->forward.nifs) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- _("there is an existing interface entry in network '%1$s' that matches \"<interface dev='%2$s'>\""),
- def->name, iface.device.dev);
+ if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST) ||
+ command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST)
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("there is an existing interface entry in network '%1$s' that matches \"<interface dev='%2$s'>\""),
+ def->name, iface.device.dev);
+ else
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("forward interface entries cannot be modified, only added or deleted"));
goto cleanup;
}
/* add to beginning/end of list */
if (VIR_INSERT_ELEMENT(def->forward.ifs,
- command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)
? 0 : def->forward.nifs,
def->forward.nifs, iface) < 0)
goto cleanup;
@@ -3056,6 +3103,9 @@ virNetworkDefUpdatePortGroup(virNetworkDef *def,
int ret = -1;
virPortGroupDef portgroup = { 0 };
+ /* added for modify-or-add feature */
+ bool modified = false;
+
if (virNetworkDefUpdateCheckElementName(def, ctxt->node, "portgroup") < 0)
goto cleanup;
@@ -3097,6 +3147,17 @@ virNetworkDefUpdatePortGroup(virNetworkDef *def,
goto cleanup;
}
+ /* modify found entries for modify-or-add command */
+ if (foundName >= 0 && (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_LAST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)) {
+
+ /* replace existing entry */
+ virPortGroupDefClear(&def->portGroups[foundName]);
+ def->portGroups[foundName] = portgroup;
+ memset(&portgroup, 0, sizeof(portgroup));
+ modified = true;
+ }
+
if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
/* replace existing entry */
@@ -3105,11 +3166,14 @@ virNetworkDefUpdatePortGroup(virNetworkDef *def,
memset(&portgroup, 0, sizeof(portgroup));
} else if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) ||
- (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST)) {
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST) ||
+ (!modified && command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_LAST) ||
+ (!modified && command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)) {
/* add to beginning/end of list */
if (VIR_INSERT_ELEMENT(def->portGroups,
- command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)
? 0 : def->nPortGroups,
def->nPortGroups, portgroup) < 0)
goto cleanup;
@@ -3144,7 +3208,9 @@ virNetworkDefUpdateDNSHost(virNetworkDef *def,
virNetworkDNSDef *dns = &def->dns;
virNetworkDNSHostDef host = { 0 };
bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
- command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
+ command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_LAST);
int foundCt = 0;
if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
@@ -3185,15 +3251,21 @@ virNetworkDefUpdateDNSHost(virNetworkDef *def,
if (isAdd) {
if (foundCt > 0) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- _("there is already at least one DNS HOST record with a matching field in network %1$s"),
- def->name);
+ if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) ||
+ command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST)
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("there is already at least one DNS HOST record with a matching field in network %1$s"),
+ def->name);
+ else
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("DNS HOST records cannot be modified, only added or deleted"));
goto cleanup;
}
/* add to beginning/end of list */
if (VIR_INSERT_ELEMENT(dns->hosts,
- command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)
? 0 : dns->nhosts, dns->nhosts, host) < 0)
goto cleanup;
} else if (command == VIR_NETWORK_UPDATE_COMMAND_DELETE) {
@@ -3240,7 +3312,9 @@ virNetworkDefUpdateDNSSrv(virNetworkDef *def,
virNetworkDNSDef *dns = &def->dns;
virNetworkDNSSrvDef srv = { 0 };
bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
- command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
+ command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_LAST);
int foundCt = 0;
if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
@@ -3268,15 +3342,21 @@ virNetworkDefUpdateDNSSrv(virNetworkDef *def,
if (isAdd) {
if (foundCt > 0) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- _("there is already at least one DNS SRV record matching all specified fields in network %1$s"),
- def->name);
+ if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) ||
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST))
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("there is already at least one DNS SRV record matching all specified fields in network %1$s"),
+ def->name);
+ else
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("DNS SRV records cannot be modified, only added or deleted"));
goto cleanup;
}
/* add to beginning/end of list */
if (VIR_INSERT_ELEMENT(dns->srvs,
- command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)
? 0 : dns->nsrvs, dns->nsrvs, srv) < 0)
goto cleanup;
} else if (command == VIR_NETWORK_UPDATE_COMMAND_DELETE) {
@@ -3322,7 +3402,9 @@ virNetworkDefUpdateDNSTxt(virNetworkDef *def,
virNetworkDNSDef *dns = &def->dns;
virNetworkDNSTxtDef txt = { 0 };
bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
- command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
+ command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_LAST);
if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
@@ -3344,15 +3426,21 @@ virNetworkDefUpdateDNSTxt(virNetworkDef *def,
if (isAdd) {
if (foundIdx < dns->ntxts) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- _("there is already a DNS TXT record with name '%1$s' in network %2$s"),
- txt.name, def->name);
+ if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST) ||
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST))
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("there is already a DNS TXT record with name '%1$s' in network %2$s"),
+ txt.name, def->name);
+ else
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("DNS TXT records cannot be modified, only added or deleted"));
goto cleanup;
}
/* add to beginning/end of list */
if (VIR_INSERT_ELEMENT(dns->txts,
- command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST
+ (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
+ command == VIR_NETWORK_UPDATE_COMMAND_MODIFY_OR_ADD_FIRST)
? 0 : dns->ntxts, dns->ntxts, txt) < 0)
goto cleanup;
} else if (command == VIR_NETWORK_UPDATE_COMMAND_DELETE) {
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index 597e3d4530..c30305ac50 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -1231,7 +1231,7 @@ static const vshCmdOptDef opts_network_update[] = {
.positional = true,
.required = true,
.completer = virshNetworkUpdateCommandCompleter,
- .help = N_("type of update (add-first, add-last (add), delete, or modify)")
+ .help = N_("type of update (add-first, add-last (add), delete, modify, modify-or-add, or modify-or-add-first)")
},
{.name = "section",
.type = VSH_OT_STRING,
@@ -1260,7 +1260,7 @@ static const vshCmdOptDef opts_network_update[] = {
VIR_ENUM_IMPL(virshNetworkUpdateCommand,
VIR_NETWORK_UPDATE_COMMAND_LAST,
- "none", "modify", "delete", "add-last", "add-first");
+ "none", "modify", "delete", "add-last", "add-first", "modify-or-add", "modify-or-add-first");
VIR_ENUM_IMPL(virshNetworkSection,
VIR_NETWORK_SECTION_LAST,
--
2.44.0
7 months, 1 week
[PATCH 00/35] vsh: Fix handling of commands and help - part 3 (virsh testing overhaul)
by Peter Krempa
Part 3 was supposed to be the refactor of the command parser but since
I wanted to add few tests I've noticed that there's a lot of old cruft
and many tests are skipped.
This series refactors virshtest and optimizes it to run multiple
commands with one virsh instance. Doing this allows us to do more
testing in the same run time allowing us to reduce the amount of
"expensive" tests.
Further down this removes all of the 'shell' test infra which was used
for virsh.
Peter Krempa (35):
virshtest: Prepare for testing against output files
virshtest: Allow to test failure of commands
virshtest: Filter multiple occurences of string to drop in
testFilterLine
virshtest: Add support for testing commands read from input file and
adapt alias tests
virshtest: Adapt 'echo --split' tests to DO_TEST_SCRIPT
virshtest: Drop some redundant 'echo' cases
virshtest: Adapt some 'escaping' tests via DO_TEST_SCRIPT
vrishtest: Prepare for simpler testing - echo tests
virshtest: Test against output files ("echo" tests)
virshtest: Drop string form of expected output data of "echo" tests
virshtest: Replace list and nodeinfo tests by equivalent
VIR_TEST_SCRIPT variant
virshtest: Adapt tests for domain id lookup and state query to
DO_TEST_SCRIPT
virshtest: Adapt 'blkiotune' tests to DO_TEST_SCRIPT
virshtest: Adapt 'iothread' tests to DO_TEST_SCRIPT
virshtest: Drop support for testing against hardcoded strings
virshtest: Adapt argument parsing tests from 'virsh-optparse'
virshtest: Adapt 'snapshot-create-as' arg handling tests from
'virsh-optparse'
virshtest: Adapt numeric option arg handling tests from
'virsh-optparse'
virshtest: Adapt 'event' option arg handling tests from
'virsh-optparse'
virshtest: Reimplement 'virsh-output' test
qemuxmlconftest: Adapt XMLs from 'virsh-cpuset' and
'virsh-define-dev-segfault' cases
virshtest: Adapt 'virsh-vcpupin' test
virshtest: Adapt 'virsh-int-overflow'
virshtest: Adapt 'virsh-schedinfo'
virshtest: Adapt 'virsh-start' and 'virsh-undefine' tests as
'lifecycle' case
virsh: Fix '--name' and '--parent' used together in
'(snapshot|checkpoint)-list' command
vsh: Allow non-interactive use of 'cd' command
virshtest: Adapt 'virsh-snapshot' test
virshtest: Adapt 'virsh-checkpoint' test
virshtest: Adapt 'virsh-read-bufsiz' and 'virsh-read-non-seekable'
virshtest: Adapt 'libvirtd-pool'
tests: Re-implement '(virsh|virt-admin)-self-test' directly in meson
tests: Reimplement 'libvirtd-fail' case directly in meson
virshtest: Adapt virsh-uriprecedence test case
tests: Drop 'test-lib.sh'
build-aux/syntax-check.mk | 6 +-
docs/manpages/virsh.rst | 17 +-
src/meson.build | 5 +
tests/libvirtd-fail | 16 -
tests/libvirtd-pool | 38 -
tests/meson.build | 39 +-
.../console-compat-crash.x86_64-latest.args | 46 +
.../console-compat-crash.x86_64-latest.xml | 65 ++
.../console-compat-crash.xml} | 36 +-
.../cpuset-invalid.x86_64-latest.err | 1 +
tests/qemuxmlconfdata/cpuset-invalid.xml | 12 +
tests/qemuxmlconftest.c | 2 +
tests/test-lib.sh | 280 ------
tests/virsh-checkpoint | 178 ----
tests/virsh-cpuset | 46 -
tests/virsh-int-overflow | 18 -
tests/virsh-optparse | 292 ------
tests/virsh-output | 29 -
tests/virsh-output-commands | 94 --
tests/virsh-output.out | 496 ----------
tests/virsh-read-bufsiz | 49 -
tests/virsh-read-non-seekable | 51 -
tests/virsh-schedinfo | 40 -
tests/virsh-self-test | 48 -
tests/virsh-snapshot | 233 -----
tests/virsh-start | 41 -
tests/virsh-undefine | 76 --
tests/virsh-uriprecedence | 97 --
tests/virsh-vcpupin | 100 --
tests/virshtest.c | 878 +++++++-----------
tests/virshtestdata/argument-assignment.in | 15 +
tests/virshtestdata/argument-assignment.out | 91 ++
tests/virshtestdata/attach-disk.in | 79 ++
tests/virshtestdata/attach-disk.out | 343 +++++++
tests/virshtestdata/blkiotune.in | 3 +
tests/virshtestdata/blkiotune.out | 15 +
tests/virshtestdata/checkpoint-c2.xml | 41 +
tests/virshtestdata/checkpoint-c3.xml | 38 +
tests/virshtestdata/checkpoint-redefine.out | 13 +
tests/virshtestdata/checkpoint.in | 35 +
tests/virshtestdata/checkpoint.out | 133 +++
tests/virshtestdata/dash-dash-argument-1.out | 1 +
tests/virshtestdata/dash-dash-argument-2.out | 1 +
tests/virshtestdata/dash-dash-argument-3.out | 1 +
tests/virshtestdata/dash-dash-argument-4.out | 1 +
tests/virshtestdata/dash-dash-argument-5.out | 1 +
tests/virshtestdata/dash-dash-argument-6.out | 1 +
tests/virshtestdata/domain-id-overflow.out | 3 +
tests/virshtestdata/domain-id.in | 18 +
tests/virshtestdata/domain-id.out | 73 ++
tests/virshtestdata/echo-alias-argv.out | 1 +
tests/virshtestdata/echo-alias.in | 3 +
tests/virshtestdata/echo-alias.out | 3 +
tests/virshtestdata/echo-escaping-1.out | 2 +
tests/virshtestdata/echo-escaping-2.out | 2 +
tests/virshtestdata/echo-escaping-3.out | 2 +
tests/virshtestdata/echo-escaping.in | 11 +
tests/virshtestdata/echo-escaping.out | 11 +
tests/virshtestdata/echo-quote-removal-1.out | 1 +
tests/virshtestdata/echo-quote-removal-2.out | 1 +
tests/virshtestdata/echo-quote-removal-3.out | 1 +
tests/virshtestdata/echo-quote-removal-4.out | 1 +
tests/virshtestdata/echo-quote-removal-5.out | 1 +
tests/virshtestdata/echo-quote-removal-6.out | 1 +
tests/virshtestdata/echo-quote-removal-7.out | 2 +
tests/virshtestdata/echo-quote-removal-8.out | 1 +
tests/virshtestdata/echo-split.in | 5 +
tests/virshtestdata/echo-split.out | 24 +
tests/virshtestdata/info-custom.in | 2 +
tests/virshtestdata/info-custom.out | 15 +
tests/virshtestdata/info-default.in | 2 +
tests/virshtestdata/info-default.out | 13 +
tests/virshtestdata/iothreads.in | 14 +
tests/virshtestdata/iothreads.out | 51 +
tests/virshtestdata/lifecycle.in | 23 +
tests/virshtestdata/lifecycle.out | 106 +++
tests/virshtestdata/multiple-commands-1.out | 2 +
tests/virshtestdata/multiple-commands-10.out | 1 +
tests/virshtestdata/multiple-commands-11.out | 1 +
tests/virshtestdata/multiple-commands-12.out | 1 +
tests/virshtestdata/multiple-commands-2.out | 2 +
tests/virshtestdata/multiple-commands-3.out | 2 +
tests/virshtestdata/multiple-commands-4.out | 2 +
tests/virshtestdata/multiple-commands-5.out | 3 +
tests/virshtestdata/multiple-commands-6.out | 1 +
tests/virshtestdata/multiple-commands-7.out | 2 +
tests/virshtestdata/multiple-commands-8.out | 2 +
tests/virshtestdata/multiple-commands-9.out | 1 +
tests/virshtestdata/numeric-parsing-event.in | 26 +
tests/virshtestdata/numeric-parsing-event.out | 10 +
tests/virshtestdata/numeric-parsing.in | 43 +
tests/virshtestdata/numeric-parsing.out | 12 +
tests/virshtestdata/pool-define-as.out | 12 +
tests/virshtestdata/read-big-pipe.out | 7 +
.../schedinfo-invalid-argument.out | 5 +
tests/virshtestdata/snapshot-create-args.in | 9 +
tests/virshtestdata/snapshot-create-args.out | 82 ++
tests/virshtestdata/snapshot-redefine.out | 17 +
tests/virshtestdata/snapshot-s2.xml | 43 +
tests/virshtestdata/snapshot-s3.xml | 40 +
tests/virshtestdata/snapshot.in | 54 ++
tests/virshtestdata/snapshot.out | 173 ++++
.../uriprecedence-LIBVIRT_DEFAULT_URI.out | 5 +
...riprecedence-VIRSH_DEFAULT_CONNECT_URI.out | 5 +
tests/virshtestdata/uriprecedence-param.out | 5 +
.../uriprecedence-xdg-config.out | 5 +
.../bad/libvirt/libvirt.conf | 1 +
.../good/libvirt/libvirt.conf | 1 +
tests/virshtestdata/vcpupin.in | 23 +
tests/virshtestdata/vcpupin.out | 26 +
tests/virt-admin-self-test | 1 -
tools/meson.build | 4 +-
tools/virsh-checkpoint.c | 18 +-
tools/virsh-snapshot.c | 18 +-
tools/vsh.c | 5 -
115 files changed, 2352 insertions(+), 2852 deletions(-)
delete mode 100755 tests/libvirtd-fail
delete mode 100755 tests/libvirtd-pool
create mode 100644 tests/qemuxmlconfdata/console-compat-crash.x86_64-latest.args
create mode 100644 tests/qemuxmlconfdata/console-compat-crash.x86_64-latest.xml
rename tests/{virsh-define-dev-segfault => qemuxmlconfdata/console-compat-crash.xml} (59%)
mode change 100755 => 100644
create mode 100644 tests/qemuxmlconfdata/cpuset-invalid.x86_64-latest.err
create mode 100644 tests/qemuxmlconfdata/cpuset-invalid.xml
delete mode 100644 tests/test-lib.sh
delete mode 100755 tests/virsh-checkpoint
delete mode 100755 tests/virsh-cpuset
delete mode 100755 tests/virsh-int-overflow
delete mode 100755 tests/virsh-optparse
delete mode 100755 tests/virsh-output
delete mode 100755 tests/virsh-output-commands
delete mode 100644 tests/virsh-output.out
delete mode 100755 tests/virsh-read-bufsiz
delete mode 100755 tests/virsh-read-non-seekable
delete mode 100755 tests/virsh-schedinfo
delete mode 100755 tests/virsh-self-test
delete mode 100755 tests/virsh-snapshot
delete mode 100755 tests/virsh-start
delete mode 100755 tests/virsh-undefine
delete mode 100755 tests/virsh-uriprecedence
delete mode 100755 tests/virsh-vcpupin
create mode 100644 tests/virshtestdata/argument-assignment.in
create mode 100644 tests/virshtestdata/argument-assignment.out
create mode 100755 tests/virshtestdata/attach-disk.in
create mode 100644 tests/virshtestdata/attach-disk.out
create mode 100644 tests/virshtestdata/blkiotune.in
create mode 100644 tests/virshtestdata/blkiotune.out
create mode 100644 tests/virshtestdata/checkpoint-c2.xml
create mode 100644 tests/virshtestdata/checkpoint-c3.xml
create mode 100644 tests/virshtestdata/checkpoint-redefine.out
create mode 100755 tests/virshtestdata/checkpoint.in
create mode 100644 tests/virshtestdata/checkpoint.out
create mode 100644 tests/virshtestdata/dash-dash-argument-1.out
create mode 100644 tests/virshtestdata/dash-dash-argument-2.out
create mode 100644 tests/virshtestdata/dash-dash-argument-3.out
create mode 100644 tests/virshtestdata/dash-dash-argument-4.out
create mode 100644 tests/virshtestdata/dash-dash-argument-5.out
create mode 100644 tests/virshtestdata/dash-dash-argument-6.out
create mode 100644 tests/virshtestdata/domain-id-overflow.out
create mode 100644 tests/virshtestdata/domain-id.in
create mode 100644 tests/virshtestdata/domain-id.out
create mode 100644 tests/virshtestdata/echo-alias-argv.out
create mode 100644 tests/virshtestdata/echo-alias.in
create mode 100644 tests/virshtestdata/echo-alias.out
create mode 100644 tests/virshtestdata/echo-escaping-1.out
create mode 100644 tests/virshtestdata/echo-escaping-2.out
create mode 100644 tests/virshtestdata/echo-escaping-3.out
create mode 100644 tests/virshtestdata/echo-escaping.in
create mode 100644 tests/virshtestdata/echo-escaping.out
create mode 100644 tests/virshtestdata/echo-quote-removal-1.out
create mode 100644 tests/virshtestdata/echo-quote-removal-2.out
create mode 100644 tests/virshtestdata/echo-quote-removal-3.out
create mode 100644 tests/virshtestdata/echo-quote-removal-4.out
create mode 100644 tests/virshtestdata/echo-quote-removal-5.out
create mode 100644 tests/virshtestdata/echo-quote-removal-6.out
create mode 100644 tests/virshtestdata/echo-quote-removal-7.out
create mode 100644 tests/virshtestdata/echo-quote-removal-8.out
create mode 100644 tests/virshtestdata/echo-split.in
create mode 100644 tests/virshtestdata/echo-split.out
create mode 100644 tests/virshtestdata/info-custom.in
create mode 100644 tests/virshtestdata/info-custom.out
create mode 100644 tests/virshtestdata/info-default.in
create mode 100644 tests/virshtestdata/info-default.out
create mode 100644 tests/virshtestdata/iothreads.in
create mode 100644 tests/virshtestdata/iothreads.out
create mode 100644 tests/virshtestdata/lifecycle.in
create mode 100644 tests/virshtestdata/lifecycle.out
create mode 100644 tests/virshtestdata/multiple-commands-1.out
create mode 100644 tests/virshtestdata/multiple-commands-10.out
create mode 100644 tests/virshtestdata/multiple-commands-11.out
create mode 100644 tests/virshtestdata/multiple-commands-12.out
create mode 100644 tests/virshtestdata/multiple-commands-2.out
create mode 100644 tests/virshtestdata/multiple-commands-3.out
create mode 100644 tests/virshtestdata/multiple-commands-4.out
create mode 100644 tests/virshtestdata/multiple-commands-5.out
create mode 100644 tests/virshtestdata/multiple-commands-6.out
create mode 100644 tests/virshtestdata/multiple-commands-7.out
create mode 100644 tests/virshtestdata/multiple-commands-8.out
create mode 100644 tests/virshtestdata/multiple-commands-9.out
create mode 100644 tests/virshtestdata/numeric-parsing-event.in
create mode 100644 tests/virshtestdata/numeric-parsing-event.out
create mode 100644 tests/virshtestdata/numeric-parsing.in
create mode 100644 tests/virshtestdata/numeric-parsing.out
create mode 100644 tests/virshtestdata/pool-define-as.out
create mode 100644 tests/virshtestdata/read-big-pipe.out
create mode 100644 tests/virshtestdata/schedinfo-invalid-argument.out
create mode 100644 tests/virshtestdata/snapshot-create-args.in
create mode 100644 tests/virshtestdata/snapshot-create-args.out
create mode 100644 tests/virshtestdata/snapshot-redefine.out
create mode 100644 tests/virshtestdata/snapshot-s2.xml
create mode 100644 tests/virshtestdata/snapshot-s3.xml
create mode 100755 tests/virshtestdata/snapshot.in
create mode 100644 tests/virshtestdata/snapshot.out
create mode 100644 tests/virshtestdata/uriprecedence-LIBVIRT_DEFAULT_URI.out
create mode 100644 tests/virshtestdata/uriprecedence-VIRSH_DEFAULT_CONNECT_URI.out
create mode 100644 tests/virshtestdata/uriprecedence-param.out
create mode 100644 tests/virshtestdata/uriprecedence-xdg-config.out
create mode 100644 tests/virshtestdata/uriprecedence-xdg/bad/libvirt/libvirt.conf
create mode 100644 tests/virshtestdata/uriprecedence-xdg/good/libvirt/libvirt.conf
create mode 100755 tests/virshtestdata/vcpupin.in
create mode 100644 tests/virshtestdata/vcpupin.out
delete mode 120000 tests/virt-admin-self-test
--
2.44.0
7 months, 2 weeks
[PATCH 0/4] Introduce SSH proxy
by Michal Privoznik
*** BLURB HERE ***
Michal Prívozník (4):
datatypes: Declare g_autoptr cleanup functions for more public objects
tools: Introduce SSH proxy
docs: Document SSH proxy
NEWS: Document SSH proxy feature
NEWS.rst | 5 +
docs/docs.rst | 3 +
docs/meson.build | 1 +
docs/nss.rst | 7 +
docs/ssh-proxy.rst | 60 +++++
libvirt.spec.in | 27 +++
meson.build | 16 +-
meson_options.txt | 2 +
po/POTFILES | 1 +
src/datatypes.h | 16 ++
tools/meson.build | 2 +
tools/ssh-proxy/30-libvirt-ssh-proxy.conf.in | 10 +
tools/ssh-proxy/meson.build | 25 ++
tools/ssh-proxy/ssh-proxy.c | 233 +++++++++++++++++++
14 files changed, 407 insertions(+), 1 deletion(-)
create mode 100644 docs/ssh-proxy.rst
create mode 100644 tools/ssh-proxy/30-libvirt-ssh-proxy.conf.in
create mode 100644 tools/ssh-proxy/meson.build
create mode 100644 tools/ssh-proxy/ssh-proxy.c
--
2.43.2
7 months, 2 weeks