[PATCH v2 for 6.5.0] domain_conf: Remove zPCI validation from formatter

Michal Privoznik posted 1 patch 3 years, 10 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/455ff2c22c6c4d5d5fb33de038822c34e7da2af4.1593428140.git.mprivozn@redhat.com
src/conf/domain_conf.c | 4 ----
1 file changed, 4 deletions(-)
[PATCH v2 for 6.5.0] domain_conf: Remove zPCI validation from formatter
Posted by Michal Privoznik 3 years, 10 months ago
In 076591009ad a validation code was added to
virDomainDeviceInfoFormat() which reports an error if zPCI
address entered in was incomplete. But, there are two problems
with this approach.

The first problem is the placement of the code - it doesn't
belong into XML formatter rather than XML validator.

The second one is that at the point of formatting XML the post
parse callback has run and thus filled in required info.
Therefore this check can never do something useful and instead of
moving it into validator, it's removed completely.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---

This is v2 of:

https://www.redhat.com/archives/libvir-list/2020-June/msg01279.html

diff to v1:
- Instead of moving the check to validator remove it completely (per
  discussion in v1)

 src/conf/domain_conf.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 33f177b16f..0c883cd834 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7523,10 +7523,6 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
         }
 
         if (virZPCIDeviceAddressIsPresent(&info->addr.pci.zpci)) {
-            if (virZPCIDeviceAddressIsIncomplete(&info->addr.pci.zpci))
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("Missing uid or fid attribute of zPCI address"));
-
             virBufferAsprintf(&childBuf,
                               "<zpci uid='0x%.4x' fid='0x%.8x'/>\n",
                               info->addr.pci.zpci.uid.value,
-- 
2.26.2

Re: [PATCH v2 for 6.5.0] domain_conf: Remove zPCI validation from formatter
Posted by Andrea Bolognani 3 years, 10 months ago
On Mon, 2020-06-29 at 12:57 +0200, Michal Privoznik wrote:
> In 076591009ad a validation code was added to
> virDomainDeviceInfoFormat() which reports an error if zPCI
> address entered in was incomplete. But, there are two problems
> with this approach.
> 
> The first problem is the placement of the code - it doesn't
> belong into XML formatter rather than XML validator.
> 
> The second one is that at the point of formatting XML the post
> parse callback has run and thus filled in required info.
> Therefore this check can never do something useful and instead of
> moving it into validator, it's removed completely.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
> 
> This is v2 of:
> 
> https://www.redhat.com/archives/libvir-list/2020-June/msg01279.html
> 
> diff to v1:
> - Instead of moving the check to validator remove it completely (per
>   discussion in v1)
> 
>  src/conf/domain_conf.c | 4 ----
>  1 file changed, 4 deletions(-)

Thanks!

  Reviewed-by: Andrea Bolognani <abologna@redhat.com>

and safe for freeze.

-- 
Andrea Bolognani / Red Hat / Virtualization