Entering freeze for libvirt-9.9.0

2023-10-26 Thread Jiri Denemark
I have just tagged v9.9.0-rc1 in the repository and pushed signed
tarballs and source RPMs to https://download.libvirt.org/

Please give the release candidate some testing and in case you find a
serious issue which should have a fix in the upcoming release, feel
free to reply to this thread to make sure the issue is more visible.

If you have not done so yet, please update NEWS.rst to document any
significant change you made since the last release.

Thanks,

Jirka



Plans for 9.9.0 release (freeze on Thursday 26 Oct)

2023-10-19 Thread Jiri Denemark
We are getting close to 9.9.0 release of libvirt. To aim for the
release on Wednesday 01 Nov I suggest entering the freeze on Thursday
26 Oct and tagging RC2 on Monday 30 Oct.

I hope this works for everyone.

Jirka



Release of libvirt-9.8.0

2023-10-02 Thread Jiri Denemark
The 9.8.0 release of both libvirt and libvirt-python is tagged and
signed tarballs and source RPMs are available at

https://download.libvirt.org/
https://download.libvirt.org/python/

Thanks everybody who helped with this release by sending patches,
reviewing, testing, or providing feedback. Your work is greatly
appreciated.

* New features

  * network: New metadata change event

The network object now has a new event ID 
``VIR_NETWORK_EVENT_ID_METADATA_CHANGE``
that can be used to get notifications upon changes in any of ,
 or .

  * qemu: Add support for vDPA block devices

With a new enough version of qemu, libvirt will allow you to assign vDPA 
block
devices to a domain. This is configured with::

  

...

* Improvements

  * qemu: add nbdkit backend for network disks

Up until now, libvirt supported network disks (http, ftp, ssh) by passing
the URL to qemu and having the appropriate qemu block drivers handle the
disk I/O. However, by handling the network I/O outside of the qemu process,
we get several advantages, such as reduced attack surface and improved
stability of qemu. Therefore, when available, libvirt will use nbdkit as a
backend for these network disks and export an NBD disk to qemu.

  * virnetdevopenvswitch: Propagate OVS error messages

When configuring OVS interfaces/bridges libvirt used to report its own
error messages instead of passing (more accurate) error messages from
`ovs-vsctl`. This is now changed.

  * Various virtio-mem/virtio-pmem fixes

Now libvirt validates more values of virtio-mem and virtio-pmem devices,
e.g. overlapping memory addresses or alignment.

Enjoy.

Jirka



libvirt-9.8.0 release candidate 2

2023-09-29 Thread Jiri Denemark
I have just tagged v9.8.0-rc2 in the repository and pushed signed
tarballs and source RPMs to https://download.libvirt.org/

Please give the release candidate some testing and in case you find a
serious issue which should have a fix in the upcoming release, feel
free to reply to this thread to make sure the issue is more visible.

If you have not done so yet, please update NEWS.rst to document any
significant change you made since the last release.

Thanks,

Jirka



Entering freeze for libvirt-9.8.0

2023-09-26 Thread Jiri Denemark
I have just tagged v9.8.0-rc1 in the repository and pushed signed
tarballs and source RPMs to https://download.libvirt.org/

Please give the release candidate some testing and in case you find a
serious issue which should have a fix in the upcoming release, feel
free to reply to this thread to make sure the issue is more visible.

If you have not done so yet, please update NEWS.rst to document any
significant change you made since the last release.

Thanks,

Jirka



Plans for 9.8.0 release (freeze on Tuesday 26 Sep)

2023-09-18 Thread Jiri Denemark
We are getting close to 9.8.0 release of libvirt. To aim for the
release on Monday 02 Oct I suggest entering the freeze on Tuesday 26
Sep and tagging RC2 on Friday 29 Sep.

I hope this works for everyone.

Jirka



Re: [PATCH] lxc: fix lxcContainerMountAllFS() DEREF_BEFORE_CHECK

2023-09-07 Thread Jiri Denemark
On Wed, Sep 06, 2023 at 18:34:42 +0300, Dmitry Frolov wrote:
> Reviewing the sources, I found, that
> in function lxcContainerMountAllFS() pointers
> vmDef->fss[i]->src and vmDef->fss[i]->src->path
> are checked for NULL after dereferencing in
> VIR_DEBUG() macro.
> 
> Fixes: 57487085dc ("lxc: don't try to reference NULL when mounting 
> filesystems")
> ---
>  src/lxc/lxc_container.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
> index 21220661f7..58a6695458 100644
> --- a/src/lxc/lxc_container.c
> +++ b/src/lxc/lxc_container.c
> @@ -1467,13 +1467,15 @@ static int lxcContainerMountAllFS(virDomainDef *vmDef,
>  if (STREQ(vmDef->fss[i]->dst, "/"))
>  continue;
>  
> +if (!(vmDef->fss[i]->src && vmDef->fss[i]->src->path))
> +return -1;

This would return -1 without reporting any error. And you are also
changing the logic here without explaining it. If vmDef->fss[i]->src was
NULL or vmDef->fss[i]->src->path was NULL this function would call
lxcContainerUnmountSubtree on vmDef->fss[i]->dst before, but now it just
returns -1. Well except that it would crash first :-) In any case, this
part is wrong, see below...

> +
>  VIR_DEBUG("Mounting '%s' -> '%s'", vmDef->fss[i]->src->path, 
> vmDef->fss[i]->dst);
>  
>  if (lxcContainerResolveSymlinks(vmDef->fss[i], false) < 0)
>  return -1;
>  
> -if (!(vmDef->fss[i]->src && vmDef->fss[i]->src->path &&
> -  STRPREFIX(vmDef->fss[i]->src->path, vmDef->fss[i]->dst)) &&
> +if (!STRPREFIX(vmDef->fss[i]->src->path, vmDef->fss[i]->dst) &&
>  lxcContainerUnmountSubtree(vmDef->fss[i]->dst, false) < 0)
>  return -1;

I checked our parsing code and vmDef->fss[i]->src can never be NULL as
it is always allocated in virDomainFSDefNew so checking it is redundant.
On the other hand vmDef->fss[i]->src->path can be NULL, but it is not en
error, e.g., VIR_DOMAIN_FS_TYPE_RAM would contain path == NULL.

So the fix should rather remove the check for vmDef->fss[i]->src and use
NULLSTR(vmDef->fss[i]->src->path) in VIR_DEBUG.

Jirka



Release of libvirt-9.7.0

2023-09-01 Thread Jiri Denemark
The 9.7.0 release of both libvirt and libvirt-python is tagged and
signed tarballs and source RPMs are available at

https://download.libvirt.org/
https://download.libvirt.org/python/

Thanks everybody who helped with this release by sending patches,
reviewing, testing, or providing feedback. Your work is greatly
appreciated.

* New features

  * qemu: basic support for use of "VFIO variant" drivers

A VFIO variant driver is a device-specific driver that can
be used in place of the generic vfio-pci driver, and provides
extra functionality to support things like live migration of
guests with vfio-assigned devices. It can currently be used by:

1) setting ``managed='no'`` in the XML configuration for the device
2) pre-binding the variant driver using the ``--driver`` option of
   ``virsh nodedev-detach``.

* Bug fixes

  * qemu: Various fixes to firmware selection

The changes made to firmware selection in libvirt 9.2.0 have unfortunately
introduced a number of regressions. All known issues in this area have now
been resolved.

Enjoy.

Jirka



Re: [PATCH] virsh: Fix net-desc --config output

2023-09-01 Thread Jiri Denemark
On Thu, Aug 31, 2023 at 23:46:57 +0530, K Shiva Kiran wrote:
> Fixes the following bug:
> Command:  `net-desc --config [--title] my_network`
> Expected Output:  Title/Description of persistent config
> Output:   Title/Description of live config
> 
> This was caused due to the usage of a single `flags` variable in
> `virshGetNetworkDescription()` which ended up in a wrong enum being
> passed to `virNetworkGetMetadata()` (enum being that of LIVE instead of
> CONFIG).
> 
> Although the domain object has the same code, this didn't cause a problem
> there because the enum values of `VIR_DOMAIN_INACTIVE_XML` and
> `VIR_DOMAIN_METADATA_CONFIG` turn out to be the same (1 << 1), whereas
> they are not for network equivalent ones (1 << 0, 1 << 1).
> 
> Signed-off-by: K Shiva Kiran 
> ---
>  tools/virsh-network.c | 11 ++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
...

Reviewed-by: Jiri Denemark 



Re: [libvirt PATCH v2 6/6] Revert "capabilities: report full external snapshot support"

2023-09-01 Thread Jiri Denemark
On Fri, Sep 01, 2023 at 11:24:28 +0200, Peter Krempa wrote:
> On Fri, Sep 01, 2023 at 10:32:17 +0200, Pavel Hrdina wrote:
> > Reverting external snapshot for running VM doesn't work correctly so we
> > should not report this capability until it is fixed.
> > 
> > This reverts commit de71573bfec7f3acd22ec74794318de121716e21.
> > 
> > Signed-off-by: Pavel Hrdina 
> > ---
> 
> If Jirka decides to go with this alternative and cut the release before
> the fixes:
> 
> Reviewed-by: Peter Krempa 

Yeah, I think this is a better approach for this release. The
functionality can be properly fixed after the release.

Jirka



libvirt-9.7.0 release candidate 2

2023-08-30 Thread Jiri Denemark
I have just tagged v9.7.0-rc2 in the repository and pushed signed
tarballs and source RPMs to https://download.libvirt.org/

Please give the release candidate some testing and in case you find a
serious issue which should have a fix in the upcoming release, feel
free to reply to this thread to make sure the issue is more visible.

If you have not done so yet, please update NEWS.rst to document any
significant change you made since the last release.

Thanks,

Jirka



Entering freeze for libvirt-9.7.0

2023-08-28 Thread Jiri Denemark
I have just tagged v9.7.0-rc1 in the repository and pushed signed
tarballs and source RPMs to https://download.libvirt.org/

Please give the release candidate some testing and in case you find a
serious issue which should have a fix in the upcoming release, feel
free to reply to this thread to make sure the issue is more visible.

If you have not done so yet, please update NEWS.rst to document any
significant change you made since the last release.

Thanks,

Jirka



Plans for 9.7.0 release (freeze on Monday 28 Aug)

2023-08-17 Thread Jiri Denemark
We are getting close to 9.7.0 release of libvirt. To aim for the
release on Friday 01 Sep I suggest entering the freeze on Monday 28
Aug and tagging RC2 on Wednesday 30 Aug.

I hope this works for everyone.

Jirka



Release of libvirt-9.6.0

2023-08-01 Thread Jiri Denemark
The 9.6.0 release of both libvirt and libvirt-python is tagged and
signed tarballs and source RPMs are available at

https://download.libvirt.org/
https://download.libvirt.org/python/

Thanks everybody who helped with this release by sending patches,
reviewing, testing, or providing feedback. Your work is greatly
appreciated.

* Security

  * ``CVE-2023-3750``: Fix race condition in storage driver leading to a crash

   In libvirt-8.3 a bug was introduced which in rare cases could cause
   ``libvirtd`` or ``virtstoraged`` to crash if multiple clients attempted to
   look up a storage volume by key, path or target path, while other clients
   attempted to access something from the same storage pool.

* Improvements

  * apparmor: All profiles and abstractions now support local overrides

This has long been the case for the ``virt-aa-helper`` profile, but has
now been extended to all other profiles and abstractions. The mechanism
used is the standard AppArmor 3.x one, where the contents of ``foo`` and
``abstractions/foo`` can be overridden by creating ``local/foo`` and
``abstractions/foo.d`` respectively.

  * qemu: Support ``removable`` attribute for scsi disk

Now the scsi disk device (``/disk@device='disk'`` and
``/disk/target@bus='scsi'``) supports the ``removable`` attribute at
``/disk/target@removable```.

  * qemu: Add NUMA node automatically for memory hotplug

Users no longer need to specify guest NUMA node in the domain XML when
enabling memory hotplug, libvirt automatically adds one when it is missing.

  * qemu: Consider ``BeeGFS`` as a shared filesystem

Allow migration with non-shared storage for VMs accessing storage via
``BeeGFS``.

* Bug fixes

  * qemu: Adapt to new way of specifying PC speaker

PC speaker is now usable again with newer QEMU since the change of how it
is specified on the command line.

  * qemu_tpm: Try harder to create emulator state

Libvirt no longer considers empty directory valid SWTPM state and setup is
now run properly in such case.

Enjoy.

Jirka



libvirt-9.6.0 release candidate 2

2023-07-28 Thread Jiri Denemark
I have just tagged v9.6.0-rc2 in the repository and pushed signed
tarballs and source RPMs to https://download.libvirt.org/

Please give the release candidate some testing and in case you find a
serious issue which should have a fix in the upcoming release, feel
free to reply to this thread to make sure the issue is more visible.

If you have not done so yet, please update NEWS.rst to document any
significant change you made since the last release.

Thanks,

Jirka



Entering freeze for libvirt-9.6.0

2023-07-26 Thread Jiri Denemark
I have just tagged v9.6.0-rc1 in the repository and pushed signed
tarballs and source RPMs to https://download.libvirt.org/

Please give the release candidate some testing and in case you find a
serious issue which should have a fix in the upcoming release, feel
free to reply to this thread to make sure the issue is more visible.

If you have not done so yet, please update NEWS.rst to document any
significant change you made since the last release.

Thanks,

Jirka



Plans for 9.6.0 release (freeze on Wednesday 26 Jul)

2023-07-21 Thread Jiri Denemark
We are getting close to 9.6.0 release of libvirt. To aim for the
release on Tuesday 01 Aug I suggest entering the freeze on Wednesday
26 Jul and tagging RC2 on Friday 28 Jul.

I hope this works for everyone.

Jirka



Plans for the next release

2023-07-21 Thread Jiri Denemark
We are getting close to the next release of libvirt. To aim for the
release on Aug 01 I suggest entering the freeze on Wednesday Jul 26 and
tagging RC2 on Friday Jul 28.

I hope this works for everyone.

Jirka



Release of libvirt-9.5.0

2023-07-03 Thread Jiri Denemark
The 9.5.0 release of both libvirt and libvirt-python is tagged and
signed tarballs and source RPMs are available at

https://download.libvirt.org/
https://download.libvirt.org/python/

Thanks everybody who helped with this release by sending patches,
reviewing, testing, or providing feedback. Your work is greatly
appreciated.

* New features

  * qemu: Allow configuring the ``discard-no-unref`` feature of ``qcow2`` driver

The new ``discard_no_unref`` attribute of the ``disk`` ``driver`` element
controls whether the ``qcow2`` driver in qemu unrefs clusters inside the
image on discard requests. Disabling cluster unrefing decreases 
fragmentation
of the image.

* Improvements

  * qemu: Include maximum physical address size in baseline CPU

When computing a baseline CPU definition for a set of hosts, we need to
include maximum physical address size in the result to make sure it is
compatible with all hosts even if their supported physical address sizes
differ.

  * conf: Properly handle slots for non-DIMM  devices

Memory devices such as ``virtio-mem`` don't need a memory slot as they are
PCI devices. ``libvirt`` now properly accounts the memory slots for such
devices as well as specifying the ``slots`` attribute of the 
element is no longer needed unless DIMM-like devices are to be used.

  * ``passt`` log and port forwarding improvements

Libvirt now ensures that the ``passt`` helper process can access the
configured log file even when it's placed in a directory without 
permissions.

The  element of a passt-backed interface can now omit the
``address`` attribute as it's enough to specify a ``dev``.

* Bug fixes

  * lxc: Allow seeking in ``/proc/meminfo`` to resove failure with new 
``procps`` package

New version of the ``free`` command from ``procps`` package seeks into the
``/proc/meminfo`` file, which was not supported by the instance of the file
exposed via LXC causing a failure.

  * qemu: Fix rare race-condition when detaching a device

The device removal handler callback function didn't re-check the state of
the unplug operation after a timeout, which could rarely cause that the
device was removed from the VM but not the definition.

  * qemu: Fix NUMA memory allocation logic

QEMU allocates memory via the emulator thread thus that has to be allowed
to access all configured NUMA nodes of the VM rather than just the one where
it's supposed to be pinned.


  * qemu: Fix setup of ``hostdev`` backed 

The proper steps to initialize the host device were skipped for interfaces
due to a logic bug preventing start of VM which used them.

Enjoy.

Jirka



libvirt-9.5.0 release candidate 2

2023-06-30 Thread Jiri Denemark
I have just tagged v9.5.0-rc2 in the repository and pushed signed
tarballs and source RPMs to https://download.libvirt.org/

Please give the release candidate some testing and in case you find a
serious issue which should have a fix in the upcoming release, feel
free to reply to this thread to make sure the issue is more visible.

If you have not done so yet, please update NEWS.rst to document any
significant change you made since the last release.

Thanks,

Jirka



Entering freeze for libvirt-9.5.0

2023-06-27 Thread Jiri Denemark
I have just tagged v9.5.0-rc1 in the repository and pushed signed
tarballs and source RPMs to https://download.libvirt.org/

Please give the release candidate some testing and in case you find a
serious issue which should have a fix in the upcoming release, feel
free to reply to this thread to make sure the issue is more visible.

If you have not done so yet, please update NEWS.rst to document any
significant change you made since the last release.

Thanks,

Jirka



Re: [PATCH] qemu: prevent SIGSEGV in qemuProcessHandleDumpCompleted

2023-06-27 Thread Jiri Denemark
On Tue, Jun 27, 2023 at 11:43:58 +0300, Nikolai Barybin wrote:
> If VIR_ASYNC_JOB_NONE flag is present, job.current is equal
> to NULL, which leads to SIGSEGV. Thus, this check should be
> moved up.
> 
> Signed-off-by: Nikolai Barybin 
> ---
>  src/qemu/qemu_process.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index d3b1bdf6a4..db06991450 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -1601,11 +1601,11 @@ qemuProcessHandleDumpCompleted(qemuMonitor *mon 
> G_GNUC_UNUSED,
>vm, vm->def->name, stats, NULLSTR(error));
>  
>  jobPriv = vm->job->privateData;
> -privJobCurrent = vm->job->current->privateData;
>  if (vm->job->asyncJob == VIR_ASYNC_JOB_NONE) {
>  VIR_DEBUG("got DUMP_COMPLETED event without a dump_completed job");
>  goto cleanup;
>  }
> +privJobCurrent = vm->job->current->privateData;
>  jobPriv->dumpCompleted = true;
>  privJobCurrent->stats.dump = *stats;
>  vm->job->error = g_strdup(error);

Right, and it used to be this way until commit v8.0.0-427-gf304de0df6

Fixes: v8.0.0-427-gf304de0df6
Reviewed-by: Jiri Denemark 

And pushed, thanks.



[libvirt PATCH 1/3] qemu: Report physical address size in domain capabilities

2023-06-16 Thread Jiri Denemark
We already report the hosts physical address size in host capabilities,
but computing a baseline CPU definition is done from domain
capabilities.

Signed-off-by: Jiri Denemark 
---
 docs/formatdomaincaps.rst |  6 +++-
 src/conf/schemas/domaincaps.rng   |  3 ++
 src/qemu/qemu_capabilities.c  | 33 ++-
 .../domaincapsdata/qemu_4.2.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_4.2.0.ppc64.xml |  1 +
 tests/domaincapsdata/qemu_4.2.0.s390x.xml |  1 +
 tests/domaincapsdata/qemu_4.2.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_5.0.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_5.0.0.ppc64.xml |  1 +
 tests/domaincapsdata/qemu_5.0.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_5.1.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_5.1.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_5.2.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_5.2.0.ppc64.xml |  1 +
 tests/domaincapsdata/qemu_5.2.0.s390x.xml |  1 +
 tests/domaincapsdata/qemu_5.2.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_6.0.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_6.0.0.s390x.xml |  1 +
 tests/domaincapsdata/qemu_6.0.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_6.1.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_6.1.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_6.2.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_6.2.0.ppc64.xml |  1 +
 tests/domaincapsdata/qemu_6.2.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_7.0.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_7.0.0.ppc64.xml |  1 +
 tests/domaincapsdata/qemu_7.0.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_7.1.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_7.1.0.ppc64.xml |  1 +
 tests/domaincapsdata/qemu_7.1.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_7.2.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_7.2.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_8.0.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_8.0.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_8.1.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_8.1.0.x86_64.xml|  1 +
 tests/domaincapsmock.c|  7 
 37 files changed, 80 insertions(+), 2 deletions(-)

diff --git a/docs/formatdomaincaps.rst b/docs/formatdomaincaps.rst
index e93c765aff..9dae941d18 100644
--- a/docs/formatdomaincaps.rst
+++ b/docs/formatdomaincaps.rst
@@ -187,6 +187,7 @@ CPUs `__.

  Broadwell
  Intel
+ 
  
  

@@ -218,7 +219,10 @@ more details about it:
indicated by the ``fallback`` attribute of the ``model`` sub element:
``allow`` means not all specifics were accounted for and thus the CPU a 
guest
will see may be different; ``forbid`` indicates that the CPU a guest will 
see
-   should match this CPU definition.
+   should match this CPU definition. The optional ``maxphysaddr`` element
+   reports physical address size of the host CPU if this value is available and
+   applicable for the requested domain type. This is useful for computing
+   baseline CPU definition which should be compatible with several hosts.
 ``custom``
The ``mode`` element contains a list of supported CPU models, each described
by a dedicated ``model`` element. The ``usable`` attribute specifies whether
diff --git a/src/conf/schemas/domaincaps.rng b/src/conf/schemas/domaincaps.rng
index 28f545bd4b..19bd6f7128 100644
--- a/src/conf/schemas/domaincaps.rng
+++ b/src/conf/schemas/domaincaps.rng
@@ -132,6 +132,9 @@
 
   
 
+
+  
+
 
   
 
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index cf85d42198..0552486805 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -717,6 +717,8 @@ struct _virQEMUCapsHostCPUData {
  * probe QEMU or load the cache.
  */
 qemuMonitorCPUModelInfo *info;
+/* Physical address size of the host CPU or 0 if unknown or not 
applicable. */
+unsigned int physAddrSize;
 /* Host CPU definition reported in domain capabilities. */
 virCPUDef *reported;
 /* Migratable host CPU definition used for updating guest CPU. */
@@ -2236,6 +2238,7 @@ virQEMUCapsGetHostModel(virQEMUCaps *qemuCaps,
 static void
 virQEMUCapsSetHostModel(virQEMUCaps *qemuCaps,
 virDomainVirtType type,
+unsigned int physAddrSize,
 virCPUDef *reported,
 virCPUDef *migratable,
 virCPUDef *full)
@@ -2243,12 +2246,34 @@ virQEMUCapsSetHostModel(virQEMUCaps *qemuCaps,
 virQEMUCapsHostCPUData *cpuData;
 
 cpuData = (qemuCaps, type)->hostCPU;
+cpuData->physAddrSize = physAddrSize;
 cpuData->reported = reported;
 cpuData->migratable = migratable;
 cpuData->full = full;
 }
 
 
+static virCPUMaxPhysAddrDef *
+virQEMUCapsGetHostPhysAddr(virQEM

[libvirt PATCH 2/3] qemu: Include maximum physical address size in baseline CPU

2023-06-16 Thread Jiri Denemark
The current implementation of virConnectBaselineHypervisorCPU in QEMU
driver can provide a CPU definition that will not work on all hosts in
case they have different maximum physical address size. So when we get
the info from domain capabilities, we need to choose the smallest
physical address size for the computed baseline CPU definition.

https://bugzilla.redhat.com/show_bug.cgi?id=2171860

Signed-off-by: Jiri Denemark 
---
 src/qemu/qemu_driver.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 857fbfb799..c4bd766531 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11778,6 +11778,8 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr conn,
 virCPUDef *cpu = NULL;
 char *cpustr = NULL;
 g_auto(GStrv) features = NULL;
+unsigned int physAddrSize = 0;
+size_t i;
 
 virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES |
   VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL);
@@ -11845,6 +11847,21 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr conn,
 virCPUExpandFeatures(arch, cpu) < 0)
 goto cleanup;
 
+for (i = 0; i < ncpus; i++) {
+if (!cpus[i]->addr || cpus[i]->addr->limit == 0)
+continue;
+
+if (physAddrSize == 0 || cpus[i]->addr->limit < physAddrSize)
+physAddrSize = cpus[i]->addr->limit;
+}
+
+if (physAddrSize > 0) {
+cpu->addr = g_new0(virCPUMaxPhysAddrDef, 1);
+cpu->addr->mode = VIR_CPU_MAX_PHYS_ADDR_MODE_PASSTHROUGH;
+cpu->addr->limit = physAddrSize;
+cpu->addr->bits = -1;
+}
+
 cpustr = virCPUDefFormat(cpu, NULL);
 
  cleanup:
-- 
2.41.0



[libvirt PATCH 3/3] NEWS: Mentioned an improvement for virConnectBaselineHypervisorCPU

2023-06-16 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 NEWS.rst | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/NEWS.rst b/NEWS.rst
index b1cccee4fa..c520a96177 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -19,6 +19,13 @@ v9.5.0 (unreleased)
 
 * **Improvements**
 
+  * qemu: Include maximum physical address size in baseline CPU
+
+When computing a baseline CPU definition for a set of hosts, we need to
+include maximum physical address size in the result to make sure it is
+compatible with all hosts even if their supported physical address sizes
+differ.
+
 * **Bug fixes**
 
 
-- 
2.41.0



[libvirt PATCH 0/3] qemu: Include maximum physical address size in baseline CPU

2023-06-16 Thread Jiri Denemark
Jiri Denemark (3):
  qemu: Report physical address size in domain capabilities
  qemu: Include maximum physical address size in baseline CPU
  NEWS: Mentioned an improvement for virConnectBaselineHypervisorCPU

 NEWS.rst  |  7 
 docs/formatdomaincaps.rst |  6 +++-
 src/conf/schemas/domaincaps.rng   |  3 ++
 src/qemu/qemu_capabilities.c  | 33 ++-
 src/qemu/qemu_driver.c| 17 ++
 .../domaincapsdata/qemu_4.2.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_4.2.0.ppc64.xml |  1 +
 tests/domaincapsdata/qemu_4.2.0.s390x.xml |  1 +
 tests/domaincapsdata/qemu_4.2.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_5.0.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_5.0.0.ppc64.xml |  1 +
 tests/domaincapsdata/qemu_5.0.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_5.1.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_5.1.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_5.2.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_5.2.0.ppc64.xml |  1 +
 tests/domaincapsdata/qemu_5.2.0.s390x.xml |  1 +
 tests/domaincapsdata/qemu_5.2.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_6.0.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_6.0.0.s390x.xml |  1 +
 tests/domaincapsdata/qemu_6.0.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_6.1.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_6.1.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_6.2.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_6.2.0.ppc64.xml |  1 +
 tests/domaincapsdata/qemu_6.2.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_7.0.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_7.0.0.ppc64.xml |  1 +
 tests/domaincapsdata/qemu_7.0.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_7.1.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_7.1.0.ppc64.xml |  1 +
 tests/domaincapsdata/qemu_7.1.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_7.2.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_7.2.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_8.0.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_8.0.0.x86_64.xml|  1 +
 .../domaincapsdata/qemu_8.1.0-q35.x86_64.xml  |  1 +
 tests/domaincapsdata/qemu_8.1.0.x86_64.xml|  1 +
 tests/domaincapsmock.c|  7 
 39 files changed, 104 insertions(+), 2 deletions(-)

-- 
2.41.0



Plans for the next release

2023-06-16 Thread Jiri Denemark
We are getting close to the next release of libvirt. To aim for the
release on Jul 03 I suggest entering the freeze on Tuesday Jun 27 and
tagging RC2 on Friday Jun 30.

I hope this works for everyone.

Jirka



Re: [RFC 0/6] Migration deprecated parts

2023-06-13 Thread Jiri Denemark
On Mon, Jun 12, 2023 at 21:33:38 +0200, Juan Quintela wrote:
> Hi this series describe the migration parts that have to be deprecated.
> 
> - It is an rfc because I doubt that I did the deprecation process right. 
> Hello Markus O:-)
> 
> - skipped field: It is older than me, I have never know what it stands
>   for.  As far as I know it has always been zero.

Libvirt doesn't use this.

> - inc/blk migrate command options.  They are only used by block
>   migration (that I deprecate on the following patch).  And they are really 
> bad.
>   grep must_remove_block_options.
>
> - block migration.  block jobs, whatever they are called this week are
>   way more flexible.  Current code works, but we broke it here and
>   there, and really nobody has stand up to maintain it.  It is quite
>   contained and can be left there.  Is anyone really using it?

We prefer nbd for storage migration if it is available.

> - old compression method.  It don't work.  See last try from Lukas to
>   make a test that works reliabely.  I failed with the same task years
>   ago.  It is really slow, and if compression is good for you, multifd
>   + zlib is going to perform/compress way more.

We do support these methods, but only enable them if a user explicitly
requests so. In other words, the user will just get an error once these
methods are removed, which is fine.

> - -incoming 
> 
>   if you need to set parameters (multifd cames to mind, and preempt has
>   the same problem), you really needs to use defer.  So what should we do 
> here?
> 
>   This part is not urget, because management apps have a working
>   option that are already using "defer", and the code simplifacation
>   if we remove it is not so big.  So we can leave it until 9.0 or
>   whatever we think fit.

Right, libvirt already uses -incoming defer if supported.

In other words, no objection to removing anything on this list and no
additional work is needed on libvirt side.

Jirka



Release of libvirt-9.4.0

2023-06-01 Thread Jiri Denemark
The 9.4.0 release of both libvirt and libvirt-python is tagged and
signed tarballs and source RPMs are available at

https://download.libvirt.org/
https://download.libvirt.org/python/

Thanks everybody who helped with this release by sending patches,
reviewing, testing, or providing feedback. Your work is greatly
appreciated.

* New features

  * qemu: Support compression for parallel migration

QEMU supports parallel migration to be compressed using either zstd or zlib.

* Improvements

  * Adapt to musl-1.2.4

The latest version of musl stopped declaring some symbols that libvirt's
test suite used (for redirecting ``stat()`` family of functions), leaving
the tests broken. This is now fixed and the test suite works even with the
latest version of musl.

  * conf: Introduce  for virtio-mem and virtio-pmem

To ensure guest ABI stability, libvirt persists address for memory devices,
now including ``virtio-mem`` and ``virtio-pmem``. The address can be also
specified by user.

* Bug fixes

  * qemu: Account for NVMe disks when calculating memlock limit on hotplug

