[PATCH] disk storage: fix allocation size for pool format dos

2020-08-28 Thread Sebastian Mitterle
The changed condition was always false because the function was always
called with boundary values 0.

Use the free extent's start value to get its start offset from the
cylinder boundary and determine if the needed size for allocation
needs to be expanded too in case the offset doesn't fit within extra
bytes for alignment.

This fixes an issue where vol-create-from will call qemu-img convert
to create a destination volume of same capacity as the source volume
and qemu-img will error 'Cannot grow device files' due to the partition
being too small for the source although both destination partition and
source volume have the same capacity.

Signed-off-by: Sebastian Mitterle 
---
 src/storage/storage_backend_disk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/storage/storage_backend_disk.c 
b/src/storage/storage_backend_disk.c
index a6d4e41220..ec0679d353 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -691,7 +691,7 @@ virStorageBackendDiskPartBoundaries(virStoragePoolObjPtr 
pool,
  if (def->source.format == VIR_STORAGE_POOL_DISK_DOS) {
  /* align to cylinder boundary */
  neededSize += extraBytes;
- if ((*start % cylinderSize) > extraBytes) {
+ if ((dev->freeExtents[i].start % cylinderSize) > extraBytes) {
  /* add an extra cylinder if the offset can't fit within
 the extra bytes we have */
  neededSize += cylinderSize;
-- 
2.25.2



[PATCH] tests/meson: fix mock library link on MacOS

2020-08-28 Thread Scott Shambarger
MacOS can not pre-load modules, so mock libraries must be built
as shared libraries (without asneeded striping, and undefined
symbols allowed).

Signed-off-by: Scott Shambarger 
---
 tests/meson.build | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/meson.build b/tests/meson.build
index b5f6e2267a..d7476452ba 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -120,9 +120,13 @@ if conf.has('WITH_SECDRIVER_SELINUX')
 endif
 
 foreach mock : mock_libs
-  shared_module(
+  shared_library(
 mock['name'],
 mock.get('sources', [ '@0@.c'.format(mock['name']) ]),
+override_options: [
+ 'b_asneeded=false',
+ 'b_lundef=false',
+],
 dependencies: [
   tests_dep,
   mock.get('deps', []),
-- 
2.24.3 (Apple Git-128)




Re: [PATCH] news: mention removal of autogenerated macvtap names from migration XML

2020-08-28 Thread Michal Privoznik

On 8/28/20 7:41 PM, Laine Stump wrote:

Signed-off-by: Laine Stump 
---
  NEWS.rst | 8 
  1 file changed, 8 insertions(+)




Reviewed-by: Michal Privoznik 

and safe for freeze.

Michal



[PATCH] news: mention removal of autogenerated macvtap names from migration XML

2020-08-28 Thread Laine Stump
Signed-off-by: Laine Stump 
---
 NEWS.rst | 8 
 1 file changed, 8 insertions(+)

diff --git a/NEWS.rst b/NEWS.rst
index 748ee3b1df..64c2b3f581 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -100,6 +100,14 @@ v6.7.0 (unreleased)
 implementation. But the implementation did not handle kernels without
 device-mapper support. This is now fixed.
 
+  * remove autogenerated macvtap names from migration XML
+
+Autogenerated macvtap device names were being left in the
+migration XML, which could result in libvirt erroneously deleting
+the macvtap device of a different guest in the aftermath of
+failing to restart the guest on the destination host. Removing the
+autogenerated names avoids this.
+
 
 v6.6.0 (2020-08-02)
 ===
-- 
2.26.2



Re: libvirt-6.7.0 release candidate 2

2020-08-28 Thread Laine Stump

On 8/28/20 12:36 PM, Ján Tomko wrote:

[off-list]

On a Friday in 2020, Jiri Denemark wrote:

I have just tagged v6.7.0-rc2 in the repository and pushed signed
tarballs and source RPMs to https://libvirt.org/sources/



Does it seem to work in your limited testing?



You need to stop living in pre-July 2020. This is *post* July 2020.



Re: Please revert f4be03b3 (libvirtaio: Drop object(*args, **kwargs)) for theoretical reasons

2020-08-28 Thread Philipp Hahn
Hello,

Am 20.08.20 um 11:20 schrieb Daniel P. Berrangé:
> On Wed, Aug 19, 2020 at 11:32:10PM +0200, Wojtek Porczyk wrote:
>> Hi Philipp,
>> (Cc: Daniel, because IIUC you reviewed !16 which got this merged),
>>
>> I'm sorry I didn't notice this earlier, but the commit f4be03b3 dated
>> 2020-04-20 [0] is wrong. The super().__init__(*args, **kwargs) in
>> Callback.__init__ was there on purpose, because of how Python's inheritance 
>> in
>> new-style classes works.
>>
>> Let me explain this a bit, because it is not obvious.
...
Thank you for that excellent explanation - I learned something new.
Sorry for the noise.

>> I don't think this breaks anything (I very much doubt anyone would need to
>> write code that would trigger this), nevertheless, as the commit is both
>> pointless and wrong, and as the original author of libvirtaio I'd like to ask
>> for this commit to be reverted. If this breaks some static analysis tool,
>> could you just suppress it for this particular line?

I've reverted my change and instead added a `  # type: ignore` comment
to silence mypy.

> Could you open a merge request providing the revert along with your
> description of why the change was wrong and I'll review & approve it.

Done: 

Sorry for the delay, but I was on vaccation and my first week back at
work was quiet busy. Have a nice weekend.

Philipp

PS: I will continue with the next chunk of changed for type annotations
when !19 is merged.




Re: libvirt-6.7.0 release candidate 2

2020-08-28 Thread Ján Tomko

[off-list]

On a Friday in 2020, Jiri Denemark wrote:

I have just tagged v6.7.0-rc2 in the repository and pushed signed
tarballs and source RPMs to https://libvirt.org/sources/



Does it seem to work in your limited testing?

Jano


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



signature.asc
Description: PGP signature


libvirt-6.7.0 release candidate 2

2020-08-28 Thread Jiri Denemark
I have just tagged v6.7.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: [PATCH] meson: Only check for openwsman if hyperv is enabled

2020-08-28 Thread Jim Fehlig

On 8/28/20 8:48 AM, Michal Privoznik wrote:

On 8/28/20 4:19 PM, Jim Fehlig wrote:

On 8/28/20 8:02 AM, Peter Krempa wrote:

On Fri, Aug 28, 2020 at 07:52:23 -0600, Jim Fehlig wrote:

On 8/28/20 2:00 AM, Pavel Hrdina wrote:

On Thu, Aug 27, 2020 at 03:58:29PM -0600, Jim Fehlig wrote:

Running meson configure with '-Ddriver_hyperv=disabled' fails with

    meson.build:1252:0: ERROR: Dependency "openwsman" not found, tried
    pkgconfig and cmake

openwsman is only required if the hyperv driver is enabled. Don't
check for it if hyperv is disabled.

Signed-off-by: Jim Fehlig 
---

There are likely other ways to fix the problem, this being a meson
noobish one :-).


You are probably using some other options as well because running:

  meson build -Ddriver_hyperv=disabled

will not fail if openwsman is missing. The default for openwsman is
'auto'.


I stumbled across it while doing downstream packaging work on 6.7.0. hyperv
is the only thing that requires openwsman and I have it disabled. Here's the
full meson invocation from the build log

/usr/bin/meson --buildtype=plain --prefix=/usr --libdir=/usr/lib64
--libexecdir=/usr/libexec --bindir=/usr/bin --sbindir=/usr/sbin
--includedir=/usr/include --datadir=/usr/share --mandir=/usr/share/man
--infodir=/usr/share/info --localedir=/usr/share/locale --sysconfdir=/etc
--localstatedir=/var --sharedstatedir=/var/lib --wrap-mode=nodownload
--auto-features=enabled . build --libexecdir=/usr/lib64/libvirt


You've specified '--auto-features=enabled', so anything 'auto' is
considered enabled in your build situation.


Facepalm! Thanks for pointing out the obvious. I see that comes from %meson 
macro in /usr/lib/rpm/macros.d/macros.meson.


Also, meson warns that -Dnetcontrol=enabled doesn't exist.


It's a message from an older log where I had the downstream netcontrol patch 
commented but not the meson define.


BTW, what is the value in having an option for something like openwsman? Isn't 
hyperv enough? If hyperv is enabled, then simply error if openwsman is not found.


Regards,
Jim




Re: [PATCH] meson: Only check for openwsman if hyperv is enabled

2020-08-28 Thread Michal Privoznik

On 8/28/20 4:19 PM, Jim Fehlig wrote:

On 8/28/20 8:02 AM, Peter Krempa wrote:

On Fri, Aug 28, 2020 at 07:52:23 -0600, Jim Fehlig wrote:

On 8/28/20 2:00 AM, Pavel Hrdina wrote:

On Thu, Aug 27, 2020 at 03:58:29PM -0600, Jim Fehlig wrote:

Running meson configure with '-Ddriver_hyperv=disabled' fails with

    meson.build:1252:0: ERROR: Dependency "openwsman" not found, tried
    pkgconfig and cmake

openwsman is only required if the hyperv driver is enabled. Don't
check for it if hyperv is disabled.

Signed-off-by: Jim Fehlig 
---

There are likely other ways to fix the problem, this being a meson
noobish one :-).


You are probably using some other options as well because running:

  meson build -Ddriver_hyperv=disabled

will not fail if openwsman is missing. The default for openwsman is
'auto'.


I stumbled across it while doing downstream packaging work on 6.7.0. 
hyperv
is the only thing that requires openwsman and I have it disabled. 
Here's the

full meson invocation from the build log

/usr/bin/meson --buildtype=plain --prefix=/usr --libdir=/usr/lib64
--libexecdir=/usr/libexec --bindir=/usr/bin --sbindir=/usr/sbin
--includedir=/usr/include --datadir=/usr/share --mandir=/usr/share/man
--infodir=/usr/share/info --localedir=/usr/share/locale 
--sysconfdir=/etc

--localstatedir=/var --sharedstatedir=/var/lib --wrap-mode=nodownload
--auto-features=enabled . build --libexecdir=/usr/lib64/libvirt


You've specified '--auto-features=enabled', so anything 'auto' is
considered enabled in your build situation.


Facepalm! Thanks for pointing out the obvious. I see that comes from 
%meson macro in /usr/lib/rpm/macros.d/macros.meson.


Also, meson warns that -Dnetcontrol=enabled doesn't exist.

Michal



Re: [PATCH] meson: Only check for openwsman if hyperv is enabled

2020-08-28 Thread Jim Fehlig

On 8/28/20 8:02 AM, Peter Krempa wrote:

On Fri, Aug 28, 2020 at 07:52:23 -0600, Jim Fehlig wrote:

On 8/28/20 2:00 AM, Pavel Hrdina wrote:

On Thu, Aug 27, 2020 at 03:58:29PM -0600, Jim Fehlig wrote:

Running meson configure with '-Ddriver_hyperv=disabled' fails with

meson.build:1252:0: ERROR: Dependency "openwsman" not found, tried
pkgconfig and cmake

openwsman is only required if the hyperv driver is enabled. Don't
check for it if hyperv is disabled.

Signed-off-by: Jim Fehlig 
---

There are likely other ways to fix the problem, this being a meson
noobish one :-).


You are probably using some other options as well because running:

  meson build -Ddriver_hyperv=disabled

will not fail if openwsman is missing. The default for openwsman is
'auto'.


I stumbled across it while doing downstream packaging work on 6.7.0. hyperv
is the only thing that requires openwsman and I have it disabled. Here's the
full meson invocation from the build log

/usr/bin/meson --buildtype=plain --prefix=/usr --libdir=/usr/lib64
--libexecdir=/usr/libexec --bindir=/usr/bin --sbindir=/usr/sbin
--includedir=/usr/include --datadir=/usr/share --mandir=/usr/share/man
--infodir=/usr/share/info --localedir=/usr/share/locale --sysconfdir=/etc
--localstatedir=/var --sharedstatedir=/var/lib --wrap-mode=nodownload
--auto-features=enabled . build --libexecdir=/usr/lib64/libvirt


You've specified '--auto-features=enabled', so anything 'auto' is
considered enabled in your build situation.


Facepalm! Thanks for pointing out the obvious. I see that comes from %meson 
macro in /usr/lib/rpm/macros.d/macros.meson.


Regards,
Jim



[PATCH v2 3/7] qemu: Add transient disk handler to start and stop the guest

2020-08-28 Thread Masayoshi Mizuma
From: Masayoshi Mizuma 

The transient disk is attached before the guest starts.
Remove the transient disk when the guest does shutdown.

Signed-off-by: Masayoshi Mizuma 
---
 src/qemu/qemu_process.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 126fabf5ef..5753258135 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -60,6 +60,7 @@
 #include "qemu_firmware.h"
 #include "qemu_backup.h"
 #include "qemu_dbus.h"
+#include "qemu_snapshot.h"
 
 #include "cpu/cpu.h"
 #include "cpu/cpu_x86.h"
@@ -7000,6 +7001,10 @@ qemuProcessLaunch(virConnectPtr conn,
 qemuProcessAutoDestroyAdd(driver, vm, conn) < 0)
 goto cleanup;
 
+VIR_DEBUG("Setting up transient disk");
+if (qemuTransientCreatetDisk(driver, vm, asyncJob) < 0)
+goto cleanup;
+
 ret = 0;
 
  cleanup:
@@ -7636,6 +7641,9 @@ void qemuProcessStop(virQEMUDriverPtr driver,
 }
 
 qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->src);
+
+if (disk->transient)
+qemuTransientRemoveDisk(disk);
 }
 }
 
