[libvirt] [PATCH 03/10] qemu: fail if virQEMUCapsProbeQMPSEVCapabilities fails

Ján Tomko posted 10 patches 7 years, 8 months ago
[libvirt] [PATCH 03/10] qemu: fail if virQEMUCapsProbeQMPSEVCapabilities fails
Posted by Ján Tomko 7 years, 8 months ago
Do not mask the errors.

If we'd expect query-sev-capabilities to fail, we should not
call it in the first place.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 src/qemu/qemu_capabilities.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 7a245a58bc..35d46c465d 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4105,7 +4105,7 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
     /* Probe for SEV capabilities */
     if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST)) {
         if (virQEMUCapsProbeQMPSEVCapabilities(qemuCaps, mon) < 0)
-            virQEMUCapsClear(qemuCaps, QEMU_CAPS_SEV_GUEST);
+            goto cleanup;
     }
 
     ret = 0;
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 03/10] qemu: fail if virQEMUCapsProbeQMPSEVCapabilities fails
Posted by Daniel P. Berrangé 7 years, 7 months ago
On Tue, Jun 12, 2018 at 02:00:17PM +0200, Ján Tomko wrote:
> Do not mask the errors.
> 
> If we'd expect query-sev-capabilities to fail, we should not
> call it in the first place.
> 
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
>  src/qemu/qemu_capabilities.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 7a245a58bc..35d46c465d 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -4105,7 +4105,7 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
>      /* Probe for SEV capabilities */
>      if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST)) {
>          if (virQEMUCapsProbeQMPSEVCapabilities(qemuCaps, mon) < 0)
> -            virQEMUCapsClear(qemuCaps, QEMU_CAPS_SEV_GUEST);
> +            goto cleanup;
>      }
>  
>      ret = 0;

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


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 :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 03/10] qemu: fail if virQEMUCapsProbeQMPSEVCapabilities fails
Posted by Ján Tomko 7 years, 7 months ago
On Wed, Jun 13, 2018 at 02:15:53PM +0100, Daniel P. Berrangé wrote:
>On Tue, Jun 12, 2018 at 02:00:17PM +0200, Ján Tomko wrote:
>> Do not mask the errors.
>>
>> If we'd expect query-sev-capabilities to fail, we should not
>> call it in the first place.
>>
>> Signed-off-by: Ján Tomko <jtomko@redhat.com>
>> ---
>>  src/qemu/qemu_capabilities.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
>> index 7a245a58bc..35d46c465d 100644
>> --- a/src/qemu/qemu_capabilities.c
>> +++ b/src/qemu/qemu_capabilities.c
>> @@ -4105,7 +4105,7 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
>>      /* Probe for SEV capabilities */
>>      if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST)) {
>>          if (virQEMUCapsProbeQMPSEVCapabilities(qemuCaps, mon) < 0)
>> -            virQEMUCapsClear(qemuCaps, QEMU_CAPS_SEV_GUEST);
>> +            goto cleanup;

Sadly we cannot do this because this capability cannot be probed
properly - both the object QEMU_CAPS_SEV_GUEST is based on and the
query-sev-capabilities are present even if QEMU does not support this,
but actually running the command fails:

internal error: unable to execute QEMU command 'query-sev-capabilities': SEV feature is not available

Jano

>>      }
>>
>>      ret = 0;
>
>Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
>
>
>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 :|
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list