When no  is set, libvirt still tries to guess a sensible
limit for memlock for domains. But this limit was not calculated properly
on a hotplug of .

  * numa: Deny other memory modes than ``restrictive``` if a memnode is 
``restrictive``

Due to a missing check it was possible to define a domain with incorrect
. For instance it was possible to have a  and  of a different mode. This is now
forbidden and if either all -s and  have to have
``restrictive`` mode, or none.

  * qemu: Start emulator thread with more generous ``cpuset.mems``

To ensure memory is allocated only from configured NUMA nodes, libvirt sets
up cpuset CGgroup controller, even before QEMU is executed. But this may
prevent QEMU from setting affinity of threads that allocate memory. Since
these threads are spawned from the emulator thread, the initial set up must
be more generous and include union of all host NUMA nodes that are allowed
in the domain definition. Once QEMU has allocated all its memory, the
emulator thread is restricted further, as it otherwise would be.

Enjoy.

Jirka



libvirt-9.4.0 release candidate 2

2023-05-30 Thread Jiri Denemark
I have just tagged v9.4.0-rc2 in the repository and pushed signed
tarballs and source RPMs to https://download.libvirt.org/

Please give the release candidate some testing and in case you find a
serious issue which should have a fix in the upcoming release, feel
free to reply to this thread to make sure the issue is more visible.

If you have not done so yet, please update NEWS.rst to document any
significant change you made since the last release.

Thanks,

Jirka



Re: [PATCH] NEWS: Document my contributions for upcoming release

2023-05-30 Thread Jiri Denemark
On Tue, May 30, 2023 at 09:51:05 +0200, Michal Privoznik wrote:
> Signed-off-by: Michal Privoznik 
> ---
>  NEWS.rst | 37 +
>  1 file changed, 37 insertions(+)
> 
> diff --git a/NEWS.rst b/NEWS.rst
> index 1b85ef6d37..1ee932db72 100644
> --- a/NEWS.rst
> +++ b/NEWS.rst
> @@ -23,8 +23,45 @@ v9.4.0 (unreleased)
>  
>  * **Improvements**
>  
> +  * Adapt to musl-1.2.4
> +
> +The latest version of musl stop declaring some symbols that libvirt's 
> test

s/stop/stopped/ ?

...

Reviewed-by: Jiri Denemark 



Entering freeze for libvirt-9.4.0

2023-05-26 Thread Jiri Denemark
I have just tagged v9.4.0-rc1 in the repository and pushed signed
tarballs and source RPMs to https://download.libvirt.org/

Please give the release candidate some testing and in case you find a
serious issue which should have a fix in the upcoming release, feel
free to reply to this thread to make sure the issue is more visible.

If you have not done so yet, please update NEWS.rst to document any
significant change you made since the last release.

Thanks,

Jirka



Re: Revisiting the virsh hypervisor-cpu-models/definitions commands

2023-05-24 Thread Jiri Denemark
On Wed, May 17, 2023 at 17:34:46 -0400, Collin Walling wrote:
> Daniel, Tim, (and others on the upstream list that'd like to chime in)
> 
> Harken back to a few months ago when I presented a few patches to
> introduce the virsh hypervisor-cpu-models command. The proposal was
> turned down, and I was pointed to a patch-set/discussion that Tim
> introduced almost a year ago today. From what I was able to gather with
> respect to Tim's patches, it seems like this is not a direction that
> x86 wants to pursue, but I still see value in these commands for s390 
> (and perhaps other architectures that may/currently implement CPU
> models via the hypervisor). I see value in these commands that shine
> when including the other hypervisor-cpu-* commands: baseline and comparison.
> 
> What I'd like to accomplish with this conversation: is there an
> agreement where these virsh commands may be implemented, or at least
> some guidance on what should be expected for virsh -> hypervisor CPU
> model commands going forward?
> 
> I believe that these commands will assist a user in creating a
> migration-safe CPU model for a guest in a mixed-generation host
> environment without having to query details from a remote machine.
> Say I have two machines, a z14 and a z15. If I wanted to know which
> CPU model I should define my guest with such that I can guarantee a
> future migration between the two machines, I would need to run
> domcapabilities on one machine, then transfer it to the other machine
> to then perform a baseline. I believe this process could be simplified
> and remove the need to query a remote machine for its CPU definition.

Sure, if you already know exactly what CPU your other host runs on you
don't need to fetch domcapabilities from there. But if you don't know
this info there's no way you could compute a baseline CPU without asking
the other host.

> With hypervisor-cpu-models, I can get a list of CPU models and their
> exact names that I'd like to consider in my mixed environment. Let's
> say I'm on my z15 machine. I want the name of the appropriate z14
> model. I run the hypervisor-cpu-models command and I see that the
> appropriate model for a z14 is a z14.2-base.

What data would hypervisor-cpu-models provide that are not already
reported in domain capabilities XML?


  gen16a-base
  gen16a
  z800-base
  z890.2-base
  z9EC.2
  z13.2
  z990.5-base
  ...


Unless it's something crazy I think we should be able to extend the XML
with such info rather then creating a dedicated API for it.

> Now I can feed that string into hypervisor-cpu-definitions and get a
> proper XML-formatted CPU model.

I think I'm missing something here, but what would such API do with the
CPU model string in addition to


  z14.2-base


> This XML can be fed into hypervisor-cpu-baseline, and produce a
> CPU model that can run on both a z14 and z15. I was able to compute a
> migration-safe CPU model for my mixed environment without having to
> query a remote machine for their host-model.

As mentioned above, the "query a remote machine for their host-model"
step is for checking what CPU the hosts are running on. You can of
course substitute this step with "I know the CPU models already". And
once you have that info you do all the rest on a single host.

I believe this could already be done with the existing APIs we have.
Could you please explain what parts are missing?

Jirka



Plans for the next release

2023-05-22 Thread Jiri Denemark
We are getting close to the next release of libvirt. To aim for the
release on Jun 01 I suggest entering the freeze on Friday May 26 and
tagging RC2 on Tuesday May 30.

I hope this works for everyone.

Jirka



[libvirt PATCH] NEWS: Mention support for compressing parallel migration

2023-05-18 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 NEWS.rst | 4 
 1 file changed, 4 insertions(+)

diff --git a/NEWS.rst b/NEWS.rst
index 446998e12e..1b85ef6d37 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -17,6 +17,10 @@ v9.4.0 (unreleased)
 
 * **New features**
 
+  * qemu: Support compression for parallel migration
+
+QEMU supports parallel migration to be compressed using either zstd or 
zlib.
+
 * **Improvements**
 
 * **Bug fixes**
-- 
2.40.1



Re: [PATCH V3 0/3] migration: add qemu parallel migration options

2023-05-18 Thread Jiri Denemark
On Wed, Apr 26, 2023 at 09:56:30 +0800, Jiang Jiacheng wrote:
> On 2023/4/24 18:57, Jiri Denemark wrote:
> > On Fri, Apr 21, 2023 at 17:39:12 +0800, Jiang Jiacheng wrote:
> >>
> >> Thank you for your reply and review, I'd appreciate for you to do that.
> >>
> >> And I'd also like to confirm that we have the following usages after the
> >> modification.
> >> for non-parallel migration, we can use
> >>
> >> --compressed
> >> default to use XBZRLE for migration
> >>
> >> --compressed --comp-methods ...
> >> use the specificed methods for migration
> >>
> >> --comp-methods ...
> >> use the specificed methods for migration, and set the corresponding cap
> >>
> >> and those are forbidden since the method isn't supported with
> >> non-parallel migration
> >>
> >> [--compressed] --comp-methods=zlib
> >> [--compressed] --comp-methods=zstd
> > 
> > Correct.
> > 
> >> for parallel migration, we have to enable the cap using "--parallel",
> >> and can use like:
> >>
> >> --parallel
> >> default to NONE compression method for parallel migration
> >>
> >> --parallel --comp-methods ...
> >> use the specificed methods for parallel migration
> >>
> >> --parallel --compressed --comp-methods ...
> >> use the specificed methods for parallel migration, it's same as the
> >> above
> >>
> >> and those are forbidden since the method isn't supported with parallel
> >> migration
> >>
> >> --parallel [--compressed] --comp-methods=mt
> >> --parallel [--compressed] --comp-methods=xbzrle
> > 
> > Right, but see below...
> > 
> >> In particular,
> >>
> >> --parallel --compressed
> >>
> >> is forbiddene because it leads to a result that NONE compression method
> >> is chosen but compressed flag is set.
> >> And I test it on libvirt-6.2.0 with qemu-6.2.0, '--parallel
> >> --compressed' will set cap 'xbzrle' and 'multifd' both to true, which I
> >> think is unreasonable though the migration is succeed.
> > 
> > Hmm, that would mean xbzrle is supported even for parallel migrations
> > and we should not break this functionality. I experimented a bit and
> > both mt and xbzrle compression methods seem to work with parallel
> > migration. Even query-migrate reports compression statistics that
> > suggest it actually works since they are similar for both normal and
> > --parallel migrations.
> > 
> > On the other hand according to Juan from QEMU none of them is compatible
> > with parallel migration. I will try to discuss this a bit more with him,
> > but so far I think we should allow both xbzrle and mt with parallel
> > migration to avoid breaking things people might be using.
> >
> 
> I found that there is a patch about this in qemu, which disables multifd
> capability explicitly when compression=on. Maybe xbzrle have the same
> problem as mt?
> 
> ref:https://github.com/qemu/qemu/commit/6f39c90b86b9d3772779f873ed88aaa75a220aba

Yeah, I discussed the situation with Juan and he said both mt and xbzrle
compressions are incompatible with multifd. QEMU would just ignore
either multifd or compression when asked for both. The mt case will
already report an error since QEMU 7.2.0 and xbzrle case may eventually
do similar thing. So apparently allowing these two compression methods
with --parallel is actually a bug and we can fix it properly in this
series.

That said, I will push this with the suggested changes squashed in.

Reviewed-by: Jiri Denemark 



Release of libvirt-9.3.0

2023-05-02 Thread Jiri Denemark
The 9.3.0 release of both libvirt and libvirt-python is tagged and
signed tarballs and source RPMs are available at

https://download.libvirt.org/
https://download.libvirt.org/python/

Thanks everybody who helped with this release by sending patches,
reviewing, testing, or providing feedback. Your work is greatly
appreciated.

* New features

  * qemu: Introduce support for ``igb`` network interface model

``igb`` is a successor to the ``e1000e`` network device using PCIe 
interface.
It was introduced in QEMU 8.0

  * qemu: Improve handling of maximum physical address configuration

* Improvements

  * qemu: Change default machine type for ARM and RISC-V

ARM and RISC-V architectures now use the ``virt`` machine type by default.
The previous defaults were nearly unusable and had to be overridden in most
cases.

  * Improve translatable strings format substitutions

All translatable error messages with substitution strings were converted to
use positional modifiers to allow translators to shuffle around words in
the translation. The translations in Weblate were also updated to match.

  * qemu: Improve validation of ``watchdog`` devices

Certain invalid configurations of ``watchdog`` device are now properly
detected:

 - hotplug of always-present platform watchdogs is forbidden
 - ``iTCO`` watchdog can be configured only once
 - ``ib700`` watchdog is allowed only on ``i440fx`` machines

  * Improved output of ``virt-host-validate`` on ARM

Our validation tool now parses the ``IORT`` data on ARM to properly detect
presence of SMMU and other features.

* Bug fixes

  * qemu: Fix inactive internal snapshots of VM with UEFI firmware

Recent changes to UEFI firmware handling resulted into breaking support
for inactive internal snapshots of VMs with UEFI which historically worked.
(Although the intention was to disallow them together with active ones, but
the check did not work properly.)

Preserve existing functionality by allowing such snapshots explicitly.

  * qemu: Properly configure locked memory limit for VMs with ``

libvirt-9.3.0 release candidate 2

2023-04-27 Thread Jiri Denemark
I have just tagged v9.3.0-rc2 in the repository and pushed signed
tarballs and source RPMs to https://libvirt.org/sources/

Please give the release candidate some testing and in case you find a
serious issue which should have a fix in the upcoming release, feel
free to reply to this thread to make sure the issue is more visible.

If you have not done so yet, please update NEWS.rst to document any
significant change you made since the last release.

Thanks,

Jirka



Entering freeze for libvirt-9.3.0

2023-04-25 Thread Jiri Denemark
I have just tagged v9.3.0-rc1 in the repository and pushed signed
tarballs and source RPMs to https://libvirt.org/sources/

Please give the release candidate some testing and in case you find a
serious issue which should have a fix in the upcoming release, feel
free to reply to this thread to make sure the issue is more visible.

If you have not done so yet, please update NEWS.rst to document any
significant change you made since the last release.

Thanks,

Jirka



Re: [PATCH V3 0/3] migration: add qemu parallel migration options

2023-04-24 Thread Jiri Denemark
On Fri, Apr 21, 2023 at 17:39:12 +0800, Jiang Jiacheng wrote:
> 
> Thank you for your reply and review, I'd appreciate for you to do that.
> 
> And I'd also like to confirm that we have the following usages after the
> modification.
> for non-parallel migration, we can use
> 
> --compressed
> default to use XBZRLE for migration
> 
> --compressed --comp-methods ...
> use the specificed methods for migration
> 
> --comp-methods ...
> use the specificed methods for migration, and set the corresponding cap
> 
> and those are forbidden since the method isn't supported with
> non-parallel migration
> 
> [--compressed] --comp-methods=zlib
> [--compressed] --comp-methods=zstd

Correct.

> for parallel migration, we have to enable the cap using "--parallel",
> and can use like:
> 
> --parallel
> default to NONE compression method for parallel migration
> 
> --parallel --comp-methods ...
> use the specificed methods for parallel migration
> 
> --parallel --compressed --comp-methods ...
> use the specificed methods for parallel migration, it's same as the
> above
> 
> and those are forbidden since the method isn't supported with parallel
> migration
> 
> --parallel [--compressed] --comp-methods=mt
> --parallel [--compressed] --comp-methods=xbzrle

Right, but see below...

> In particular,
> 
> --parallel --compressed
> 
> is forbiddene because it leads to a result that NONE compression method
> is chosen but compressed flag is set.
> And I test it on libvirt-6.2.0 with qemu-6.2.0, '--parallel
> --compressed' will set cap 'xbzrle' and 'multifd' both to true, which I
> think is unreasonable though the migration is succeed.

Hmm, that would mean xbzrle is supported even for parallel migrations
and we should not break this functionality. I experimented a bit and
both mt and xbzrle compression methods seem to work with parallel
migration. Even query-migrate reports compression statistics that
suggest it actually works since they are similar for both normal and
--parallel migrations.

On the other hand according to Juan from QEMU none of them is compatible
with parallel migration. I will try to discuss this a bit more with him,
but so far I think we should allow both xbzrle and mt with parallel
migration to avoid breaking things people might be using.

Jirka



Re: [PATCH 0/3] qemu: migration: implement zstd compression

2023-04-20 Thread Jiri Denemark
On Tue, Apr 18, 2023 at 14:44:47 +0600, Oleg Vasilev wrote:
> QEMU now supports multifd-compression=zstd for migration with enabled multifd.
> Bring the support to libvirt as well.

There is an earlier series implementing this functionality (with zlib as
well): [PATCH V3 0/3] migration: add qemu parallel migration options

I just forgot to review the last version of it... I did it now.

Jirka



Re: [PATCH 2/3] virsh: Add migrate options to set parallel compress level

2023-04-20 Thread Jiri Denemark
On Fri, Feb 24, 2023 at 17:27:11 +0800, Jiang Jiacheng wrote:
> Add migrate options: --compression-zlib-level
>  --compression-zstd-level
> These options are used to set compress level for "zlib"
> or "zstd" during parallel migration if the compress method
> is specified.
> 
> Signed-off-by: Jiang Jiacheng 
> ---
>  docs/manpages/virsh.rst | 29 -
>  tools/virsh-domain.c| 26 ++
>  2 files changed, 46 insertions(+), 9 deletions(-)
> 
> diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
> index d5b614dc03..ccad02bd94 100644
> --- a/docs/manpages/virsh.rst
> +++ b/docs/manpages/virsh.rst
> @@ -3356,7 +3356,8 @@ migrate
>[--xml file] [--migrate-disks disk-list] [--disks-port port]
>[--compressed] [--comp-methods method-list]
>[--comp-mt-level] [--comp-mt-threads] [--comp-mt-dthreads]
> -  [--comp-xbzrle-cache] [--auto-converge] [auto-converge-initial]
> +  [--comp-xbzrle-cache] [--comp-zlib-level] [--comp-zstd-level]
> +  [--auto-converge] [auto-converge-initial]
>[auto-converge-increment] [--persistent-xml file] [--tls]
>[--postcopy-bandwidth bandwidth]
>[--parallel [--parallel-connections connections]]
> @@ -3463,14 +3464,24 @@ to post-copy upon timeout; migration has to be 
> started with *--postcopy*
>  option for this to work.
>  
>  *--compressed* activates compression, the compression method is chosen
> -with *--comp-methods*. Supported methods are "mt" and "xbzrle" and
> -can be used in any combination. When no methods are specified, a hypervisor
> -default methods will be used. QEMU defaults to "xbzrle". Compression methods
> -can be tuned further. *--comp-mt-level* sets compression level.
> -Values are in range from 0 to 9, where 1 is maximum speed and 9 is maximum
> -compression. *--comp-mt-threads* and *--comp-mt-dthreads* set the number
> -of compress threads on source and the number of decompress threads on target
> -respectively. *--comp-xbzrle-cache* sets size of page cache in bytes.
> +with *--comp-methods*. Supported methods are "mt", "xbzrle", "zlib",
> +and "zstd". The supported set of methods and their combinations depend
> +on a hypervisor and migration options. QEMU only supports "zlib" and
> +"zstd" methods when *--parallel* is used and they cannot be used at
> +once. When no methods are specified, a hypervisor default methods will
> +be used. QEMU defaults to no compression for *--parallel* migration and
> +"xbzrle" otherwise. Compression methods can be tuned further.

This would suggest --parallel --compressed is allowed and results in no
compression as that is the default for QEMU. I think it would be better
to explicitly say that using --compressed without --comp-method is not
allowed with --parallel.

> +*--comp-mt-level* sets compression level for "mt" method. Values are in
> +range from 0 to 9, where 1 is maximum speed and 9 is maximum compression.
> +*--comp-mt-threads* and *--comp-mt-dthreads* set the number of compress
> +threads on source and the number of decompress threads on target 
> respectively.
> +*--comp-xbzrle-cache* sets size of page cache in bytes.
> +*--comp-zlib-level* sets the compression level when using "zlib" method.
> +Values are in range from 0 to 9 and defaults to 1, where 0 is no compression,
> +1 is maximum speed and 9 is maximum compression.
> +*--comp-zstd-level* sets the compression level when using "zstd" method.
> +Values are in range from 0 to 20 and defaults to 1, where 0 is no 
> compression,
> +1 is maximum speed and 20 is maximum compression.
>  
>  Providing *--tls* causes the migration to use the host configured TLS setup
>  (see migrate_tls_x509_cert_dir in /etc/libvirt/qemu.conf) in order to perform
...

With the following suggested changes
Reviewed-by: Jiri Denemark 

diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 738d3b7fb9..f4e5a0bd62 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -3485,19 +3485,20 @@ and "zstd". The supported set of methods and their 
combinations depend
 on a hypervisor and migration options. QEMU only supports "zlib" and
 "zstd" methods when *--parallel* is used and they cannot be used at
 once. When no methods are specified, a hypervisor default methods will
-be used. QEMU defaults to no compression for *--parallel* migration and
-"xbzrle" otherwise. Compression methods can be tuned further.
-*--comp-mt-level* sets compression level for "mt" method. Values are in
-range from 0 to 9, where 1 is maximum speed and 9 is maximum compression.
-*

Re: [PATCH 1/3] Add public API for parallel compression method

2023-04-20 Thread Jiri Denemark
On Fri, Feb 24, 2023 at 17:27:10 +0800, Jiang Jiacheng wrote:
> Add description for VIR_MIGRATE_PARAM_COMPRESSION, it will
> be reused in choosing compression method during parallel migration.
> Add public API VIR_MIGRATE_PARAM_COMPRESSION_ZLIB_LEVEL,
> VIR_MIGRATE_PARAM_COMPRESSION_ZSTD_LEVEL for migration APIs
> to support set compress level during parallel migration.
> 
> Signed-off-by: Jiang Jiacheng 
> ---
>  include/libvirt/libvirt-domain.h | 30 +++---
>  1 file changed, 27 insertions(+), 3 deletions(-)
> 
> diff --git a/include/libvirt/libvirt-domain.h 
> b/include/libvirt/libvirt-domain.h
> index 5152ed4551..40b6b19495 100644
> --- a/include/libvirt/libvirt-domain.h
> +++ b/include/libvirt/libvirt-domain.h
> @@ -1269,9 +1269,11 @@ typedef enum {
>   * VIR_MIGRATE_PARAM_COMPRESSION:
>   *
>   * virDomainMigrate* params multiple field: name of the method used to
> - * compress migration traffic. Supported compression methods: xbzrle, mt.
> - * The parameter may be specified multiple times if more than one method
> - * should be used.
> + * compress migration traffic. Supported compression methods: xbzrle, mt,
> + * zlib, zstd. The parameter may be specified multiple times if more than
> + * one method. Not all combinations of compression methods and migration

Looks like something is missing after "if more than one method" here.
Perhaps "if more than one method should be used"?

> + * options may be allowed. Parallel migration of QEMU domains is only
> + * compatible with either zlib or zstd method.
>   *
>   * Since: 1.3.4
>   */
...

With the following suggested changes
Reviewed-by: Jiri Denemark 

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 46b10fd908..984ae8883b 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -1272,9 +1272,9 @@ typedef enum {
  * virDomainMigrate* params multiple field: name of the method used to
  * compress migration traffic. Supported compression methods: xbzrle, mt,
  * zlib, zstd. The parameter may be specified multiple times if more than
- * one method. Not all combinations of compression methods and migration
- * options may be allowed. Parallel migration of QEMU domains is only
- * compatible with either zlib or zstd method.
+ * one method should be used. Not all combinations of compression methods
+ * and migration options may be allowed. Parallel migration of QEMU domains
+ * is only compatible with either zlib or zstd method.
  *
  * Since: 1.3.4
  */



Re: [PATCH 3/3] qemu: support set parallel migration compression method

2023-04-20 Thread Jiri Denemark
n zlib compression on to tune it"));
> +return -1;
> +}
> +
> +if (migParams->params[QEMU_MIGRATION_PARAM_MULTIFD_ZSTD_LEVEL].set &&
> +!(migParams->compMethods & (1ULL << QEMU_MIGRATION_COMPRESS_ZSTD))) {
> +virReportError(VIR_ERR_INVALID_ARG, "%s",
> +   _("Turn zstd compression on to tune it"));
> +return -1;
> +}
> +

The idea was to consistently use

--compressed --comp-method=... --comp-...-...

regardless on selected compression method or whether parallel migration
is turned on or not. Specifically,

--parallel --compressed --comp-method=zlib --comp-zlib-...
--parallel --compressed --comp-method=zstd --comp-zstd-...
--compressed --comp-method=mt --comp-mt-...
--compressed --comp-method=xbzrle,mt --comp-xbzrle-... --comp-mt-...
--compressed

are all ok, while

--compressed --comp-method=zlib
--compressed --comp-method=zstd

should report an error about missing --parallel option and

--parallel --compressed --comp-method=xbzrle
--parallel --compressed --comp-method=mt

should report an error saying the selected method cannot be used with
parallel migration.

Actually looking at the current code (confirmed also by an experiment)
the --compressed parameter is not required. It's mostly a shortcut for a
default method, which is xbzrle for non-parallel migration. The default
for parallel migration is documented as "no compression", which would
mean

--parallel --compressed

is equivalent to

--parallel

I think it would be better to just forbid --compressed with --parallel
unless there is a compression method specified with --comp-method to
avoid a strange semantics of --compressed not providing any compression
at all.

>  if (!migParams->compMethods && (flags & VIR_MIGRATE_COMPRESSED)) {
>  migParams->compMethods = 1ULL << QEMU_MIGRATION_COMPRESS_XBZRLE;
>  ignore_value(virBitmapSetBit(migParams->caps,
> @@ -690,6 +761,11 @@ qemuMigrationParamsDump(qemuMigrationParams *migParams,
>  *flags |= VIR_MIGRATE_COMPRESSED;
>  }
>  
> +if (migParams->compMethods == 1ULL << QEMU_MIGRATION_COMPRESS_ZLIB ||
> +migParams->compMethods == 1ULL << QEMU_MIGRATION_COMPRESS_ZSTD) {
> +*flags |= VIR_MIGRATE_PARALLEL;
> +}
> +

This is not needed as the VIR_MIGRATE_PARALLEL flag has to be set
explicitly.

>  for (i = 0; i < QEMU_MIGRATION_COMPRESS_LAST; ++i) {
>  if ((migParams->compMethods & (1ULL << i)) &&
>  virTypedParamsAddString(params, nparams, maxparams,
> diff --git a/src/qemu/qemu_migration_params.h 
> b/src/qemu/qemu_migration_params.h
> index e7c65f6a21..5857673227 100644
> --- a/src/qemu/qemu_migration_params.h
> +++ b/src/qemu/qemu_migration_params.h
> @@ -59,6 +59,9 @@ typedef enum {
>  QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE,
>  QEMU_MIGRATION_PARAM_MAX_POSTCOPY_BANDWIDTH,
>  QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS,
> +QEMU_MIGRATION_PARAM_MULTIFD_COMPRESSION,
> +QEMU_MIGRATION_PARAM_MULTIFD_ZLIB_LEVEL,
> +QEMU_MIGRATION_PARAM_MULTIFD_ZSTD_LEVEL,
>  
>  QEMU_MIGRATION_PARAM_LAST
>  } qemuMigrationParam;

With the following suggested changes
Reviewed-by: Jiri Denemark 

diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index ee23cec23d..807cccd86e 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -528,6 +528,8 @@ qemuMigrationParamsSetTPString(qemuMigrationParams 
*migParams,
migParams->params[param].value.s);
 }

+
+
 static int
 qemuMigrationParamsSetCompression(virTypedParameterPtr params,
   int nparams,
@@ -536,19 +538,11 @@ qemuMigrationParamsSetCompression(virTypedParameterPtr 
params,
 {
 size_t i;
 int method;
-qemuMigrationCapability cap;

 for (i = 0; i < nparams; i++) {
 if (STRNEQ(params[i].field, VIR_MIGRATE_PARAM_COMPRESSION))
 continue;

-if (migParams->params[QEMU_MIGRATION_PARAM_MULTIFD_COMPRESSION].set) {
-virReportError(VIR_ERR_INVALID_ARG, "%s",
-   _("Only one compression method could be specified 
with "
- "parallel compression"));
-return -1;
-}
-
 method = qemuMigrationCompressMethodTypeFromString(params[i].value.s);
 if (method < 0) {
 virReportError(VIR_ERR_INVALID_ARG,
@@ -568,46 +562,47 @@ qemuMigrationParamsSetCompression(virTypedParameterPtr 
params,
  method == QEMU_MIGRATION_COMPRESS_XBZRLE) &&
 flags & VIR_MIGRATE_PARALLEL) {
 virReportEr

Re: [PATCH V3 0/3] migration: add qemu parallel migration options

2023-04-20 Thread Jiri Denemark
On Fri, Feb 24, 2023 at 17:27:09 +0800, Jiang Jiacheng wrote:
> Add compress method zlib and zstd for parallel migration and new
> migration options to set qemu's parameter related with parallel
> migration(multifd-compression, multifd-zlib-level and multifd-zstd-level).
> These parameters has been supported by QEMU since 5.0.

Oh, I apologize for the delay reviewing this series. It got lost among
all the other emails somehow. And since this is my fault, I will reply
with suggested changes (mostly minor ones) and if you agree, I will
squash them in and push the series.

Jirka



Plans for the next release

2023-04-17 Thread Jiri Denemark
We are getting close to the next release of libvirt. To aim for the
release on May 02 I suggest entering the freeze on Tuesday Apr 25 and
tagging RC2 on Thursday Apr 27.

I hope this works for everyone.

Jirka



Re: [PATCH 1/3] util: Introduce virAcpi module

2023-04-12 Thread Jiri Denemark
On Thu, Apr 06, 2023 at 02:20:31 -0700, Andrea Bolognani wrote:
> On Thu, Apr 06, 2023 at 10:20:46AM +0200, Michal Prívozník wrote:
> > On 4/5/23 19:21, Andrea Bolognani wrote:
> > > On Wed, Apr 05, 2023 at 01:30:17PM +0200, Michal Privoznik wrote:
> > >> +if (nodeHeader->len < sizeof(*nodeHeader)) {
> > >> +virReportError(VIR_ERR_INTERNAL_ERROR,
> > >> +   _("IORT table node type %1$s has invalid length: 
> > >> %2$" PRIu16),
> > >
> > > I'm not sure this plays well with the recently introduced changes to
> > > translatable strings. Have you checked with Jirka?
> >
> > I haven't. But, gcc complains if only a part of string contains
> > positioned arguments. That is:
> >
> >   "argument value %1$s and another argument %s"
> >   "argument value %s and another argument %2$s"
> >
> > are invalid format string and compiler throws an error. Now, using no
> > positions works:
> >
> >   "argument value %s and another argument %s"
> >
> > but then, Jirka's syntax-check rule throws an error. But it doesn't for
> > the case I'm using:
> >
> >   "integer value %" PRIu16
> 
> Yeah, either your usage is fine or the syntax-check rule should be
> improve to catch it. Jirka?

Yeah, the syntax check is quite simple so it doesn't catch all possible
cases and libvirt-pot-check run after libvirt-pot (either in our CI or
manually) will detect all cases.

> > Although, one could argue that if the translate tool doesn't allow fixed
> > size integer types modifiers, then the tool is broken. Surely, libvirt's
> > not the only one using fixed size integers. But okay, for error messages

Well, not really. The tool is not a C preprocessor so it doesn't have
any idea what a specific macro you concatenate with an actual string is.
So the best thing to do here is to avoid the situation and do what you
came up with here:

> > I can typecast arguments. IOW:
> >
> >  virReportError(VIR_ERR_INTERNAL_ERROR,
> > _("IORT table node type %1$s has invalid length: %2$u"),
> > NULLSTR(typeStr), (unsigned int)nodeHeader->len);

Jirka



Release of libvirt-9.2.0

2023-04-01 Thread Jiri Denemark
The 9.2.0 release of both libvirt and libvirt-python is tagged and
signed tarballs and source RPMs are available at

https://libvirt.org/sources/
https://libvirt.org/sources/python/

Thanks everybody who helped with this release by sending patches,
reviewing, testing, or providing feedback. Your work is greatly
appreciated.

* New features

  * qemu: Add support for QCOW2 formatted firmware

This type of firmware can be picked up either automatically, if the
corresponding JSON descriptor has the highest priority, or manually by
using  in the domain XML.

* Improvements

  * qemu: Make firmware selection persistent

Up until now, firmware autoselection has been performed at domain startup
time: as a result, changes to the JSON firmware descriptors present on the
system could have translated to a different firmware being chosen for
subsequent startups of the same domain, potentially rendering it unbootable
or lowering the security guarantees. Firmware selection now happens once,
when the domain is defined, and its results are stored in the domain XML
to be reused, unchanged, for all subsequent boots.

  * qemu: passt now works when SELinux/AppArmor is enabled

In the case of SELinux, this requires passt-specific support code to be
present in the host policy, so it might only work with upcoming operating
systems and not with existing ones.

  * xen: Support custom UEFI firmware paths

The Xen libxl driver now supports specifying a custom UEFI firmware path.
Previously the Xen default was used in all cases.

* Bug fixes

  * qemu: Fix validation of the HPET timer

Due to a logic bug introduced in libvirt 9.0.0, VM configurations
explicitly enabling the HPET timer were rejected.

  * qemu: Fix thread-context .host-nodes generation

With new enough QEMU, libvirt instructs QEMU to set affinity of memory
allocation threads. But this may have resulted in QEMU being unable to do
so, as affinity to NUMA nodes inaccessible to emulator thread might have
been requested.

  * rpc: fix typo in admin code generation

Fix the bug in the remote ``virt-admin`` code generator, that resulted
in a crash. Introduced in libvirt 9.1.0.

  * qemu: relax shared memory check for vhostuser daemons

Fix hotplug of virtiofs ``filesystem`` after restarting libvirtd.
Before, libvirtd would incorrectly complain about missing shared
memory.

Enjoy.

Jirka



Re: [libvirt PATCH 00/51] Use permutable format strings in translations

2023-03-31 Thread Jiri Denemark
On Fri, Mar 31, 2023 at 16:52:50 +0100, Daniel P. Berrangé wrote:
> On Fri, Mar 31, 2023 at 05:43:16PM +0200, Jiri Denemark wrote:
> > On Fri, Mar 31, 2023 at 16:26:42 +0100, Daniel P. Berrangé wrote:
> > > On Thu, Mar 30, 2023 at 11:37:55AM +0200, Jiri Denemark wrote:
> > > > On Mon, Mar 27, 2023 at 15:37:34 +0100, Daniel P. Berrangé wrote:
> > > > > On Mon, Mar 27, 2023 at 01:08:09PM +0200, Jiri Denemark wrote:
> > > > > > On Fri, Mar 10, 2023 at 17:14:32 +, Daniel P. Berrangé wrote:
> > > > > > > Even if fixed, it might be worth switching the .pot file anyway, 
> > > > > > > but
> > > > > > > this can't be done without us bulk updating the translations, and
> > > > > > > bulk re-importing them, which will be challenging. We'll almost
> > > > > > > certainly want to try this on a throw-away repo in weblate first,
> > > > > > > not our main repo.
> > > > > > 
> > > > > > I was able to come up with steps leading to the desired state:
> > > > > > 
> > > > > >  0. lock weblate repository
> > > > > >  1. update libvirt.pot from the most recent potfile job
> > > > > >  2. push to libvirt.git
> > > > > >  2. wait for translations update from Fedora Weblate and merge it
> > > > > >  3. pull from libvirt.git
> > > > > >  4. apply the first 50 patches from this seires (with required 
> > > > > > changes
> > > > > > to make sure all translation strings are updated)
> > > > > >  5. update all po files with the attached script
> > > > > >  6. update libvirt.pot by running meson compile libvirt-pot
> > > > > >  7. apply patch 51 of this series
> > > > > >  8. push to libvirt.git
> > > > > >  9. wait for translations update from Fedora Weblate and merge it
> > > > > > 10. unlock weblate repository
> > > 
> > > This looks ok, but I'm wondering if weblate will remember all
> > > our obsolete msgids when we do step 8 ? IOW, will our po files
> > > get the 10,000 current msgids, plus another 5,000 non-position
> > > based msgids marked with '#~ msgid' ?
> > 
> > No, apparently it doesn't do so. Looking at the last commit in
> > https://gitlab.com/jirkade/libvirt/-/commits/format-strings which is an
> > update from weblate after all the changes, there's not a single new
> > "#~ msgid" line added. The overall statistics of the patch is
> > 
> > 46 files changed, 28392 insertions(+), 19137 deletions(-)
> > 
> > and it is caused by weblate (or rather msgmerge) wrapping lines as they
> > got longer when format strings were updated using the script.
> 
> Ok, I wonder where our existing '#~ msgids' lines are coming
> from ! 

They seem to be added only when a msgid in .po does not exist in .pot
anymore. But since we're pushing both .pot and .po updates at the same
time, msgid strings match.

Jirka



Re: [libvirt PATCH 00/51] Use permutable format strings in translations

2023-03-31 Thread Jiri Denemark
On Fri, Mar 31, 2023 at 16:26:42 +0100, Daniel P. Berrangé wrote:
> On Thu, Mar 30, 2023 at 11:37:55AM +0200, Jiri Denemark wrote:
> > On Mon, Mar 27, 2023 at 15:37:34 +0100, Daniel P. Berrangé wrote:
> > > On Mon, Mar 27, 2023 at 01:08:09PM +0200, Jiri Denemark wrote:
> > > > On Fri, Mar 10, 2023 at 17:14:32 +, Daniel P. Berrangé wrote:
> > > > > Even if fixed, it might be worth switching the .pot file anyway, but
> > > > > this can't be done without us bulk updating the translations, and
> > > > > bulk re-importing them, which will be challenging. We'll almost
> > > > > certainly want to try this on a throw-away repo in weblate first,
> > > > > not our main repo.
> > > > 
> > > > I was able to come up with steps leading to the desired state:
> > > > 
> > > >  0. lock weblate repository
> > > >  1. update libvirt.pot from the most recent potfile job
> > > >  2. push to libvirt.git
> > > >  2. wait for translations update from Fedora Weblate and merge it
> > > >  3. pull from libvirt.git
> > > >  4. apply the first 50 patches from this seires (with required changes
> > > > to make sure all translation strings are updated)
> > > >  5. update all po files with the attached script
> > > >  6. update libvirt.pot by running meson compile libvirt-pot
> > > >  7. apply patch 51 of this series
> > > >  8. push to libvirt.git
> > > >  9. wait for translations update from Fedora Weblate and merge it
> > > > 10. unlock weblate repository
> 
> This looks ok, but I'm wondering if weblate will remember all
> our obsolete msgids when we do step 8 ? IOW, will our po files
> get the 10,000 current msgids, plus another 5,000 non-position
> based msgids marked with '#~ msgid' ?

No, apparently it doesn't do so. Looking at the last commit in
https://gitlab.com/jirkade/libvirt/-/commits/format-strings which is an
update from weblate after all the changes, there's not a single new
"#~ msgid" line added. The overall statistics of the patch is

46 files changed, 28392 insertions(+), 19137 deletions(-)

and it is caused by weblate (or rather msgmerge) wrapping lines as they
got longer when format strings were updated using the script.

So I don't thing we can just use the existing weblate component in
libvirt project.

> This basically looks good to me. The only minor thing I see is that
> projects/libvirt/libvirt has gained some extra translations that
> are not in current git master. For example in cs.po there are about
> 6 fewer failing c-format checks in weblate that are still in cs.po
> 
> That will be taken care of when you re-sync the .po files and rerun
> the conversion.

Right.

> So I think this looks ok to go ahead with after release.

Great. Thanks for checking. Do you want me to add Reviewed-by lines to
all the ~100 patches with your name or something similar?

Jirka



Re: [libvirt PATCH 00/51] Use permutable format strings in translations

2023-03-30 Thread Jiri Denemark
On Mon, Mar 27, 2023 at 15:37:34 +0100, Daniel P. Berrangé wrote:
> On Mon, Mar 27, 2023 at 01:08:09PM +0200, Jiri Denemark wrote:
> > On Fri, Mar 10, 2023 at 17:14:32 +, Daniel P. Berrangé wrote:
> > > Even if fixed, it might be worth switching the .pot file anyway, but
> > > this can't be done without us bulk updating the translations, and
> > > bulk re-importing them, which will be challenging. We'll almost
> > > certainly want to try this on a throw-away repo in weblate first,
> > > not our main repo.
> > 
> > I was able to come up with steps leading to the desired state:
> > 
> >  0. lock weblate repository
> >  1. update libvirt.pot from the most recent potfile job
> >  2. push to libvirt.git
> >  2. wait for translations update from Fedora Weblate and merge it
> >  3. pull from libvirt.git
> >  4. apply the first 50 patches from this seires (with required changes
> > to make sure all translation strings are updated)
> >  5. update all po files with the attached script
> >  6. update libvirt.pot by running meson compile libvirt-pot
> >  7. apply patch 51 of this series
> >  8. push to libvirt.git
> >  9. wait for translations update from Fedora Weblate and merge it
> > 10. unlock weblate repository
> > 
> > The process takes about an hour if we're lucky as weblate is quite slow
> > when processing such large amount of changes.
> > 
> > The result can be seen at
> > 
> > https://gitlab.com/jirkade/libvirt/-/commits/format-strings
> > 
> > and the corresponding weblate repository at
> > 
> > https://translate.fedoraproject.org/projects/libvirt/test/
> > 
> > I used d05ad0f15e737fa2327dd68870a485821505b58f commit as a base.
> 
> Looking at this, I picked a random language (Bengali) and compared
> stats:
> 
>   https://translate.fedoraproject.org/projects/libvirt/test/bn_IN/
> 
> vs
> 
>   https://translate.fedoraproject.org/projects/libvirt/libvirt/bn_IN/
> 
> Translated strings matches to within 2 words, which is probably
> accounted for by being based on different HEAD
> 
> Strings with failing checks is massively different, and that is
> the fault of 'failing check: C format' - 1300 more failing checks
> afterwards.

Oops, my random generator apparently selected wrong language where the
number of 'failing check: C format' issues was significantly lower then
before :-)

Anyway, I did what you suggested and updated the repositories

https://gitlab.com/jirkade/libvirt/-/commits/format-strings
https://translate.fedoraproject.org/projects/libvirt/test/

The content is now based on v9.2.0-rc1-8-geb677e3a10 which is just one
commit behind 9.2.0-rc2.

The fixes to whitespace and cpp string concatenation were sent
separately to the list earlier today.

Jirka



[libvirt PATCH 1/2] Drop excess whitespace from error messages

2023-03-30 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/conf/domain_conf.c   | 3 +--
 src/util/virnetdevvportprofile.c | 3 +--
 src/util/virsocketaddr.c | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9f49c6e62d..23fc19a409 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14881,8 +14881,7 @@ virDomainControllerAliasFind(const virDomainDef *def,
 }
 if (!def->controllers[contIndex]->info.alias) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Device alias was not set for %s controller "
- "with index %d "),
+   _("Device alias was not set for %s controller with 
index %d"),
contTypeStr, idx);
 return NULL;
 }
diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c
index ae23f795b2..95f3bd2fc0 100644
--- a/src/util/virnetdevvportprofile.c
+++ b/src/util/virnetdevvportprofile.c
@@ -577,8 +577,7 @@ virNetDevVPortProfileGetStatus(struct nlattr **tb, int32_t 
vf,
virUUIDFormat(instanceId, instanceIdStr);
 
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not find vf/instanceId %u/%s "
- " in netlink response"),
+   _("Could not find vf/instanceId %u/%s in 
netlink response"),
vf, instanceIdStr);
 
 /* go through all the entries again. This seems tedious,
diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c
index 0480485ab7..7db9a7d7e8 100644
--- a/src/util/virsocketaddr.c
+++ b/src/util/virsocketaddr.c
@@ -906,8 +906,7 @@ virSocketAddrGetRange(virSocketAddr *start, virSocketAddr 
*end,
 virSocketAddrPrefixToNetmask(prefix, ,
  VIR_SOCKET_ADDR_FAMILY(network)) < 0) 
{
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("bad prefix %d for network %s when "
- " checking range %s - %s"),
+   _("bad prefix %d for network %s when checking range 
%s - %s"),
prefix, netStr, startStr, endStr);
 return -1;
 }
-- 
2.40.0



[libvirt PATCH 2/2] Do not use VIR_PCI_DEVICE_ADDRESS_FMT in translations

2023-03-30 Thread Jiri Denemark
xgettext cannot handle strings concatenated with cpp macros.

Signed-off-by: Jiri Denemark 
---
 src/conf/domain_conf.c   |  3 +--
 src/libxl/libxl_driver.c | 15 +--
 src/qemu/qemu_hotplug.c  | 14 --
 3 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 23fc19a409..8f87663e08 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19585,8 +19585,7 @@ 
virDomainDeviceInfoCheckABIStability(virDomainDeviceInfo *src,
 src->addr.pci.slot != dst->addr.pci.slot ||
 src->addr.pci.function != dst->addr.pci.function) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("Target device PCI address " 
VIR_PCI_DEVICE_ADDRESS_FMT
- "does not match source " 
VIR_PCI_DEVICE_ADDRESS_FMT),
+   _("Target device PCI address %04x:%02x:%02x.%d does 
not match source %04x:%02x:%02x.%d"),
dst->addr.pci.domain, dst->addr.pci.bus,
dst->addr.pci.slot, dst->addr.pci.function,
src->addr.pci.domain, src->addr.pci.bus,
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 07dcfcdc05..6e002ab77c 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -3082,8 +3082,7 @@ libxlDomainAttachHostPCIDevice(libxlDriverPrivate *driver,
 
 if (virDomainHostdevFind(vm->def, hostdev, ) >= 0) {
 virReportError(VIR_ERR_OPERATION_FAILED,
-   _("target pci device " VIR_PCI_DEVICE_ADDRESS_FMT
- " already exists"),
+   _("target pci device %04x:%02x:%02x.%d already exists"),
pcisrc->addr.domain, pcisrc->addr.bus,
pcisrc->addr.slot, pcisrc->addr.function);
 goto cleanup;
@@ -3101,8 +3100,7 @@ libxlDomainAttachHostPCIDevice(libxlDriverPrivate *driver,
 
 if (libxl_device_pci_add(cfg->ctx, vm->def->id, , 0) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("libxenlight failed to attach pci device "
- VIR_PCI_DEVICE_ADDRESS_FMT),
+   _("libxenlight failed to attach pci device 
%04x:%02x:%02x.%d"),
pcisrc->addr.domain, pcisrc->addr.bus,
pcisrc->addr.slot, pcisrc->addr.function);
 goto error;
@@ -3659,8 +3657,7 @@ libxlDomainDetachHostPCIDevice(libxlDriverPrivate *driver,
 idx = virDomainHostdevFind(vm->def, hostdev, );
 if (idx < 0) {
 virReportError(VIR_ERR_OPERATION_FAILED,
-   _("host pci device " VIR_PCI_DEVICE_ADDRESS_FMT
- " not found"),
+   _("host pci device %04x:%02x:%02x.%d not found"),
pcisrc->addr.domain, pcisrc->addr.bus,
pcisrc->addr.slot, pcisrc->addr.function);
 goto cleanup;
@@ -3668,8 +3665,7 @@ libxlDomainDetachHostPCIDevice(libxlDriverPrivate *driver,
 
 if (libxlIsMultiFunctionDevice(vm->def, detach->info)) {
 virReportError(VIR_ERR_OPERATION_FAILED,
-   _("cannot hot unplug multifunction PCI device: "
- VIR_PCI_DEVICE_ADDRESS_FMT),
+   _("cannot hot unplug multifunction PCI device: 
%04x:%02x:%02x.%d"),
pcisrc->addr.domain, pcisrc->addr.bus,
pcisrc->addr.slot, pcisrc->addr.function);
 goto error;
@@ -3681,8 +3677,7 @@ libxlDomainDetachHostPCIDevice(libxlDriverPrivate *driver,
 
 if (libxl_device_pci_remove(cfg->ctx, vm->def->id, , 0) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("libxenlight failed to detach pci device "
- VIR_PCI_DEVICE_ADDRESS_FMT),
+   _("libxenlight failed to detach pci device 
%04x:%02x:%02x.%d"),
pcisrc->addr.domain, pcisrc->addr.bus,
pcisrc->addr.slot, pcisrc->addr.function);
 goto error;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index f5990d3da6..7f104c28be 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -5520,8 +5520,7 @@ qemuDomainDetachPrepHostdev(virDomainObj *vm,
 switch (subsys->type) {
 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
 virReportError(VIR_ERR_DEVICE_MISSING,
-   _("host pci device " VIR_PCI_DEVICE_ADDRESS_FMT
- " not found"),
+   _("host pci dev

[libvirt PATCH 0/2] A few fixes in error messages

2023-03-30 Thread Jiri Denemark
These fixes were separated from my "Use permutable format strings in
translations" series. There are more VIR_PCI_DEVICE_ADDRESS_FMT cases
fixed here compared to the format strings series as not all of them were
identified by either syntax check or libvirt-pot-check.

Jiri Denemark (2):
  Drop excess whitespace from error messages
  Do not use VIR_PCI_DEVICE_ADDRESS_FMT in translations

 src/conf/domain_conf.c   |  6 ++
 src/libxl/libxl_driver.c | 15 +--
 src/qemu/qemu_hotplug.c  | 14 --
 src/util/virnetdevvportprofile.c |  3 +--
 src/util/virsocketaddr.c |  3 +--
 5 files changed, 13 insertions(+), 28 deletions(-)

-- 
2.40.0



libvirt-9.2.0 release candidate 2

2023-03-29 Thread Jiri Denemark
I have just tagged v9.2.0-rc2 in the repository and pushed signed
tarballs and source RPMs to https://libvirt.org/sources/

Please give the release candidate some testing and in case you find a
serious issue which should have a fix in the upcoming release, feel
free to reply to this thread to make sure the issue is more visible.

If you have not done so yet, please update NEWS.rst to document any
significant change you made since the last release.

Thanks,

Jirka



Re: [libvirt PATCH] cpu-data.py: Filter out apic current logical processor

2023-03-29 Thread Jiri Denemark
On Tue, Mar 28, 2023 at 16:26:15 +0200, Tim Wiederhake wrote:
> Commit 10b5e789c5 attempts to filter out the logical processor id
> in the generated data to remove noise and irrelevant changes in the
> output.
> 
> cpuid-leaf 0x0B may have more than two sub-leaves though. Filter out
> logical processor id from all sub-leaves of 0x0B and 0x1F (superset
> of the information in 0x0B).
> 
> Signed-off-by: Tim Wiederhake 
> ---
>  tests/cputestdata/cpu-data.py | 17 ++---
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/cputestdata/cpu-data.py b/tests/cputestdata/cpu-data.py
> index 498e07b2f7..b5641f7c16 100755
> --- a/tests/cputestdata/cpu-data.py
> +++ b/tests/cputestdata/cpu-data.py
> @@ -107,11 +107,14 @@ def gather_cpuid_leaves_kcpuid(output):
>  
>  def gather_cpuid_leaves(args):
>  def mask(regs, eax_in, ecx_in, eax_mask, ebx_mask, ecx_mask, edx_mask):
> -if regs["eax_in"] == eax_in and regs["ecx_in"] == ecx_in:
> -regs["eax"] &= eax_mask
> -regs["ebx"] &= ebx_mask
> -regs["ecx"] &= ecx_mask
> -regs["edx"] &= edx_mask
> +if eax_in != regs["eax_in"]:
> +return
> +if ecx_in != regs["ecx_in"] and ecx_in is not None:

My brain would be happier if the two expressions were swapped, i.e.:

   if ecx_in is not None and ecx_in != regs["ecx_in"]:

but both should work as we're not in C...

> +return
> +regs["eax"] &= eax_mask
> +regs["ebx"] &= ebx_mask
> +regs["ecx"] &= ecx_mask
> +regs["edx"] &= edx_mask
>  
>  cpuid = args.path_to_cpuid or "cpuid"
>  try:
> @@ -132,8 +135,8 @@ def gather_cpuid_leaves(args):
>  for regs in reglist:
>  # local apic id. Pretend to always run on logical processor #0.
>  mask(regs, 0x01, 0x00, 0x, 0x00ff, 0x, 
> 0x)
> -mask(regs, 0x0b, 0x00, 0x, 0x, 0x, 
> 0xff00)
> -mask(regs, 0x0b, 0x01, 0x, 0x, 0x, 
> 0xff00)
> +mask(regs, 0x0b, None, 0x, 0x, 0x, 
> 0x)
> +mask(regs, 0x1f, None, 0x, 0x, 0x, 
> 0x)
>  
>  yield regs

Reviewed-by: Jiri Denemark 



Re: [libvirt PATCH 00/51] Use permutable format strings in translations

2023-03-27 Thread Jiri Denemark
On Fri, Mar 10, 2023 at 17:14:32 +, Daniel P. Berrangé wrote:
> Even if fixed, it might be worth switching the .pot file anyway, but
> this can't be done without us bulk updating the translations, and
> bulk re-importing them, which will be challenging. We'll almost
> certainly want to try this on a throw-away repo in weblate first,
> not our main repo.

I was able to come up with steps leading to the desired state:

 0. lock weblate repository
 1. update libvirt.pot from the most recent potfile job
 2. push to libvirt.git
 2. wait for translations update from Fedora Weblate and merge it
 3. pull from libvirt.git
 4. apply the first 50 patches from this seires (with required changes
to make sure all translation strings are updated)
 5. update all po files with the attached script
 6. update libvirt.pot by running meson compile libvirt-pot
 7. apply patch 51 of this series
 8. push to libvirt.git
 9. wait for translations update from Fedora Weblate and merge it
10. unlock weblate repository

The process takes about an hour if we're lucky as weblate is quite slow
when processing such large amount of changes.

The result can be seen at

https://gitlab.com/jirkade/libvirt/-/commits/format-strings

and the corresponding weblate repository at

https://translate.fedoraproject.org/projects/libvirt/test/

I used d05ad0f15e737fa2327dd68870a485821505b58f commit as a base.

If we agree this is a reasonable approach, I think we should apply it
just after a release to give translators the whole release cycle to
check or update the translations if they wish so.

The attached script analyzes a single po file and updates all msgid
strings to use permutable format strings. It also tries to update all
translations, but only if the format strings in them exactly match
(including their order) the corresponding msgid format string. That is,
a msgstr will not be updated if format strings in it were incorrect or
reordered or they already used the permutable form. That is, the
processing should be a NO-OP except for strings that already used
permutable format in msgstr, such translations were failing c-format
check in weblate before but would be marked as correct now.

Jirka
#!/usr/bin/env python3

import sys
import re


# see man 3 printf
reIndex = r"([1-9][0-9]*\$)?"
reFlags = r"([-#0+I']|' ')*"
reWidth = rf"([1-9][0-9]*|\*{reIndex})?"
rePrecision = rf"(\.{reWidth})?"
reLenghtMod = r"(hh|h|l|ll|q|L|j|z|Z|t)?"
reConversion = r"[diouxXeEfFgGaAcspnm%]"
reCFormat = "".join([
r"%",
rf"(?P{reIndex})",
rf"(?P{reFlags})",
rf"(?P{reWidth})",
rf"(?P{rePrecision})",
rf"(?P{reLenghtMod})",
rf"(?P{reConversion})"])


def translateFormat(fmt, idx, m):
groups = m.groupdict()

if groups["index"] or groups["conversion"] == "%":
print(f"Ignoring c-format '{fmt}'")
return idx, fmt

for field in "width", "precision":
if "*" in groups[field]:
groups[field] = f"{groups[field]}{idx}$"
idx += 1

newFmt = f"%{idx}${''.join(groups.values())}"
idx += 1

return idx, newFmt


def process(ids, strs, fuzzy):
regex = rf"(.*?)({reCFormat})(.*)"
fmts = []
idx = 1

newIds = []
for s in ids:
new = []
m = re.search(regex, s)
while m is not None:
new.append(m.group(1))

oldFmt = m.group(2)
idx, newFmt = translateFormat(oldFmt, idx, m)
fmts.append((oldFmt, newFmt))
new.append(newFmt)

s = m.group(m.lastindex)
m = re.search(regex, s)

new.append(s)
newIds.append("".join(new))

if fuzzy:
return newIds, strs

n = 0
newStrs = []
for s in strs:
new = []
m = re.search(regex, s)
while m is not None:
new.append(m.group(1))

if n < len(fmts) and fmts[n][0] == m.group(2):
new.append(fmts[n][1])
n += 1
else:
print("Ignoring translation", strs)
print("  for id", newIds)
return newIds, strs

s = m.group(m.lastindex)
m = re.search(regex, s)

new.append(s)
newStrs.append("".join(new))

return newIds, newStrs


def writeMsg(po, header, strs):
if len(strs) == 0:
return

po.write(header)
po.write(" ")
for s in strs:
po.write('"')
po.write(s)
po.write('"\n')


if len(sys.argv) != 2:
print(f"usage: {sys.argv[0]} PO-FILE", file=sys.stderr)
sys.exit(1)

pofile = sys.argv[1]

with open(pofile, "r") as po:
polines = po.readlines()

with open(pofile, "w") as po:
current = None
cfmt = False
fuzzy = False
ids = []
strs = []

for line in polines:
m = re.search(r'^(([a-z]+) )?"(.*)"', line)
if m is None:
if cfmt:
ids, strs = process(ids, strs, fuzzy)

writeMsg(po, "msgid", ids)
 

Entering freeze for libvirt-9.2.0

2023-03-27 Thread Jiri Denemark
I have just tagged v9.2.0-rc1 in the repository and pushed signed
tarballs and source RPMs to https://libvirt.org/sources/

Please give the release candidate some testing and in case you find a
serious issue which should have a fix in the upcoming release, feel
free to reply to this thread to make sure the issue is more visible.

If you have not done so yet, please update NEWS.rst to document any
significant change you made since the last release.

Thanks,

Jirka



Plans for the next release

2023-03-17 Thread Jiri Denemark
We are getting close to the next release of libvirt. To aim for the
release on Mar 31 (in the evening since Apr 1 is Saturday) I suggest
entering the freeze on Monday Mar 27 and tagging RC2 on Wednesday Mar 29
in the afternoon.

I hope this works for everyone.

Jirka



Re: [libvirt PATCH 00/51] Use permutable format strings in translations

2023-03-10 Thread Jiri Denemark
On Fri, Mar 10, 2023 at 16:29:52 +, Daniel P. Berrangé wrote:
> On Fri, Mar 10, 2023 at 05:17:21PM +0100, Jiri Denemark wrote:
> > On Fri, Mar 10, 2023 at 16:14:00 +, Daniel P. Berrangé wrote:
> > > On Fri, Mar 10, 2023 at 05:09:16PM +0100, Jiri Denemark wrote:
> > > > See 01/51 for rationale. Enforced by the last two patches of this
> > > > series. The rest is quite boring mechanical update, partially done using
> > > > a perl oneliner
> > > > 
> > > > perl -pe 'for (my $i=1; $i<=12; $i++) { s/(N?_\("[^"]*?%)([^%$ 
> > > > ]*[a-zA-Z][^"]*")/\1$i\$\2/; }'
> > > > 
> > > > and tuned manually to fix cases not covered by the regexp above and to
> > > > merge multiline messages into a single line. I merged only those that
> > > > were touched anyway. Some very long messages consisting of several
> > > > sentences were merged only partially and split on sentence boundary.
> > > > 
> > > > I will also update libvirt.pot once this is pushed.
> > > 
> > > Are we *100% sure* weblate is going to handle this intelligently.
> > > 
> > > This will change almost all of the msgid strings in libvirt.pot,
> > > and translations are associatd with msgid strings.
> > > 
> > > IOW, this risks throwing all our translations away putting us back
> > > to near zero translation coverage, unless weblate is intelligent
> > > enough to map numbered format strings, to non-numbered format
> > > strings, and I'm not convinced that it can do that.
> > 
> > I don't know is there a way to check this? Technically we should be able
> > to update the translations as well to make sure we don't lose any work
> > done by translators. But can that be pushed into weblate somehow (I
> > guess it must have some kind of import in case you do the translation in
> > a separate tool).
> 
> Yes, there is a mechanism to import that I used when first setting
> up weblate, but I can't remember exactly what it was now. I do
> recall, however, that it was *immensely* slow and continually
> pushed weblate into OOM death due to the large number of string
> in libvirt.pot. Took me days to get everything imported :-(
> 
> 
> Technically we should really not have to modify the .pot at all,
> as it is valid to use numbered format strings in the translation
> regardless of whether the .pot uses them.
> 
> The main downside is that weblates c-format check is broken so
> will complain that the translation format is wrong, despite being
> correct. 

Not sure whether the check is disabled by default, but it allows you to
use numbered format strings when msgid doesn't use it. The problem is
that translators cannot just copy a format string to the right
place, they need to invent it. And sometimes they apparently use tools
that do not even allow using numbered format strings when they are not
present in msgid. Which then causes regressions as updates undoing the
correct formatting are pushed via weblate. Which is what happened just
now with https://gitlab.com/libvirt/libvirt/-/merge_requests/232

Jirka



Re: [libvirt PATCH 00/51] Use permutable format strings in translations

2023-03-10 Thread Jiri Denemark
On Fri, Mar 10, 2023 at 16:14:00 +, Daniel P. Berrangé wrote:
> On Fri, Mar 10, 2023 at 05:09:16PM +0100, Jiri Denemark wrote:
> > See 01/51 for rationale. Enforced by the last two patches of this
> > series. The rest is quite boring mechanical update, partially done using
> > a perl oneliner
> > 
> > perl -pe 'for (my $i=1; $i<=12; $i++) { s/(N?_\("[^"]*?%)([^%$ 
> > ]*[a-zA-Z][^"]*")/\1$i\$\2/; }'
> > 
> > and tuned manually to fix cases not covered by the regexp above and to
> > merge multiline messages into a single line. I merged only those that
> > were touched anyway. Some very long messages consisting of several
> > sentences were merged only partially and split on sentence boundary.
> > 
> > I will also update libvirt.pot once this is pushed.
> 
> Are we *100% sure* weblate is going to handle this intelligently.
> 
> This will change almost all of the msgid strings in libvirt.pot,
> and translations are associatd with msgid strings.
> 
> IOW, this risks throwing all our translations away putting us back
> to near zero translation coverage, unless weblate is intelligent
> enough to map numbered format strings, to non-numbered format
> strings, and I'm not convinced that it can do that.

I don't know is there a way to check this? Technically we should be able
to update the translations as well to make sure we don't lose any work
done by translators. But can that be pushed into weblate somehow (I
guess it must have some kind of import in case you do the translation in
a separate tool).

Jirka



[libvirt PATCH 51/51] ci: Run libvirt-pot-check in potfile job

2023-03-10 Thread Jiri Denemark
The potfile job will fail unless all format strings are permutable
(checked by meson compile libvirt-pot-check).

Signed-off-by: Jiri Denemark 
---
 .gitlab-ci.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1b72ebc493..cbaa6a5344 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -155,6 +155,7 @@ potfile:
 - meson setup build --werror || (cat build/meson-logs/meson-log.txt && 
exit 1)
 - ninja -C build libvirt-pot-dep
 - ninja -C build libvirt-pot
+- ninja -C build libvirt-pot-check
 - cp po/libvirt.pot libvirt.pot
   artifacts:
 expose_as: 'Potfile'
-- 
2.39.2



[libvirt PATCH 44/51] vmware: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/vmware/vmware_conf.c   | 16 
 src/vmware/vmware_driver.c | 26 ++
 2 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index 5703ce717e..8303591a9b 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -212,19 +212,19 @@ vmwareParseVersionStr(int type, const char *verbuf, 
unsigned long *version)
 break;
 default:
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Invalid driver type: %d"), type);
+   _("Invalid driver type: %1$d"), type);
 return -1;
 }
 
 if ((tmp = strstr(verbuf, pattern)) == NULL) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("cannot find version pattern \"%s\""), pattern);
+   _("cannot find version pattern \"%1$s\""), pattern);
 return -1;
 }
 
 if ((tmp = STRSKIP(tmp, pattern)) == NULL) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("failed to parse %sversion"), pattern);
+   _("failed to parse %1$sversion"), pattern);
 return -1;
 }
 
@@ -311,7 +311,7 @@ vmwareParsePath(const char *path, char **directory, char 
**filename)
 
 if (*separator == '\0') {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("path '%s' doesn't reference a file"), path);
+   _("path '%1$s' doesn't reference a file"), path);
 return -1;
 }
 
@@ -385,8 +385,8 @@ vmwareVmxPath(virDomainDef *vmdef, char **vmxPath)
 
 if (!virStringHasCaseSuffix(fileName, ".vmdk")) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Expecting source '%s' of first file-based harddisk "
- "to be a VMDK image"), src);
+   _("Expecting source '%1$s' of first file-based harddisk 
to be a VMDK image"),
+   src);
 return -1;
 }
 
@@ -401,7 +401,7 @@ vmwareMoveFile(char *srcFile, char *dstFile)
 g_autoptr(virCommand) cmd = NULL;
 
 if (!virFileExists(srcFile)) {
-virReportError(VIR_ERR_INTERNAL_ERROR, _("file %s does not exist"),
+virReportError(VIR_ERR_INTERNAL_ERROR, _("file %1$s does not exist"),
srcFile);
 return -1;
 }
@@ -413,7 +413,7 @@ vmwareMoveFile(char *srcFile, char *dstFile)
 
 if (virCommandRun(cmd, NULL) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("failed to move file to %s "), dstFile);
+   _("failed to move file to %1$s "), dstFile);
 return -1;
 }
 
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index 3c578434f3..259d00cacd 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -57,7 +57,7 @@ vmwareDomObjFromDomainLocked(struct vmware_driver *driver,
 virUUIDFormat(uuid, uuidstr);
 
 virReportError(VIR_ERR_NO_DOMAIN,
-   _("no domain with matching uuid '%s'"), uuidstr);
+   _("no domain with matching uuid '%1$s'"), uuidstr);
 return NULL;
 }
 
@@ -158,7 +158,7 @@ vmwareConnectOpen(virConnectPtr conn,
 /* If path isn't /session, then they typoed, so tell them correct path */
 if (STRNEQ(conn->uri->path, "/session")) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("unexpected VMware URI path '%s', try 
vmwareplayer:///session, vmwarews:///session or vmwarefusion:///session"),
+   _("unexpected VMware URI path '%1$s', try 
vmwareplayer:///session, vmwarews:///session or vmwarefusion:///session"),
NULLSTR(conn->uri->path));
 return VIR_DRV_OPEN_ERROR;
 }
@@ -177,7 +177,7 @@ vmwareConnectOpen(virConnectPtr conn,
 if (vmrun == NULL)
 continue;
 if (virFileResolveLink(vmrun, >vmrun) < 0) {
-virReportSystemError(errno, _("unable to resolve symlink '%s'"), 
vmrun);
+virReportSystemError(errno, _("unable to resolve symlink '%1$s'"), 
vmrun);
 goto cleanup;
 }
 VIR_FREE(vmrun);
@@ -196,8 +196,9 @@ vmwareConnectOpen(virConnectPtr conn,
 goto cleanup;
 
 if ((tmp = STRSKIP(conn->uri->scheme, "vmware")) == NULL) {
-virReportError(VIR_ERR_INTERNAL_ERROR, _("unable to parse URI "
-   "scheme '%s'"), conn->uri->scheme);
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _("unable to 

[libvirt PATCH 48/51] tools: Update format strings in translated messages (part 1)

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 tools/virsh-checkpoint.c |  28 ++--
 tools/virsh-domain-event.c   |  65 
 tools/virsh-domain-monitor.c |  24 +--
 tools/virsh-domain.c | 312 +--
 tools/virsh-edit.c   |   2 +-
 tools/virsh-host.c   |  46 +++---
 tools/virsh-interface.c  |  84 +-
 tools/virsh-network.c|  71 
 8 files changed, 310 insertions(+), 322 deletions(-)

diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c
index 9605c893af..727de34abb 100644
--- a/tools/virsh-checkpoint.c
+++ b/tools/virsh-checkpoint.c
@@ -59,10 +59,10 @@ virshCheckpointCreate(vshControl *ctl,
 }
 
 if (from)
-vshPrintExtra(ctl, _("Domain checkpoint %s created from '%s'"),
+vshPrintExtra(ctl, _("Domain checkpoint %1$s created from '%2$s'"),
   name, from);
 else
-vshPrintExtra(ctl, _("Domain checkpoint %s created"), name);
+vshPrintExtra(ctl, _("Domain checkpoint %1$s created"), name);
 
 return true;
 }
@@ -179,7 +179,7 @@ virshParseCheckpointDiskspec(vshControl *ctl,
 ret = 0;
  cleanup:
 if (ret < 0)
-vshError(ctl, _("unable to parse diskspec: %s"), str);
+vshError(ctl, _("unable to parse diskspec: %1$s"), str);
 return ret;
 }
 
@@ -293,7 +293,7 @@ virshLookupCheckpoint(vshControl *ctl,
 if (chkname) {
 *chk = virDomainCheckpointLookupByName(dom, chkname, 0);
 } else {
-vshError(ctl, _("--%s is required"), arg);
+vshError(ctl, _("--%1$s is required"), arg);
 return -1;
 }
 if (!*chk) {
@@ -354,7 +354,7 @@ cmdCheckpointEdit(vshControl *ctl,
 #define EDIT_NOT_CHANGED \
 do { \
 vshPrintExtra(ctl, \
-  _("Checkpoint %s XML configuration not changed.\n"), \
+  _("Checkpoint %1$s XML configuration not changed.\n"), \
   name); \
 ret = true; \
 goto edit_cleanup; \
@@ -365,16 +365,16 @@ cmdCheckpointEdit(vshControl *ctl,
 
 edited_name = virDomainCheckpointGetName(edited);
 if (STREQ(name, edited_name)) {
-vshPrintExtra(ctl, _("Checkpoint %s edited.\n"), name);
+vshPrintExtra(ctl, _("Checkpoint %1$s edited.\n"), name);
 } else {
 unsigned int delete_flags = VIR_DOMAIN_CHECKPOINT_DELETE_METADATA_ONLY;
 
 if (virDomainCheckpointDelete(edited, delete_flags) < 0) {
 vshReportError(ctl);
-vshError(ctl, _("Failed to clean up %s"), edited_name);
+vshError(ctl, _("Failed to clean up %1$s"), edited_name);
 goto cleanup;
 }
-vshError(ctl, _("Cannot rename checkpoint %s to %s"),
+vshError(ctl, _("Cannot rename checkpoint %1$s to %2$s"),
  name, edited_name);
 goto cleanup;
 }
@@ -383,7 +383,7 @@ cmdCheckpointEdit(vshControl *ctl,
 
  cleanup:
 if (!ret && name)
-vshError(ctl, _("Failed to update %s"), name);
+vshError(ctl, _("Failed to update %1$s"), name);
 return ret;
 }
 
@@ -705,7 +705,7 @@ cmdCheckpointList(vshControl *ctl,
 if (vshCommandOptBool(cmd, option)) { \
 if (tree) { \
 vshError(ctl, \
- _("--%s and --tree are mutually exclusive"), \
+ _("--%1$s and --tree are mutually exclusive"), \
  option); \
 return false; \
 } \
@@ -944,7 +944,7 @@ cmdCheckpointParent(vshControl *ctl,
 if (virshGetCheckpointParent(ctl, checkpoint, ) < 0)
 return false;
 if (!parent) {
-vshError(ctl, _("checkpoint '%s' has no parent"), name);
+vshError(ctl, _("checkpoint '%1$s' has no parent"), name);
 return false;
 }
 
@@ -1016,11 +1016,11 @@ cmdCheckpointDelete(vshControl *ctl,
 
 if (virDomainCheckpointDelete(checkpoint, flags) == 0) {
 if (flags & VIR_DOMAIN_CHECKPOINT_DELETE_CHILDREN_ONLY)
-vshPrintExtra(ctl, _("Domain checkpoint %s children deleted\n"), 
name);
+vshPrintExtra(ctl, _("Domain checkpoint %1$s children deleted\n"), 
name);
 else
-vshPrintExtra(ctl, _("Domain checkpoint %s deleted\n"), name);
+vshPrintExtra(ctl, _("Domain checkpoint %1$s deleted\n"), name);
 } else {
-vshError(ctl, _("Failed to delete checkpoint %s"), name);
+vshError(ctl, _("Failed to delete checkpoint %1$s"), name);
 return false;
 }
 
diff --git a/tools/virsh-domain-event.c b/tools/virsh-domain-event.c
index 9531a5435c..2ad4573ee9 100644
--- a/tools/virsh-do

[libvirt PATCH 41/51] util: Update format strings in translated messages (part 2)

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/util/virfdstream.c   |  30 +++
 src/util/virfile.c   | 184 +++
 src/util/virfilecache.c  |   4 +-
 src/util/virfirewall.c   |   4 +-
 src/util/virfirewalld.c  |   6 +-
 src/util/virfirmware.c   |   4 +-
 src/util/virgdbus.c  |   4 +-
 src/util/virhash.c   |   2 +-
 src/util/virhook.c   |   4 +-
 src/util/virhostcpu.c|  36 
 src/util/virhostmem.c|  32 +++
 src/util/virhostuptime.c |   4 +-
 src/util/viridentity.c   |  16 ++--
 src/util/virinitctl.c|   6 +-
 src/util/viriptables.c   |   2 +-
 src/util/viriscsi.c  |  16 ++--
 src/util/virjson.c   |  24 ++---
 src/util/virlease.c  |   4 +-
 src/util/virlockspace.c  |  34 
 src/util/virlog.c|  28 +++---
 src/util/virmacmap.c |   6 +-
 src/util/virmdev.c   |  18 ++--
 src/util/virmodule.c |  10 +--
 src/util/virnetdev.c | 145 +++---
 24 files changed, 307 insertions(+), 316 deletions(-)

diff --git a/src/util/virfdstream.c b/src/util/virfdstream.c
index 3de0d59a8b..0e39889ac9 100644
--- a/src/util/virfdstream.c
+++ b/src/util/virfdstream.c
@@ -152,7 +152,7 @@ virFDStreamMsgQueuePush(virFDStreamData *fdst,
 
 if (safewrite(fd, , sizeof(c)) != sizeof(c)) {
 virReportSystemError(errno,
- _("Unable to write to %s"),
+ _("Unable to write to %1$s"),
  fdname);
 return -1;
 }
@@ -177,7 +177,7 @@ virFDStreamMsgQueuePop(virFDStreamData *fdst,
 
 if (saferead(fd, , sizeof(c)) != sizeof(c)) {
 virReportSystemError(errno,
- _("Unable to read from %s"),
+ _("Unable to read from %1$s"),
  fdname);
 return NULL;
 }
@@ -473,7 +473,7 @@ virFDStreamThreadDoRead(virFDStreamData *fdst,
 if (sectionLen &&
 lseek(fdin, sectionLen, SEEK_CUR) == (off_t) -1) {
 virReportSystemError(errno,
- _("unable to seek in %s"),
+ _("unable to seek in %1$s"),
  fdinname);
 return -1;
 }
@@ -486,7 +486,7 @@ virFDStreamThreadDoRead(virFDStreamData *fdst,
 
 if ((got = saferead(fdin, buf, buflen)) < 0) {
 virReportSystemError(errno,
- _("Unable to read %s"),
+ _("Unable to read %1$s"),
  fdinname);
 return -1;
 }
@@ -524,7 +524,7 @@ virFDStreamThreadDoWrite(virFDStreamData *fdst,
 msg->stream.data.len - msg->stream.data.offset);
 if (got < 0) {
 virReportSystemError(errno,
- _("Unable to write %s"),
+ _("Unable to write %1$s"),
  fdoutname);
 return -1;
 }
@@ -560,7 +560,7 @@ virFDStreamThreadDoWrite(virFDStreamData *fdst,
 
 if ((r = safewrite(fdout, buf, count)) < 0) {
 virReportSystemError(errno,
- _("Unable to write %s"),
+ _("Unable to write %1$s"),
  fdoutname);
 return -1;
 }
@@ -573,14 +573,14 @@ virFDStreamThreadDoWrite(virFDStreamData *fdst,
 off = lseek(fdout, got, SEEK_CUR);
 if (off == (off_t) -1) {
 virReportSystemError(errno,
- _("unable to seek in %s"),
+ _("unable to seek in %1$s"),
  fdoutname);
 return -1;
 }
 
 if (ftruncate(fdout, off) < 0) {
 virReportSystemError(errno,
- _("unable to truncate %s"),
+ _("unable to truncate %1$s"),
  fdoutname);
 return -1;
 }
@@ -1265,7 +1265,7 @@ virFDStreamOpenFileInternal(virStreamPtr st,
 fd = open(path, oflags);
 if (fd < 0) {
 virReportSystemError(errno,
- _("Unable to open stream for '%s'"),
+ _("Unable to open stream for '%1$s'"),
  path);
 return -1;
 }
@@ -1273,7 +1273,7 @@ virFDStreamOpenFileInternal(virStreamPtr st,
 
 if (fstat(fd, ) < 0) {
 virReportSystemError(errno,
- _("Unable to access stream for '%s'"

[libvirt PATCH 28/51] qemu/qemu_migration: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/qemu/qemu_migration.c | 105 +++---
 1 file changed, 52 insertions(+), 53 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 2720f0b083..a18910f7ad 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -90,7 +90,7 @@ qemuMigrationJobIsAllowed(virDomainObj *vm)
 if (vm->job->asyncJob == VIR_ASYNC_JOB_MIGRATION_IN ||
 vm->job->asyncJob == VIR_ASYNC_JOB_MIGRATION_OUT) {
 virReportError(VIR_ERR_OPERATION_INVALID,
-   _("another migration job is already running for domain 
'%s'"),
+   _("another migration job is already running for domain 
'%1$s'"),
vm->def->name);
 return false;
 }
@@ -139,7 +139,7 @@ qemuMigrationCheckPhase(virDomainObj *vm,
 if (phase < QEMU_MIGRATION_PHASE_POSTCOPY_FAILED &&
 phase < vm->job->phase) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("migration protocol going backwards %s => %s"),
+   _("migration protocol going backwards %1$s => %2$s"),
qemuMigrationJobPhaseTypeToString(vm->job->phase),
qemuMigrationJobPhaseTypeToString(phase));
 return -1;
@@ -190,9 +190,9 @@ qemuMigrationJobIsActive(virDomainObj *vm,
 const char *msg;
 
 if (job == VIR_ASYNC_JOB_MIGRATION_IN)
-msg = _("domain '%s' is not processing incoming migration");
+msg = _("domain '%1$s' is not processing incoming migration");
 else
-msg = _("domain '%s' is not being migrated");
+msg = _("domain '%1$s' is not being migrated");
 
 virReportError(VIR_ERR_OPERATION_INVALID, msg, vm->def->name);
 return false;
@@ -250,7 +250,7 @@ qemuMigrationSrcRestoreDomainState(virQEMUDriver *driver, 
virDomainObj *vm)
 /* Hm, we already know we are in error here.  We don't want to
  * overwrite the previous error, though, so we just throw something
  * to the logs and hope for the best */
-VIR_ERROR(_("Failed to resume guest %s after failure"), 
vm->def->name);
+VIR_ERROR(_("Failed to resume guest %1$s after failure"), 
vm->def->name);
 goto cleanup;
 }
 ret = true;
@@ -291,7 +291,7 @@ qemuMigrationDstPrecreateDisk(virConnectPtr *conn,
 
 if (!(volName = strrchr(basePath, '/'))) {
 virReportError(VIR_ERR_INVALID_ARG,
-   _("malformed disk path: %s"),
+   _("malformed disk path: %1$s"),
disk->src->path);
 goto cleanup;
 }
@@ -340,7 +340,7 @@ qemuMigrationDstPrecreateDisk(virConnectPtr *conn,
 case VIR_STORAGE_TYPE_NONE:
 case VIR_STORAGE_TYPE_LAST:
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("cannot precreate storage for disk type '%s'"),
+   _("cannot precreate storage for disk type '%1$s'"),
virStorageTypeToString(disk->src->type));
 goto cleanup;
 }
@@ -446,7 +446,7 @@ qemuMigrationDstPrecreateStorage(virDomainObj *vm,
 
 if (!(disk = virDomainDiskByTarget(vm->def, nbd->disks[i].target))) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("unable to find disk by target: %s"),
+   _("unable to find disk by target: %1$s"),
nbd->disks[i].target);
 goto cleanup;
 }
@@ -526,7 +526,7 @@ qemuMigrationDstStartNBDServer(virQEMUDriver *driver,
 return -1;
 
 if (!uri->scheme) {
-virReportError(VIR_ERR_INVALID_ARG, _("No URI scheme specified: 
%s"), nbdURI);
+virReportError(VIR_ERR_INVALID_ARG, _("No URI scheme specified: 
%1$s"), nbdURI);
 return -1;
 }
 
@@ -537,7 +537,7 @@ qemuMigrationDstStartNBDServer(virQEMUDriver *driver,
  * we should rather error out instead of auto-allocating a port
  * as that would be the exact opposite of what was requested. 
*/
 virReportError(VIR_ERR_INVALID_ARG,
-   _("URI with tcp scheme did not provide a server 
part: %s"),
+   _("URI with tcp scheme did not provide a server 
part: %1$s"),
nbdURI);
 return -1;
 }
@@ -554,7 +554,7 @@ qemuMigrationDstStartNBDServer(virQEMUDriver *driver,
 server.socket = (char *)uri->path;
 } else {
 virReportE

[libvirt PATCH 40/51] util: Update format strings in translated messages (part 1)

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/util/iohelper.c   |  10 +-
 src/util/viralloc.c   |   2 +-
 src/util/virauth.c|   6 +-
 src/util/virauthconfig.c  |   4 +-
 src/util/virbitmap.c  |   4 +-
 src/util/virccw.c |   2 +-
 src/util/vircgroup.c  |  42 +++
 src/util/vircgroupbackend.c   |   2 +-
 src/util/vircgroupbackend.h   |   4 +-
 src/util/vircgroupv1.c|  78 ++---
 src/util/vircgroupv2.c|  80 ++---
 src/util/vircgroupv2devices.c |   4 +-
 src/util/vircommand.c |  38 +++---
 src/util/virconf.c|  40 +++
 src/util/vircrypto.c  |  14 +--
 src/util/virdaemon.c  |   8 +-
 src/util/virdevmapper.c   |   8 +-
 src/util/virdnsmasq.c |  15 ++-
 src/util/virerror.c   | 212 +-
 src/util/virerror.h   |  14 +--
 src/util/vireventthread.c |   2 +-
 tests/virerrortest.c  |   7 +-
 22 files changed, 298 insertions(+), 298 deletions(-)

diff --git a/src/util/iohelper.c b/src/util/iohelper.c
index dd77bda723..0a57672bb4 100644
--- a/src/util/iohelper.c
+++ b/src/util/iohelper.c
@@ -44,9 +44,9 @@ G_GNUC_NORETURN static void
 usage(int status)
 {
 if (status) {
-fprintf(stderr, _("%s: try --help for more details"), program_name);
+fprintf(stderr, _("%1$s: try --help for more details"), program_name);
 } else {
-printf(_("Usage: %s FILENAME FD"), program_name);
+printf(_("Usage: %1$s FILENAME FD"), program_name);
 }
 exit(status);
 }
@@ -61,7 +61,7 @@ main(int argc, char **argv)
 
 if (virGettextInitialize() < 0 ||
 virErrorInitialize() < 0) {
-fprintf(stderr, _("%s: initialization failed"), program_name);
+fprintf(stderr, _("%1$s: initialization failed"), program_name);
 exit(EXIT_FAILURE);
 }
 
@@ -71,7 +71,7 @@ main(int argc, char **argv)
 usage(EXIT_SUCCESS);
 if (argc == 3) { /* FILENAME FD */
 if (virStrToLong_i(argv[2], NULL, 10, ) < 0) {
-fprintf(stderr, _("%s: malformed fd %s"),
+fprintf(stderr, _("%1$s: malformed fd %2$s"),
 program_name, argv[3]);
 exit(EXIT_FAILURE);
 }
@@ -85,7 +85,7 @@ main(int argc, char **argv)
 return 0;
 
  error:
-fprintf(stderr, _("%s: failure with %s: %s"),
+fprintf(stderr, _("%1$s: failure with %2$s: %3$s"),
 program_name, path, virGetLastErrorMessage());
 exit(EXIT_FAILURE);
 }
diff --git a/src/util/viralloc.c b/src/util/viralloc.c
index 4ebbf1cf8c..7aa14cccb2 100644
--- a/src/util/viralloc.c
+++ b/src/util/viralloc.c
@@ -248,7 +248,7 @@ virInsertElementsN(void *ptrptr,
 at = *countptr;
 } else if (at > *countptr) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("out of bounds index - count %zu at %zu"),
+   _("out of bounds index - count %1$zu at %2$zu"),
*countptr, at);
 return -1;
 }
diff --git a/src/util/virauth.c b/src/util/virauth.c
index 7b4a1bd8a5..d6917bde9f 100644
--- a/src/util/virauth.c
+++ b/src/util/virauth.c
@@ -153,10 +153,10 @@ virAuthGetUsernamePath(const char *path,
 memset(, 0, sizeof(virConnectCredential));
 
 if (defaultUsername != NULL) {
-prompt = g_strdup_printf(_("Enter username for %s [%s]"), hostname,
+prompt = g_strdup_printf(_("Enter username for %1$s [%2$s]"), hostname,
  defaultUsername);
 } else {
-prompt = g_strdup_printf(_("Enter username for %s"), hostname);
+prompt = g_strdup_printf(_("Enter username for %1$s"), hostname);
 }
 
 for (ncred = 0; ncred < auth->ncredtype; ncred++) {
@@ -230,7 +230,7 @@ virAuthGetPasswordPath(const char *path,
 return NULL;
 }
 
-prompt = g_strdup_printf(_("Enter %s's password for %s"), username, 
hostname);
+prompt = g_strdup_printf(_("Enter %1$s's password for %2$s"), username, 
hostname);
 
 if (!(cred = virAuthAskCredential(auth, prompt, false)))
 return NULL;
diff --git a/src/util/virauthconfig.c b/src/util/virauthconfig.c
index 818df7a252..0c9eeae76e 100644
--- a/src/util/virauthconfig.c
+++ b/src/util/virauthconfig.c
@@ -109,7 +109,7 @@ virAuthConfigLookup(virAuthConfig *auth,
 
 if (!(authcred = g_key_file_get_string(auth->keyfile, authgroup, 
"credentials", NULL))) {
 virReportError(VIR_ERR_CONF_SYNTAX,
-   _("Missing item 'credentials' in group '%s' in '%s'"),
+   _("Missing item 'credentials' in group '%1$s' in 
'%2$s'"),
authgroup, auth->path);
 return -1;
 }
@@ -118,7 +118,7 @@ virAut

[libvirt PATCH 50/51] build: Add checks for permutable format strings

2023-03-10 Thread Jiri Denemark
Since all messages marked for translation contain permutable format
strings, we can add checks for enforcing them.

The syntax check does not catch all cases as it only checks format
strings between _(" and the first ". In other words messages where \"
appears before the first format string or multi-line messages where the
first format strings is not in the first line will not be checked. On
the other hand, it's run automatically by "meson test".

check-pot.py python script will detect all incorrect format strings, but
it's not as easy to use as it requires libvirt.pot to be regenerated and
this does not happen during a standard build. The following steps are
needed to check messages with check-pot.py:

meson compile libvirt-pot-dep
meson compile libvirt-pot
meson compile libvirt-pot-check

Don't forget to revert changes to libvirt.pot if you run these commands
locally as we don't want each patch series to update libvirt.pot.

Shell scripts (tools/libvirt-guests.sh.in is the only one currently)
need to be exempt from this check as shell's printf function does not
understand the permutable format strings.

Signed-off-by: Jiri Denemark 
---
 build-aux/syntax-check.mk |  5 
 po/meson.build|  8 ++
 scripts/check-pot.py  | 54 +++
 3 files changed, 67 insertions(+)
 create mode 100755 scripts/check-pot.py

diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk
index 21f6b311ce..5829dc9011 100644
--- a/build-aux/syntax-check.mk
+++ b/build-aux/syntax-check.mk
@@ -455,6 +455,11 @@ sc_prohibit_diagnostic_without_format:
  { echo 'found diagnostic without %' 1>&2; \
exit 1; } || :
 
+sc_require_permutable_format_in_translation:
+   @prohibit='\

[libvirt PATCH 35/51] security: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/security/security_apparmor.c |  37 +-
 src/security/security_dac.c  |  28 
 src/security/security_driver.c   |   4 +-
 src/security/security_manager.c  |   6 +-
 src/security/security_selinux.c  | 114 ++-
 src/security/security_util.c |  16 ++---
 src/security/virt-aa-helper.c|  10 +--
 7 files changed, 97 insertions(+), 118 deletions(-)

diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index b63b248975..e619919604 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -85,8 +85,8 @@ profile_status(const char *str, const int check_enforcing)
 
 if (virFileReadAll(APPARMOR_PROFILES_PATH, MAX_FILE_LEN, ) < 0) {
 virReportSystemError(errno,
- _("Failed to read AppArmor profiles list "
- "\'%s\'"), APPARMOR_PROFILES_PATH);
+ _("Failed to read AppArmor profiles list 
\'%1$s\'"),
+ APPARMOR_PROFILES_PATH);
 return -2;
 }
 
@@ -128,7 +128,7 @@ profile_status_file(const char *str)
 
 if ((len = virFileReadAll(profile, MAX_FILE_LEN, )) < 0) {
 virReportSystemError(errno,
- _("Failed to read \'%s\'"), profile);
+ _("Failed to read \'%1$s\'"), profile);
 goto failed;
 }
 
@@ -265,8 +265,7 @@ reload_profile(virSecurityManager *mgr,
 if (profile_loaded(secdef->imagelabel) >= 0) {
 if (load_profile(mgr, secdef->imagelabel, def, fn, append) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("cannot update AppArmor profile "
- "\'%s\'"),
+   _("cannot update AppArmor profile \'%1$s\'"),
secdef->imagelabel);
 return -1;
 }
@@ -327,12 +326,12 @@ AppArmorSecurityManagerProbe(const char *virtDriver 
G_GNUC_UNUSED)
 
 if (!virFileExists(template_qemu)) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("template \'%s\' does not exist"), template_qemu);
+   _("template \'%1$s\' does not exist"), template_qemu);
 return SECURITY_DRIVER_DISABLE;
 }
 if (!virFileExists(template_lxc)) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("template \'%s\' does not exist"), template_lxc);
+   _("template \'%1$s\' does not exist"), template_lxc);
 return SECURITY_DRIVER_DISABLE;
 }
 
@@ -414,8 +413,8 @@ AppArmorGenSecurityLabel(virSecurityManager *mgr 
G_GNUC_UNUSED,
 /* Now that we have a label, load the profile into the kernel. */
 if (load_profile(mgr, secdef->label, def, NULL, false) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("cannot load AppArmor profile "
-   "\'%s\'"), secdef->label);
+   _("cannot load AppArmor profile \'%1$s\'"),
+   secdef->label);
 goto err;
 }
 
@@ -518,7 +517,7 @@ AppArmorRestoreSecurityAllLabel(virSecurityManager *mgr 
G_GNUC_UNUSED,
 if (secdef->type == VIR_DOMAIN_SECLABEL_DYNAMIC) {
 if ((rc = remove_profile(secdef->label)) != 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("could not remove profile for \'%s\'"),
+   _("could not remove profile for \'%1$s\'"),
secdef->label);
 }
 }
@@ -544,9 +543,7 @@ AppArmorSetSecurityProcessLabel(virSecurityManager *mgr 
G_GNUC_UNUSED,
 
 if (STRNEQ(SECURITY_APPARMOR_NAME, secdef->model)) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("security label driver mismatch: "
- "\'%s\' model configured for domain, but "
- "hypervisor driver is \'%s\'."),
+   _("security label driver mismatch: \'%1$s\' model 
configured for domain, but hypervisor driver is \'%2$s\'."),
secdef->model, SECURITY_APPARMOR_NAME);
 if (use_apparmor() > 0)
 return -1;
@@ -582,9 +579,7 @@ AppArmorSetSecurityChildProcessLabel(virSecurityManager 
*mgr G_GNUC_UNUSED,
 
 if (STRNEQ(SECURITY_APPARMOR_NAME, secdef->model)) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("security label driver mismatch: "
- "\'%s\' model configured for domain, but "
- "hypervisor driver is \'%s\'."),
+   _("security

[libvirt PATCH 47/51] src: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/driver.c   |  6 ++
 src/internal.h | 20 +--
 src/libvirt-domain.c   | 44 +-
 src/libvirt-host.c |  6 ++
 src/libvirt-lxc.c  | 11 +--
 src/libvirt-network.c  |  8 
 src/libvirt-nodedev.c  |  4 ++--
 src/libvirt-nwfilter.c |  2 +-
 src/libvirt-qemu.c |  4 ++--
 src/libvirt-secret.c   |  6 +++---
 src/libvirt-storage.c  | 13 ++---
 src/libvirt.c  | 24 +++
 12 files changed, 70 insertions(+), 78 deletions(-)

diff --git a/src/driver.c b/src/driver.c
index 04cbbcd3ef..c7a9c2659f 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -297,16 +297,14 @@ virConnectValidateURIPath(const char *uriPath,
 
 if (STRNEQ(uriPath, "/system") && !compatSessionRoot) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("unexpected %s URI path '%s', try "
- "%s:///system"),
+   _("unexpected %1$s URI path '%2$s', try 
%3$s:///system"),
entityName, uriPath, entityName);
 return false;
 }
 } else {
 if (STRNEQ(uriPath, "/session")) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("unexpected %s URI path '%s', try "
- "%s:///session"),
+   _("unexpected %1$s URI path '%2$s', try 
%3$s:///session"),
entityName, uriPath, entityName);
 return false;
 }
diff --git a/src/internal.h b/src/internal.h
index 9dc34a0bf5..5a9e1c7cd0 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -273,13 +273,13 @@
 unsigned int __unsuppflags = flags & ~(supported); \
 if (__uiflags != flags) { \
 virReportInvalidArg(flags, \
-_("unsupported use of long flags in function 
%s"), \
+_("unsupported use of long flags in function 
%1$s"), \
 __FUNCTION__); \
 return retval; \
 } \
 if (__unsuppflags) { \
 virReportInvalidArg(flags, \
-_("unsupported flags (0x%x) in function %s"), \
+_("unsupported flags (0x%1$x) in function 
%2$s"), \
 __unsuppflags, __FUNCTION__); \
 return retval; \
 } \
@@ -302,13 +302,13 @@
 unsigned int __unsuppflags = flags & ~(supported); \
 if (__uiflags != flags) { \
 virReportInvalidArg(flags, \
-_("unsupported use of long flags in function 
%s"), \
+_("unsupported use of long flags in function 
%1$s"), \
 __FUNCTION__); \
 goto label; \
 } \
 if (__unsuppflags) { \
 virReportInvalidArg(flags, \
-_("unsupported flags (0x%x) in function %s"), \
+_("unsupported flags (0x%1$x) in function 
%2$s"), \
 __unsuppflags, __FUNCTION__); \
 goto label; \
 } \
@@ -333,8 +333,7 @@
 do { \
 if ((flags & FLAG1) && (flags & FLAG2)) { \
 virReportInvalidArg(ctl, \
-_("Flags '%s' and '%s' are mutually " \
-  "exclusive"), \
+_("Flags '%1$s' and '%2$s' are mutually 
exclusive"), \
 #FLAG1, #FLAG2); \
 return RET; \
 } \
@@ -357,8 +356,7 @@
 do { \
 if ((flags & FLAG1) && (flags & FLAG2)) { \
 virReportInvalidArg(ctl, \
-_("Flags '%s' and '%s' are mutually " \
-  "exclusive"), \
+_("Flags '%1$s' and '%2$s' are mutually 
exclusive"), \
 #FLAG1, #FLAG2); \
 goto LABEL; \
 } \
@@ -383,7 +381,7 @@
 do { \
 if ((flags & (FLAG1)) && !(flags & (FLAG2))) { \
 virReportInvalidArg(ctl, \
-_("Flag '%s' is required by flag '%s'"), \
+_("Flag '%1$s' is required by flag '%2$s'"), \
 #FLAG2, #FLAG1); \
 return RET; \
 } \
@@ -405,7 +403,7 @@
 do { \
 if ((flags & (FLAG1)) && !(flags & (FLAG2))) { \
 virReportInvalidArg(ctl, \
-

[libvirt PATCH 46/51] vz: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/vz/vz_driver.c | 32 ++--
 src/vz/vz_sdk.c| 74 ++
 src/vz/vz_utils.c  | 31 +--
 src/vz/vz_utils.h  |  2 +-
 4 files changed, 67 insertions(+), 72 deletions(-)

diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 4a7b14997f..56dc236233 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -364,7 +364,7 @@ vzConnectOpen(virConnectPtr conn,
 /* From this point on, the connection is for us. */
 if (STRNEQ(conn->uri->path, "/system")) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Unexpected Virtuozzo URI path '%s', try 
vz:///system"),
+   _("Unexpected Virtuozzo URI path '%1$s', try 
vz:///system"),
conn->uri->path);
 return VIR_DRV_OPEN_ERROR;
 }
@@ -575,7 +575,7 @@ vzDomainLookupByUUID(virConnectPtr conn, const unsigned 
char *uuid)
 char uuidstr[VIR_UUID_STRING_BUFLEN];
 virUUIDFormat(uuid, uuidstr);
 virReportError(VIR_ERR_NO_DOMAIN,
-   _("no domain with matching uuid '%s'"), uuidstr);
+   _("no domain with matching uuid '%1$s'"), uuidstr);
 return NULL;
 }
 
@@ -600,7 +600,7 @@ vzDomainLookupByName(virConnectPtr conn, const char *name)
 
 if (dom == NULL) {
 virReportError(VIR_ERR_NO_DOMAIN,
-   _("no domain with matching name '%s'"), name);
+   _("no domain with matching name '%1$s'"), name);
 return NULL;
 }
 
@@ -773,7 +773,7 @@ vzEnsureDomainExists(virDomainObj *dom)
 
 virUUIDFormat(dom->def->uuid, uuidstr);
 virReportError(VIR_ERR_NO_DOMAIN,
-   _("no domain with matching uuid '%s' (%s)"),
+   _("no domain with matching uuid '%1$s' (%2$s)"),
uuidstr, dom->def->name);
 
 return -1;
@@ -816,7 +816,7 @@ vzDomainDefineXMLFlags(virConnectPtr conn, const char *xml, 
unsigned int flags)
 goto cleanup;
 } else {
 virReportError(VIR_ERR_INVALID_ARG,
-   _("Unsupported OS type: %s"),
+   _("Unsupported OS type: %1$s"),
virDomainOSTypeToString(def->os.type));
 goto cleanup;
 }
@@ -1705,7 +1705,7 @@ vzDomainBlockStatsImpl(virDomainObj *dom,
 
 if (*path) {
 if ((idx = virDomainDiskIndexByName(dom->def, path, false)) < 0) {
-virReportError(VIR_ERR_INVALID_ARG, _("invalid path: %s"), path);
+virReportError(VIR_ERR_INVALID_ARG, _("invalid path: %1$s"), path);
 return -1;
 }
 if (prlsdkGetBlockStats(privdom->stats,
@@ -1956,7 +1956,7 @@ static int vzConnectGetMaxVcpus(virConnectPtr conn,
 return 1028;
 
 virReportError(VIR_ERR_INVALID_ARG,
-   _("unknown type '%s'"), type);
+   _("unknown type '%1$s'"), type);
 return -1;
 }
 
@@ -2129,7 +2129,7 @@ vzSnapObjFromName(virDomainSnapshotObjList *snapshots, 
const char *name)
 snap = virDomainSnapshotFindByName(snapshots, name);
 if (!snap)
 virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
-   _("no domain snapshot with matching name '%s'"), name);
+   _("no domain snapshot with matching name '%1$s'"), 
name);
 
 return snap;
 }
@@ -2452,7 +2452,7 @@ vzDomainSnapshotGetParent(virDomainSnapshotPtr snapshot, 
unsigned int flags)
 
 if (!snap->def->parent_name) {
 virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
-   _("snapshot '%s' does not have a parent"),
+   _("snapshot '%1$s' does not have a parent"),
snap->def->name);
 goto cleanup;
 }
@@ -3037,21 +3037,21 @@ vzParseVzURI(const char *uri_str)
 
 if (!uri->scheme || !uri->server) {
 virReportError(VIR_ERR_INVALID_ARG,
-   _("scheme and host are mandatory vz migration URI: %s"),
+   _("scheme and host are mandatory vz migration URI: 
%1$s"),
uri_str);
 goto error;
 }
 
 if (uri->user || uri->path || uri->query || uri->fragment) {
 virReportError(VIR_ERR_INVALID_ARG,
-   _("only scheme, host and port are supported in "
- "vz migration URI: %s"), uri_str);
+   _("only scheme, host and port are supported in vz 
migration URI: %1$s"),
+   uri_str);
 goto error;
 }
 
 if (STRNEQ(uri->scheme, "vzmigr")) {
  

[libvirt PATCH 49/51] tools: Update format strings in translated messages (part 2)

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 tools/virsh-nodedev.c |  62 +++---
 tools/virsh-nwfilter.c|  27 +++---
 tools/virsh-pool.c|  72 
 tools/virsh-secret.c  |  22 ++---
 tools/virsh-snapshot.c|  46 +-
 tools/virsh-util.c|   2 +-
 tools/virsh-volume.c  |  78 -
 tools/virsh.c |  40 -
 tools/virt-admin.c|  54 ++--
 tools/virt-host-validate-bhyve.c  |   4 +-
 tools/virt-host-validate-common.c |   4 +-
 tools/virt-host-validate.c|   8 +-
 tools/virt-login-shell-helper.c   |  22 ++---
 tools/virt-pki-query-dn.c |  12 +--
 tools/vsh.c   | 138 +++---
 tools/vsh.h   |   6 +-
 16 files changed, 296 insertions(+), 301 deletions(-)

diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index 5dbec65367..a079c8063b 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -76,11 +76,11 @@ cmdNodeDeviceCreate(vshControl *ctl, const vshCmd *cmd)
 flags |= VIR_NODE_DEVICE_CREATE_XML_VALIDATE;
 
 if (!(dev = virNodeDeviceCreateXML(priv->conn, buffer, flags))) {
-vshError(ctl, _("Failed to create node device from %s"), from);
+vshError(ctl, _("Failed to create node device from %1$s"), from);
 return false;
 }
 
-vshPrintExtra(ctl, _("Node device %s created from %s\n"),
+vshPrintExtra(ctl, _("Node device %1$s created from %2$s\n"),
   virNodeDeviceGetName(dev), from);
 return true;
 }
@@ -125,7 +125,7 @@ vshFindNodeDevice(vshControl *ctl, const char *value)
 if (strchr(value, ',')) {
 narr = vshStringToArray(value, );
 if (narr != 2) {
-vshError(ctl, _("Malformed device value '%s'"), value);
+vshError(ctl, _("Malformed device value '%1$s'"), value);
 return NULL;
 }
 
@@ -159,9 +159,9 @@ cmdNodeDeviceDestroy(vshControl *ctl, const vshCmd *cmd)
 return false;
 
 if (virNodeDeviceDestroy(dev) == 0) {
-vshPrintExtra(ctl, _("Destroyed node device '%s'\n"), device_value);
+vshPrintExtra(ctl, _("Destroyed node device '%1$s'\n"), device_value);
 } else {
-vshError(ctl, _("Failed to destroy node device '%s'"), device_value);
+vshError(ctl, _("Failed to destroy node device '%1$s'"), device_value);
 return false;
 }
 
@@ -656,7 +656,7 @@ cmdNodeDeviceDetach(vshControl *ctl, const vshCmd *cmd)
 ignore_value(vshCommandOptStringQuiet(ctl, cmd, "driver", ));
 
 if (!(device = virNodeDeviceLookupByName(priv->conn, name))) {
-vshError(ctl, _("Could not find matching device '%s'"), name);
+vshError(ctl, _("Could not find matching device '%1$s'"), name);
 return false;
 }
 
@@ -672,9 +672,9 @@ cmdNodeDeviceDetach(vshControl *ctl, const vshCmd *cmd)
 }
 
 if (ret)
-vshPrintExtra(ctl, _("Device %s detached\n"), name);
+vshPrintExtra(ctl, _("Device %1$s detached\n"), name);
 else
-vshError(ctl, _("Failed to detach device %s"), name);
+vshError(ctl, _("Failed to detach device %1$s"), name);
 
 return ret;
 }
@@ -715,14 +715,14 @@ cmdNodeDeviceReAttach(vshControl *ctl, const vshCmd *cmd)
 return false;
 
 if (!(device = virNodeDeviceLookupByName(priv->conn, name))) {
-vshError(ctl, _("Could not find matching device '%s'"), name);
+vshError(ctl, _("Could not find matching device '%1$s'"), name);
 return false;
 }
 
 if (virNodeDeviceReAttach(device) == 0) {
-vshPrintExtra(ctl, _("Device %s re-attached\n"), name);
+vshPrintExtra(ctl, _("Device %1$s re-attached\n"), name);
 } else {
-vshError(ctl, _("Failed to re-attach device %s"), name);
+vshError(ctl, _("Failed to re-attach device %1$s"), name);
 ret = false;
 }
 
@@ -765,14 +765,14 @@ cmdNodeDeviceReset(vshControl *ctl, const vshCmd *cmd)
 return false;
 
 if (!(device = virNodeDeviceLookupByName(priv->conn, name))) {
-vshError(ctl, _("Could not find matching device '%s'"), name);
+vshError(ctl, _("Could not find matching device '%1$s'"), name);
 return false;
 }
 
 if (virNodeDeviceReset(device) == 0) {
-vshPrintExtra(ctl, _("Device %s reset\n"), name);
+vshPrintExtra(ctl, _("Device %1$s reset\n"), name);
 } else {
-vshError(ctl, _("Failed to reset device %s"), name);
+vshError(ctl, _("Failed to reset device %1$s"), name);
 ret = false;
 }
 
@@ -824,11 +824,11 @@ vshEve

[libvirt PATCH 45/51] vmx: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/vmx/vmx.c | 264 +++---
 1 file changed, 122 insertions(+), 142 deletions(-)

diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index c2c9095062..5e0f1b6b3e 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -782,14 +782,14 @@ virVMXConvertToUTF8(const char *encoding, const char 
*string)
 
 if (handler == NULL) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("libxml2 doesn't handle %s encoding"), encoding);
+   _("libxml2 doesn't handle %1$s encoding"), encoding);
 return NULL;
 }
 
 if (!(input = xmlBufferCreateStatic((char *)string, strlen(string))) ||
 xmlCharEncInFunc(handler, utf8, input) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not convert from %s to UTF-8 encoding"), 
encoding);
+   _("Could not convert from %1$s to UTF-8 encoding"), 
encoding);
 goto cleanup;
 }
 
@@ -817,7 +817,7 @@ virVMXGetConfigStringHelper(virConf *conf, const char 
*name, char **string,
 return 0;
 
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Missing essential config entry '%s'"), name);
+   _("Missing essential config entry '%1$s'"), name);
 return -1;
 }
 
@@ -852,7 +852,7 @@ virVMXGetConfigUUID(virConf *conf, const char *name, 
unsigned char *uuid,
 rc = virUUIDParse(string, uuid);
 if (rc < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not parse UUID from string '%s'"), string);
+   _("Could not parse UUID from string '%1$s'"), string);
 goto cleanup;
 }
 
@@ -883,7 +883,7 @@ virVMXGetConfigLong(virConf *conf, const char *name, long 
long *number,
 *number = -1;
 } else if (virStrToLong_ll(string, NULL, 10, number) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-_("Config entry '%s' must represent an integer value"),
+_("Config entry '%1$s' must represent an integer value"),
 name);
 goto cleanup;
 }
@@ -917,8 +917,8 @@ virVMXGetConfigBoolean(virConf *conf, const char *name, 
bool *boolean_,
 *boolean_ = false;
 } else {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Config entry '%s' must represent a boolean value "
- "(true|false)"), name);
+   _("Config entry '%1$s' must represent a boolean value 
(true|false)"),
+   name);
 goto cleanup;
 }
 
@@ -947,14 +947,14 @@ virVMXSCSIDiskNameToControllerAndUnit(const char *name, 
int *controller, int *un
 
 if (idx < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not parse valid disk index from '%s'"), name);
+   _("Could not parse valid disk index from '%1$s'"), 
name);
 return -1;
 }
 
 /* Each of the 4 SCSI controllers has 1 bus with 15 units each for devices 
*/
 if (idx >= (4 * 15)) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("SCSI disk index (parsed from '%s') is too large"), 
name);
+   _("SCSI disk index (parsed from '%1$s') is too large"), 
name);
 return -1;
 }
 
@@ -986,14 +986,14 @@ virVMXIDEDiskNameToBusAndUnit(const char *name, int *bus, 
int *unit)
 
 if (idx < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not parse valid disk index from '%s'"), name);
+   _("Could not parse valid disk index from '%1$s'"), 
name);
 return -1;
 }
 
 /* The IDE controller has 2 buses with 2 units each for devices */
 if (idx >= (2 * 2)) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("IDE disk index (parsed from '%s') is too large"), 
name);
+   _("IDE disk index (parsed from '%1$s') is too large"), 
name);
 return -1;
 }
 
@@ -1021,14 +1021,14 @@ virVMXFloppyDiskNameToUnit(const char *name, int *unit)
 
 if (idx < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not parse valid disk index from '%s'"), name);
+   _("Could not parse valid disk index from '%1$s'"), 
name);
 return -1;
 }
 
 /* The FDC controller has 1 bus with 2 units for devices */
 if (idx >= 2) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Floppy disk index (parsed from '%s') is too large"), 
name);
+   _("Floppy disk index (parsed from '%1$s') is too 
large"), name);

[libvirt PATCH 43/51] vbox: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/vbox/vbox_XPCOMCGlue.c|   6 +-
 src/vbox/vbox_common.c| 157 +-
 src/vbox/vbox_network.c   |   2 +-
 src/vbox/vbox_snapshot_conf.c |  12 +--
 src/vbox/vbox_storage.c   |  20 ++---
 src/vbox/vbox_tmpl.c  |  16 ++--
 6 files changed, 106 insertions(+), 107 deletions(-)

diff --git a/src/vbox/vbox_XPCOMCGlue.c b/src/vbox/vbox_XPCOMCGlue.c
index 77a3041612..688211d122 100644
--- a/src/vbox/vbox_XPCOMCGlue.c
+++ b/src/vbox/vbox_XPCOMCGlue.c
@@ -86,7 +86,7 @@ tryLoadOne(const char *dir, bool setAppHome, bool 
ignoreMissing,
 
 if (!virFileExists(name)) {
 if (!ignoreMissing)
-VIR_ERROR(_("Library '%s' doesn't exist"), name);
+VIR_ERROR(_("Library '%1$s' doesn't exist"), name);
 
 VIR_FREE(name);
 return -1;
@@ -124,7 +124,7 @@ tryLoadOne(const char *dir, bool setAppHome, bool 
ignoreMissing,
 dlsym(hVBoxXPCOMC, VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME);
 
 if (pfnGetFunctions == NULL) {
-VIR_ERROR(_("Could not dlsym %s from '%s': %s"),
+VIR_ERROR(_("Could not dlsym %1$s from '%2$s': %3$s"),
   VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME, name, dlerror());
 goto cleanup;
 }
@@ -132,7 +132,7 @@ tryLoadOne(const char *dir, bool setAppHome, bool 
ignoreMissing,
 pVBoxFuncs_v2_2 = pfnGetFunctions(VBOX_XPCOMC_VERSION);
 
 if (pVBoxFuncs_v2_2 == NULL) {
-VIR_ERROR(_("Calling %s from '%s' failed"),
+VIR_ERROR(_("Calling %1$s from '%2$s' failed"),
   VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME, name);
 goto cleanup;
 }
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 7aed421390..34ca0cc28c 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -493,7 +493,7 @@ vboxSetStorageController(virDomainControllerDef *controller,
 case VIR_DOMAIN_CONTROLLER_TYPE_ISA:
 case VIR_DOMAIN_CONTROLLER_TYPE_LAST:
 vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-_("The vbox driver does not support %s controller 
type"),
+_("The vbox driver does not support %1$s controller 
type"),
 virDomainControllerTypeToString(controller->type));
 return -1;
 }
@@ -527,13 +527,13 @@ vboxSetStorageController(virDomainControllerDef 
*controller,
 case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DC390:
 case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AM53C974:
 vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-_("The vbox driver does not support %s SCSI 
controller model"),
+_("The vbox driver does not support %1$s SCSI 
controller model"),
 
virDomainControllerModelSCSITypeToString(controller->model));
 goto cleanup;
 case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DEFAULT:
 case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST:
 vboxReportError(VIR_ERR_INTERNAL_ERROR,
-_("Unexpected SCSI controller model %d"),
+_("Unexpected SCSI controller model %1$d"),
 controller->model);
 goto cleanup;
 }
@@ -555,7 +555,7 @@ vboxSetStorageController(virDomainControllerDef *controller,
 case VIR_DOMAIN_CONTROLLER_MODEL_IDE_LAST:
 case VIR_DOMAIN_CONTROLLER_MODEL_IDE_DEFAULT:
 vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-_("Unexpected IDE controller model %d"),
+_("Unexpected IDE controller model %1$d"),
 controller->model);
 goto cleanup;
 }
@@ -570,7 +570,7 @@ vboxSetStorageController(virDomainControllerDef *controller,
 
 if (NS_FAILED(rc)) {
 vboxReportError(VIR_ERR_INTERNAL_ERROR,
-_("Failed to add storage controller (name: %s, 
busType: %d)"),
+_("Failed to add storage controller (name: %1$s, 
busType: %2$d)"),
 debugName, vboxBusType);
 goto cleanup;
 }
@@ -883,7 +883,7 @@ static virDomainPtr vboxDomainLookupByID(virConnectPtr 
conn, int id)
  * starts from 1, so refuse id == 0, and adjust the rest */
 if (id == 0) {
 vboxReportError(VIR_ERR_NO_DOMAIN,
-_("no domain with matching id %d"), id);
+_("no domain with matching id %1$d"), id);
 return NULL;
 }
 id = id - 1;
@@ -1163,7 +1163,7 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDriver 
*data, IMachine *machine)
 
 if (type != VIR_STORAGE_TYPE_FILE) {
 vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED

[libvirt PATCH 34/51] rpc: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/rpc/gendispatch.pl| 10 ++---
 src/rpc/virkeepalive.c|  2 +-
 src/rpc/virnetclient.c|  4 +-
 src/rpc/virnetclientprogram.c | 26 ++--
 src/rpc/virnetclientstream.c  |  6 +--
 src/rpc/virnetdaemon.c|  6 +--
 src/rpc/virnetlibsshsession.c | 57 -
 src/rpc/virnetmessage.c   | 21 +-
 src/rpc/virnetsaslcontext.c   | 38 -
 src/rpc/virnetserver.c|  2 +-
 src/rpc/virnetserverclient.c  |  4 +-
 src/rpc/virnetserverprogram.c | 12 +++---
 src/rpc/virnetsocket.c| 42 +--
 src/rpc/virnetsshsession.c| 59 --
 src/rpc/virnettlscontext.c| 78 +--
 15 files changed, 178 insertions(+), 189 deletions(-)

diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index b186849606..e791d2c75c 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -1178,7 +1178,7 @@ elsif ($mode eq "server") {
 if ($modern_ret_as_list) {
 print "if (nresults > $single_ret_list_max_define) {\n";
 print "virReportError(VIR_ERR_INTERNAL_ERROR,\n";
-print "   _(\"Too many 
${single_ret_list_error_msg_type}s '%d' for limit '%d'\"),\n";
+print "   _(\"Too many 
${single_ret_list_error_msg_type}s '%1\$d' for limit '%2\$d'\"),\n";
 print "   nresults, 
$single_ret_list_max_define);\n";
 print "goto cleanup;\n";
 print "}\n";
@@ -1845,7 +1845,7 @@ elsif ($mode eq "client") {
 print "\n";
 print "if ($args_check->{arg} > $args_check->{limit}) {\n";
 print "virReportError(VIR_ERR_RPC,\n";
-print "   _(\"%s length greater than maximum: 
%d > %d\"),\n";
+print "   _(\"%1\$s length greater than 
maximum: %2\$d > %3\$d\"),\n";
 print "   $args_check->{name}, 
(int)$args_check->{arg}, $args_check->{limit});\n";
 print "goto done;\n";
 print "}\n";
@@ -1855,7 +1855,7 @@ elsif ($mode eq "client") {
 print "\n";
 print "if ($single_ret_list_max_var > 
$single_ret_list_max_define) {\n";
 print "virReportError(VIR_ERR_RPC,\n";
-print "   _(\"too many remote 
${single_ret_list_error_msg_type}s: %d > %d,\"\n";
+print "   _(\"too many remote 
${single_ret_list_error_msg_type}s: %1\$d > %2\$d,\"\n";
 print " \"in parameter 
'$single_ret_list_name' for 'vir$call->{ProcName}'\"),\n";
 print "   $single_ret_list_max_var, 
$single_ret_list_max_define);\n";
 print "goto done;\n";
@@ -1917,7 +1917,7 @@ elsif ($mode eq "client") {
 $modern_ret_as_list) {
 print "if 
(ret.$single_ret_list_name.${single_ret_list_name}_len > 
$single_ret_list_max_var) {\n";
 print "virReportError(VIR_ERR_RPC,\n";
-print "   _(\"too many remote 
${single_ret_list_error_msg_type}s: %d > %d,\"\n";
+print "   _(\"too many remote 
${single_ret_list_error_msg_type}s: %1\$d > %2\$d,\"\n";
 print " \"in parameter 
'$single_ret_list_name' for 'vir$call->{ProcName}'\"),\n";
 print "   
ret.$single_ret_list_name.${single_ret_list_name}_len, 
$single_ret_list_max_var);\n";
 print "goto cleanup;\n";
@@ -2219,7 +2219,7 @@ elsif ($mode eq "client") {
 if ($action eq "Ensure") {
 print "if (rv == 0)\n";
 print "
virReportError(VIR_ERR_ACCESS_DENIED,\n";
-print"_(\"'%s' denied 
access\"), conn->driver->name);\n";
+print"_(\"'%1\$s' denied 
access\"), conn->driver->name);\n";
 print "return $fail;\n";
 } else {
 print "virResetLastError();\n";
diff --git a/src/rpc/virkeepalive.

[libvirt PATCH 32/51] qemu: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/qemu/qemu_agent.c| 41 -
 src/qemu/qemu_backup.c   | 12 ++---
 src/qemu/qemu_block.c| 39 
 src/qemu/qemu_blockjob.c |  2 +-
 src/qemu/qemu_capabilities.c | 50 ++--
 src/qemu/qemu_cgroup.c   |  4 +-
 src/qemu/qemu_checkpoint.c   | 19 
 src/qemu/qemu_conf.c | 75 ++
 src/qemu/qemu_dbus.c | 12 ++---
 src/qemu/qemu_domain_address.c   | 26 ---
 src/qemu/qemu_domainjob.c|  6 +--
 src/qemu/qemu_extdevice.c|  2 +-
 src/qemu/qemu_fd.c   |  2 +-
 src/qemu/qemu_firmware.c | 42 -
 src/qemu/qemu_interface.c|  6 +--
 src/qemu/qemu_interop_config.c   |  4 +-
 src/qemu/qemu_migration_cookie.c | 34 +++---
 src/qemu/qemu_migration_params.c | 18 
 src/qemu/qemu_monitor.c  | 30 ++--
 src/qemu/qemu_monitor_text.c |  4 +-
 src/qemu/qemu_namespace.c| 46 +--
 src/qemu/qemu_passt.c|  2 +-
 src/qemu/qemu_qapi.c |  4 +-
 src/qemu/qemu_saveimage.c| 30 ++--
 src/qemu/qemu_slirp.c|  6 +--
 src/qemu/qemu_snapshot.c | 78 ++--
 src/qemu/qemu_tpm.c  | 29 ++--
 src/qemu/qemu_vhost_user.c   |  8 ++--
 src/qemu/qemu_vhost_user_gpu.c   |  2 +-
 src/qemu/qemu_virtiofs.c | 10 ++--
 30 files changed, 303 insertions(+), 340 deletions(-)

diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index b5aa518d55..eda1308097 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -169,7 +169,7 @@ qemuAgentOpenUnix(const char *socketpath)
 addr.sun_family = AF_UNIX;
 if (virStrcpyStatic(addr.sun_path, socketpath) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Socket path %s too big for destination"), 
socketpath);
+   _("Socket path %1$s too big for destination"), 
socketpath);
 goto error;
 }
 
@@ -226,7 +226,7 @@ qemuAgentIOProcessLine(qemuAgent *agent,
 
 if (virJSONValueGetType(obj) != VIR_JSON_TYPE_OBJECT) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Parsed JSON reply '%s' isn't an object"), line);
+   _("Parsed JSON reply '%1$s' isn't an object"), line);
 return -1;
 }
 
@@ -264,7 +264,7 @@ qemuAgentIOProcessLine(qemuAgent *agent,
 }
 
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Unknown JSON reply '%s'"), line);
+   _("Unknown JSON reply '%1$s'"), line);
 return -1;
 }
 
@@ -375,7 +375,7 @@ qemuAgentIORead(qemuAgent *agent)
 if (avail < 1024) {
 if (agent->bufferLength >= QEMU_AGENT_MAX_RESPONSE) {
 virReportSystemError(ERANGE,
- _("No complete agent response found in %d 
bytes"),
+ _("No complete agent response found in %1$d 
bytes"),
  QEMU_AGENT_MAX_RESPONSE);
 return -1;
 }
@@ -616,7 +616,7 @@ qemuAgentOpen(virDomainObj *vm,
 
 if (config->type != VIR_DOMAIN_CHR_TYPE_UNIX) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("unable to handle agent type: %s"),
+   _("unable to handle agent type: %1$s"),
virDomainChrTypeToString(config->type));
 goto cleanup;
 }
@@ -633,7 +633,7 @@ qemuAgentOpen(virDomainObj *vm,
 agent->socket = g_socket_new_from_fd(agent->fd, );
 if (!agent->socket) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Unable to create socket object: %s"),
+   _("Unable to create socket object: %1$s"),
gerr->message);
 goto cleanup;
 }
@@ -973,7 +973,7 @@ qemuAgentCheckError(virJSONValue *cmd,
 /* Only send the user the command name + friendly error */
 if (!error) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("unable to execute QEMU agent command '%s'"),
+   _("unable to execute QEMU agent command '%1$s'"),
qemuAgentCommandName(cmd));
 return -1;
 }
@@ -987,7 +987,7 @@ qemuAgentCheckError(virJSONValue *cmd,
 }
 
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("unable to execute QEMU agent command '%s': %s"),
+   _("unable to execute QEMU agent command '%1$s': %2$s"),
qemuAgentCommandName(cmd),
qemuAgentStringifyError(error));
 
@@ -1000,7 +1000,7 @@ qemuAgentChe

[libvirt PATCH 38/51] storage_file: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/storage_file/storage_file_backend.c   |  8 ++--
 src/storage_file/storage_file_backend_fs.c|  6 +--
 .../storage_file_backend_gluster.c| 16 +++
 src/storage_file/storage_file_probe.c | 13 +++--
 src/storage_file/storage_source.c | 36 +++---
 .../storage_source_backingstore.c | 47 +--
 6 files changed, 59 insertions(+), 67 deletions(-)

diff --git a/src/storage_file/storage_file_backend.c 
b/src/storage_file/storage_file_backend.c
index 94944ea356..03583803de 100644
--- a/src/storage_file/storage_file_backend.c
+++ b/src/storage_file/storage_file_backend.c
@@ -90,8 +90,7 @@ virStorageFileBackendRegister(virStorageFileBackend *backend)
 
 if (virStorageFileBackendsCount >= VIR_STORAGE_BACKENDS_MAX) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Too many drivers, cannot register storage file "
- "backend '%s'"),
+   _("Too many drivers, cannot register storage file 
backend '%1$s'"),
virStorageTypeToString(backend->type));
 return -1;
 }
@@ -130,12 +129,11 @@ virStorageFileBackendForType(int type,
 
 if (type == VIR_STORAGE_TYPE_NETWORK) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("missing storage backend for network files "
- "using %s protocol"),
+   _("missing storage backend for network files using %1$s 
protocol"),
virStorageNetProtocolTypeToString(protocol));
 } else {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("missing storage backend for '%s' storage"),
+   _("missing storage backend for '%1$s' storage"),
virStorageTypeToString(type));
 }
 
diff --git a/src/storage_file/storage_file_backend_fs.c 
b/src/storage_file/storage_file_backend_fs.c
index c657cb0277..1de822200d 100644
--- a/src/storage_file/storage_file_backend_fs.c
+++ b/src/storage_file/storage_file_backend_fs.c
@@ -102,20 +102,20 @@ virStorageFileBackendFileRead(virStorageSource *src,
 
 if ((fd = virFileOpenAs(src->path, O_RDONLY, 0,
 drv->uid, drv->gid, 0)) < 0) {
-virReportSystemError(-fd, _("Failed to open file '%s'"),
+virReportSystemError(-fd, _("Failed to open file '%1$s'"),
  src->path);
 return -1;
 }
 
 if (offset > 0) {
 if (lseek(fd, offset, SEEK_SET) == (off_t) -1) {
-virReportSystemError(errno, _("cannot seek into '%s'"), src->path);
+virReportSystemError(errno, _("cannot seek into '%1$s'"), 
src->path);
 return -1;
 }
 }
 
 if ((ret = virFileReadHeaderFD(fd, len, buf)) < 0) {
-virReportSystemError(errno, _("cannot read header '%s'"), src->path);
+virReportSystemError(errno, _("cannot read header '%1$s'"), src->path);
 return -1;
 }
 
diff --git a/src/storage_file/storage_file_backend_gluster.c 
b/src/storage_file/storage_file_backend_gluster.c
index 72341cf2c5..d018d5422e 100644
--- a/src/storage_file/storage_file_backend_gluster.c
+++ b/src/storage_file/storage_file_backend_gluster.c
@@ -83,7 +83,7 @@ 
virStorageFileBackendGlusterInitServer(virStorageFileBackendGlusterPriv *priv,
 
 if (glfs_set_volfile_server(priv->vol, transport, hoststr, port) < 0) {
 virReportSystemError(errno,
- _("failed to set gluster volfile server '%s'"),
+ _("failed to set gluster volfile server '%1$s'"),
  hoststr);
 return -1;
 }
@@ -101,7 +101,7 @@ virStorageFileBackendGlusterInit(virStorageSource *src)
 
 if (!src->volume) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("missing gluster volume name for path '%s'"),
+   _("missing gluster volume name for path '%1$s'"),
src->path);
 return -1;
 }
@@ -115,7 +115,7 @@ virStorageFileBackendGlusterInit(virStorageSource *src)
 
 if (!(priv->vol = glfs_new(src->volume))) {
 virReportError(VIR_ERR_OPERATION_FAILED,
-   _("failed to create glfs object for '%s'"), 
src->volume);
+   _("failed to create glfs object for '%1$s'"), 
src->volume);
 goto error;
 }
 
@@ -126,8 +126,8 @@ virStorageFileBackendGlusterInit(virStorageSource *src)
 
 if (glfs_init(priv->vol) < 0) {
 virReportSystemError(errno,
- _("failed to initialize 

[libvirt PATCH 37/51] storage: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/storage/parthelper.c   |   6 +-
 src/storage/storage_backend.c  |   4 +-
 src/storage/storage_backend_disk.c |  20 +--
 src/storage/storage_backend_fs.c   |  15 +-
 src/storage/storage_backend_gluster.c  |  31 ++--
 src/storage/storage_backend_iscsi.c|   6 +-
 src/storage/storage_backend_iscsi_direct.c |  44 +++---
 src/storage/storage_backend_logical.c  |  19 ++-
 src/storage/storage_backend_mpath.c|   2 +-
 src/storage/storage_backend_rbd.c  |  87 +-
 src/storage/storage_backend_scsi.c |  17 +-
 src/storage/storage_backend_vstorage.c |   2 +-
 src/storage/storage_driver.c   | 126 +++
 src/storage/storage_util.c | 176 ++---
 14 files changed, 270 insertions(+), 285 deletions(-)

diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c
index da67455335..ee07ba41bb 100644
--- a/src/storage/parthelper.c
+++ b/src/storage/parthelper.c
@@ -75,7 +75,7 @@ int main(int argc, char **argv)
 } else if (argc == 3 && STREQ(argv[2], "-p")) {
 devmap_partsep = true;
 } else if (argc != 2) {
-fprintf(stderr, _("syntax: %s DEVICE [-g]|[-p]\n"), argv[0]);
+fprintf(stderr, _("syntax: %1$s DEVICE [-g]|[-p]\n"), argv[0]);
 return 1;
 }
 
@@ -101,7 +101,7 @@ int main(int argc, char **argv)
 }
 
 if ((dev = ped_device_get(path)) == NULL) {
-fprintf(stderr, _("unable to access device %s\n"), path);
+fprintf(stderr, _("unable to access device %1$s\n"), path);
 return 2;
 }
 
@@ -115,7 +115,7 @@ int main(int argc, char **argv)
 }
 
 if ((disk = ped_disk_new(dev)) == NULL) {
-fprintf(stderr, _("unable to access disk %s\n"), argv[1]);
+fprintf(stderr, _("unable to access disk %1$s\n"), argv[1]);
 return 2;
 }
 
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index d6e02a47a8..ecc30ae710 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -149,7 +149,7 @@ virStorageBackendRegister(virStorageBackend *backend)
 
 if (virStorageBackendsCount >= VIR_STORAGE_BACKENDS_MAX) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Too many drivers, cannot register storage backend 
'%s'"),
+   _("Too many drivers, cannot register storage backend 
'%1$s'"),
virStoragePoolTypeToString(backend->type));
 return -1;
 }
@@ -169,7 +169,7 @@ virStorageBackendForType(int type)
 return virStorageBackends[i];
 
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("missing backend for pool type %d (%s)"),
+   _("missing backend for pool type %1$d (%2$s)"),
type, NULLSTR(virStoragePoolTypeToString(type)));
 return NULL;
 }
diff --git a/src/storage/storage_backend_disk.c 
b/src/storage/storage_backend_disk.c
index bf867491d0..7466f0e234 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -100,7 +100,7 @@ virStorageBackendDiskMakeDataVol(virStoragePoolObj *pool,
  */
 if (STRNEQ(vol->name, partname)) {
 virReportError(VIR_ERR_INVALID_ARG,
-   _("invalid partition name '%s', expected '%s'"),
+   _("invalid partition name '%1$s', expected '%2$s'"),
vol->name, partname);
 
 /* Let's see if by chance parthelper created a name that won't be
@@ -436,7 +436,7 @@ virStorageBackendDiskRefreshPool(virStoragePoolObj *pool)
 
 if (!virFileExists(def->source.devices[0].path)) {
 virReportError(VIR_ERR_INVALID_ARG,
-   _("device path '%s' doesn't exist"),
+   _("device path '%1$s' doesn't exist"),
def->source.devices[0].path);
 return -1;
 }
@@ -462,7 +462,7 @@ virStorageBackendDiskStartPool(virStoragePoolObj *pool)
 
 if (!virFileExists(path)) {
 virReportError(VIR_ERR_INVALID_ARG,
-   _("device path '%s' doesn't exist"), path);
+   _("device path '%1$s' doesn't exist"), path);
 return -1;
 }
 
@@ -814,7 +814,7 @@ virStorageBackendDiskDeleteVol(virStoragePoolObj *pool,
 
 if (!vol->target.path) {
 virReportError(VIR_ERR_INVALID_ARG,
-   _("volume target path empty for source path '%s'"),
+   _("volume target path empty for source path '%1$s'"),
   src_path);
 return -1;
 }
@@ -829,7 +829,7 @@ virStorageBackendDiskDeleteVol(virStoragePoolObj *pool,
 } else {
 if (virFileResolveL

[libvirt PATCH 36/51] secret: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/secret/secret_driver.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index 43d2a0c05a..c7bd65b4e9 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -83,7 +83,7 @@ secretObjFromSecret(virSecretPtr secret)
 virUUIDFormat(secret->uuid, uuidstr);
 if (!(obj = virSecretObjListFindByUUID(driver->secrets, uuidstr))) {
 virReportError(VIR_ERR_NO_SECRET,
-   _("no secret with matching uuid '%s'"), uuidstr);
+   _("no secret with matching uuid '%1$s'"), uuidstr);
 return NULL;
 }
 return obj;
@@ -164,7 +164,7 @@ secretLookupByUUID(virConnectPtr conn,
 virUUIDFormat(uuid, uuidstr);
 if (!(obj = virSecretObjListFindByUUID(driver->secrets, uuidstr))) {
 virReportError(VIR_ERR_NO_SECRET,
-   _("no secret with matching uuid '%s'"), uuidstr);
+   _("no secret with matching uuid '%1$s'"), uuidstr);
 goto cleanup;
 }
 
@@ -195,7 +195,7 @@ secretLookupByUsage(virConnectPtr conn,
 if (!(obj = virSecretObjListFindByUsage(driver->secrets,
 usageType, usageID))) {
 virReportError(VIR_ERR_NO_SECRET,
-   _("no secret with matching usage '%s'"), usageID);
+   _("no secret with matching usage '%1$s'"), usageID);
 goto cleanup;
 }
 
@@ -524,13 +524,13 @@ secretStateInitialize(bool privileged,
 }
 
 if (g_mkdir_with_parents(driver->configDir, S_IRWXU) < 0) {
-virReportSystemError(errno, _("cannot create config directory '%s'"),
+virReportSystemError(errno, _("cannot create config directory '%1$s'"),
  driver->configDir);
 goto error;
 }
 
 if (g_mkdir_with_parents(driver->stateDir, S_IRWXU) < 0) {
-virReportSystemError(errno, _("cannot create state directory '%s'"),
+virReportSystemError(errno, _("cannot create state directory '%1$s'"),
  driver->stateDir);
 goto error;
 }
@@ -594,8 +594,7 @@ secretConnectOpen(virConnectPtr conn,
 
 if (STRNEQ(root, driver->embeddedRoot)) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Cannot open embedded driver at path '%s', "
- "already open with path '%s'"),
+   _("Cannot open embedded driver at path '%1$s', 
already open with path '%2$s'"),
root, driver->embeddedRoot);
 return VIR_DRV_OPEN_ERROR;
 }
-- 
2.39.2



[libvirt PATCH 39/51] test: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/test/test_driver.c | 161 -
 1 file changed, 80 insertions(+), 81 deletions(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index bd6f063a00..822639e0f3 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -254,7 +254,7 @@ testDomainDefNamespaceParse(xmlXPathContextPtr ctxt,
 if (tmp == 0) {
 if (tmpuint >= VIR_DOMAIN_LAST) {
 virReportError(VIR_ERR_XML_ERROR,
-   _("runstate '%d' out of range'"), tmpuint);
+   _("runstate '%1$d' out of range'"), tmpuint);
 goto error;
 }
 nsdata->runstate = tmpuint;
@@ -644,7 +644,7 @@ testDomObjFromDomain(virDomainPtr domain)
 if (!vm) {
 virUUIDFormat(domain->uuid, uuidstr);
 virReportError(VIR_ERR_NO_DOMAIN,
-   _("no domain with matching uuid '%s' (%s)"),
+   _("no domain with matching uuid '%1$s' (%2$s)"),
uuidstr, domain->name);
 }
 
@@ -670,7 +670,7 @@ testDomainGenerateIfname(virDomainDef *domdef)
 }
 
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Exceeded max iface limit %d"), maxif);
+   _("Exceeded max iface limit %1$d"), maxif);
 return NULL;
 }
 
@@ -927,7 +927,7 @@ testParseNodeInfo(virNodeInfoPtr nodeInfo, 
xmlXPathContextPtr ctxt)
 if (str != NULL) {
 if (virStrcpyStatic(nodeInfo->model, str) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Model %s too big for destination"), str);
+   _("Model %1$s too big for destination"), str);
 return -1;
 }
 }
@@ -985,8 +985,8 @@ testParseDomainSnapshots(testDriver *privconn,
 
 if (virDomainSnapshotUpdateRelations(domobj->snapshots) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Snapshots have inconsistent relations for "
- "domain %s"), domobj->def->name);
+   _("Snapshots have inconsistent relations for domain 
%1$s"),
+   domobj->def->name);
 return -1;
 }
 
@@ -1879,7 +1879,7 @@ static int testDomainResume(virDomainPtr domain)
 return -1;
 
 if (virDomainObjGetState(privdom, NULL) != VIR_DOMAIN_PAUSED) {
-virReportError(VIR_ERR_INTERNAL_ERROR, _("domain '%s' not paused"),
+virReportError(VIR_ERR_INTERNAL_ERROR, _("domain '%1$s' not paused"),
domain->name);
 goto cleanup;
 }
@@ -1910,7 +1910,7 @@ static int testDomainSuspend(virDomainPtr domain)
 
 state = virDomainObjGetState(privdom, NULL);
 if (state == VIR_DOMAIN_SHUTOFF || state == VIR_DOMAIN_PAUSED) {
-virReportError(VIR_ERR_INTERNAL_ERROR, _("domain '%s' not running"),
+virReportError(VIR_ERR_INTERNAL_ERROR, _("domain '%1$s' not running"),
domain->name);
 goto cleanup;
 }
@@ -1977,7 +1977,7 @@ static int testDomainShutdownFlags(virDomainPtr domain,
 
 if (virDomainObjGetState(privdom, NULL) == VIR_DOMAIN_SHUTOFF) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("domain '%s' not running"), domain->name);
+   _("domain '%1$s' not running"), domain->name);
 goto cleanup;
 }
 
@@ -2277,21 +2277,21 @@ testDomainSaveImageWrite(testDriver *driver,
 
 if (xml == NULL) {
 virReportSystemError(errno,
- _("saving domain '%s' failed to allocate space 
for metadata"),
+ _("saving domain '%1$s' failed to allocate space 
for metadata"),
  def->name);
 goto error;
 }
 
 if ((fd = open(path, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) {
 virReportSystemError(errno,
- _("saving domain '%s' to '%s': open failed"),
+ _("saving domain '%1$s' to '%2$s': open failed"),
  def->name, path);
 goto error;
 }
 
 if (safewrite(fd, TEST_SAVE_MAGIC, sizeof(TEST_SAVE_MAGIC)) < 0) {
 virReportSystemError(errno,
- _("saving domain '%s' to '%s': write failed"),
+ _("saving domain '%1$s' to '%2$s': write failed"),
  def->name, path);
 goto error;
 }
@@ -2299,21 +2299,21 @@ testDomainSaveImageWrite(testDriver *driver,
 len = strlen(xml);
 if (safewrite(fd, (char*), sizeof(len)) < 0) {
 virReportSystemError(errno,
-  

[libvirt PATCH 30/51] qemu/qemu_process: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/qemu/qemu_process.c | 116 +++-
 1 file changed, 54 insertions(+), 62 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index deebd03717..8818eb4c8d 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -220,7 +220,7 @@ qemuConnectAgent(virQEMUDriver *driver, virDomainObj *vm)
 }
 
 if (qemuSecuritySetDaemonSocketLabel(driver->securityManager, vm->def) < 
0) {
-VIR_ERROR(_("Failed to set security context for agent for %s"),
+VIR_ERROR(_("Failed to set security context for agent for %1$s"),
   vm->def->name);
 goto cleanup;
 }
@@ -238,7 +238,7 @@ qemuConnectAgent(virQEMUDriver *driver, virDomainObj *vm)
 }
 
 if (qemuSecurityClearSocketLabel(driver->securityManager, vm->def) < 0) {
-VIR_ERROR(_("Failed to clear security context for agent for %s"),
+VIR_ERROR(_("Failed to clear security context for agent for %1$s"),
   vm->def->name);
 qemuAgentClose(agent);
 goto cleanup;
@@ -395,7 +395,7 @@ qemuProcessFindDomainDiskByAliasOrQOM(virDomainObj *vm,
 }
 
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("no disk found with alias '%s' or id '%s'"),
+   _("no disk found with alias '%1$s' or id '%2$s'"),
NULLSTR(alias), NULLSTR(qomid));
 return NULL;
 }
@@ -1864,7 +1864,7 @@ qemuConnectMonitor(virQEMUDriver *driver,
 qemuMonitor *mon = NULL;
 
 if (qemuSecuritySetDaemonSocketLabel(driver->securityManager, vm->def) < 
0) {
-VIR_ERROR(_("Failed to set security context for monitor for %s"),
+VIR_ERROR(_("Failed to set security context for monitor for %1$s"),
   vm->def->name);
 return -1;
 }
@@ -1888,7 +1888,7 @@ qemuConnectMonitor(virQEMUDriver *driver,
 priv->mon = mon;
 
 if (qemuSecurityClearSocketLabel(driver->securityManager, vm->def) < 0) {
-VIR_ERROR(_("Failed to clear security context for monitor for %s"),
+VIR_ERROR(_("Failed to clear security context for monitor for %1$s"),
   vm->def->name);
 return -1;
 }
@@ -2026,7 +2026,7 @@ qemuProcessLookupPTYs(virDomainChrDef **devices,
  * pty path for this chardev, report an error
  */
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("no assigned pty for device %s"), id);
+   _("no assigned pty for device %1$s"), id);
 return -1;
 } else {
 /* 'info chardev' had no pty path for this chardev,
@@ -2155,7 +2155,7 @@ qemuProcessRefreshPRManagerState(virDomainObj *vm,
 
 if (!(prManagerInfo = virHashLookup(info, managedAlias))) {
 virReportError(VIR_ERR_OPERATION_FAILED,
-   _("missing info on pr-manager %s"),
+   _("missing info on pr-manager %1$s"),
managedAlias);
 return -1;
 }
@@ -2360,8 +2360,7 @@ qemuProcessDetectIOThreadPIDs(virDomainObj *vm,
 
 if (niothreads != vm->def->niothreadids) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("got wrong number of IOThread pids from QEMU monitor. 
"
- "got %d, wanted %zu"),
+   _("got wrong number of IOThread pids from QEMU monitor. 
got %1$d, wanted %2$zu"),
niothreads, vm->def->niothreadids);
 goto cleanup;
 }
@@ -2378,7 +2377,7 @@ qemuProcessDetectIOThreadPIDs(virDomainObj *vm,
 if (!(iothrid = virDomainIOThreadIDFind(vm->def,
 iothreads[i]->iothread_id))) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("iothread %d not found"),
+   _("iothread %1$d not found"),
iothreads[i]->iothread_id);
 goto cleanup;
 }
@@ -2518,7 +2517,7 @@ qemuProcessSetLinkStates(virDomainObj *vm,
 VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN);
 if (rv < 0) {
 virReportError(VIR_ERR_OPERATION_FAILED,
-   _("Couldn't set link state on interface: %s"),
+   _("Couldn't set link state on interface: %1$s"),
def->nets[i]->info.alias);
 goto cleanup;
 }
@@ -2839,7 +2838,7 @@ qemuProcessStartManagedPRDaemon(virDomainObj *vm)
 cfg = virQEMUDriverGetConfig(driver);
 
 

[libvirt PATCH 33/51] remote: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/remote/remote_daemon.c  | 20 +++
 src/remote/remote_daemon_config.c   |  4 +-
 src/remote/remote_daemon_dispatch.c | 75 
 src/remote/remote_daemon_stream.c   |  4 +-
 src/remote/remote_driver.c  | 88 ++---
 src/remote/remote_sockets.c |  5 +-
 src/remote/remote_ssh_helper.c  | 16 +++---
 7 files changed, 105 insertions(+), 107 deletions(-)

diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index 4f14187bef..d880711c91 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -250,17 +250,17 @@ daemonSetupNetworking(virNetServer *srv,
 }
 
 if (virStrToLong_i(config->unix_sock_ro_perms, NULL, 8, 
_sock_ro_mask) != 0) {
-VIR_ERROR(_("Failed to parse mode '%s'"), config->unix_sock_ro_perms);
+VIR_ERROR(_("Failed to parse mode '%1$s'"), 
config->unix_sock_ro_perms);
 return -1;
 }
 
 if (virStrToLong_i(config->unix_sock_admin_perms, NULL, 8, 
_sock_adm_mask) != 0) {
-VIR_ERROR(_("Failed to parse mode '%s'"), 
config->unix_sock_admin_perms);
+VIR_ERROR(_("Failed to parse mode '%1$s'"), 
config->unix_sock_admin_perms);
 return -1;
 }
 
 if (virStrToLong_i(config->unix_sock_rw_perms, NULL, 8, 
_sock_rw_mask) != 0) {
-VIR_ERROR(_("Failed to parse mode '%s'"), config->unix_sock_rw_perms);
+VIR_ERROR(_("Failed to parse mode '%1$s'"), 
config->unix_sock_rw_perms);
 return -1;
 }
 
@@ -682,18 +682,18 @@ daemonSetupHostUUID(const struct daemonConfig *config)
 return 0;
 } else if (STREQ(config->host_uuid_source, "machine-id")) {
 if (virFileReadBufQuiet(machine_id, buf, sizeof(buf)) < 0) {
-VIR_ERROR(_("Can't read %s"), machine_id);
+VIR_ERROR(_("Can't read %1$s"), machine_id);
 return -1;
 }
 
 uuid = buf;
 } else {
-VIR_ERROR(_("invalid UUID source: %s"), config->host_uuid_source);
+VIR_ERROR(_("invalid UUID source: %1$s"), config->host_uuid_source);
 return -1;
 }
 
 if (virSetHostUUIDStr(uuid)) {
-VIR_ERROR(_("invalid host UUID: %s"), uuid);
+VIR_ERROR(_("invalid host UUID: %1$s"), uuid);
 return -1;
 }
 
@@ -915,7 +915,7 @@ int main(int argc, char **argv) {
 /* Read the config file if it exists */
 if (remote_config_file &&
 daemonConfigLoadFile(config, remote_config_file, implicit_conf) < 0) {
-VIR_ERROR(_("Can't load config file: %s: %s"),
+VIR_ERROR(_("Can't load config file: %1$s: %2$s"),
   virGetLastErrorMessage(), remote_config_file);
 exit(EXIT_FAILURE);
 }
@@ -977,13 +977,13 @@ int main(int argc, char **argv) {
 
 if (godaemon) {
 if (chdir("/") < 0) {
-VIR_ERROR(_("cannot change to root directory: %s"),
+VIR_ERROR(_("cannot change to root directory: %1$s"),
   g_strerror(errno));
 goto cleanup;
 }
 
 if ((statuswrite = virDaemonForkIntoBackground(argv[0])) < 0) {
-VIR_ERROR(_("Failed to fork as daemon: %s"),
+VIR_ERROR(_("Failed to fork as daemon: %1$s"),
   g_strerror(errno));
 goto cleanup;
 }
@@ -1007,7 +1007,7 @@ int main(int argc, char **argv) {
 old_umask = umask(077);
 VIR_DEBUG("Ensuring run dir '%s' exists", run_dir);
 if (g_mkdir_with_parents(run_dir, 0777) < 0) {
-VIR_ERROR(_("unable to create rundir %s: %s"), run_dir,
+VIR_ERROR(_("unable to create rundir %1$s: %2$s"), run_dir,
   g_strerror(errno));
 ret = VIR_DAEMON_ERR_RUNDIR;
 goto cleanup;
diff --git a/src/remote/remote_daemon_config.c 
b/src/remote/remote_daemon_config.c
index 3567e337c4..2a41c27dfc 100644
--- a/src/remote/remote_daemon_config.c
+++ b/src/remote/remote_daemon_config.c
@@ -62,7 +62,7 @@ remoteConfigGetAuth(virConf *conf,
 *auth = VIR_NET_SERVER_SERVICE_AUTH_POLKIT;
 } else {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("%s: %s: unsupported auth %s"),
+   _("%1$s: %2$s: unsupported auth %3$s"),
filename, key, authstr);
 VIR_FREE(authstr);
 return -1;
@@ -306,7 +306,7 @@ daemonConfigLoadOptions(struct daemonConfig *data,
 return -1;
 } else if (rc > 0 && data->tcp_min_ssf < SSF_WARNING_LEVEL) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("minimum SSF levels lower than %d are not supported"),
+

[libvirt PATCH 25/51] qemu/qemu_domain: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/qemu/qemu_domain.c | 188 +++--
 1 file changed, 85 insertions(+), 103 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 0feab09bee..e27b805bb0 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -446,7 +446,7 @@ qemuDomainObjFromDomain(virDomainPtr domain)
 if (!vm) {
 virUUIDFormat(domain->uuid, uuidstr);
 virReportError(VIR_ERR_NO_DOMAIN,
-   _("no domain with matching uuid '%s' (%s)"),
+   _("no domain with matching uuid '%1$s' (%2$s)"),
uuidstr, domain->name);
 return NULL;
 }
@@ -612,7 +612,7 @@ qemuDomainMasterKeyReadFile(qemuDomainObjPrivate *priv)
 
 if (!virFileExists(path)) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("domain master key file doesn't exist in %s"),
+   _("domain master key file doesn't exist in %1$s"),
priv->libDir);
 goto error;
 }
@@ -633,7 +633,7 @@ qemuDomainMasterKeyReadFile(qemuDomainObjPrivate *priv)
 
 if (masterKeyLen != QEMU_DOMAIN_MASTER_KEY_LEN) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("invalid master key read, size=%zd"), masterKeyLen);
+   _("invalid master key read, size=%1$zd"), masterKeyLen);
 goto error;
 }
 
@@ -1378,7 +1378,7 @@ qemuDomainSecretInfoTLSNew(qemuDomainObjPrivate *priv,
 
 if (virUUIDParse(secretUUID, seclookupdef.u.uuid) < 0) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("malformed TLS secret uuid '%s' provided"),
+   _("malformed TLS secret uuid '%1$s' provided"),
secretUUID);
 return NULL;
 }
@@ -2616,12 +2616,12 @@ qemuDomainObjPrivateXMLParseVcpu(xmlNodePtr node,
 if (idstr &&
 (virStrToLong_uip(idstr, NULL, 10, ) < 0)) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("cannot parse vcpu index '%s'"), idstr);
+   _("cannot parse vcpu index '%1$s'"), idstr);
 return -1;
 }
 if (!(vcpu = virDomainDefGetVcpu(def, idx))) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("invalid vcpu index '%u'"), idx);
+   _("invalid vcpu index '%1$u'"), idx);
 return -1;
 }
 
@@ -3090,7 +3090,7 @@ qemuDomainObjPrivateXMLParseSlirpFeatures(xmlNodePtr 
featuresNode,
 feature = qemuSlirpFeatureTypeFromString(str);
 if (feature < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Unknown slirp feature %s"), str);
+   _("Unknown slirp feature %1$s"), str);
 return -1;
 }
 
@@ -3143,7 +3143,7 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
 default:
 VIR_FREE(monitorpath);
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("unsupported monitor type '%s'"),
+   _("unsupported monitor type '%1$s'"),
virDomainChrTypeToString(priv->monConfig->type));
 return -1;
 }
@@ -3166,7 +3166,7 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
 
 if (ns < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("malformed namespace name: %s"),
+   _("malformed namespace name: %1$s"),
next->name);
 return -1;
 }
@@ -3206,7 +3206,7 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
 int flag = virQEMUCapsTypeFromString(str);
 if (flag < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Unknown qemu capabilities flag %s"), 
str);
+   _("Unknown qemu capabilities flag %1$s"), 
str);
 return -1;
 }
 virQEMUCapsSet(qemuCaps, flag);
@@ -3600,7 +3600,7 @@ 
qemuDomainDefNamespaceParseOverrideProperties(qemuDomainXmlNsOverrideProperty *p
 case QEMU_DOMAIN_XML_NS_OVERRIDE_SIGNED:
 if (virStrToLong_ll(prop->value, NULL, 10, ) < 0) {
 virReportError(VIR_ERR_XML_ERROR,
-   _("invalid value '%s' of 'value' attribute of 
'qemu:property'"),
+   _("invalid value '%1$s' of 'value' attribute of 
'qemu:property'"),
prop->value);
 return -1;
 }
@@

[libvirt PATCH 20/51] network: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/network/bridge_driver.c   | 188 +++---
 src/network/bridge_driver_conf.c  |   2 +-
 src/network/bridge_driver_linux.c |  12 +-
 src/network/leaseshelper.c|  12 +-
 4 files changed, 81 insertions(+), 133 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 3fa56bfc09..97e099880b 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -248,7 +248,7 @@ networkObjFromNetwork(virNetworkPtr net)
 if (!obj) {
 virUUIDFormat(net->uuid, uuidstr);
 virReportError(VIR_ERR_NO_NETWORK,
-   _("no network with matching uuid '%s' (%s)"),
+   _("no network with matching uuid '%1$s' (%2$s)"),
uuidstr, net->name);
 }
 
@@ -827,7 +827,7 @@ networkConnectSupportsFeature(virConnectPtr conn, int 
feature)
 case VIR_DRV_FEATURE_NETWORK_UPDATE_HAS_CORRECT_ORDER:
 case VIR_DRV_FEATURE_FD_PASSING:
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("Global feature %d should have already been handled"),
+   _("Global feature %1$d should have already been 
handled"),
feature);
 return -1;
 case VIR_DRV_FEATURE_MIGRATION_V2:
@@ -937,8 +937,7 @@ networkDnsmasqConfLocalPTRs(virBuffer *buf,
 if (rc == -2) {
 int family = VIR_SOCKET_ADDR_FAMILY(>address);
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("PTR domain for %s network with prefix %u "
- "cannot be automatically created"),
+   _("PTR domain for %1$s network with prefix %2$u 
cannot be automatically created"),
(family == AF_INET) ? "IPv4" : "IPv6",
virNetworkIPDefPrefix(ip));
 }
@@ -968,7 +967,7 @@ networkDnsmasqConfDHCP(virBuffer *buf,
 prefix = virNetworkIPDefPrefix(ipdef);
 if (prefix < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("bridge '%s' has an invalid prefix"),
+   _("bridge '%1$s' has an invalid prefix"),
bridge);
 return -1;
 }
@@ -993,8 +992,7 @@ networkDnsmasqConfDHCP(virBuffer *buf,
 
 if (virSocketAddrPrefixToNetmask(prefix, , AF_INET) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Failed to translate bridge '%s' "
- "prefix %d to netmask"),
+   _("Failed to translate bridge '%1$s' prefix 
%2$d to netmask"),
bridge, prefix);
 return -1;
 }
@@ -1247,15 +1245,13 @@ networkDnsmasqConfContents(virNetworkObj *obj,
  */
 if (!dns->srvs[i].service) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Missing required 'service' "
- "attribute in SRV record of network '%s'"),
+   _("Missing required 'service' attribute in SRV 
record of network '%1$s'"),
def->name);
 return -1;
 }
 if (!dns->srvs[i].protocol) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Missing required 'service' "
- "attribute in SRV record of network '%s'"),
+   _("Missing required 'service' attribute in SRV 
record of network '%1$s'"),
def->name);
 return -1;
 }
@@ -1433,7 +1429,7 @@ networkBuildDhcpDaemonCommandLine(virNetworkDriverState 
*driver,
 /* Write the file */
 if (virFileWriteStr(configfile, configstr, 0600) < 0) {
 virReportSystemError(errno,
- _("couldn't write dnsmasq config file '%s'"),
+ _("couldn't write dnsmasq config file '%1$s'"),
  configfile);
 return -1;
 }
@@ -1487,7 +1483,7 @@ networkStartDhcpDaemon(virNetworkDriverState *driver,
 return 0;
 
 if (g_mkdir_with_parents(cfg->pidDir, 0777) < 0) {
-virReportSystemError(errno, _("cannot create directory %s"), 
cfg->pidDir);
+virReportSystemError(errno, _("cannot create directory %1$s"), 
cfg->pidDir);
 return -1;
 }
 
@@ -1496,7 +1492,7 @@ networkStartDhcpDaemon(virNetworkDriverState *driver,
 
 if (g_mkdir_with_parents(cfg->dnsmasqS

[libvirt PATCH 21/51] node_device: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/node_device/node_device_driver.c | 37 ++---
 src/node_device/node_device_udev.c   | 49 ++--
 2 files changed, 42 insertions(+), 44 deletions(-)

diff --git a/src/node_device/node_device_driver.c 
b/src/node_device/node_device_driver.c
index 355ab31745..3cac25a10c 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -136,7 +136,7 @@ nodeDeviceUpdateDriverName(virNodeDeviceDef *def)
 
 if (virFileResolveLink(driver_link, ) < 0) {
 virReportSystemError(errno,
- _("cannot resolve driver link %s"), driver_link);
+ _("cannot resolve driver link %1$s"), 
driver_link);
 return -1;
 }
 
@@ -236,7 +236,7 @@ nodeDeviceObjFindByName(const char *name)
 
 if (!(obj = virNodeDeviceObjListFindByName(driver->devs, name))) {
 virReportError(VIR_ERR_NO_NODE_DEVICE,
-   _("no node device with matching name '%s'"),
+   _("no node device with matching name '%1$s'"),
name);
 }
 
@@ -735,7 +735,7 @@ nodeDeviceGetMdevctlCommand(virNodeDeviceDef *def,
 default:
 /* SHOULD NEVER HAPPEN */
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Unknown Command '%i'"), cmd_type);
+   _("Unknown Command '%1$i'"), cmd_type);
 return NULL;
 }
 
@@ -744,7 +744,7 @@ nodeDeviceGetMdevctlCommand(virNodeDeviceDef *def,
 case MDEVCTL_CMD_DEFINE:
 if (!def->caps->data.mdev.parent_addr) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("unable to find parent device '%s'"), 
def->parent);
+   _("unable to find parent device '%1$s'"), 
def->parent);
 return NULL;
 }
 
@@ -802,7 +802,7 @@ virMdevctlCreate(virNodeDeviceDef *def, char **uuid)
 
 if (status != 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Unable to start mediated device: %s"),
+   _("Unable to start mediated device: %1$s"),
MDEVCTL_ERROR(errmsg));
 return -1;
 }
@@ -832,7 +832,7 @@ virMdevctlDefine(virNodeDeviceDef *def, char **uuid)
 
 if (status != 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Unable to define mediated device: %s"),
+   _("Unable to define mediated device: %1$s"),
MDEVCTL_ERROR(errmsg));
 return -1;
 }
@@ -913,8 +913,7 @@ nodeDeviceCreateXML(virConnectPtr conn,
 
 if (device == NULL)
 virReportError(VIR_ERR_NO_NODE_DEVICE,
-   _("no node device for '%s' with matching "
- "wwnn '%s' and wwpn '%s'"),
+   _("no node device for '%1$s' with matching wwnn 
'%2$s' and wwpn '%3$s'"),
def->name, wwnn, wwpn);
 } else if (nodeDeviceHasCapability(def, VIR_NODE_DEV_CAP_MDEV)) {
 device = nodeDeviceCreateXMLMdev(conn, def);
@@ -944,7 +943,7 @@ virMdevctlStop(virNodeDeviceDef *def)
 
 if (status != 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Unable to destroy '%s': %s"), def->name,
+   _("Unable to destroy '%1$s': %2$s"), def->name,
MDEVCTL_ERROR(errmsg));
 return -1;
 }
@@ -970,7 +969,7 @@ virMdevctlUndefine(virNodeDeviceDef *def)
 
 if (status != 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Unable to undefine mediated device: %s"),
+   _("Unable to undefine mediated device: %1$s"),
MDEVCTL_ERROR(errmsg));
 return -1;
 }
@@ -996,7 +995,7 @@ virMdevctlStart(virNodeDeviceDef *def)
 
 if (status != 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Unable to create mediated device: %s"),
+   _("Unable to create mediated device: %1$s"),
MDEVCTL_ERROR(errmsg));
 return -1;
 }
@@ -1279,7 +1278,7 @@ nodeDeviceDestroy(virNodeDevicePtr device)
 
 if (!(obj = virNodeDeviceObjListFindByName(driver->devs, parent))) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("cannot find parent '%s' definition"), parent);
+   _("cannot find parent '%1$s' definition"), parent);
 goto cleanup;
 }
 
@@ -1296,7 +1295,7 @@ nodeDeviceDestroy(virNodeDevicePtr device)
 
 if (!virNodeDeviceObjIsActive(obj)) {
 virRepo

[libvirt PATCH 29/51] qemu/qemu_monitor_json: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/qemu/qemu_monitor_json.c | 91 ++--
 1 file changed, 45 insertions(+), 46 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index f4416c929f..3b42b28fa1 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -195,7 +195,7 @@ qemuMonitorJSONIOProcessLine(qemuMonitor *mon,
 
 if (virJSONValueGetType(obj) != VIR_JSON_TYPE_OBJECT) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Parsed JSON reply '%s' isn't an object"), line);
+   _("Parsed JSON reply '%1$s' isn't an object"), line);
 return -1;
 }
 
@@ -215,11 +215,11 @@ qemuMonitorJSONIOProcessLine(qemuMonitor *mon,
 return 0;
 } else {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Unexpected JSON reply '%s'"), line);
+   _("Unexpected JSON reply '%1$s'"), line);
 }
 } else {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Unknown JSON reply '%s'"), line);
+   _("Unknown JSON reply '%1$s'"), line);
 }
 
 return -1;
@@ -362,11 +362,11 @@ qemuMonitorJSONCheckErrorFull(virJSONValue *cmd,
 /* Only send the user the command name + friendly error */
 if (!error)
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("unable to execute QEMU command '%s'"),
+   _("unable to execute QEMU command '%1$s'"),
qemuMonitorJSONCommandName(cmd));
 else
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("unable to execute QEMU command '%s': %s"),
+   _("unable to execute QEMU command '%1$s': %2$s"),
qemuMonitorJSONCommandName(cmd),
qemuMonitorJSONStringifyError(error));
 
@@ -382,7 +382,7 @@ qemuMonitorJSONCheckErrorFull(virJSONValue *cmd,
 return -1;
 
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("unable to execute QEMU command '%s'"),
+   _("unable to execute QEMU command '%1$s'"),
qemuMonitorJSONCommandName(cmd));
 return -1;
 }
@@ -416,7 +416,7 @@ qemuMonitorJSONGetReply(virJSONValue *cmd,
 VIR_DEBUG("Unexpected return type %d (expecting %d) for command %s: 
%s",
   virJSONValueGetType(data), type, cmdstr, retstr);
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("unexpected type returned by QEMU command '%s'"),
+   _("unexpected type returned by QEMU command '%1$s'"),
qemuMonitorJSONCommandName(cmd));
 
 return NULL;
@@ -632,7 +632,7 @@ qemuMonitorJSONGuestPanicExtractInfo(virJSONValue *data)
 return qemuMonitorJSONGuestPanicExtractInfoS390(data);
 
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("unknown panic info type '%s'"), NULLSTR(type));
+   _("unknown panic info type '%1$s'"), NULLSTR(type));
 return NULL;
 }
 
@@ -1261,7 +1261,7 @@ qemuMonitorJSONExtractDumpStats(virJSONValue *result,
 ret->status = qemuMonitorDumpStatusTypeFromString(statusstr);
 if (ret->status < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("incomplete result, unknown status string '%s'"),
+   _("incomplete result, unknown status string '%1$s'"),
statusstr);
 return -1;
 }
@@ -1389,7 +1389,7 @@ qemuMonitorJSONHumanCommand(qemuMonitor *mon,
 
 if (qemuMonitorJSONHasError(reply, "CommandNotFound")) {
 virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
-   _("Human monitor command is not available to run %s"),
+   _("Human monitor command is not available to run %1$s"),
cmd_str);
 return -1;
 }
@@ -1763,7 +1763,7 @@ qemuMonitorJSONUpdateVideoMemorySize(qemuMonitor *mon,
 case VIR_DOMAIN_VIDEO_TYPE_VGA:
 if (qemuMonitorJSONGetObjectProperty(mon, path, "vgamem_mb", ) < 
0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("QOM Object '%s' has no property 'vgamem_mb'"),
+   _("QOM Object '%1$s' has no property 'vgamem_mb'"),
path);
 return -1;
 }
@@ -1772,7 +1772,7 @@ qemuMonitorJSONUpdateVideoMemorySize(qemuMonitor *mon,
 case VIR_DOMAIN_VIDEO_TYPE_QXL:
 if (qemuMonitorJSONGetObjectProperty(mon, path, "vram_size", ) <

[libvirt PATCH 16/51] libxl: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/libxl/libxl_capabilities.c |   2 +-
 src/libxl/libxl_conf.c |  61 +-
 src/libxl/libxl_domain.c   |  24 ++--
 src/libxl/libxl_driver.c   | 215 -
 src/libxl/libxl_migration.c|   6 +-
 src/libxl/xen_common.c |  72 +--
 src/libxl/xen_xl.c |  28 ++---
 src/libxl/xen_xm.c |   4 +-
 8 files changed, 201 insertions(+), 211 deletions(-)

diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
index c2975d637e..cd40cff739 100644
--- a/src/libxl/libxl_capabilities.c
+++ b/src/libxl/libxl_capabilities.c
@@ -348,7 +348,7 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCaps *caps)
 regex = g_regex_new(XEN_CAP_REGEX, 0, 0, );
 if (!regex) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Failed to compile regex %s"), err->message);
+   _("Failed to compile regex %1$s"), err->message);
 return -1;
 }
 
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 15369b2791..12a0eb7085 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -186,7 +186,7 @@ libxlMakeDomCreateInfo(libxl_ctx *ctx,
strlen(def->seclabels[0]->label),
_info->ssidref)) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("libxenlight failed to resolve security label 
'%s'"),
+   _("libxenlight failed to resolve security label 
'%1$s'"),
def->seclabels[0]->label);
 }
 }
@@ -194,7 +194,7 @@ libxlMakeDomCreateInfo(libxl_ctx *ctx,
 virUUIDFormat(def->uuid, uuidstr);
 if (libxl_uuid_from_string(_info->uuid, uuidstr)) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("libxenlight failed to parse UUID '%s'"), uuidstr);
+   _("libxenlight failed to parse UUID '%1$s'"), uuidstr);
 goto error;
 }
 
@@ -272,7 +272,7 @@ libxlMakeChrdevStr(virDomainChrDef *def, char **buf)
 
 default:
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("unsupported chardev '%s'"), type);
+   _("unsupported chardev '%1$s'"), type);
 return -1;
 }
 
@@ -384,7 +384,7 @@ libxlMakeDomBuildInfo(virDomainDef *def,
 
 case VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE:
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("unsupported clock offset '%s'"),
+   _("unsupported clock offset '%1$s'"),
virDomainClockOffsetTypeToString(clock.offset));
 return -1;
 
@@ -392,7 +392,7 @@ libxlMakeDomBuildInfo(virDomainDef *def,
 case VIR_DOMAIN_CLOCK_OFFSET_LAST:
 default:
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("unexpected clock offset '%d'"), clock.offset);
+   _("unexpected clock offset '%1$d'"), clock.offset);
 return -1;
 }
 
@@ -421,7 +421,7 @@ libxlMakeDomBuildInfo(virDomainDef *def,
 case VIR_DOMAIN_TIMER_NAME_HPET:
 if (!hvm) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("unsupported timer type (name) '%s'"),
+   _("unsupported timer type (name) '%1$s'"),

virDomainTimerNameTypeToString(clock.timers[i]->name));
 return -1;
 }
@@ -436,7 +436,7 @@ libxlMakeDomBuildInfo(virDomainDef *def,
 case VIR_DOMAIN_TIMER_NAME_PIT:
 case VIR_DOMAIN_TIMER_NAME_ARMVTIMER:
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("unsupported timer type (name) '%s'"),
+   _("unsupported timer type (name) '%1$s'"),

virDomainTimerNameTypeToString(clock.timers[i]->name));
 return -1;
 
@@ -503,7 +503,7 @@ libxlMakeDomBuildInfo(virDomainDef *def,
false));
 if (libxl_cpuid_parse_config(_info->cpuid, 
xlCPU)) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-_("unsupported cpu feature '%s'"),
+_("unsupported cpu feature '%1$s'"),
 def->cpu->features[i].name);
 return -1;
 }
@@ -524,7 +524,7 @@ libxlMakeDomBuildInfo(virDomainDef *def,
def->cpu->features[i].name, false));
  

[libvirt PATCH 27/51] qemu/qemu_hotplug: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/qemu/qemu_hotplug.c | 160 ++--
 1 file changed, 72 insertions(+), 88 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index da17525824..e753c20471 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -259,7 +259,7 @@ qemuHotplugWaitForTrayEject(virDomainObj *vm,
  * error. Report the failure in an off-chance that it didn't. */
 if (virGetLastErrorCode() == VIR_ERR_OK) {
 virReportError(VIR_ERR_OPERATION_FAILED,
-   _("timed out waiting to open tray of '%s'"),
+   _("timed out waiting to open tray of '%1$s'"),
disk->dst);
 }
 return -1;
@@ -767,7 +767,7 @@ int qemuDomainAttachControllerDevice(virDomainObj *vm,
 
 if (controller->type != VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
 virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
-   _("'%s' controller cannot be hot plugged."),
+   _("'%1$s' controller cannot be hot plugged."),
virDomainControllerTypeToString(controller->type));
 return -1;
 }
@@ -782,7 +782,7 @@ int qemuDomainAttachControllerDevice(virDomainObj *vm,
 
 if (virDomainControllerFind(vm->def, controller->type, controller->idx) >= 
0) {
 virReportError(VIR_ERR_OPERATION_FAILED,
-   _("target %s:%d already exists"),
+   _("target %1$s:%2$d already exists"),
type, controller->idx);
 return -1;
 }
@@ -939,7 +939,7 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver 
*driver,
 /* We should have an address already, so make sure */
 if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("unexpected disk address type %s"),
+   _("unexpected disk address type %1$s"),

virDomainDeviceAddressTypeToString(disk->info.type));
 goto cleanup;
 }
@@ -975,7 +975,7 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver 
*driver,
 case VIR_DOMAIN_DISK_BUS_NONE:
 case VIR_DOMAIN_DISK_BUS_LAST:
 virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
-   _("disk bus '%s' cannot be hotplugged."),
+   _("disk bus '%1$s' cannot be hotplugged."),
virDomainDiskBusTypeToString(disk->bus));
 }
 
@@ -1241,7 +1241,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
 case VIR_DOMAIN_NET_TYPE_VDS:
 case VIR_DOMAIN_NET_TYPE_LAST:
 virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
-   _("hotplug of interface type of %s is not implemented 
yet"),
+   _("hotplug of interface type of %1$s is not implemented 
yet"),
virDomainNetTypeToString(actualType));
 goto cleanup;
 }
@@ -1498,7 +1498,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver,
 case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN:
 case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("QEMU does not support device assignment mode '%s'"),
+   _("QEMU does not support device assignment mode 
'%1$s'"),
virDomainHostdevSubsysPCIBackendTypeToString(backend));
 goto error;
 break;
@@ -2763,7 +2763,7 @@ qemuDomainAttachHostDevice(virQEMUDriver *driver,
 {
 if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("hotplug is not supported for hostdev mode '%s'"),
+   _("hotplug is not supported for hostdev mode '%1$s'"),
virDomainHostdevModeTypeToString(hostdev->mode));
 return -1;
 }
@@ -2798,7 +2798,7 @@ qemuDomainAttachHostDevice(virQEMUDriver *driver,
 
 default:
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("hotplug is not supported for hostdev subsys type 
'%s'"),
+   _("hotplug is not supported for hostdev subsys type 
'%1$s'"),

virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type));
 return -1;
 }
@@ -2829,7 +2829,7 @@ qemuDomainAttachShmemDevice(virDomainObj *vm,
 
 case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM:
 virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
-   _("live attach of shmem model '%s' is not supported"),
+   _("live attach of shmem

[libvirt PATCH 31/51] qemu/qemu_validate: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/conf/domain_validate.c |   2 +-
 src/qemu/qemu_validate.c   | 317 +
 2 files changed, 142 insertions(+), 177 deletions(-)

diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index d30bb31dda..c20d3fe1d7 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -230,7 +230,7 @@ virDomainVideoDefValidate(const virDomainVideoDef *video,
 return -1;
 if (video->blob != VIR_TRISTATE_SWITCH_ABSENT) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("video type '%s' does not support blob 
resources"),
+   _("video type '%1$s' does not support blob 
resources"),
virDomainVideoTypeToString(video->type));
 return -1;
 }
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 0146220d8f..baebb6becf 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -45,8 +45,7 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def,
 if (def->features[feature] != VIR_TRISTATE_SWITCH_ABSENT &&
 !qemuDomainIsPSeries(def)) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("The '%s' feature is not supported for "
- "architecture '%s' or machine type '%s'"),
+   _("The '%1$s' feature is not supported for architecture 
'%2$s' or machine type '%3$s'"),
virDomainFeatureTypeToString(feature),
virArchToString(def->os.arch),
def->os.machine);
@@ -180,8 +179,7 @@ qemuValidateDomainDefFeatures(const virDomainDef *def,
 if (def->features[i] != VIR_DOMAIN_IOAPIC_NONE) {
 if (!ARCH_IS_X86(def->os.arch)) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("The '%s' feature is not supported for "
- "architecture '%s' or machine type '%s'"),
+   _("The '%1$s' feature is not supported for 
architecture '%2$s' or machine type '%3$s'"),
featureName,
virArchToString(def->os.arch),
def->os.machine);
@@ -205,8 +203,7 @@ qemuValidateDomainDefFeatures(const virDomainDef *def,
 if (def->features[i] == VIR_TRISTATE_SWITCH_ON &&
 !qemuDomainIsARMVirt(def)) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("The '%s' feature is not supported for "
- "architecture '%s' or machine type '%s'"),
+   _("The '%1$s' feature is not supported for 
architecture '%2$s' or machine type '%3$s'"),
featureName,
virArchToString(def->os.arch),
def->os.machine);
@@ -241,9 +238,7 @@ qemuValidateDomainDefFeatures(const virDomainDef *def,
 def->apic_eoi != VIR_TRISTATE_SWITCH_ABSENT &&
 !ARCH_IS_X86(def->os.arch)) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("The 'eoi' attribute of the '%s' feature "
- "is not supported for architecture '%s' or "
- "machine type '%s'"),
+   _("The 'eoi' attribute of the '%1$s' feature is 
not supported for architecture '%2$s' or machine type '%3$s'"),
  featureName,
  virArchToString(def->os.arch),
  def->os.machine);
@@ -255,8 +250,7 @@ qemuValidateDomainDefFeatures(const virDomainDef *def,
 if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT &&
 !ARCH_IS_X86(def->os.arch)) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("The '%s' feature is not supported for "
- "architecture '%s' or machine type '%s'"),
+   _("The '%1$s' feature is not supported for 
architecture '%2$s' or machine type '%3$s'"),
  featureName,
  virArchToString(def->os.arch),
  def->os.machine);
@@ -268,8 +262,7 @@ qemuValidateDomainDefFeatures(const virDomainDef *def,
 if (def->features[i] != VIR_DOMAIN_HYPERV_MODE_NONE &&
 !ARCH_IS_X86(def->os.arch) &&am

[libvirt PATCH 26/51] qemu/qemu_driver: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/qemu/qemu_driver.c | 428 +++--
 1 file changed, 203 insertions(+), 225 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fd8136be37..13f8458d4d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -188,7 +188,7 @@ qemuAutostartDomain(virDomainObj *vm,
 if (qemuProcessBeginJob(vm, VIR_DOMAIN_JOB_OPERATION_START,
 flags) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Failed to start job on VM '%s': %s"),
+   _("Failed to start job on VM '%1$s': %2$s"),
vm->def->name, virGetLastErrorMessage());
 goto cleanup;
 }
@@ -196,7 +196,7 @@ qemuAutostartDomain(virDomainObj *vm,
 if (qemuDomainObjStart(NULL, driver, vm, flags,
VIR_ASYNC_JOB_START) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Failed to autostart VM '%s': %s"),
+   _("Failed to autostart VM '%1$s': %2$s"),
vm->def->name, virGetLastErrorMessage());
 }
 
@@ -370,7 +370,7 @@ qemuDomainSnapshotLoad(virDomainObj *vm,
 if (virFileReadAll(fullpath, 1024*1024*1, ) < 0) {
 /* Nothing we can do here, skip this one */
 virReportSystemError(errno,
- _("Failed to read snapshot file %s"),
+ _("Failed to read snapshot file %1$s"),
  fullpath);
 continue;
 }
@@ -382,7 +382,7 @@ qemuDomainSnapshotLoad(virDomainObj *vm,
 if (snapdef == NULL) {
 /* Nothing we can do here, skip this one */
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Failed to parse snapshot XML from file '%s'"),
+   _("Failed to parse snapshot XML from file '%1$s'"),
fullpath);
 continue;
 }
@@ -391,20 +391,20 @@ qemuDomainSnapshotLoad(virDomainObj *vm,
 if (cur && snap) {
 if (current)
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Too many snapshots claiming to be current 
for domain %s"),
+   _("Too many snapshots claiming to be current 
for domain %1$s"),
vm->def->name);
 current = snap;
 }
 }
 if (direrr < 0)
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Failed to fully read directory %s"),
+   _("Failed to fully read directory %1$s"),
snapDir);
 
 virDomainSnapshotSetCurrent(vm->snapshots, current);
 if (virDomainSnapshotUpdateRelations(vm->snapshots) < 0)
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Snapshots have inconsistent relations for domain 
%s"),
+   _("Snapshots have inconsistent relations for domain 
%1$s"),
vm->def->name);
 
 /* FIXME: qemu keeps internal track of snapshots.  We can get access
@@ -465,7 +465,7 @@ qemuDomainCheckpointLoad(virDomainObj *vm,
 if (virFileReadAll(fullpath, 1024*1024*1, ) < 0) {
 /* Nothing we can do here, skip this one */
 virReportSystemError(errno,
- _("Failed to read checkpoint file %s"),
+ _("Failed to read checkpoint file %1$s"),
  fullpath);
 continue;
 }
@@ -482,12 +482,12 @@ qemuDomainCheckpointLoad(virDomainObj *vm,
 }
 if (direrr < 0)
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Failed to fully read directory %s"),
+   _("Failed to fully read directory %1$s"),
chkDir);
 
 if (virDomainCheckpointUpdateRelations(vm->checkpoints, ) < 0)
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Checkpoints have inconsistent relations for domain 
%s"),
+   _("Checkpoints have inconsistent relations for domain 
%1$s"),
vm->def->name);
 virDomainCheckpointSetCurrent(vm->checkpoints, current);
 
@@ -610,69 +610,69 @@ qemuStateInitialize(bool privileged,
 goto error;
 
 if (g_mkdir_with_parents(cfg->stateDir, 0777) < 0) {
-virReportSystemError(errno, _("Failed to create state dir %s"),
+virReportSystemError(errno, _("Failed to 

[libvirt PATCH 22/51] nwfilter: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/nwfilter/nwfilter_dhcpsnoop.c | 67 +++
 src/nwfilter/nwfilter_driver.c| 18 +++---
 src/nwfilter/nwfilter_ebiptables_driver.c | 16 +++---
 src/nwfilter/nwfilter_gentech_driver.c| 19 +++
 src/nwfilter/nwfilter_learnipaddr.c   |  9 ++-
 5 files changed, 60 insertions(+), 69 deletions(-)

diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c 
b/src/nwfilter/nwfilter_dhcpsnoop.c
index 20afc1b2d4..3dc0b777e9 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -485,8 +485,7 @@ virNWFilterSnoopReqNew(const char *ifkey)
 
 if (ifkey == NULL || strlen(ifkey) != VIR_IFKEY_LEN - 1) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("virNWFilterSnoopReqNew called with invalid "
- "key \"%s\" (%zu)"),
+   _("virNWFilterSnoopReqNew called with invalid key 
\"%1$s\" (%2$zu)"),
NULLSTR_EMPTY(ifkey),
ifkey ? strlen(ifkey) : 0);
 return NULL;
@@ -955,26 +954,26 @@ virNWFilterSnoopDHCPOpen(const char *ifname, virMacAddr 
*mac,
 pcap_set_immediate_mode(handle, 1) < 0 ||
 pcap_activate(handle) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("setup of pcap handle failed: %s"),
+   _("setup of pcap handle failed: %1$s"),
pcap_geterr(handle));
 goto cleanup;
 }
 
 if (pcap_compile(handle, , ext_filter, 1, PCAP_NETMASK_UNKNOWN) != 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("pcap_compile: %s"), pcap_geterr(handle));
+   _("pcap_compile: %1$s"), pcap_geterr(handle));
 goto cleanup;
 }
 
 if (pcap_setfilter(handle, ) != 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("pcap_setfilter: %s"), pcap_geterr(handle));
+   _("pcap_setfilter: %1$s"), pcap_geterr(handle));
 goto cleanup_freecode;
 }
 
 if (pcap_setdirection(handle, dir) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("pcap_setdirection: %s"),
+   _("pcap_setdirection: %1$s"),
pcap_geterr(handle));
 goto cleanup_freecode;
 }
@@ -1004,8 +1003,8 @@ static void virNWFilterDHCPDecodeWorker(void *jobdata, 
void *opaque)
 req->jobCompletionStatus = -1;
 
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Instantiation of rules failed on "
- "interface '%s'"), req->binding->portdevname);
+   _("Instantiation of rules failed on interface '%1$s'"),
+   req->binding->portdevname);
 }
 ignore_value(!!g_atomic_int_dec_and_test(job->qCtr));
 }
@@ -1306,7 +1305,7 @@ virNWFilterDHCPSnoopThread(void *req0)
 /* protect req->binding->portdevname */
 VIR_WITH_MUTEX_LOCK_GUARD(>lock) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("interface '%s' failing; reopening"),
+   _("interface '%1$s' failing; 
reopening"),
req->binding->portdevname);
 if (req->binding->portdevname)
 pcapConf[i].handle =
@@ -1359,8 +1358,8 @@ virNWFilterDHCPSnoopThread(void *req0)
   pcapConf[i].dir,
   [i].qCtr) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Job submission failed on "
- "interface '%s'"), 
req->binding->portdevname);
+   _("Job submission failed on interface 
'%1$s'"),
+   req->binding->portdevname);
 error = true;
 break;
 }
@@ -1468,8 +1467,8 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriver *techdriver,
 req->binding->portdevname,
 req->ifkey) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("virNWFilterDHCPSnoopReq ifname map failed"
- " on interface \"%s\" key \"%s\""), 
binding->portdevname,
+   _("virNWFilterDHCPSnoopReq ifname map failed on 
interface \"%1$s\" key \"%2$s\""),
+   binding->

[libvirt PATCH 24/51] qemu/qemu_command: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/qemu/qemu_command.c | 82 -
 1 file changed, 40 insertions(+), 42 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 929bcc0be1..843dd103c7 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -357,7 +357,7 @@ qemuBuildDeviceAddressPCIGetBus(const virDomainDef 
*domainDef,
 
 if (!contAlias) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Device alias was not set for PCI controller 
with index '%u' required for device at address '%s'"),
+   _("Device alias was not set for PCI controller 
with index '%1$u' required for device at address '%2$s'"),
info->addr.pci.bus, devStr);
 return NULL;
 }
@@ -382,7 +382,7 @@ qemuBuildDeviceAddressPCIGetBus(const virDomainDef 
*domainDef,
 
 if (!contAlias) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not find PCI controller with index '%u' 
required for device at address '%s'"),
+   _("Could not find PCI controller with index '%1$u' 
required for device at address '%2$s'"),
info->addr.pci.bus, devStr);
 return NULL;
 }
@@ -467,7 +467,7 @@ qemuBuildDeviceAddresDriveProps(virJSONValue *props,
 case VIR_DOMAIN_DISK_BUS_SCSI:
 if (!(controller = virDomainDeviceFindSCSIController(domainDef, 
>addr.drive))) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("unable to find a SCSI controller for idx=%d"),
+   _("unable to find a SCSI controller for idx=%1$d"),
info->addr.drive.controller);
 return -1;
 }
@@ -511,7 +511,7 @@ qemuBuildDeviceAddresDriveProps(virJSONValue *props,
 case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DEFAULT:
 case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST:
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Unexpected SCSI controller model %d"),
+   _("Unexpected SCSI controller model %1$d"),
controller->model);
 return -1;
 }
@@ -527,7 +527,7 @@ qemuBuildDeviceAddresDriveProps(virJSONValue *props,
 case VIR_DOMAIN_DISK_BUS_LAST:
 default:
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("address type drive is not supported for bus '%s'"),
+   _("address type drive is not supported for bus '%1$s'"),

NULLSTR(virDomainDiskBusTypeToString(info->addr.drive.diskbus)));
 return -1;
 }
@@ -778,7 +778,7 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
 
 if (!model || STREQ(model, "")) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("invalid model for video type '%s'"),
+   _("invalid model for video type '%1$s'"),
virDomainVideoTypeToString(video->type));
 return NULL;
 }
@@ -1003,7 +1003,7 @@ qemuBuildVirtioDevGetConfig(const virDomainDeviceDef 
*device,
 case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA:
 case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM:
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Unexpected address type for '%s'"), baseName);
+   _("Unexpected address type for '%1$s'"), baseName);
 return -1;
 
 case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE:
@@ -1020,8 +1020,7 @@ qemuBuildVirtioDevGetConfig(const virDomainDeviceDef 
*device,
 if (has_tmodel || has_ntmodel) {
 if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("virtio (non-)transitional models are not "
- "supported for address type=%s"),
+   _("virtio (non-)transitional models are not 
supported for address type=%1$s"),
virDomainDeviceAddressTypeToString(info->type));
 }
 
@@ -1532,7 +1531,7 @@ qemuBuildChardevCommand(virCommand *cmd,
 case VIR_DOMAIN_CHR_TYPE_LAST:
 default:
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("unsupported chardev '%s'"),
+   _("unsupported chardev '%1$s'"),
virDomainChrTypeToString(dev->type));
 return -1;
 }
@@ -1860,7 +1859,7 @@ qemuBuildDiskDeviceProps(const virDomainDef *def,
 case VIR_DOMAIN_DISK_BUS_LAST:
 default:
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("unsupported disk bus '%s' with device setup&

[libvirt PATCH 19/51] lxc: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/lxc/lxc_cgroup.c |   2 +-
 src/lxc/lxc_container.c  | 114 +++
 src/lxc/lxc_controller.c |  78 +--
 src/lxc/lxc_domain.c |   8 +--
 src/lxc/lxc_driver.c | 104 +--
 src/lxc/lxc_fuse.c   |   4 +-
 src/lxc/lxc_hostdev.c|   6 +--
 src/lxc/lxc_native.c |  26 -
 src/lxc/lxc_process.c|  38 ++---
 9 files changed, 190 insertions(+), 190 deletions(-)

diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
index ee14570470..1b516bba73 100644
--- a/src/lxc/lxc_cgroup.c
+++ b/src/lxc/lxc_cgroup.c
@@ -382,7 +382,7 @@ virCgroup *virLXCCgroupCreate(virDomainDef *def,
 
 if (!g_path_is_absolute(def->resource->partition)) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("Resource partition '%s' must start with '/'"),
+   _("Resource partition '%1$s' must start with '/'"),
def->resource->partition);
 return NULL;
 }
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index a5401c2186..63cf283285 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -126,7 +126,7 @@ int lxcContainerHasReboot(void)
 
 if (virStrToLong_i(buf, NULL, 10, ) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Malformed ctrl-alt-del setting '%s'"), buf);
+   _("Malformed ctrl-alt-del setting '%1$s'"), buf);
 return -1;
 }
 cmd = v ? LINUX_REBOOT_CMD_CAD_ON : LINUX_REBOOT_CMD_CAD_OFF;
@@ -178,7 +178,7 @@ static virCommand *lxcContainerBuildInitCmd(virDomainDef 
*vmDef,
 for (i = 1; i < nttyPaths; i++) {
 if (!STRPREFIX(ttyPaths[i], "/dev/")) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Expected a /dev path for '%s'"),
+   _("Expected a /dev path for '%1$s'"),
ttyPaths[i]);
 return NULL;
 }
@@ -292,7 +292,7 @@ static int lxcContainerSetupFDs(int *ttyfd,
 
 if (newfd < 0) {
 virReportSystemError(errno,
- _("Cannot move fd %d out of the way"),
+ _("Cannot move fd %1$d out of the 
way"),
  passFDs[j]);
 goto cleanup;
 }
@@ -310,7 +310,7 @@ static int lxcContainerSetupFDs(int *ttyfd,
 /* Finally we can move into our desired FD number */
 if (dup2(passFDs[i], wantfd) < 0) {
 virReportSystemError(errno,
- _("Cannot duplicate fd %d onto fd %d"),
+ _("Cannot duplicate fd %1$d onto fd %2$d"),
  passFDs[i], wantfd);
 goto cleanup;
 }
@@ -532,7 +532,7 @@ static int lxcContainerUnmountSubtree(const char *prefix,
 /* This detaches the subtree */
 if (umount2(mounts[nmounts-1], MNT_DETACH) < 0) {
 virReportSystemError(saveErrno,
- _("Failed to unmount '%s' and could not 
detach subtree '%s'"),
+ _("Failed to unmount '%1$s' and could not 
detach subtree '%2$s'"),
  failedUmount, mounts[nmounts-1]);
 return -1;
 }
@@ -540,7 +540,7 @@ static int lxcContainerUnmountSubtree(const char *prefix,
 if (isOldRootFS &&
 umount(mounts[nmounts-1]) < 0) {
 virReportSystemError(saveErrno,
- _("Failed to unmount '%s' and could not 
unmount old root '%s'"),
+ _("Failed to unmount '%1$s' and could not 
unmount old root '%2$s'"),
  failedUmount, mounts[nmounts-1]);
 return -1;
 }
@@ -563,7 +563,7 @@ static int lxcContainerResolveSymlinks(virDomainFSDef *fs, 
bool gentle)
 return 0;
 } else {
 virReportSystemError(errno,
- _("Failed to access '%s'"), fs->src->path);
+ _("Failed to access '%1$s'"), fs->src->path);
 return -1;
 }
 }
@@ -575,7 +575,7 @@ static int lxcContainerResolveSymlinks(virDomainFSDef *fs, 
bool gentle)
 return 0;
 } else {
 virReportSystemError(errno,
- _("Failed to resolve symlink at %s"),
+ _("Failed to resolve symlink at %1$s"),
  fs->src->path);
 }
 return

[libvirt PATCH 15/51] interface: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/interface/interface_backend_netcf.c |  50 ++--
 src/interface/interface_backend_udev.c  | 100 
 2 files changed, 76 insertions(+), 74 deletions(-)

diff --git a/src/interface/interface_backend_netcf.c 
b/src/interface/interface_backend_netcf.c
index 7bd3e7e1e2..d4a11157cc 100644
--- a/src/interface/interface_backend_netcf.c
+++ b/src/interface/interface_backend_netcf.c
@@ -117,7 +117,7 @@ netcfStateInitialize(bool privileged,
 }
 
 if (g_mkdir_with_parents(driver->stateDir, S_IRWXU) < 0) {
-virReportSystemError(errno, _("cannot create state directory '%s'"),
+virReportSystemError(errno, _("cannot create state directory '%1$s'"),
  driver->stateDir);
 goto error;
 }
@@ -299,12 +299,12 @@ static struct netcf_if *interfaceDriverGetNetcfIF(struct 
netcf *ncf, virInterfac
 int errcode = ncf_error(ncf, , );
 if (errcode != NETCF_NOERROR) {
 virReportError(netcf_to_vir_err(errcode),
-   _("couldn't find interface named '%s': %s%s%s"),
+   _("couldn't find interface named '%1$s': 
%2$s%3$s%4$s"),
ifinfo->name, errmsg, details ? " - " : "",
NULLSTR_EMPTY(details));
 } else {
 virReportError(VIR_ERR_NO_INTERFACE,
-   _("couldn't find interface named '%s'"),
+   _("couldn't find interface named '%1$s'"),
ifinfo->name);
 }
 }
@@ -323,7 +323,7 @@ netcfInterfaceObjIsActive(struct netcf_if *iface,
 const char *errmsg, *details;
 int errcode = ncf_error(driver->netcf, , );
 virReportError(netcf_to_vir_err(errcode),
-   _("failed to get status of interface %s: %s%s%s"),
+   _("failed to get status of interface %1$s: 
%2$s%3$s%4$s"),
ncf_if_name(iface), errmsg, details ? " - " : "",
NULLSTR_EMPTY(details));
 goto cleanup;
@@ -355,7 +355,7 @@ static int netcfConnectNumOfInterfacesImpl(virConnectPtr 
conn,
 const char *errmsg, *details;
 int errcode = ncf_error(driver->netcf, , );
 virReportError(netcf_to_vir_err(errcode),
-   _("failed to get number of host interfaces: %s%s%s"),
+   _("failed to get number of host interfaces: 
%1$s%2$s%3$s"),
errmsg, details ? " - " : "",
NULLSTR_EMPTY(details));
 goto cleanup;
@@ -372,7 +372,7 @@ static int netcfConnectNumOfInterfacesImpl(virConnectPtr 
conn,
 const char *errmsg, *details;
 int errcode = ncf_error(driver->netcf, , );
 virReportError(netcf_to_vir_err(errcode),
-   _("failed to list host interfaces: %s%s%s"),
+   _("failed to list host interfaces: %1$s%2$s%3$s"),
errmsg, details ? " - " : "",
NULLSTR_EMPTY(details));
 goto cleanup;
@@ -388,7 +388,7 @@ static int netcfConnectNumOfInterfacesImpl(virConnectPtr 
conn,
 int errcode = ncf_error(driver->netcf, , );
 if (errcode != NETCF_NOERROR) {
 virReportError(netcf_to_vir_err(errcode),
-   _("couldn't find interface named '%s': %s%s%s"),
+   _("couldn't find interface named '%1$s': 
%2$s%3$s%4$s"),
names[i], errmsg,
details ? " - " : "", NULLSTR_EMPTY(details));
 goto cleanup;
@@ -441,7 +441,7 @@ static int netcfConnectListInterfacesImpl(virConnectPtr 
conn,
 const char *errmsg, *details;
 int errcode = ncf_error(driver->netcf, , );
 virReportError(netcf_to_vir_err(errcode),
-   _("failed to get number of host interfaces: %s%s%s"),
+   _("failed to get number of host interfaces: 
%1$s%2$s%3$s"),
errmsg, details ? " - " : "",
NULLSTR_EMPTY(details));
 goto cleanup;
@@ -458,7 +458,7 @@ static int netcfConnectListInterfacesImpl(virConnectPtr 
conn,
 const char *errmsg, *details;
 int errcode = ncf_error(driver->netcf, , );
 virReportError(netcf_to_vir_err(errcode),
-   _("failed to list host interfaces: %s%s%s"),
+   _("failed to list host interfaces: %1$s%2$s%3$s"),
errmsg, de

[libvirt PATCH 23/51] openvz: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/openvz/openvz_conf.c   | 29 +
 src/openvz/openvz_driver.c | 43 +++---
 2 files changed, 35 insertions(+), 37 deletions(-)

diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index c28d0e9f43..1331860a82 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -174,7 +174,7 @@ openvzReadNetworkConf(virDomainDef *def,
 ret = openvzReadVPSConfigParam(veid, "IP_ADDRESS", );
 if (ret < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not read 'IP_ADDRESS' from config for 
container %d"),
+   _("Could not read 'IP_ADDRESS' from config for 
container %1$d"),
veid);
 goto error;
 } else if (ret > 0) {
@@ -200,7 +200,7 @@ openvzReadNetworkConf(virDomainDef *def,
 ret = openvzReadVPSConfigParam(veid, "NETIF", );
 if (ret < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not read 'NETIF' from config for container 
%d"),
+   _("Could not read 'NETIF' from config for container 
%1$d"),
veid);
 goto error;
 } else if (ret > 0) {
@@ -283,7 +283,7 @@ openvzReadFSConf(virDomainDef *def,
 ret = openvzReadVPSConfigParam(veid, "OSTEMPLATE", );
 if (ret < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not read 'OSTEMPLATE' from config for 
container %d"),
+   _("Could not read 'OSTEMPLATE' from config for 
container %1$d"),
veid);
 goto error;
 } else if (ret > 0) {
@@ -297,7 +297,7 @@ openvzReadFSConf(virDomainDef *def,
 ret = openvzReadVPSConfigParam(veid, "VE_PRIVATE", );
 if (ret <= 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not read 'VE_PRIVATE' from config for 
container %d"),
+   _("Could not read 'VE_PRIVATE' from config for 
container %1$d"),
veid);
 goto error;
 }
@@ -319,7 +319,7 @@ openvzReadFSConf(virDomainDef *def,
 if (ret > 0) {
 if (openvzParseBarrierLimit(temp, , )) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not read '%s' from config for container 
%d"),
+   _("Could not read '%1$s' from config for container 
%2$d"),
param, veid);
 goto error;
 } else {
@@ -365,15 +365,15 @@ openvzReadMemConf(virDomainDef *def, int veid)
 ret = openvzReadVPSConfigParam(veid, param, );
 if (ret < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not read '%s' from config for container %d"),
+   _("Could not read '%1$s' from config for container 
%2$d"),
param, veid);
 goto error;
 } else if (ret > 0) {
 ret = openvzParseBarrierLimit(temp, , NULL);
 if (ret < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not parse barrier of '%s' "
- "from config for container %d"), param, veid);
+   _("Could not parse barrier of '%1$s' from config 
for container %2$d"),
+   param, veid);
 goto error;
 }
 if (barrier == LONG_MAX)
@@ -387,15 +387,15 @@ openvzReadMemConf(virDomainDef *def, int veid)
 ret = openvzReadVPSConfigParam(veid, param, );
 if (ret < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not read '%s' from config for container %d"),
+   _("Could not read '%1$s' from config for container 
%2$d"),
param, veid);
 goto error;
 } else if (ret > 0) {
 ret = openvzParseBarrierLimit(temp, , );
 if (ret < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not parse barrier and limit of '%s' "
- "from config for container %d"), param, veid);
+   _("Could not parse barrier and limit of '%1$s' from 
config for container %2$d"),
+   param, veid);
 goto error;
 }
 if (barrier == LONG_MAX)
@@ -490,7 +490,7 @@ int openvzLoadDomains(struct openvz_driver *driver)
 ret = openvzReadVPSConfigParam(veid, "CPUS", );
 if (ret < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not read con

[libvirt PATCH 13/51] hyperv: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/hyperv/hyperv_driver.c | 46 +++---
 src/hyperv/hyperv_network_driver.c |  4 +--
 src/hyperv/hyperv_util.c   |  3 +-
 src/hyperv/hyperv_wmi.c| 43 ++--
 4 files changed, 47 insertions(+), 49 deletions(-)

diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index 5c3c810ba5..414274fdfd 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -69,7 +69,7 @@ hypervGetProcessorsByName(hypervPrivate *priv, const char 
*name,
 
 if (!processorList) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not look up processor(s) on '%s'"),
+   _("Could not look up processor(s) on '%1$s'"),
name);
 return -1;
 }
@@ -155,7 +155,7 @@ hypervGetVirtualSystemByID(hypervPrivate *priv, int id,
 return -1;
 
 if (*computerSystemList == NULL) {
-virReportError(VIR_ERR_NO_DOMAIN, _("No domain with ID %d"), id);
+virReportError(VIR_ERR_NO_DOMAIN, _("No domain with ID %1$d"), id);
 return -1;
 }
 
@@ -179,7 +179,7 @@ hypervGetVirtualSystemByName(hypervPrivate *priv, const 
char *name,
 
 if (*computerSystemList == NULL) {
 virReportError(VIR_ERR_NO_DOMAIN,
-   _("No domain with name %s"), name);
+   _("No domain with name %1$s"), name);
 return -1;
 }
 
@@ -250,7 +250,7 @@ hypervLookupHostSystemBiosUuid(hypervPrivate *priv, 
unsigned char *uuid)
 
 if (virUUIDParse(computerSystem->data->UUID, uuid) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not parse UUID from string '%s'"),
+   _("Could not parse UUID from string '%1$s'"),
computerSystem->data->UUID);
 return -1;
 }
@@ -384,7 +384,7 @@ hypervGetDeviceParentRasdFromDeviceId(const char 
*parentDeviceId,
 return 0;
 
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Failed to locate parent device with ID '%s'"),
+   _("Failed to locate parent device with ID '%1$s'"),
parentDeviceId);
 
 return -1;
@@ -424,13 +424,13 @@ hypervDomainCreateSCSIController(virDomainPtr domain, 
virDomainControllerDef *de
 if (def->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DEFAULT &&
 def->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("Unsupported SCSI controller model '%d'"), 
def->model);
+   _("Unsupported SCSI controller model '%1$d'"), 
def->model);
 return -1;
 }
 
 if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("Unsupported SCSI controller address type '%d'"), 
def->info.type);
+   _("Unsupported SCSI controller address type '%1$d'"), 
def->info.type);
 return -1;
 }
 
@@ -1327,7 +1327,7 @@ hypervDomainDefParseVirtualExtent(hypervPrivate *priv,
 disk->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;
 } else {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Unrecognized controller type %d"),
+   _("Unrecognized controller type %1$d"),
controller->data->ResourceType);
 goto cleanup;
 }
@@ -1773,7 +1773,7 @@ hypervConnectOpen(virConnectPtr conn, virConnectAuthPtr 
auth,
 
 if (!os) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not get version information for host %s"),
+   _("Could not get version information for host %1$s"),
conn->uri->server);
 goto cleanup;
 }
@@ -1818,7 +1818,7 @@ hypervConnectGetVersion(virConnectPtr conn, unsigned long 
*version)
 
 if (hypervParseVersionString(priv->version, , , ) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not parse version from '%s'"),
+   _("Could not parse version from '%1$s'"),
priv->version);
 return -1;
 }
@@ -1842,7 +1842,7 @@ hypervConnectGetVersion(virConnectPtr conn, unsigned long 
*version)
  */
 if (major > 99 || minor > 99 || micro > 99) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not produce packed version number from '%s'"),
+   _("Could not produce packed version number from 
'%1$s'"),
priv->version);
 ret

[libvirt PATCH 11/51] cpu: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/cpu/cpu.c   | 40 +-
 src/cpu/cpu_arm.c   | 23 ---
 src/cpu/cpu_map.c   |  6 ++--
 src/cpu/cpu_ppc64.c | 33 ++
 src/cpu/cpu_s390.c  |  5 ++--
 src/cpu/cpu_x86.c   | 68 +
 6 files changed, 83 insertions(+), 92 deletions(-)

diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index 26f41272a7..bb5737e938 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -64,7 +64,7 @@ cpuGetSubDriver(virArch arch)
 }
 
 virReportError(VIR_ERR_NO_SUPPORT,
-   _("'%s' architecture is not supported by CPU driver"),
+   _("'%1$s' architecture is not supported by CPU driver"),
virArchToString(arch));
 return NULL;
 }
@@ -81,7 +81,7 @@ cpuGetSubDriverByName(const char *name)
 }
 
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("CPU driver '%s' does not exist"),
+   _("CPU driver '%1$s' does not exist"),
name);
 return NULL;
 }
@@ -156,7 +156,7 @@ virCPUCompare(virArch arch,
 
 if (!driver->compare) {
 virReportError(VIR_ERR_NO_SUPPORT,
-   _("cannot compare CPUs of %s architecture"),
+   _("cannot compare CPUs of %1$s architecture"),
virArchToString(arch));
 return VIR_CPU_COMPARE_ERROR;
 }
@@ -210,7 +210,7 @@ cpuDecode(virCPUDef *cpu,
 
 if (driver->decode == NULL) {
 virReportError(VIR_ERR_NO_SUPPORT,
-   _("cannot decode CPU data for %s architecture"),
+   _("cannot decode CPU data for %1$s architecture"),
virArchToString(cpu->arch));
 return -1;
 }
@@ -266,7 +266,7 @@ cpuEncode(virArch arch,
 
 if (driver->encode == NULL) {
 virReportError(VIR_ERR_NO_SUPPORT,
-   _("cannot encode CPU data for %s architecture"),
+   _("cannot encode CPU data for %1$s architecture"),
virArchToString(arch));
 return -1;
 }
@@ -417,7 +417,7 @@ virCPUGetHost(virArch arch,
 case VIR_CPU_TYPE_GUEST:
 if (nodeInfo) {
 virReportError(VIR_ERR_INVALID_ARG,
-   _("cannot set topology for CPU type '%s'"),
+   _("cannot set topology for CPU type '%1$s'"),
virCPUTypeToString(type));
 return NULL;
 }
@@ -427,7 +427,7 @@ virCPUGetHost(virArch arch,
 case VIR_CPU_TYPE_AUTO:
 case VIR_CPU_TYPE_LAST:
 virReportError(VIR_ERR_INVALID_ARG,
-   _("unsupported CPU type: %s"),
+   _("unsupported CPU type: %1$s"),
virCPUTypeToString(type));
 return NULL;
 }
@@ -450,7 +450,7 @@ virCPUGetHost(virArch arch,
   virArchToString(arch));
 } else {
 virReportError(VIR_ERR_NO_SUPPORT,
-   _("cannot detect host CPU model for %s architecture"),
+   _("cannot detect host CPU model for %1$s architecture"),
virArchToString(arch));
 return NULL;
 }
@@ -524,12 +524,12 @@ virCPUBaseline(virArch arch,
 for (i = 0; i < ncpus; i++) {
 if (!cpus[i]) {
 virReportError(VIR_ERR_INVALID_ARG,
-   _("invalid CPU definition at index %zu"), i);
+   _("invalid CPU definition at index %1$zu"), i);
 return NULL;
 }
 if (!cpus[i]->model) {
 virReportError(VIR_ERR_INVALID_ARG,
-   _("no CPU model specified at index %zu"), i);
+   _("no CPU model specified at index %1$zu"), i);
 return NULL;
 }
 }
@@ -542,7 +542,7 @@ virCPUBaseline(virArch arch,
 
 if (!driver->baseline) {
 virReportError(VIR_ERR_NO_SUPPORT,
-   _("cannot compute baseline CPU of %s architecture"),
+   _("cannot compute baseline CPU of %1$s architecture"),
virArchToString(arch));
 return NULL;
 }
@@ -614,7 +614,7 @@ virCPUUpdate(virArch arch,
 
 if (!driver->update) {
 virReportError(VIR_ERR_NO_SUPPORT,
-   _("cannot update guest CPU for %s architecture"),
+   _("cannot update guest CPU for %1$s architecture"),
virArchToString(arch));
 return -1;
 }
@@ -701,7 +701,7 @@ virCPUCheckFeature(virArch arch,
 
 if (!driver->checkFeature) {
 virReportError(VIR_ERR_N

[libvirt PATCH 14/51] hypervisor: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/hypervisor/domain_cgroup.c |  4 +--
 src/hypervisor/domain_driver.c | 20 ++---
 src/hypervisor/virhostdev.c| 53 ++
 3 files changed, 33 insertions(+), 44 deletions(-)

diff --git a/src/hypervisor/domain_cgroup.c b/src/hypervisor/domain_cgroup.c
index 7265325406..20ad96b11c 100644
--- a/src/hypervisor/domain_cgroup.c
+++ b/src/hypervisor/domain_cgroup.c
@@ -166,7 +166,7 @@ virDomainCgroupSetupDomainBlkioParameters(virCgroup *cgroup,
 }
 }
 } else {
-virReportError(VIR_ERR_INVALID_ARG, _("Unknown blkio parameter 
%s"),
+virReportError(VIR_ERR_INVALID_ARG, _("Unknown blkio parameter 
%1$s"),
param->field);
 ret = -1;
 virBlkioDeviceArrayClear(devices, ndevices);
@@ -370,7 +370,7 @@ virDomainCgroupInitCgroup(const char *prefix,
 
 if (!g_path_is_absolute(vm->def->resource->partition)) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("Resource partition '%s' must start with '/'"),
+   _("Resource partition '%1$s' must start with '/'"),
vm->def->resource->partition);
 return -1;
 }
diff --git a/src/hypervisor/domain_driver.c b/src/hypervisor/domain_driver.c
index d020b94921..66e09ffb04 100644
--- a/src/hypervisor/domain_driver.c
+++ b/src/hypervisor/domain_driver.c
@@ -151,7 +151,7 @@ virDomainDriverMergeBlkioDevice(virBlkioDevice **dest_array,
 } else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS)) {
 dest->wbps = src->wbps;
 } else {
-virReportError(VIR_ERR_INVALID_ARG, _("Unknown parameter 
%s"),
+virReportError(VIR_ERR_INVALID_ARG, _("Unknown parameter 
%1$s"),
type);
 return -1;
 }
@@ -256,7 +256,7 @@ virDomainDriverParseBlkioDeviceStr(char *blkioDeviceStr, 
const char *type,
 goto number_error;
 } else {
 virReportError(VIR_ERR_INVALID_ARG,
-   _("unknown parameter '%s'"), type);
+   _("unknown parameter '%1$s'"), type);
 goto cleanup;
 }
 
@@ -279,13 +279,13 @@ virDomainDriverParseBlkioDeviceStr(char *blkioDeviceStr, 
const char *type,
 
  parse_error:
 virReportError(VIR_ERR_INVALID_ARG,
-   _("unable to parse blkio device '%s' '%s'"),
+   _("unable to parse blkio device '%1$s' '%2$s'"),
type, blkioDeviceStr);
 goto cleanup;
 
  number_error:
 virReportError(VIR_ERR_INVALID_ARG,
-   _("invalid value '%s' for parameter '%s' of device '%s'"),
+   _("invalid value '%1$s' for parameter '%2$s' of device 
'%3$s'"),
temp, type, result[i].path);
 
  cleanup:
@@ -362,7 +362,7 @@ virDomainDriverNodeDeviceGetPCIInfo(virNodeDeviceDef *def,
 
 if (!cap) {
 virReportError(VIR_ERR_INVALID_ARG,
-   _("device %s is not a PCI device"), def->name);
+   _("device %1$s is not a PCI device"), def->name);
 return -1;
 }
 
@@ -525,7 +525,7 @@ virDomainDriverAddIOThreadCheck(virDomainDef *def,
 {
 if (virDomainIOThreadIDFind(def, iothread_id)) {
 virReportError(VIR_ERR_INVALID_ARG,
-   _("an IOThread is already using iothread_id '%u'"),
+   _("an IOThread is already using iothread_id '%1$u'"),
iothread_id);
 return -1;
 }
@@ -548,7 +548,7 @@ virDomainDriverDelIOThreadCheck(virDomainDef *def,
 
 if (!virDomainIOThreadIDFind(def, iothread_id)) {
 virReportError(VIR_ERR_INVALID_ARG,
-   _("cannot find IOThread '%u' in iothreadids list"),
+   _("cannot find IOThread '%1$u' in iothreadids list"),
iothread_id);
 return -1;
 }
@@ -556,8 +556,7 @@ virDomainDriverDelIOThreadCheck(virDomainDef *def,
 for (i = 0; i < def->ndisks; i++) {
 if (def->disks[i]->iothread == iothread_id) {
 virReportError(VIR_ERR_INVALID_ARG,
-   _("cannot remove IOThread %u since it "
- "is being used by disk '%s'"),
+   _("cannot remove IOThread %1$u since it is being 
used by disk '%2$s'"),
iothread_id, def->disks[i]->dst);
 return -1;
 }
@@ -566,8 +565,7 @@ virDomainDriverDelIOThreadCheck(virDomainDef *def,
 for (

[libvirt PATCH 12/51] esx: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/esx/esx_driver.c| 106 
 src/esx/esx_network_driver.c|  21 ++--
 src/esx/esx_storage_backend_iscsi.c |   6 +-
 src/esx/esx_storage_backend_vmfs.c  |  32 ++---
 src/esx/esx_storage_driver.c|   8 +-
 src/esx/esx_stream.c|   4 +-
 src/esx/esx_util.c  |  29 ++---
 src/esx/esx_vi.c| 189 ++--
 src/esx/esx_vi_types.c  |  48 ---
 9 files changed, 211 insertions(+), 232 deletions(-)

diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 9dc5489411..c86e1e7470 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -208,8 +208,8 @@ esxParseVMXFileName(const char *fileName,
 !(datastoreName = strtok_r(tmp, "/", ))||
 !(directoryAndFileName = strtok_r(NULL, "", ))) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("File name '%s' doesn't have expected format "
- "'/vmfs/volumes//'"), fileName);
+   _("File name '%1$s' doesn't have expected format 
'/vmfs/volumes//'"),
+   fileName);
 goto cleanup;
 }
 
@@ -226,7 +226,7 @@ esxParseVMXFileName(const char *fileName,
 ret = 0;
 } else {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("File name '%s' refers to non-existing 
datastore '%s'"),
+   _("File name '%1$s' refers to non-existing 
datastore '%2$s'"),
fileName, datastoreName);
 }
 goto cleanup;
@@ -243,7 +243,7 @@ esxParseVMXFileName(const char *fileName,
 
 if (!*out) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not handle file name '%s'"), fileName);
+   _("Could not handle file name '%1$s'"), fileName);
 goto cleanup;
 }
 
@@ -334,7 +334,7 @@ esxFormatVMXFileName(const char *fileName, void *opaque)
 tmpResult = g_strdup(fileName);
 } else {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not handle file name '%s'"), fileName);
+   _("Could not handle file name '%1$s'"), fileName);
 goto cleanup;
 }
 
@@ -381,7 +381,7 @@ esxAutodetectSCSIControllerModel(virDomainDiskDef *def, int 
*model,
 
 if (!vmDiskFileInfo || !vmDiskFileInfo->controllerType) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Could not lookup controller model for '%s'"), src);
+   _("Could not lookup controller model for '%1$s'"), src);
 goto cleanup;
 }
 
@@ -399,7 +399,7 @@ esxAutodetectSCSIControllerModel(virDomainDiskDef *def, int 
*model,
 *model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI;
 } else {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Found unexpected controller model '%s' for disk 
'%s'"),
+   _("Found unexpected controller model '%1$s' for disk 
'%2$s'"),
vmDiskFileInfo->controllerType, src);
 goto cleanup;
 }
@@ -462,10 +462,8 @@ esxSupportsLongMode(esxPrivate *priv)
 priv->supportsLongMode = esxVI_Boolean_False;
 } else {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Bit 29 (Long Mode) of HostSystem 
property "
- "'hardware.cpuFeature[].edx' with 
value '%s' "
- "has unexpected value '%c', expecting 
'0' "
- "or '1'"), hostCpuIdInfo->edx, 
edxLongModeBit);
+   _("Bit 29 (Long Mode) of HostSystem 
property 'hardware.cpuFeature[].edx' with value '%1$s' has unexpected value 
'%2$c', expecting '0' or '1'"),
+   hostCpuIdInfo->edx, edxLongModeBit);
 goto cleanup;
 }
 
@@ -637,7 +635,7 @@ esxConnectToHost(esxPrivate *priv,
 
 if (priv->host->productLine != expectedProductLine) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Expecting '%s' to be a %s host but found a %s host"),
+   _("Expecting '%1$s' to be a %2$s host but found a %3$s 
host"),
conn->uri->server,
esxVI_ProductLineToDisplayName(expectedProductLine),

esxVI_ProductLineToDisplayName(priv->host->productLine));
@@ -720,7 +718,7 @@ esxConnectToVCenter(es

[libvirt PATCH 17/51] locking: Update format strings in translated messages

2023-03-10 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/locking/lock_daemon.c  | 26 -
 src/locking/lock_daemon_dispatch.c | 10 ++--
 src/locking/lock_driver_lockd.c| 12 ++--
 src/locking/lock_driver_sanlock.c  | 94 +++---
 src/locking/lock_manager.c |  8 +--
 src/locking/sanlock_helper.c   |  6 +-
 6 files changed, 77 insertions(+), 79 deletions(-)

diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index 6b0a8220e5..ba52ce7d77 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -187,7 +187,7 @@ virLockDaemonNewServerPostExecRestart(virNetDaemon *dmn 
G_GNUC_UNUSED,
   dmn);
 } else {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Unexpected server name '%s' during restart"),
+   _("Unexpected server name '%1$s' during restart"),
name);
 return NULL;
 }
@@ -461,14 +461,14 @@ virLockDaemonClientNew(virNetServerClient *client,
 
 if (!privileged) {
 if (geteuid() != clientuid) {
-virReportRestrictedError(_("Disallowing client %llu with uid 
%llu"),
+virReportRestrictedError(_("Disallowing client %1$llu with uid 
%2$llu"),
  (unsigned long long)priv->clientPid,
  (unsigned long long)clientuid);
 goto error;
 }
 } else {
 if (clientuid != 0) {
-virReportRestrictedError(_("Disallowing client %llu with uid 
%llu"),
+virReportRestrictedError(_("Disallowing client %1$llu with uid 
%2$llu"),
  (unsigned long long)priv->clientPid,
  (unsigned long long)clientuid);
 goto error;
@@ -716,7 +716,7 @@ virLockDaemonPreExecRestart(const char *state_file,
 
 if (virFileWriteStr(state_file, state, 0700) < 0) {
 virReportSystemError(errno,
- _("Unable to save state file %s"), state_file);
+ _("Unable to save state file %1$s"), state_file);
 return -1;
 }
 
@@ -738,7 +738,7 @@ virLockDaemonUsage(const char *argv0, bool privileged)
 fprintf(stderr,
 _("\n"
   "Usage:\n"
-  "  %s [options]\n"
+  "  %1$s [options]\n"
   "\n"
   "Options:\n"
   "  -h | --helpDisplay program help:\n"
@@ -757,13 +757,13 @@ virLockDaemonUsage(const char *argv0, bool privileged)
   "  Default paths:\n"
   "\n"
   "Configuration file (unless overridden by -f):\n"
-  "  %s/libvirt/virtlockd.conf\n"
+  "  %1$s/libvirt/virtlockd.conf\n"
   "\n"
   "Sockets:\n"
-  "  %s/libvirt/virtlockd-sock\n"
+  "  %2$s/libvirt/virtlockd-sock\n"
   "\n"
   "PID file (unless overridden by -p):\n"
-  "  %s/virtlockd.pid\n"
+  "  %3$s/virtlockd.pid\n"
   "\n"),
 SYSCONFDIR,
 RUNSTATEDIR,
@@ -823,7 +823,7 @@ int main(int argc, char **argv) {
 
 if (virGettextInitialize() < 0 ||
 virErrorInitialize() < 0) {
-fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
+fprintf(stderr, _("%1$s: initialization failed\n"), argv[0]);
 exit(EXIT_FAILURE);
 }
 
@@ -903,7 +903,7 @@ int main(int argc, char **argv) {
 /* Read the config file if it exists */
 if (remote_config_file &&
 virLockDaemonConfigLoadFile(config, remote_config_file, implicit_conf) 
< 0) {
-VIR_ERROR(_("Can't load config file: %s: %s"),
+VIR_ERROR(_("Can't load config file: %1$s: %2$s"),
   virGetLastErrorMessage(), remote_config_file);
 exit(EXIT_FAILURE);
 }
@@ -963,7 +963,7 @@ int main(int argc, char **argv) {
 old_umask = umask(077);
 VIR_DEBUG("Ensuring run dir '%s' exists", run_dir);
 if (g_mkdir_with_parents(run_dir, 0777) < 0) {
-VIR_ERROR(_("unable to create rundir %s: %s"), run_dir,
+VIR_ERROR(_("unable to create rundir %1$s: %2$s"), run_dir,
   g_strerror(errno));
 ret = VIR_DAEMON_ERR_RUNDIR;
 umask(old_umask);
@@ -987,13 +987,13 @@ int main(int argc, char **argv) {
 
 if (godaemon) {
 if (chdir("/") < 0) 

  1   2   3   4   5   6   7   8   9   10   >