-- 
2.27.0



[PATCH v2 4/7] qemu: Transient option gets avaiable for qcow2 and raw format disk

2020-08-28 Thread Masayoshi Mizuma
From: Masayoshi Mizuma 

Signed-off-by: Masayoshi Mizuma 
---
 src/qemu/qemu_validate.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 488f258d00..82818a4fdc 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -2166,9 +2166,12 @@ qemuValidateDomainDeviceDefDiskFrontend(const 
virDomainDiskDef *disk,
 }
 
 if (disk->transient) {
-virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-   _("transient disks not supported yet"));
-return -1;
+if ((disk->src->format != VIR_STORAGE_FILE_QCOW2) &&
+(disk->src->format != VIR_STORAGE_FILE_RAW)) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+   _("transient disks not supported yet"));
+return -1;
+}
 }
 
 if (disk->iomode == VIR_DOMAIN_DISK_IO_NATIVE &&
-- 
2.27.0



[PATCH v2 6/7] qemu: Block disk hotplug when transient disk option is enabled

2020-08-28 Thread Masayoshi Mizuma
From: Masayoshi Mizuma 

Block disk hotplug when transient disk option is enabled so far.

Signed-off-by: Masayoshi Mizuma 
---
 src/qemu/qemu_hotplug.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 2c6c30ce03..1c1b6c3acf 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1031,6 +1031,12 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriverPtr 
driver,
 return -1;
 }
 
