[libvirt] [PATCH] test_driver: implement virDomainGetLaunchSecurityInfo

Ilias Stamatis posted 1 patch 4 years, 9 months ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20190611110726.4885-1-stamatis.iliass@gmail.com
src/test/test_driver.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
[libvirt] [PATCH] test_driver: implement virDomainGetLaunchSecurityInfo
Posted by Ilias Stamatis 4 years, 9 months ago
Since this is the test driver and this is tied to AMD CPUs at the
moment, we can pretend that the domain doesn't have launch security and
always return 0 parameters.

Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
---
 src/test/test_driver.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 1aa79ce898..213f17808b 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2284,6 +2284,18 @@ testDomainGetOSType(virDomainPtr dom ATTRIBUTE_UNUSED)
 }


+static int
+testDomainGetLaunchSecurityInfo(virDomainPtr domain ATTRIBUTE_UNUSED,
+                                virTypedParameterPtr *params ATTRIBUTE_UNUSED,
+                                int *nparams,
+                                unsigned int flags)
+{
+    virCheckFlags(0, -1);
+    *nparams = 0;
+    return 0;
+}
+
+
 static unsigned long long
 testDomainGetMaxMemory(virDomainPtr domain)
 {
@@ -7011,6 +7023,7 @@ static virHypervisorDriver testHypervisorDriver = {
     .domainDestroy = testDomainDestroy, /* 0.1.1 */
     .domainDestroyFlags = testDomainDestroyFlags, /* 4.2.0 */
     .domainGetOSType = testDomainGetOSType, /* 0.1.9 */
+    .domainGetLaunchSecurityInfo = testDomainGetLaunchSecurityInfo, /* 5.5.0 */
     .domainGetMaxMemory = testDomainGetMaxMemory, /* 0.1.4 */
     .domainSetMaxMemory = testDomainSetMaxMemory, /* 0.1.1 */
     .domainSetMemory = testDomainSetMemory, /* 0.1.4 */
--
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] test_driver: implement virDomainGetLaunchSecurityInfo
Posted by Erik Skultety 4 years, 9 months ago
On Tue, Jun 11, 2019 at 01:07:26PM +0200, Ilias Stamatis wrote:
> Since this is the test driver and this is tied to AMD CPUs at the
> moment, we can pretend that the domain doesn't have launch security and
> always return 0 parameters.

I'd reword this in a bit different way:
"Since the behaviour of launch security is heavily dependent on 3rd party
vendors (e.g. AMD SEV) where the data returned can be essentially anything,
the most reasonable approach here in the test driver is not to try return any
data."

Reviewed-by: Erik Skultety <eskultet@redhat.com>

>
> Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
> ---
>  src/test/test_driver.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> index 1aa79ce898..213f17808b 100644
> --- a/src/test/test_driver.c
> +++ b/src/test/test_driver.c
> @@ -2284,6 +2284,18 @@ testDomainGetOSType(virDomainPtr dom ATTRIBUTE_UNUSED)
>  }
>
>
> +static int
> +testDomainGetLaunchSecurityInfo(virDomainPtr domain ATTRIBUTE_UNUSED,
> +                                virTypedParameterPtr *params ATTRIBUTE_UNUSED,
> +                                int *nparams,
> +                                unsigned int flags)
> +{
> +    virCheckFlags(0, -1);

I'll put an extra newline here.

> +    *nparams = 0;
> +    return 0;
> +}
> +
> +
>  static unsigned long long
>  testDomainGetMaxMemory(virDomainPtr domain)
>  {
> @@ -7011,6 +7023,7 @@ static virHypervisorDriver testHypervisorDriver = {
>      .domainDestroy = testDomainDestroy, /* 0.1.1 */
>      .domainDestroyFlags = testDomainDestroyFlags, /* 4.2.0 */
>      .domainGetOSType = testDomainGetOSType, /* 0.1.9 */
> +    .domainGetLaunchSecurityInfo = testDomainGetLaunchSecurityInfo, /* 5.5.0 */
>      .domainGetMaxMemory = testDomainGetMaxMemory, /* 0.1.4 */
>      .domainSetMaxMemory = testDomainSetMaxMemory, /* 0.1.1 */
>      .domainSetMemory = testDomainSetMemory, /* 0.1.4 */
> --
> 2.21.0
>
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list