[PATCH v2] virnetserver: fix some memory leaks in virNetTLSContextReloadForServer
by Jin Yan
These leaks were introduced in commit 15d280fa97b0, use g_autofree for all
cert_path pointers.
Signed-off-by: Jin Yan <jinyan12(a)huawei.com>
---
src/rpc/virnettlscontext.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c
index 168f3010ae..37564db14e 100644
--- a/src/rpc/virnettlscontext.c
+++ b/src/rpc/virnettlscontext.c
@@ -921,10 +921,10 @@ int virNetTLSContextReloadForServer(virNetTLSContextPtr ctxt,
{
gnutls_certificate_credentials_t x509credBak;
int err;
- char *cacert = NULL;
- char *cacrl = NULL;
- char *cert = NULL;
- char *key = NULL;
+ g_autofree char *cacert = NULL;
+ g_autofree char *cacrl = NULL;
+ g_autofree char *cert = NULL;
+ g_autofree char *key = NULL;
x509credBak = ctxt->x509cred;
ctxt->x509cred = NULL;
--
2.23.0
4 years, 4 months
[PATCH] NEWS: Mention IQN setting for iSCSI hostdevs
by Peter Krempa
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
NEWS.rst | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/NEWS.rst b/NEWS.rst
index d92714c29b..70c6684761 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -13,6 +13,12 @@ v6.7.0 (unreleased)
* **New features**
+ * qemu: Add support for initiator IQN configuration for iSCSI hostdevs
+
+ Similarly to iSCSI ``<disk>`` users can use an ``<initiator>`` element
+ inside ``<hostdev>`` with the same format to configure the ``IQN`` value
+ used by the qemu initiator when connecting to an iSCSI target.
+
* **Improvements**
* Allow sparse streams for block devices
--
2.26.2
4 years, 4 months
[PATCH 0/5] qemu: split off snapshot code for cleanup and reuse
by Peter Krempa
Peter Krempa (5):
qemuOpenFileAs: Move into util/virqemu.c
qemuOpenFile: Move to qemu_domain.c
qemuFileWrapperFDClose: move to qemu_domain.c
qemu: Split of code related to handling of the save image file
qemu: Extract snapshot related code to a separate file
po/POTFILES.in | 2 +
src/libvirt_private.syms | 1 +
src/qemu/meson.build | 2 +
src/qemu/qemu_domain.c | 70 +
src/qemu/qemu_domain.h | 11 +
src/qemu/qemu_driver.c | 3320 ++-----------------------------------
src/qemu/qemu_saveimage.c | 764 +++++++++
src/qemu/qemu_saveimage.h | 116 ++
src/qemu/qemu_snapshot.c | 2266 +++++++++++++++++++++++++
src/qemu/qemu_snapshot.h | 55 +
src/util/virqemu.c | 130 ++
src/util/virqemu.h | 7 +
12 files changed, 3520 insertions(+), 3224 deletions(-)
create mode 100644 src/qemu/qemu_saveimage.c
create mode 100644 src/qemu/qemu_saveimage.h
create mode 100644 src/qemu/qemu_snapshot.c
create mode 100644 src/qemu/qemu_snapshot.h
--
2.26.2
4 years, 4 months
[PATCH 1/1] NEWS.rst: update with NVDIMM auto-alignment removal for pSeries
by Daniel Henrique Barboza
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
NEWS.rst | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/NEWS.rst b/NEWS.rst
index d92714c29b..7ae4aa9340 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -20,6 +20,17 @@ v6.7.0 (unreleased)
Sparse streams (e.g. ``virsh vol-download --sparse`` or ``virsh vol-upload
--sparse``) now handle if one of the stream ends is a block device.
+ * Remove NVDIMM auto-alignment for pSeries Guests
+
+ This feature was introduced in libvirt v6.2.0 as part of the overall
+ NVDIMM support for pSeries guests. The idea was to relieve the user
+ from knowing ppc64 alignment details, but the end result is that we
+ ended up with inconsistencies between domain XML and actual NVDIMM
+ size the guest is using. To promote consistency between domain XML
+ and the guest, unaligned NVDIMM sizes for pSeries guests will now be
+ forbid and no size auto-alignment will be made. Instead, libvirt will
+ suggest an aligned round up size for the user.
+
* **Bug fixes**
* virdevmapper: Deal with kernels without DM support
--
2.26.2
4 years, 4 months
[libvirt PATCH v2] manpages/virsh: A couple of small clarifications
by Kashyap Chamarthy
Changes:
- Update the descriptions of --current & --config flags.
For --config, the reason to rephrase "next boot" to "next start"
is: "Next boot may still imply somebody selecting "reboot" in the
guest OS and fully expecting the changes to be applied." (per Peter
Krempa)
For --current, existing documentation says:
"If *--current* is specified, affect the current guest state."
It's not entirely clear what states can "current" mean or imply. So
rephrase it in context of the other two related flags --live and
--config.
- While at it, I also took the liberty to replace the few occurrences
of "peristent domain[s]" with "persistent guest[s]"
Fix all occurrences (i.e. as many as I could spot) of this.
(Thanks: Dan Berrangé on IRC.)
Signed-off-by: Kashyap Chamarthy <kchamart(a)redhat.com>
---
- v2: Address Peter Krempa's feedback
(https://www.redhat.com/archives/libvir-list/2020-July/msg01274.html)
---
docs/manpages/virsh.rst | 163 +++++++++++++++++++++++-----------------
1 file changed, 95 insertions(+), 68 deletions(-)
diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 1a2cf09fb7..561b1f038e 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -710,7 +710,7 @@ groups:
Persistence
...........
-Flag *--persistent* is used to include persistent domains in the returned
+Flag *--persistent* is used to include persistent guests in the returned
list. To include transient domains specify *--transient*.
Existence of managed save image
@@ -1089,8 +1089,9 @@ then the default value of 1 second will be displayed. Supplying a 0 will
reset the value back to the default.
If *--live* is specified, affect a running guest.
-If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--config* is specified, affect the next start of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
When setting the disk io parameters both *--live* and *--config* flags may be
given, but *--current* is exclusive. For querying only one of *--live*,
*--config* or *--current* can be specified. If no flag is specified, behavior
@@ -1151,8 +1152,9 @@ Only the devices listed in the string are modified;
any existing per-device write_bytes_sec for other devices remain unchanged.
If *--live* is specified, affect a running guest.
-If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--config* is specified, affect the next start of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
@@ -1451,7 +1453,7 @@ Create a domain from an XML <file>. Optionally, *--validate* option can be
passed to validate the format of the input XML file against an internal RNG
schema (identical to using virt-xml-validate(1) tool). Domains created using
this command are going to be either transient (temporary ones that will vanish
-once destroyed) or existing persistent domains that will run with one-time use
+once destroyed) or existing persistent guests that will run with one-time use
configuration, leaving the persistent XML untouched (this can come handy during
an automated testing of various configurations all based on the original XML).
See the example below for usage demonstration.
@@ -1490,7 +1492,7 @@ is only supported with container based virtualization.
respectively:
a. the domain is going to be transient
- b. an existing persistent domain will run with a modified one-time
+ b. an existing persistent guest will run with a modified one-time
configuration
.. code-block::
@@ -1985,8 +1987,9 @@ To clear inbound or outbound settings, use *--inbound* or *--outbound*
respectfully with average value of zero.
If *--live* is specified, affect a running guest.
-If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--config* is specified, affect the next start of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
@@ -2088,8 +2091,10 @@ QEMU/KVM 1.5 to be running on the host.
The *--live*, *--config*, and *--current* flags are only valid when using
the *--period* option in order to set the collection period for the balloon
driver. If *--live* is specified, only the running guest collection period
-is affected. If *--config* is specified, affect the next boot of a persistent
-guest. If *--current* is specified, affect the current guest state.
+is affected. If *--config* is specified, affect the next start of a persistent
+guest. If *--current* is specified, it is equivalent to either *--live*
+or *--config*, depending on the current state of the guest.
+
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. If no flag is specified, behavior is different depending
@@ -2581,8 +2586,9 @@ CPUs.
See ``vcpupin`` for *cpulist*.
If *--live* is specified, affect a running guest.
-If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--config* is specified, affect the next start of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
Both *--live* and *--config* flags may be given if *cpulist* is present,
but *--current* is exclusive.
If no flag is specified, behavior is different depending on hypervisor.
@@ -2744,9 +2750,9 @@ If the *iothread_id* already exists, the command will fail. The
If *--live* is specified, affect a running guest. If the guest is not
running an error is returned.
-If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified or *--live* and *--config* are not specified,
-affect the current guest state.
+If *--config* is specified, affect the next start of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
iothreaddel
@@ -2765,9 +2771,10 @@ If the *iothread_id* does not exist an error will occur.
If *--live* is specified, affect a running guest. If the guest is not
running an error is returned.
-If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified or *--live* and *--config* are not specified,
-affect the current guest state.
+If *--config* is specified, affect the next start of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
+
iothreadinfo
@@ -2784,10 +2791,11 @@ the CPU Affinity for each IOThread.
If *--live* is specified, get the IOThreads data from the running guest. If
the guest is not running, an error is returned.
-If *--config* is specified, get the IOThreads data from the next boot of
+If *--config* is specified, get the IOThreads data from the next start of
a persistent guest.
If *--current* is specified or *--live* and *--config* are not specified,
-then get the IOThread data based on the current guest state.
+then get the IOThread data based on the current guest state, which can
+either be live or offline.
iothreadpin
@@ -2812,9 +2820,9 @@ to all physical cpus, simply specify 'r' as a *cpulist*.
If *--live* is specified, affect a running guest. If the guest is not running,
an error is returned.
-If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified or *--live* and *--config* are not specified,
-affect the current guest state.
+If *--config* is specified, affect the next start of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
Both *--live* and *--config* flags may be given if *cpulist* is present,
but *--current* is exclusive.
If no flag is specified, behavior is different depending on hypervisor.
@@ -2851,7 +2859,8 @@ next start, restore, etc.
If *--live* is specified, affect a running guest. If the guest is not
running an error is returned.
If *--current* is specified or *--live* is not specified, then handle
-as if *--live* was specified.
+as if *--live* was specified. (Where "current" here means whatever the
+present guest state is: live or offline.)
managedsave
@@ -2997,8 +3006,9 @@ than KiB, and requests that are not an even multiple will be rounded up.
For example, vSphere/ESX rounds the parameter up to mebibytes (1024 kibibytes).
If *--live* is specified, affect a running guest.
-If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--config* is specified, affect the next start of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
@@ -3160,7 +3170,7 @@ the destination to supply a larger set of changes to any host-specific
portions of the domain XML, such as accounting for naming differences
between source and destination in accessing underlying storage.
If *--persistent* is enabled, *--persistent-xml* ``file`` can be used to
-supply an alternative XML file which will be used as the persistent domain
+supply an alternative XML file which will be used as the persistent guest
definition on the destination host.
*--timeout* ``seconds`` tells virsh to run a specified action when live
@@ -3392,8 +3402,9 @@ Its syntax is a comma separated list, with '-' for ranges and '^' for
excluding a node.
If *--live* is specified, set scheduler information of a running guest.
-If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--config* is specified, affect the next start of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
For running guests in Linux hosts, the changes made in the domain's
numa parameters does not imply that the guest memory will be moved to a
@@ -3485,8 +3496,9 @@ separated by commas. Valid event names are as follows:
the *--perf* flag.
If *--live* is specified, affect a running guest.
-If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--config* is specified, affect the next start of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
@@ -3714,8 +3726,9 @@ Xen (credit scheduler): weight, cap
ESX (allocation scheduler): reservation, limit, shares
If *--live* is specified, set scheduler information of a running guest.
-If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--config* is specified, affect the next start of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
``Note``: The cpu_shares parameter has a valid value range of 0-262144; Negative
values are wrapped to positive, and larger values are capped at the maximum.
@@ -3956,8 +3969,9 @@ setmaxmem
Change the maximum memory allocation limit for a guest domain.
If *--live* is specified, affect a running guest.
-If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--config* is specified, affect the next start of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
@@ -3987,8 +4001,9 @@ setmem
Change the memory allocation for a guest domain.
If *--live* is specified, perform a memory balloon of a running guest.
-If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--config* is specified, affect the next start of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
@@ -4038,7 +4053,8 @@ specified together if supported by the hypervisor. If this command is run
before the guest has finished booting, the guest may fail to process
the change.
-If *--current* is specified, affect the current guest state.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
When no flags are given, the *--live*
flag is assumed and the guest domain must be active. In this situation it
@@ -4083,10 +4099,11 @@ Note that hypervisors may refuse to disable certain vcpus such as vcpu 0 or
others.
If *--live* is specified, affect a running domain.
-If *--config* is specified, affect the next startup of a persistent domain.
-If *--current* is specified, affect the current domain state. This is the
-default. Both *--live* and *--config* flags may be given, but *--current* is
-exclusive.
+If *--config* is specified, affect the next startup of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest. This is the
+default. Both *--live* and *--config* flags may be given, but
+*--current* is exclusive.
shutdown
@@ -4262,7 +4279,7 @@ via the *--active* flag, rather than relating to the *--current* flag.
*--maximum* requests information on the maximum cap of vcpus that a
domain can add via ``setvcpus``, while *--active* shows the current
usage; these two flags cannot both be specified. *--config*
-requires a persistent domain and requests information regarding the next
+requires a persistent guest and requests information regarding the next
time the domain will be booted, *--live* requires a running domain and
lists current values, and *--current* queries according to the current
state of the domain (corresponding to *--live* if running, or
@@ -4355,8 +4372,9 @@ 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 *vcpu* to all physical cpus specify 'r' as a *cpulist*.
If *--live* is specified, affect a running guest.
-If *--config* is specified, affect the next boot of a persistent guest.
-If *--current* is specified, affect the current guest state.
+If *--config* is specified, affect the next start of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
Both *--live* and *--config* flags may be given if *cpulist* is present,
but *--current* is exclusive.
If no flag is specified, behavior is different depending on hypervisor.
@@ -4402,7 +4420,7 @@ file using a device definition element such as <disk> or <interface>
as the top-level element. See the documentation at
`https://libvirt.org/formatdomain.html#elementsDevices <https://libvirt.org/formatdomain.html#elementsDevices>`__ to learn about
libvirt XML format for a device. If *--config* is specified the
-command alters the persistent domain configuration with the device
+command alters the persistent guest configuration with the device
attach taking effect the next time libvirt starts the domain.
For cdrom and floppy devices, this command only replaces the media
within an existing device; consider using ``update-device`` for this
@@ -4410,8 +4428,9 @@ usage. For passthrough host devices, see also ``nodedev-detach``,
needed if the PCI device does not use managed mode.
If *--live* is specified, affect a running domain.
-If *--config* is specified, affect the next startup of a persistent domain.
-If *--current* is specified, affect the current domain state.
+If *--config* is specified, affect the next startup of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. When no flag is specified legacy API is used whose behavior depends
on the hypervisor driver.
@@ -4479,8 +4498,9 @@ If *--print-xml* is specified, then the XML of the disk that would be attached
is printed instead.
If *--live* is specified, affect a running domain.
-If *--config* is specified, affect the next startup of a persistent domain.
-If *--current* is specified, affect the current domain state.
+If *--config* is specified, affect the next startup of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. When no flag is specified legacy API is used whose behavior depends
on the hypervisor driver.
@@ -4567,8 +4587,9 @@ If ``--print-xml`` is specified, then the XML of the interface that would be
attached is printed instead.
If ``--live`` is specified, affect a running domain.
-If ``--config`` is specified, affect the next startup of a persistent domain.
-If ``--current`` is specified, affect the current domain state.
+If ``--config`` is specified, affect the next startup of a persistent guest.
+If ``--current`` is specified, affect the current domain state, which
+can either be live or offline.
Both ``--live`` and ``--config`` flags may be given, but ``--current`` is
exclusive. When no flag is specified legacy API is used whose behavior
depends on the hypervisor driver.
@@ -4614,8 +4635,9 @@ when the device is removed. Note that the event may arrive before the command
returns.
If *--live* is specified, affect a running domain.
-If *--config* is specified, affect the next startup of a persistent domain.
-If *--current* is specified, affect the current domain state.
+If *--config* is specified, affect the next startup of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. When no flag is specified legacy API is used whose behavior depends
on the hypervisor driver.
@@ -4642,8 +4664,9 @@ removal of the device is notified asynchronously via libvirt events
(see virsh event).
If *--live* is specified, affect a running domain.
-If *--config* is specified, affect the next startup of a persistent domain.
-If *--current* is specified, affect the current domain state.
+If *--config* is specified, affect the next startup of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive.
@@ -4662,8 +4685,9 @@ Detach a disk device from a domain. The *target* is the device as seen
from the domain.
If *--live* is specified, affect a running domain.
-If *--config* is specified, affect the next startup of a persistent domain.
-If *--current* is specified, affect the current domain state.
+If *--config* is specified, affect the next startup of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. When no flag is specified legacy API is used whose behavior depends
on the hypervisor driver.
@@ -4698,8 +4722,9 @@ Detach a network interface from a domain.
present on the domain.
If *--live* is specified, affect a running domain.
-If *--config* is specified, affect the next startup of a persistent domain.
-If *--current* is specified, affect the current domain state.
+If *--config* is specified, affect the next startup of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. When no flag is specified legacy API is used whose behavior depends
on the hypervisor driver.
@@ -4731,8 +4756,9 @@ locked/mounted in the domain. See the documentation at
libvirt XML format for a device.
If *--live* is specified, affect a running domain.
-If *--config* is specified, affect the next startup of a persistent domain.
-If *--current* is specified, affect the current domain state.
+If *--config* is specified, affect the next startup of a persistent guest.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. Not specifying any flag is the same as specifying *--current*.
@@ -4776,7 +4802,7 @@ is used by default.
The *--force* option can be used to force media changing.
If *--live* is specified, alter live configuration of running guest.
If *--config* is specified, alter persistent configuration, effect observed
-on next boot.
+on next startup of the guest.
*--current* can be either or both of *live* and *config*, depends on
the hypervisor's implementation.
Both *--live* and *--config* flags may be given, but *--current* is
@@ -5223,7 +5249,8 @@ instance of <ip> will get the modification.
If *--live* is specified, affect a running network.
If *--config* is specified, affect the next startup of a persistent network.
-If *--current* is specified, affect the current network state.
+If *--current* is specified, it is equivalent to either *--live* or
+*--config*, depending on the current state of the guest.
Both *--live* and *--config* flags may be given, but *--current* is
exclusive. Not specifying any flag is the same as specifying *--current*.
@@ -6717,7 +6744,7 @@ taken. This increases the size of the memory image of the external
snapshot. This is currently supported only for full system external snapshots.
Existence of snapshot metadata will prevent attempts to ``undefine``
-a persistent domain. However, for transient domains, snapshot
+a persistent guest. However, for transient domains, snapshot
metadata is silently lost when the domain quits running (whether
by command such as ``destroy`` or by internal guest action).
@@ -6926,7 +6953,7 @@ Filtering options are not compatible with *--tree*.
If *--metadata* is specified, the list will be filtered to just
snapshots that involve libvirt metadata, and thus would prevent
-``undefine`` of a persistent domain, or be lost on ``destroy`` of
+``undefine`` of a persistent guest, or be lost on ``destroy`` of
a transient domain. Likewise, if *--no-metadata* is specified,
the list will be filtered to just snapshots that exist without
the need for libvirt metadata.
@@ -7087,7 +7114,7 @@ to freeze and unfreeze domain's mounted file systems. However,
if domain has no guest agent, checkpoint creation will fail.
Existence of checkpoint metadata will prevent attempts to ``undefine``
-a persistent domain. However, for transient domains, checkpoint
+a persistent guest. However, for transient domains, checkpoint
metadata is silently lost when the domain quits running (whether
by command such as ``destroy`` or by internal guest action).
--
2.26.2
4 years, 4 months
[PATCH] virsh: Add source-initiator opt to build the initiator of pool XML
by Han Han
For iscsi-direct pool, the initiator is necessary for pool defining:
<pool type="iscsi-direct">
...
<initiator>
<iqn name="iqn.2013-06.com.example:iscsi-initiator"/>
</initiator>
...
</pool>
Add --source-initiator to fill the initiator iqn for
pool-create-as/pool-define-as subcommands.
https://bugzilla.redhat.com/show_bug.cgi?id=1658082
Signed-off-by: Han Han <hhan(a)redhat.com>
---
docs/manpages/virsh.rst | 5 +++++
tools/virsh-pool.c | 17 +++++++++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 9187037a56..0482fe8b26 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -5732,6 +5732,7 @@ pool-create-as
pool-create-as name type
[--source-host hostname] [--source-path path] [--source-dev path]
[--source-name name] [--target path] [--source-format format]
+ [--source-initiator initiator-iqn]
[--auth-type authtype --auth-username username
[--secret-usage usage | --secret-uuid uuid]]
[--source-protocol-ver ver]
@@ -5769,6 +5770,9 @@ the host file system.
[*--source-format format*] provides information about the format of the
pool (pool types fs, netfs, disk, logical).
+[*--source-initiator initiator-iqn*] provides the initiator iqn for iscsi
+connection of the pool (pool type iscsi-direct).
+
[*--auth-type authtype* *--auth-username username*
[*--secret-usage usage* | *--secret-uuid uuid*]]
provides the elements required to generate authentication credentials for
@@ -5831,6 +5835,7 @@ pool-define-as
pool-define-as name type
[--source-host hostname] [--source-path path] [--source-dev path]
[*--source-name name*] [*--target path*] [*--source-format format*]
+ [--source-initiator initiator-iqn]
[*--auth-type authtype* *--auth-username username*
[*--secret-usage usage* | *--secret-uuid uuid*]]
[*--source-protocol-ver ver*]
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index fd43d3bb62..a7e0aa3010 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -141,6 +141,10 @@
{.name = "source-protocol-ver", \
.type = VSH_OT_STRING, \
.help = N_("nfsvers value for NFS pool mount option") \
+ }, \
+ {.name = "source-initiator", \
+ .type = VSH_OT_STRING, \
+ .help = N_("initiator iqn for underlying storage") \
}
virStoragePoolPtr
@@ -324,7 +328,8 @@ virshBuildPoolXML(vshControl *ctl,
*secretUsage = NULL, *adapterName = NULL, *adapterParent = NULL,
*adapterWwnn = NULL, *adapterWwpn = NULL, *secretUUID = NULL,
*adapterParentWwnn = NULL, *adapterParentWwpn = NULL,
- *adapterParentFabricWwn = NULL, *protoVer = NULL;
+ *adapterParentFabricWwn = NULL, *protoVer = NULL,
+ *srcInitiator = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
VSH_EXCLUSIVE_OPTIONS("secret-usage", "secret-uuid");
@@ -352,7 +357,8 @@ virshBuildPoolXML(vshControl *ctl,
vshCommandOptStringReq(ctl, cmd, "adapter-parent-wwnn", &adapterParentWwnn) < 0 ||
vshCommandOptStringReq(ctl, cmd, "adapter-parent-wwpn", &adapterParentWwpn) < 0 ||
vshCommandOptStringReq(ctl, cmd, "adapter-parent-fabric-wwn", &adapterParentFabricWwn) < 0 ||
- vshCommandOptStringReq(ctl, cmd, "source-protocol-ver", &protoVer) < 0) {
+ vshCommandOptStringReq(ctl, cmd, "source-protocol-ver", &protoVer) < 0 ||
+ vshCommandOptStringReq(ctl, cmd, "source-initiator", &srcInitiator) < 0) {
return false;
}
@@ -370,6 +376,13 @@ virshBuildPoolXML(vshControl *ctl,
virBufferAsprintf(&buf, "<dir path='%s'/>\n", srcPath);
if (srcDev)
virBufferAsprintf(&buf, "<device path='%s'/>\n", srcDev);
+ if (srcInitiator) {
+ virBufferAddLit(&buf, "<initiator>\n");
+ virBufferAdjustIndent(&buf, 2);
+ virBufferAsprintf(&buf, "<iqn name='%s'/>\n", srcInitiator);
+ virBufferAdjustIndent(&buf, -2);
+ virBufferAddLit(&buf, "</initiator>\n");
+ }
if (adapterWwnn && adapterWwpn) {
virBufferAddLit(&buf, "<adapter type='fc_host'");
if (adapterParent)
--
2.28.0
4 years, 4 months
[libvirt PATCH] conf: properly clear out autogenerated macvtap names when formatting/parsing
by Laine Stump
Back when macvtap support was added in commit 315baab9443 in Feb. 2010
(libvirt-0.7.7), it was setup to autogenerate a name for the device if
one wasn't supplied, in the pattern "macvtap%d" (or "macvlan%d"),
similar to the way an unspecified standard tap device name will lead
to an autogenerated "vnet%d".
As a matter of fact, in commit ca1b7cc8e45 added in May 2010, the code
was changed to *always* ignore a supplied device name for macvtap
interfaces by deleting any name immediately during the <interface>
parsing (this was intended to prevent one domain which had failed to
completely start from deleting the macvtap device of another domain
which had subsequently been provided the same device name (this will
seem mildly ironic later). This was later fixed to only clear the
device name when inactive XML was being parsed. HOWEVER - this was
only done if the xml was <interface type='direct'> - autogenerated
names were not cleared for <interface type='network'> (which could
also result in a macvtap device).
Although the names of "vnetX" tap devices had always been
automatically cleared when parsing <interface> (see commit d1304583d
from July 2008 (!)), at the time macvtap support was added, both vnetX
and macvtapX device names were always included when formatting the
XML.
Then in commit a8be259d0cc (July 2011, libvirt-0.9.4), <interface>
formatting was changed to also clear out "vnetX" device names during
XML formatting as well. However the same treatment wasn't given to
"macvtapX".
The result of all this (among other things) was that when a running guest
Now in 2020, there has been a report that a failed migration leads to
the macvtap device of some other unrelated guest on the destination
host losing its network connectivity. It was determined that this was
due to the domain XML in the migration containing a macvtap device
name, e.g. "macvtap0", that was already in use on the
destination. Normally this wouldn't be a problem, because libvirt
would see that the device was already in use, and then find a
different unused name. But in this case, other external problems were
causing the migration to fail prior to selecting a macvtap device and
successfully opening it, and during error recovery, qemuProcessStop()
was called, which went through all def->nets objects and (if they were
macvtap) deleted the device specified in net->ifname; since libvirt
hadn't gotten to the point of replacing the incoming "macvtap0" with
the name of a device it actually created for this guest, that meant
that "macvtap0" was deleted, *even though it was currently in use by a
different guest*!
Whew!
So, it turns out that when formatting "migratable" XML, "vnetX"
devices are omitted, just as when formatting "inactive" XML (I'm sure
there's a bit of code somewhere that says "if (migratable) then set
inactive too", but found it was easier to just try it out with "virsh
dumpxml blah --migratable"). By making the code in both interface
parsing and formatting consistent for "vnetX", "macvtapX", and
"macvlanX", we can thus make sure that the autogenerated (and unneeded
/ completely *not* wanted) macvtap device name will not be sent with
the migration XML. This way when a migration fails, net->ifname will
be NULL, and libvirt won't have any device to try and delete.
Signed-off-by: Laine Stump <laine(a)redhat.com>
---
src/conf/domain_conf.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8e7981bf25..6064d31b99 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12428,14 +12428,6 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
}
def->data.direct.linkdev = g_steal_pointer(&dev);
-
- if (ifname &&
- flags & VIR_DOMAIN_DEF_PARSE_INACTIVE &&
- (STRPREFIX(ifname, VIR_NET_GENERATED_MACVTAP_PREFIX) ||
- STRPREFIX(ifname, VIR_NET_GENERATED_MACVLAN_PREFIX))) {
- VIR_FREE(ifname);
- }
-
break;
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
@@ -12481,6 +12473,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
if (def->managed_tap != VIR_TRISTATE_BOOL_NO && ifname &&
(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
(STRPREFIX(ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
+ STRPREFIX(ifname, VIR_NET_GENERATED_MACVTAP_PREFIX) ||
+ STRPREFIX(ifname, VIR_NET_GENERATED_MACVLAN_PREFIX) ||
(prefix && STRPREFIX(ifname, prefix)))) {
/* An auto-generated target name, blank it out */
VIR_FREE(ifname);
@@ -26796,6 +26790,8 @@ virDomainNetDefFormat(virBufferPtr buf,
(def->managed_tap == VIR_TRISTATE_BOOL_NO ||
!((flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) &&
(STRPREFIX(def->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
+ STRPREFIX(def->ifname, VIR_NET_GENERATED_MACVTAP_PREFIX) ||
+ STRPREFIX(def->ifname, VIR_NET_GENERATED_MACVLAN_PREFIX) ||
(prefix && STRPREFIX(def->ifname, prefix)))))) {
/* Skip auto-generated target names for inactive config. */
virBufferEscapeString(&attrBuf, " dev='%s'", def->ifname);
--
2.26.2
4 years, 4 months
[libvirt PATCH] qemu: remove unreachable code in qemuProcessStart()
by Laine Stump
Back when the original version of this chunk of code was added (commit
41b087198 in libvirt-0.8.1 in April 2010), we used virExecDaemonize()
to start the qemu process, and would continue on in the function
(which at that time was called qemudStartVMDaemon()) even if a -1 was
returned. So it was possible to get to this code with rv == -1 (it was
called "ret" in that version of the code).
In modern libvirt code, qemu is started with virCommandRun(); then we
call virPidFileReadPath(); those are the only two ways of setting "rv"
prior to this code being removed, and in either case if the new value
of rv < 0, then we immediately skip over the rest of the code to the
cleanup: label.
This means that the code being removed by this patch is
unreachable.
(NB: anyway, attempting to fend off accidental removal of some other
guest's nwfilter rules by carefully ordering all nwfilter teardowns to
happen "before tap device deletion" is a fruitless pursuit, because a
tap device could be deleted by the qemu process being terminated
external to libvirt, i.e. we must instead avoid re-using tap device
names. That is coming.)
Signed-off-by: Laine Stump <laine(a)redhat.com>
---
src/qemu/qemu_process.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 126fabf5ef..832b2e6870 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6907,12 +6907,6 @@ qemuProcessLaunch(virConnectPtr conn,
goto cleanup;
VIR_DEBUG("Handshake complete, child running");
- if (rv == -1) {
- /* The VM failed to start; tear filters before taps */
- virDomainConfVMNWFilterTeardown(vm);
- goto cleanup;
- }
-
if (qemuDomainObjStartWorker(vm) < 0)
goto cleanup;
--
2.26.2
4 years, 4 months
[libvirt PATCH] gitdm: add missing aliases
by Pino Toscano
Consider a couple of misspelt emails in B-y tags.
Signed-off-by: Pino Toscano <ptoscano(a)redhat.com>
---
docs/gitdm/aliases | 2 ++
1 file changed, 2 insertions(+)
diff --git a/docs/gitdm/aliases b/docs/gitdm/aliases
index 83637bdff9..467e90f141 100644
--- a/docs/gitdm/aliases
+++ b/docs/gitdm/aliases
@@ -1,6 +1,8 @@
# Silly mistakes, mostly found in S-o-b or R-b tags.
+"berrange redhat com" berrange(a)redhat.com
"jdenemar redhat com" jdenemar(a)redhat.com
+"jtomko redhat com" jtomko(a)redhat.com
"pkrempa@redhat st.com" pkrempa(a)redhat.com
berrange(a)localhost.localdomain berrange(a)redhat.com
jyang@redhat jyang(a)redhat.com
--
2.26.2
4 years, 4 months
[PATCH] qemu_namespace: Don't build namespace if domain doesn't have it enabled
by Michal Privoznik
Even if namespaces are disabled, then due to a missing check at the
beginning of qemuDomainBuildNamespace(), the domain startup code
still tries to populate (nonexistent) domain's namespace.
Fixes: 8da362fe62766b4eee209cd3ce591ceb62299d13
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_namespace.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c
index 797722b714..b6724a095f 100644
--- a/src/qemu/qemu_namespace.c
+++ b/src/qemu/qemu_namespace.c
@@ -616,6 +616,11 @@ qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg,
{
VIR_AUTOSTRINGLIST paths = NULL;
+ if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT)) {
+ VIR_DEBUG("namespaces disabled for domain %s", vm->def->name);
+ return 0;
+ }
+
if (qemuDomainPopulateDevices(cfg, &paths) < 0)
return -1;
--
2.26.2
4 years, 4 months