+if (disk->transient) {
+virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+   _("transient disk hotplug isn't supported"));
+return -1;
+}
+
 if (virDomainDiskTranslateSourcePool(disk) < 0)
 goto cleanup;
 
-- 
2.27.0



[PATCH v2 7/7] qemu: Block blockjobs when transient disk option is enabled

2020-08-28 Thread Masayoshi Mizuma
From: Masayoshi Mizuma 

Block blockjobs when transient disk option is enabled so far.

Signed-off-by: Masayoshi Mizuma 
---
 src/qemu/qemu_domain.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index e28f704dba..98a52e5476 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -10678,6 +10678,13 @@ qemuDomainDiskBlockJobIsSupported(virDomainObjPtr vm,
 return false;
 }
 
+if (disk->transient) {
+virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
+   _("block jobs are not supported on transient disk 
'%s'"),
+   disk->dst);
+return false;
+}
+
 return true;
 }
 
-- 
2.27.0



[PATCH v2 5/7] qemu: Block migration when transient disk option is enabled

2020-08-28 Thread Masayoshi Mizuma
From: Masayoshi Mizuma 

Block migration when transient disk option is enabled because migration
requires some blockjobs.

Signed-off-by: Masayoshi Mizuma 
---
 src/qemu/qemu_migration.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 0f2f92b211..6fcf5a3a07 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2949,6 +2949,22 @@ qemuMigrationDstPrepareDirect(virQEMUDriverPtr driver,
 }
 
 
+static bool
+qemuMigrationTransientDiskExists(virDomainDefPtr def)
+{
+size_t i;
+
+for (i = 0; i < def->ndisks; i++) {
+   virDomainDiskDefPtr disk = def->disks[i];
+
+   if (disk->transient)
+return true;
+}
+
+return false;
+}
+
+
 virDomainDefPtr
 qemuMigrationAnyPrepareDef(virQEMUDriverPtr driver,
virQEMUCapsPtr qemuCaps,
@@ -2971,6 +2987,12 @@ qemuMigrationAnyPrepareDef(virQEMUDriverPtr driver,
 VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)))
 goto cleanup;
 
