[PATCH] qemu_domain: Modify access to a NVMe disk iff needed

Michal Privoznik posted 1 patch 1 week ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/06212c93c77502086c0ca15a862db67d4a72afb8.1581686654.git.mprivozn@redhat.com
src/qemu/qemu_domain.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

[PATCH] qemu_domain: Modify access to a NVMe disk iff needed

Posted by Michal Privoznik 1 week ago
If a domain has a NVMe disk it already has the access configured.
Trying to configure it again on a commit or some other operation
is wrong and condemned to failure.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_domain.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 72f03c3a35..b0e90f818d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11676,13 +11676,13 @@ qemuDomainStorageSourceAccessModify(virQEMUDriverPtr driver,
 
     revoke_lockspace = true;
 
-    if (qemuDomainStorageSourceAccessModifyNVMe(driver, vm, src, false) < 0)
-        goto revoke;
-
-    revoke_nvme = true;
-
     /* When modifying access of existing @src namespace does not need update */
     if (!(flags & QEMU_DOMAIN_STORAGE_SOURCE_ACCESS_MODIFY_ACCESS)) {
+        if (qemuDomainStorageSourceAccessModifyNVMe(driver, vm, src, false) < 0)
+            goto revoke;
+
+        revoke_nvme = true;
+
         if (qemuDomainNamespaceSetupDisk(vm, src) < 0)
             goto revoke;
 
-- 
2.24.1

Re: [PATCH] qemu_domain: Modify access to a NVMe disk iff needed

Posted by Ján Tomko 1 week ago
On Fri, Feb 14, 2020 at 02:25:15PM +0100, Michal Privoznik wrote:
>If a domain has a NVMe disk it already has the access configured.
>Trying to configure it again on a commit or some other operation
>is wrong and condemned to failure.
>
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
> src/qemu/qemu_domain.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
>diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
>index 72f03c3a35..b0e90f818d 100644
>--- a/src/qemu/qemu_domain.c
>+++ b/src/qemu/qemu_domain.c
>@@ -11676,13 +11676,13 @@ qemuDomainStorageSourceAccessModify(virQEMUDriverPtr driver,
>
>     revoke_lockspace = true;
>
>-    if (qemuDomainStorageSourceAccessModifyNVMe(driver, vm, src, false) < 0)
>-        goto revoke;
>-
>-    revoke_nvme = true;
>-

>     /* When modifying access of existing @src namespace does not need update */

This renders the above comment incomplete. I suggest deleting it :)

>     if (!(flags & QEMU_DOMAIN_STORAGE_SOURCE_ACCESS_MODIFY_ACCESS)) {
>+        if (qemuDomainStorageSourceAccessModifyNVMe(driver, vm, src, false) < 0)
>+            goto revoke;
>+
>+        revoke_nvme = true;
>+
>         if (qemuDomainNamespaceSetupDisk(vm, src) < 0)
>             goto revoke;
>
>-- 

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano