[PATCH] virDomainDiskTranslateSourcePool: Check for disk type correctly

Michal Privoznik posted 1 patch 4 years, 1 month ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/ef24ef57ad67557c6def1f25056a10c2ef5c61ac.1583769052.git.mprivozn@redhat.com
src/conf/domain_conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] virDomainDiskTranslateSourcePool: Check for disk type correctly
Posted by Michal Privoznik 4 years, 1 month ago
When rewriting the virDomainDiskTranslateSourcePool() function in
v6.1.0-rc1~184 a typo was introduced. Previously, we allowed
startup policy only for those volumes which translated to
VIR_STORAGE_TYPE_FILE. But starting with the referenced commit,
the value we checked for was changed to VIR_STORAGE_VOL_FILE
which comes from a different enum and has a different value too.
This is wrong, because virStorageSourceGetActualType() returns a
value from the original enum.

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

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/conf/domain_conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d8471acd2d..d2d97daf80 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -31856,7 +31856,7 @@ virDomainDiskTranslateSourcePool(virDomainDiskDefPtr def)
     }
 
     if (def->startupPolicy != 0 &&
-        virStorageSourceGetActualType(def->src) != VIR_STORAGE_VOL_FILE) {
+        virStorageSourceGetActualType(def->src) != VIR_STORAGE_TYPE_FILE) {
         virReportError(VIR_ERR_XML_ERROR, "%s",
                        _("'startupPolicy' is only valid for "
                          "'file' type volume"));
-- 
2.24.1

Re: [PATCH] virDomainDiskTranslateSourcePool: Check for disk type correctly
Posted by Peter Krempa 4 years, 1 month ago
On Mon, Mar 09, 2020 at 16:50:52 +0100, Michal Privoznik wrote:
> When rewriting the virDomainDiskTranslateSourcePool() function in
> v6.1.0-rc1~184 a typo was introduced. Previously, we allowed
> startup policy only for those volumes which translated to
> VIR_STORAGE_TYPE_FILE. But starting with the referenced commit,
> the value we checked for was changed to VIR_STORAGE_VOL_FILE
> which comes from a different enum and has a different value too.
> This is wrong, because virStorageSourceGetActualType() returns a
> value from the original enum.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1811728
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>

Oops.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>