+/*
+ * transient disk option is a blocker for migration
+ */
+if (qemuMigrationTransientDiskExists(def))
+   goto cleanup;
+
 if (dname) {
 name = def->name;
 def->name = g_strdup(dname);
-- 
2.27.0



[PATCH v2 1/7] qemuSnapshotDiskPrepareOne: Get available even if snapdisk is NULL

2020-08-28 Thread Masayoshi Mizuma
From: Masayoshi Mizuma 

Get available even if snapdisk argument is NULL at qemuSnapshotDiskPrepareOne()
so that the caller can setup dd->src.

Signed-off-by: Masayoshi Mizuma 
---
 src/qemu/qemu_snapshot.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 1e8ea80b22..d310e6ff02 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -953,8 +953,9 @@ qemuSnapshotDiskPrepareOne(virQEMUDriverPtr driver,
 if (qemuDomainStorageSourceValidateDepth(disk->src, 1, disk->dst) < 0)
 return -1;
 
-if (!(dd->src = virStorageSourceCopy(snapdisk->src, false)))
-return -1;
+if (snapdisk)
+if (!(dd->src = virStorageSourceCopy(snapdisk->src, false)))
+return -1;
 
 if (virStorageSourceInitChainElement(dd->src, dd->disk->src, false) < 0)
 return -1;
-- 
2.27.0



[PATCH v2 2/7] qemu: Introduce functions to handle transient disk

2020-08-28 Thread Masayoshi Mizuma
From: Masayoshi Mizuma 

Here is the implementation of transient option for qcow2 and raw format
disk. This gets available  directive in domain xml file
like as:


  
  
  
  


When the qemu command line options are built, a new qcow2 image is
created with backing qcow2 by using blockdev-snapshot command.
The backing image is the qcow2 file which is set as .
The filename of the new qcow2 image is original-source-file.TRANSIENT.

Signed-off-by: Masayoshi Mizuma 
---
 src/qemu/qemu_snapshot.c  | 134 ++
 src/qemu/qemu_snapshot.h  |   8 +++
 src/util/virstoragefile.h |   2 +
 3 files changed, 144 insertions(+)

diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index d310e6ff02..5c61d19f26 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -2265,3 +2265,137 @@ qemuSnapshotDelete(virDomainObjPtr vm,
  cleanup:
 return ret;
 }
+
+static int
+qemuTransientDiskPrepareOne(virQEMUDriverPtr driver,
+virDomainObjPtr vm,
+qemuSnapshotDiskDataPtr data,
+virHashTablePtr blockNamedNodeData,
+int asyncJob,
+virJSONValuePtr actions)
+{
+int rc = -1;
+virStorageSourcePtr dest;
+virStorageSourcePtr src = data->disk->src;
+qemuDomainObjPrivatePtr priv = vm->privateData;
+g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(priv->driver);
+
+if (!strlen(src->path))
+return rc;
+
+if (!(dest = virStorageSourceNew()))
+return rc;
+
+dest->path = g_strdup_printf("%s.TRANSIENT", src->path);
+
+if (virFileExists(dest->path)) {
+virReportError(VIR_ERR_INVALID_ARG,
+   _("Transient disk '%s' for '%s' exists"),
+   dest->path, src->path);
+goto cleanup;
+}
+
+dest->type = VIR_STORAGE_TYPE_FILE;
+dest->format = VIR_STORAGE_FILE_QCOW2;
+data->src = dest;
+
+if (qemuSnapshotDiskPrepareOne(driver, vm, cfg, data->disk,
+ NULL, data, blockNamedNodeData,
+ false, true, asyncJob, actions) < 0)
+goto cleanup;
+
+rc = 0;
+ cleanup:
+if (rc < 0)
+g_free(dest->path);
+
+return rc;
+}
+
+static int
+qemuWaitTransaction(virQEMUDriverPtr driver,
+virDomainObjPtr vm,
+int asyncJob,
+virJSONValuePtr *actions)
+{
+qemuDomainObjPrivatePtr priv = vm->privateData;
+
+if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
+return -1;
+
+if (qemuMonitorTransaction(priv->mon, actions) < 0)
+return -1;
+
+if (qemuDomainObjExitMonitor(driver, vm) < 0)
+return -1;
+
+return 0;
+}
+
+int
+qemuTransientCreatetDisk(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ int asyncJob)
+{
+size_t i;
+int rc = -1;
+size_t ndata = 0;
+qemuSnapshotDiskDataPtr data = NULL;
+g_autoptr(virJSONValue) actions = NULL;
+qemuDomainObjPrivatePtr priv = vm->privateData;
+g_autoptr(virHashTable) blockNamedNodeData = NULL;
+bool blockdev =  virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
+
+if (!blockdev)
+return rc;
+
+if (VIR_ALLOC_N(data, vm->def->ndisks) < 0)
+return rc;
+
+if (!(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, asyncJob)))
+goto cleanup;
+
+if (!(actions = virJSONValueNewArray()))
+goto cleanup;
+
+for (i = 0; i < vm->def->ndisks; i++) {
+virDomainDiskDefPtr disk = vm->def->disks[i];
+
+if (disk->src->readonly)
+continue;
+
+if (disk->transient) {
+data[ndata].disk = disk;
+if (qemuTransientDiskPrepareOne(driver, vm, &data[ndata], 
blockNamedNodeData,
+ asyncJob, actions) < 0)
+goto cleanup;
+ndata++;
+}
+}
+
+if (qemuWaitTransaction(driver, vm, asyncJob, &actions) < 0)
+goto cleanup;
+
+for (i = 0; i < ndata; i++) {
+qemuSnapshotDiskDataPtr dd = &data[i];
+
+qemuSnapshotDiskUpdateSource(driver, vm, dd, blockdev);
+dd->disk->src->transientEstablished = true;
+}
+
+VIR_FREE(data);
+rc = 0;
+ cleanup:
+qemuSnapshotDiskCleanup(data, vm->def->ndisks, driver, vm, asyncJob);
+
+return rc;
+}
+
+void
+qemuTransientRemoveDisk(virDomainDiskDefPtr disk)
+{
+if (disk->src->transientEstablished) {
+VIR_DEBUG("unlink transient disk: %s", disk->src->path);
+unlink(disk->src->path);
+}
+}
diff --git a/src/qemu/qemu_snapshot.h b/src/qemu/qemu_snapshot.h
index 8b3ebe87b1..aecb1762d2 100644
--- a/src/qemu/qemu_snapshot.h
+++ b/src/qemu/qemu_snapshot.h
@@ -53,3 +53,11 @@ int
 qemuSnapshotDelete(virDomainObjPtr vm,
virDoma

[PATCH v2 0/7] qemu: implementation of transient disk option

2020-08-28 Thread Masayoshi Mizuma
This patchset tries to implement transient option for qcow2 and raw
format disk. This uses the snapshot cleanup codes:
https://www.redhat.com/archives/libvir-list/2020-August/msg00299.html

It gets user available to set  to the domain xml file like as:


  
  
  
  


Any changes which the Guest does to the disk is dropped when the Guest
is shutdowned.

There are some limitations for transient disk option so far:

- Supported disk format is qcow2 and raw
- blockdev capability is required for qemu
- Following features are blocked with transient disk option
  - blockjobs 
  - Migration
  - Disk hotplug

Masayoshi Mizuma (7):
  qemuSnapshotDiskPrepareOne: Get available even if snapdisk is NULL
  qemu: Introduce functions to handle transient disk
  qemu: Add transient disk handler to start and stop the guest
  qemu: Transient option gets avaiable for qcow2 and raw format disk
  qemu: Block blockjobs when transient disk option is enabled
  qemu: Block migration when transient disk option is enabled
  qemu: Block disk hotplug when transient disk option is enabled

 src/qemu/qemu_domain.c|   7 ++
 src/qemu/qemu_hotplug.c   |   6 ++
 src/qemu/qemu_migration.c |  22 ++
 src/qemu/qemu_process.c   |   8 +++
 src/qemu/qemu_snapshot.c  | 139 +-
 src/qemu/qemu_snapshot.h  |   8 +++
 src/qemu/qemu_validate.c  |   9 ++-
 src/util/virstoragefile.h |   2 +
 8 files changed, 196 insertions(+), 5 deletions(-)

-- 
2.27.0



Re: device compatibility interface for live migration with assigned devices

2020-08-28 Thread Sean Mooney
On Fri, 2020-08-28 at 15:47 +0200, Cornelia Huck wrote:
> On Wed, 26 Aug 2020 14:41:17 +0800
> Yan Zhao  wrote:
> 
> > previously, we want to regard the two mdevs created with dsa-1dwq x 30 and
> > dsa-2dwq x 15 as compatible, because the two mdevs consist equal resources.
> > 
> > But, as it's a burden to upper layer, we agree that if this condition
> > happens, we still treat the two as incompatible.
> > 
> > To fix it, either the driver should expose dsa-1dwq only, or the target
> > dsa-2dwq needs to be destroyed and reallocated via dsa-1dwq x 30.
> 
> AFAIU, these are mdev types, aren't they? So, basically, any management
> software needs to take care to use the matching mdev type on the target
> system for device creation?

or just do the simple thing of use the same mdev type on the source and dest.
matching mdevtypes is not nessiarly trivial. we could do that but we woudl have
to do that in python rather then sql so it would be slower to do at least today.

we dont currently have the ablity to say the resouce provider must have 1 of 
these
set of traits. just that we must have a specific trait. this is a feature we 
have
disucssed a couple of times and delayed untill we really really need it but its 
not out
of the question that we could add it for this usecase. i suspect however we 
would do exact
match first and explore this later after the inital mdev migration works.

by the way i was looking at some vdpa reslated matiail today and noticed vdpa 
devices are nolonger
usign mdevs and and now use a vhost chardev so i guess we will need a 
completely seperate mechanioum
for vdpa vs mdev migration as a result. that is rather unfortunet but i guess 
that is life.
> 



Re: [PATCH] meson: Only check for openwsman if hyperv is enabled

2020-08-28 Thread Peter Krempa
On Fri, Aug 28, 2020 at 07:52:23 -0600, Jim Fehlig wrote:
> On 8/28/20 2:00 AM, Pavel Hrdina wrote:
> > On Thu, Aug 27, 2020 at 03:58:29PM -0600, Jim Fehlig wrote:
> > > Running meson configure with '-Ddriver_hyperv=disabled' fails with
> > > 
> > >meson.build:1252:0: ERROR: Dependency "openwsman" not found, tried
> > >pkgconfig and cmake
> > > 
> > > openwsman is only required if the hyperv driver is enabled. Don't
> > > check for it if hyperv is disabled.
> > > 
> > > Signed-off-by: Jim Fehlig 
> > > ---
> > > 
> > > There are likely other ways to fix the problem, this being a meson
> > > noobish one :-).
> > 
> > You are probably using some other options as well because running:
> > 
> >  meson build -Ddriver_hyperv=disabled
> > 
> > will not fail if openwsman is missing. The default for openwsman is
> > 'auto'.
> 
> I stumbled across it while doing downstream packaging work on 6.7.0. hyperv
> is the only thing that requires openwsman and I have it disabled. Here's the
> full meson invocation from the build log
> 
> /usr/bin/meson --buildtype=plain --prefix=/usr --libdir=/usr/lib64
> --libexecdir=/usr/libexec --bindir=/usr/bin --sbindir=/usr/sbin
> --includedir=/usr/include --datadir=/usr/share --mandir=/usr/share/man
> --infodir=/usr/share/info --localedir=/usr/share/locale --sysconfdir=/etc
> --localstatedir=/var --sharedstatedir=/var/lib --wrap-mode=nodownload
> --auto-features=enabled . build --libexecdir=/usr/lib64/libvirt

You've specified '--auto-features=enabled', so anything 'auto' is
considered enabled in your build situation.



Re: [PATCH] meson: Only check for openwsman if hyperv is enabled

2020-08-28 Thread Jim Fehlig

On 8/28/20 2:00 AM, Pavel Hrdina wrote:

On Thu, Aug 27, 2020 at 03:58:29PM -0600, Jim Fehlig wrote:

Running meson configure with '-Ddriver_hyperv=disabled' fails with

   meson.build:1252:0: ERROR: Dependency "openwsman" not found, tried
   pkgconfig and cmake

openwsman is only required if the hyperv driver is enabled. Don't
check for it if hyperv is disabled.

Signed-off-by: Jim Fehlig 
---

There are likely other ways to fix the problem, this being a meson
noobish one :-).


You are probably using some other options as well because running:

 meson build -Ddriver_hyperv=disabled

will not fail if openwsman is missing. The default for openwsman is
'auto'.


I stumbled across it while doing downstream packaging work on 6.7.0. hyperv is 
the only thing that requires openwsman and I have it disabled. Here's the full 
meson invocation from the build log


/usr/bin/meson --buildtype=plain --prefix=/usr --libdir=/usr/lib64 
--libexecdir=/usr/libexec --bindir=/usr/bin --sbindir=/usr/sbin 
--includedir=/usr/include --datadir=/usr/share --mandir=/usr/share/man 
--infodir=/usr/share/info --localedir=/usr/share/locale --sysconfdir=/etc 
--localstatedir=/var --sharedstatedir=/var/lib --wrap-mode=nodownload 
--auto-features=enabled . build --libexecdir=/usr/lib64/libvirt 
-Drunstatedir=/run -Ddriver_qemu=enabled -Ddriver_openvz=enabled 
-Ddriver_lxc=enabled -Ddriver_vbox=disabled -Ddriver_libxl=enabled 
-Dsasl=enabled -Dpolkit=enabled -Ddriver_libvirtd=enabled -Ddriver_esx=enabled 
-Ddriver_hyperv=disabled -Ddriver_vmware=enabled -Ddriver_vz=disabled 
-Ddriver_bhyve=disabled -Dremote_default_mode=legacy -Ddriver_interface=enabled 
-Ddriver_network=enabled -Dstorage_fs=enabled -Dstorage_lvm=enabled 
-Dstorage_iscsi=enabled -Dstorage_scsi=enabled -Dstorage_disk=enabled 
-Dstorage_mpath=enabled -Dstorage_rbd=enabled -Dstorage_sheepdog=disabled 
-Dstorage_gluster=enabled -Dstorage_iscsi_direct=enabled -Dstorage_zfs=disabled 
-Dstorage_vstorage=disabled -Dnumactl=enabled -Dnumad=enabled -Dcapng=enabled 
-Dfuse=enabled -Dnetcf=disabled -Dnetcontrol=enabled -Dselinux=enabled 
-Dselinux_mount=/selinux -Dapparmor=enabled -Dapparmor_profiles=true 
-Dhal=disabled -Dudev=enabled -Dyajl=enabled -Dsanlock=enabled -Dlibpcap=enabled 
-Dmacvtap=enabled -Daudit=enabled -Ddtrace=enabled -Dfirewalld=enabled 
-Dfirewalld_zone=enabled -Dwireshark_dissector=enabled -Dnss=enabled 
-Dqemu_user=qemu -Dqemu_group=qemu -Dlogin_shell=disabled -Dinit_script=systemd


...

meson.build:1258:0: ERROR: Dependency "openwsman" not found, tried pkgconfig and 
cmake


Regards,
Jim



Re: device compatibility interface for live migration with assigned devices

2020-08-28 Thread Cornelia Huck
On Wed, 26 Aug 2020 14:41:17 +0800
Yan Zhao  wrote:

> previously, we want to regard the two mdevs created with dsa-1dwq x 30 and
> dsa-2dwq x 15 as compatible, because the two mdevs consist equal resources.
> 
> But, as it's a burden to upper layer, we agree that if this condition
> happens, we still treat the two as incompatible.
> 
> To fix it, either the driver should expose dsa-1dwq only, or the target
> dsa-2dwq needs to be destroyed and reallocated via dsa-1dwq x 30.

AFAIU, these are mdev types, aren't they? So, basically, any management
software needs to take care to use the matching mdev type on the target
system for device creation?



Re: [libvirt PATCH] docs: Remove extraneous plus signs from virsh man page

2020-08-28 Thread Michal Privoznik

On 8/28/20 2:58 PM, Martin Kletzander wrote:

Signed-off-by: Martin Kletzander 
---
  docs/manpages/virsh.rst | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 0482fe8b26f2..8e2fb7039046 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -3206,10 +3206,10 @@ 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
  the migration of the domain. Usage requires proper TLS setup for both source
  and target. Normally the TLS certificate from the destination host must match
-+the host's name for TLS verification to succeed. When the certificate does not
-+match the destination hostname and the expected certificate's hostname is
-+known, *--tls-destination* can be used to pass the expected *hostname* when
-+starting the migration.
+the host's name for TLS verification to succeed. When the certificate does not
+match the destination hostname and the expected certificate's hostname is
+known, *--tls-destination* can be used to pass the expected *hostname* when
+starting the migration.
  
  
  *--parallel* option will cause migration data to be sent over multiple




Reviewed-by: Michal Privoznik 

and safe for freeze.

Michal



[libvirt PATCH] docs: Remove extraneous plus signs from virsh man page

2020-08-28 Thread Martin Kletzander
Signed-off-by: Martin Kletzander 
---
 docs/manpages/virsh.rst | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 0482fe8b26f2..8e2fb7039046 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -3206,10 +3206,10 @@ 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
 the migration of the domain. Usage requires proper TLS setup for both source
 and target. Normally the TLS certificate from the destination host must match
-+the host's name for TLS verification to succeed. When the certificate does not
-+match the destination hostname and the expected certificate's hostname is
-+known, *--tls-destination* can be used to pass the expected *hostname* when
-+starting the migration.
+the host's name for TLS verification to succeed. When the certificate does not
+match the destination hostname and the expected certificate's hostname is
+known, *--tls-destination* can be used to pass the expected *hostname* when
+starting the migration.
 
 
 *--parallel* option will cause migration data to be sent over multiple
-- 
2.28.0



Re: [PATCH for 6.7.0] NEWS: Document improvements/bug fixes for upcoming release

2020-08-28 Thread Andrea Bolognani
On Fri, 2020-08-28 at 13:45 +0200, Michal Privoznik wrote:
>  * **Improvements**
>  
> +  * Libvirt switch to Meson build system
> +
> +Libvirt abandoned autotools and switched to Meson build system.

This should be in the "Packaging changes" section that we use from
time to time specifically for these scenarios.

> +  * resctrl: Use exclusive lock for /sys/fs/resctrl
> +
> +When two or more domains were attempted to start at once, due to a bug in
> +implementation, resctrl was not locked properly and thus threads did not
> +mutually exclude with each other resulting in not setting requested
> +limitations as requested.

s/ as requested//

With the above addressed,

  Reviewed-by: Andrea Bolognani 

and safe for freeze. Thanks for taking care of this!

-- 
Andrea Bolognani / Red Hat / Virtualization



Re: [PATCH for 6.7.0] NEWS: Document improvements/bug fixes for upcoming release

2020-08-28 Thread Neal Gompa
On Fri, Aug 28, 2020 at 7:45 AM Michal Privoznik  wrote:
>
> Signed-off-by: Michal Privoznik 
> ---
>  NEWS.rst | 34 ++
>  1 file changed, 34 insertions(+)
>
> diff --git a/NEWS.rst b/NEWS.rst
> index 852746eb2a..4ed4e45590 100644
> --- a/NEWS.rst
> +++ b/NEWS.rst
> @@ -33,6 +33,10 @@ v6.7.0 (unreleased)
>
>  * **Improvements**
>
> +  * Libvirt switch to Meson build system
> +
> +Libvirt abandoned autotools and switched to Meson build system.
> +
>* Allow sparse streams for block devices
>
>  Sparse streams (e.g. ``virsh vol-download --sparse`` or ``virsh 
> vol-upload
> @@ -58,6 +62,36 @@ v6.7.0 (unreleased)
>  either don't have device mapper enabled or where the dm-mod module is not
>  loaded yet. This is now fixed.
>
> +  * resctrl: Use exclusive lock for /sys/fs/resctrl
> +
> +When two or more domains were attempted to start at once, due to a bug in
> +implementation, resctrl was not locked properly and thus threads did not
> +mutually exclude with each other resulting in not setting requested
> +limitations as requested.
> +
> +  * mdev: Fix daemon crash when reattaching mdevs on assignment conflict
> +
> +If there's a list of mdevs to be assigned to a domain, but one of them 
> (NOT
> +the first) is already assigned to a different domain then libvirtd would
> +crash. This is now fixed.
> +
> +  * Fix logic in setting COW flag on btrfs
> +
> +When COW is not explicitly requested to be disabled or enabled, then
> +libvirt should do nothing on non-BTRFS file systems.
> +
> +  * Avoid crash due to race in glib event loop code
> +
> +Libvirt switched to glib event loop in 6.1.0 but it was also tickling a 
> bug
> +in glib code leading to the daemon crash. Libvirt way of calling glib was
> +changed so the daemon crashes no more.
> +
> +  * virdevmapper: Handle kernel without device-mapper support
> +
> +In the previous release, Libvirt dropped libdevmapper in favor of its own
> +implementation. But the implementation did not handle kernels without
> +device-mapper support. This is now fixed.
> +
>
>  v6.6.0 (2020-08-02)
>  ===
> --
> 2.26.2
>

Reviewed-by: Neal Gompa 


-- 
真実はいつも一つ!/ Always, there's only one truth!




[PATCH for 6.7.0] NEWS: Document improvements/bug fixes for upcoming release

2020-08-28 Thread Michal Privoznik
Signed-off-by: Michal Privoznik 
---
 NEWS.rst | 34 ++
 1 file changed, 34 insertions(+)

diff --git a/NEWS.rst b/NEWS.rst
index 852746eb2a..4ed4e45590 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -33,6 +33,10 @@ v6.7.0 (unreleased)
 
 * **Improvements**
 
+  * Libvirt switch to Meson build system
+
+Libvirt abandoned autotools and switched to Meson build system.
+
   * Allow sparse streams for block devices
 
 Sparse streams (e.g. ``virsh vol-download --sparse`` or ``virsh vol-upload
@@ -58,6 +62,36 @@ v6.7.0 (unreleased)
 either don't have device mapper enabled or where the dm-mod module is not
 loaded yet. This is now fixed.
 
+  * resctrl: Use exclusive lock for /sys/fs/resctrl
+
+When two or more domains were attempted to start at once, due to a bug in
+implementation, resctrl was not locked properly and thus threads did not
+mutually exclude with each other resulting in not setting requested
+limitations as requested.
+
+  * mdev: Fix daemon crash when reattaching mdevs on assignment conflict
+
+If there's a list of mdevs to be assigned to a domain, but one of them (NOT
+the first) is already assigned to a different domain then libvirtd would
+crash. This is now fixed.
+
+  * Fix logic in setting COW flag on btrfs
+
+When COW is not explicitly requested to be disabled or enabled, then
+libvirt should do nothing on non-BTRFS file systems.
+
+  * Avoid crash due to race in glib event loop code
+
+Libvirt switched to glib event loop in 6.1.0 but it was also tickling a bug
+in glib code leading to the daemon crash. Libvirt way of calling glib was
+changed so the daemon crashes no more.
+
+  * virdevmapper: Handle kernel without device-mapper support
+
+In the previous release, Libvirt dropped libdevmapper in favor of its own
+implementation. But the implementation did not handle kernels without
+device-mapper support. This is now fixed.
+
 
 v6.6.0 (2020-08-02)
 ===
-- 
2.26.2



Re: [PATCH] news: Document the `role` attribute for shmem device

2020-08-28 Thread Michal Privoznik

On 8/21/20 10:53 AM, Wang Xin wrote:

Signed-off-by: Wang Xin 

diff --git a/NEWS.rst b/NEWS.rst
index 0669051ee6..be7274a184 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -13,6 +13,12 @@ v6.7.0 (unreleased)
  
  * **New features**
  
+  * shmem: Add support for shmem-{plain, doorbell} ``role`` option

+
+The ``role`` attribute controls how the domain behaves on migration. With
+``role=master``, the guest will copy the shared memory on migration to
+the destination host. With ``role=peer``, the migration is disabled.
+
  * **Improvements**
  
  * **Bug fixes**




Reviewed-by: Michal Privoznik 

and pushed.

Michal



Re: [PATCH] news: mention bhyve sound support

2020-08-28 Thread Michal Privoznik

On 8/27/20 4:08 PM, Roman Bogorodskiy wrote:

Signed-off-by: Roman Bogorodskiy 
---
  NEWS.rst | 5 +
  1 file changed, 5 insertions(+)

diff --git a/NEWS.rst b/NEWS.rst
index 2d30d5a5e8..9ded7731f8 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -25,6 +25,11 @@ v6.7.0 (unreleased)
  the ``device_model_args`` setting in xl.cfg(5). The libvirt xen driver now
  supports this using  XML extensions.
  
+  * bhyve: Sound device support

+
+This feature allows to configure guest sound device using
+the  element, and map it to the host sound device using
+the  element.
  
  * **Improvements**
  



Reviewed-by: Michal Privoznik 

and safe for freeze.

Michal



Re: [libvirt PATCH 0/8] Use https:// more

2020-08-28 Thread Neal Gompa
On Thu, Aug 27, 2020 at 9:28 AM Ján Tomko  wrote:
>
> Ján Tomko (8):
>   docs: tlscerts: fix link to certtool invocation
>   tools: wireshark: fix link to wireshark repo
>   build-aux: vc-list-files: remove non-git support
>   vbox: do not repeat the innotek namespace url
>   Prefer https: for Wikipedia links
>   Prefer https: for Red Hat websites
>   Prefer https: for libguestfs.org links
>   Prefer https: everywhere where possible
>
>  build-aux/vc-list-files | 24 ---
>  docs/acl.html.in|  2 +-
>  docs/aclpolkit.html.in  |  2 +-
>  docs/advanced-tests.rst |  4 +-
>  docs/api.html.in|  4 +-
>  docs/apps.html.in   | 26 
>  docs/best-practices.rst |  2 +-
>  docs/bindings.html.in   |  4 +-
>  docs/bugs.html.in   |  6 +-
>  docs/coding-style.rst   |  2 +-
>  docs/contact.html.in|  2 +-
>  docs/contribute.html.in |  4 +-
>  docs/csharp.html.in |  2 +-
>  docs/docs.html.in   |  4 +-
>  docs/downloads.html.in  |  2 +-
>  docs/drvbhyve.html.in   | 10 +--
>  docs/drvesx.html.in | 20 +++---
>  docs/drvlxc.html.in |  2 +-
>  docs/drvnodedev.html.in |  2 +-
>  docs/drvopenvz.html.in  |  4 +-
>  docs/drvvbox.html.in|  2 +-
>  docs/drvvmware.html.in  |  8 +--
>  docs/firewall.html.in   |  2 +-
>  docs/formatdomain.rst   | 18 +++---
>  docs/formatstorage.html.in  |  2 +-
>  docs/index.html.in  |  4 +-
>  docs/internals/rpc.html.in  |  2 +-
>  docs/java.html.in   |  2 +-
>  docs/kbase/secureusage.rst  |  2 +-
>  docs/logging.html.in|  2 +-
>  docs/logos/README   |  2 +-
>  docs/manpages/virsh.rst |  2 +-
>  docs/nss.html.in|  2 +-
>  docs/page.xsl   |  4 +-
>  docs/pci-hotplug.html.in|  2 +-
>  docs/php.html.in|  2 +-
>  docs/remote.html.in |  8 +--
>  docs/securityprocess.html.in|  2 +-
>  docs/storage.html.in|  2 +-
>  docs/testsuites.html.in |  4 +-
>  docs/testtck.html.in|  4 +-
>  docs/tlscerts.html.in   |  6 +-
>  docs/uri.html.in|  2 +-
>  docs/virshcmdref.html.in|  2 +-
>  docs/windows.html.in|  6 +-
>  meson.build |  2 +-
>  run.in  |  2 +-
>  src/conf/virchrdev.c|  2 +-
>  src/esx/README  | 18 +++---
>  src/esx/esx_driver.c|  6 +-
>  src/hyperv/hyperv_wmi_generator.input   |  2 +-
>  src/internal.h  |  2 +-
>  src/libxl/libxl_conf.c  |  2 +-
>  src/lxc/lxc_container.c |  2 +-
>  src/qemu/qemu_domain.c  |  2 +-
>  src/remote/remote_driver.c  |  2 +-
>  src/rpc/virnetclient.c  |  2 +-
>  src/rpc/virnetdaemon.c  |  2 +-
>  src/rpc/virnetlibsshsession.c   |  2 +-
>  src/storage/storage_backend_gluster.c   |  6 +-
>  src/storage/storage_util.c  |  2 +-
>  src/util/virarch.h  | 72 ++---
>  src/util/virhashcode.c  |  2 +-
>  src/util/virhashcode.h  |  2 +-
>  src/util/virprocess.c   |  2 +-
>  src/util/virsysinfo.c   |  2 +-
>  src/util/virutil.c  |  2 +-
>  src/vbox/vbox_snapshot_conf.c   | 12 ++--
>  src/vmx/vmx.c   |  6 +-
>  tests/cputestdata/cpu-gather.sh |  2 +-
>  tools/wireshark/README.rst  |  2 +-
>  tools/wireshark/samples/libvirt-sample.pdml |  2 +-
>  tools/wireshark/util/genxdrstub.pl  |  2 +-
>  73 files changed, 182 insertions(+), 204 deletions(-)
>
> --
> 2.26.2
>

Reviewed-by: Neal Gompa 


-- 
真実はいつも一つ!/ Always, there's only one truth!




[PATCH] util: Add phys_port_name support on virPCIGetNetName

2020-08-28 Thread Dmytro Linkin
Current virPCIGetNetName() logic is to get net device name by checking
it's phys_port_id, if caller provide it, or by it's index (eg, by it's
position at sysfs net directory). This approach worked fine up until
linux kernel version 5.8, where NVIDIA Mellanox driver implemented
linking of VFs' representors to PCI device in switchdev mode. This mean
that device's sysfs net directory will hold multiple net devices. Ex.:

$ ls '/sys/bus/pci/devices/:82:00.0/net'
ens1f0  eth0  eth1

Most switch devices support phys_port_name instead of phys_port_id, so
virPCIGetNetName() will try to get PF name by it's index - 0. The
problem here is that the PF nedev entry may not be the first.

To fix that, for switch devices, we introduce a new logic to select the
PF uplink netdev according to the content of phys_port_name. Extend
virPCIGetNetName() with physPortNameRegex variable to get proper device
by it's phys_port_name scheme, for ex., "p[0-9]+$" to get PF,
"pf[0-9]+vf[0-9]+$" to get VF or "p1$" to get exact net device. So now
virPCIGetNetName() logic work in following sequence:
 - filter by phys_port_id, if it's provided,
 or
 - filter by phys_port_name, if it's regex provided,
 or
 - get net device by it's index (position) in sysfs net directory.
Also, make getting content of iface sysfs files more generic.

Signed-off-by: Dmytro Linkin 
Reviewed-by: Adrian Chiris 
---
 src/hypervisor/virhostdev.c |  2 +-
 src/util/virnetdev.c| 74 -
 src/util/virnetdev.h|  4 +++
 src/util/virpci.c   | 63 --
 src/util/virpci.h   |  6 
 5 files changed, 130 insertions(+), 19 deletions(-)

diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c
index 69102b8..1f5c347 100644
--- a/src/hypervisor/virhostdev.c
+++ b/src/hypervisor/virhostdev.c
@@ -333,7 +333,7 @@ virHostdevNetDevice(virDomainHostdevDefPtr hostdev,
  * type='hostdev'>, and it is only those devices that should
  * end up calling this function.
  */
-if (virPCIGetNetName(sysfs_path, 0, NULL, linkdev) < 0)
+if (virPCIGetNetName(sysfs_path, 0, NULL, NULL, linkdev) < 0)
 return -1;
 
 if (!(*linkdev)) {
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index b42fa86..99e3b35 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -1112,6 +1112,29 @@ virNetDevGetPCIDevice(const char *devName)
 }
 
 
+/* A wrapper to get content of file from ifname SYSFS_NET_DIR
+ */
+static int
+virNetDevGetSysfsFileValue(const char *ifname,
+   const char *fileName,
+   char **sysfsFileData)
+{
+g_autofree char *sysfsFile = NULL;
+
+*sysfsFileData = NULL;
+
+if (virNetDevSysfsFile(&sysfsFile, ifname, fileName) < 0)
+return -1;
+
+/* a failure to read just means the driver doesn't support
+ * , so set success now and ignore the return from
+ * virFileReadAllQuiet().
+ */
+
+ignore_value(virFileReadAllQuiet(sysfsFile, 1024, sysfsFileData));
+return 0;
+}
+
 /**
  * virNetDevGetPhysPortID:
  *
@@ -1130,20 +1153,29 @@ int
 virNetDevGetPhysPortID(const char *ifname,
char **physPortID)
 {
-g_autofree char *physPortIDFile = NULL;
-
-*physPortID = NULL;
-
-if (virNetDevSysfsFile(&physPortIDFile, ifname, "phys_port_id") < 0)
-return -1;
+return virNetDevGetSysfsFileValue(ifname, "phys_port_id", physPortID);
+}
 
-/* a failure to read just means the driver doesn't support
- * phys_port_id, so set success now and ignore the return from
- * virFileReadAllQuiet().
- */
 
-ignore_value(virFileReadAllQuiet(physPortIDFile, 1024, physPortID));
-return 0;
+/**
+ * virNetDevGetPhysPortName:
+ *
+ * @ifname: name of a netdev
+ *
+ * @physPortName: pointer to char* that will receive @ifname's
+ *phys_port_name from sysfs (null terminated
+ *string). Could be NULL if @ifname's net driver doesn't
+ *support phys_port_name (most netdev drivers
+ *don't). Caller is responsible for freeing the string
+ *when finished.
+ *
+ * Returns 0 on success or -1 on failure.
+ */
+int
+virNetDevGetPhysPortName(const char *ifname,
+ char **physPortName)
+{
+return virNetDevGetSysfsFileValue(ifname, "phys_port_name", physPortName);
 }
 
 
@@ -1200,7 +1232,7 @@ virNetDevGetVirtualFunctions(const char *pfname,
 }
 
 if (virPCIGetNetName(pci_sysfs_device_link, 0,
- pfPhysPortID, &((*vfname)[i])) < 0) {
+ pfPhysPortID, NULL, &((*vfname)[i])) < 0) {
 goto cleanup;
 }
 
@@ -1295,7 +1327,8 @@ virNetDevGetPhysicalFunction(const char *ifname, char 
**pfname)
 return -1;
 
 if (virPCIGetNetName(physfn_sysfs_path, 0,
- vfPhysPortID, pfname) < 0) {

Re: [libvirt PATCH 8/8] Prefer https: everywhere where possible

2020-08-28 Thread Ján Tomko

On a Friday in 2020, Erik Skultety wrote:

On Thu, Aug 27, 2020 at 03:27:05PM +0200, Ján Tomko wrote:

Use https: links for websites that support them.

The URIs which are used as namespace identifiers
are left alone.

Signed-off-by: Ján Tomko 
---
 60 files changed, 116 insertions(+), 116 deletions(-)





sflow.net in docs/apps/html.in is also served over https


Strange, I had it in the list of sites that only support HTTP


scripts.sil.org/OFL in docs/fonts/LICENSE.rst is also served over https



I specifically did not want to alter the license text (same with
numerous occurrences of http://www.gnu.org/licenses/)

Jano


Erik



signature.asc
Description: PGP signature


Re: [libvirt PATCH 3/8] build-aux: vc-list-files: remove non-git support

2020-08-28 Thread Daniel P . Berrangé
On Fri, Aug 28, 2020 at 08:34:48AM +0200, Erik Skultety wrote:
> On Thu, Aug 27, 2020 at 03:27:00PM +0200, Ján Tomko wrote:
> > Delete support for other VCSs than git.
> >
> > This also removes a http: link.
> >
> > Signed-off-by: Ján Tomko 
> > ---
> >  build-aux/vc-list-files | 24 
> >  1 file changed, 24 deletions(-)
> >
> > diff --git a/build-aux/vc-list-files b/build-aux/vc-list-files
> > index af6b1c0f8a..31014d3b7a 100755
> > --- a/build-aux/vc-list-files
> > +++ b/build-aux/vc-list-files
> > @@ -25,7 +25,6 @@ scriptversion=2018-03-07.03; # UTC
> >  # list the version-controlled files in that directory.
> >
> >  # If there's an argument, it must be a single, "."-relative directory name.
> > -# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
> >
> >  postprocess=
> >  case $1 in
> > @@ -75,29 +74,6 @@ do
> >  # belong to this package.
> >  eval exec git ls-tree -r 'HEAD:"$dir"' \
> >\| sed -n '"s/^100[^ ]*./$sed_esc/p"' $postprocess
> > -  elif test -d .hg; then
> > -eval exec hg locate '"$dir/*"' $postprocess
> > -  elif test -d .bzr; then
> > -test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
> > -eval exec bzr ls -R --versioned '"$dir"' $postprocess
> > -  elif test -d CVS; then
> > -test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
> > -if test -x build-aux/cvsu; then
> > -  eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess
> > -elif (cvsu --help) >/dev/null 2>&1; then
> > -  eval cvsu --find --types=AFGM '"$dir"' $postprocess
> > -else
> > -  eval awk -F/ \''{\
> > -  if (!$1 && $3 !~ /^-/) { \
> > -f=FILENAME;\
> > -if (f ~ /CVS\/Entries$/)   \
> > -  f = substr(f, 1, length(f)-11); \
> > -print f $2;\
> > -  }}'\''   \
> > -`find "$dir" -name Entries -print` /dev/null' $postprocess
> > -fi
> > -  elif test -d .svn; then
> > -eval exec svn list -R '"$dir"' $postprocess
> >else
> >  echo "$0: Failed to determine type of version control used in `pwd`" 
> > 1>&2
> >  exit 1
> 
> I'm wondering whether we could not simplify this even more after this rewrite
> and drop the top level if-else checks since this is only used within
> syntax-check and we're now assuming git anyway, so .git must be present
> otherwise the repo is corrupt.

With all the other VCS removed there's little compelling reason for this
file to exist. I'd suggest we just delete the file entirely, and call
git ls-tree directly from the syntax-check.mk.

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [PATCH] meson: Only check for openwsman if hyperv is enabled

2020-08-28 Thread Pavel Hrdina
On Thu, Aug 27, 2020 at 03:58:29PM -0600, Jim Fehlig wrote:
> Running meson configure with '-Ddriver_hyperv=disabled' fails with
> 
>   meson.build:1252:0: ERROR: Dependency "openwsman" not found, tried
>   pkgconfig and cmake
> 
> openwsman is only required if the hyperv driver is enabled. Don't
> check for it if hyperv is disabled.
> 
> Signed-off-by: Jim Fehlig 
> ---
> 
> There are likely other ways to fix the problem, this being a meson
> noobish one :-).

You are probably using some other options as well because running:

meson build -Ddriver_hyperv=disabled

will not fail if openwsman is missing. The default for openwsman is
'auto'.

Pavel


signature.asc
Description: PGP signature