Re: [libvirt] [PATCH 4/6] test: Add various vir*Flags API

2019-07-10 Thread Eric Blake
On 7/8/19 10:37 PM, Eric Blake wrote:
> Even though we don't accept any flags, it is unfriendly to callers
> that use the modern API to have to fall back to the flag-free API.
> 
> Note that virDomainBlockStats does not trivially forward to
> virDomainBlockStatsFlags, so that one is omitted.
> 
> Signed-off-by: Eric Blake 
> ---
>  src/test/test_driver.c | 34 --
>  1 file changed, 28 insertions(+), 6 deletions(-)
> 
> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> index 7dd448bb20..49d7030d21 100644
> --- a/src/test/test_driver.c
> +++ b/src/test/test_driver.c
> @@ -2469,12 +2469,15 @@ static int testDomainSetMaxMemory(virDomainPtr domain,
>  return 0;
>  }
> 
> -static int testDomainSetMemory(virDomainPtr domain,
> -   unsigned long memory)
> +static int testDomainSetMemoryFlags(virDomainPtr domain,
> +unsigned long memory,
> +unsigned int flags)
>  {
>  virDomainObjPtr privdom;
>  int ret = -1;
> 
> +virCheckFlags(0, -1);
> +

As discussed in v2, this should probably accept VIR_DOMAIN_AFFECT_LIVE,
and maybe even VIR_DOMAIN_AFFECT_MAXIMUM_MEMORY...


> +static int testDomainSetMemory(virDomainPtr domain,
> +   unsigned long memory)
> +{
> +return testDomainSetMemoryFlags(domain, memory, 0);

where this should pass VIR_DOMAIN_AFFECT_LIVE instead of 0, and we may
want to implement testDomainSetMaxMemory(),...


> +static int testDomainPinVcpu(virDomainPtr domain,
> + unsigned int vcpu,
> + unsigned char *cpumap,
> + int maplen)
> +{
> +return testDomainPinVcpuFlags(domain, vcpu, cpumap, maplen, 0);

and another interface that should probably pass VIR_DOMAIN_AFFECT_LIVE.

Looks like I'll be doing a v3.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 4/6] test: Add various vir*Flags API

2019-07-09 Thread Peter Krempa
On Mon, Jul 08, 2019 at 22:37:01 -0500, Eric Blake wrote:
> Even though we don't accept any flags, it is unfriendly to callers
> that use the modern API to have to fall back to the flag-free API.
> 
> Note that virDomainBlockStats does not trivially forward to
> virDomainBlockStatsFlags, so that one is omitted.
> 
> Signed-off-by: Eric Blake 
> ---
>  src/test/test_driver.c | 34 --
>  1 file changed, 28 insertions(+), 6 deletions(-)

This may conflict with Ilias' test driver work.

ACK


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 4/6] test: Add various vir*Flags API

2019-07-08 Thread Eric Blake
Even though we don't accept any flags, it is unfriendly to callers
that use the modern API to have to fall back to the flag-free API.

Note that virDomainBlockStats does not trivially forward to
virDomainBlockStatsFlags, so that one is omitted.

Signed-off-by: Eric Blake 
---
 src/test/test_driver.c | 34 --
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 7dd448bb20..49d7030d21 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2469,12 +2469,15 @@ static int testDomainSetMaxMemory(virDomainPtr domain,
 return 0;
 }

-static int testDomainSetMemory(virDomainPtr domain,
-   unsigned long memory)
+static int testDomainSetMemoryFlags(virDomainPtr domain,
+unsigned long memory,
+unsigned int flags)
 {
 virDomainObjPtr privdom;
 int ret = -1;

+virCheckFlags(0, -1);
+
 if (!(privdom = testDomObjFromDomain(domain)))
 return -1;

@@ -2491,6 +2494,12 @@ static int testDomainSetMemory(virDomainPtr domain,
 return ret;
 }

+static int testDomainSetMemory(virDomainPtr domain,
+   unsigned long memory)
+{
+return testDomainSetMemoryFlags(domain, memory, 0);
+}
+
 static int
 testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
 {
@@ -2679,16 +2688,19 @@ static int testDomainGetVcpus(virDomainPtr domain,
 return ret;
 }

-static int testDomainPinVcpu(virDomainPtr domain,
- unsigned int vcpu,
- unsigned char *cpumap,
- int maplen)
+static int testDomainPinVcpuFlags(virDomainPtr domain,
+  unsigned int vcpu,
+  unsigned char *cpumap,
+  int maplen,
+  unsigned int flags)
 {
 virDomainVcpuDefPtr vcpuinfo;
 virDomainObjPtr privdom;
 virDomainDefPtr def;
 int ret = -1;

+virCheckFlags(0, -1);
+
 if (!(privdom = testDomObjFromDomain(domain)))
 return -1;

@@ -2720,6 +2732,14 @@ static int testDomainPinVcpu(virDomainPtr domain,
 return ret;
 }

+static int testDomainPinVcpu(virDomainPtr domain,
+ unsigned int vcpu,
+ unsigned char *cpumap,
+ int maplen)
+{
+return testDomainPinVcpuFlags(domain, vcpu, cpumap, maplen, 0);
+}
+
 static int
 testDomainGetVcpuPinInfo(virDomainPtr dom,
 int ncpumaps,
@@ -7595,6 +7615,7 @@ static virHypervisorDriver testHypervisorDriver = {
 .domainGetMaxMemory = testDomainGetMaxMemory, /* 0.1.4 */
 .domainSetMaxMemory = testDomainSetMaxMemory, /* 0.1.1 */
 .domainSetMemory = testDomainSetMemory, /* 0.1.4 */
+.domainSetMemoryFlags = testDomainSetMemoryFlags, /* 5.6.0 */
 .domainGetHostname = testDomainGetHostname, /* 5.5.0 */
 .domainGetInfo = testDomainGetInfo, /* 0.1.1 */
 .domainGetState = testDomainGetState, /* 0.9.2 */
@@ -7611,6 +7632,7 @@ static virHypervisorDriver testHypervisorDriver = {
 .domainSetVcpusFlags = testDomainSetVcpusFlags, /* 0.8.5 */
 .domainGetVcpusFlags = testDomainGetVcpusFlags, /* 0.8.5 */
 .domainPinVcpu = testDomainPinVcpu, /* 0.7.3 */
+.domainPinVcpuFlags = testDomainPinVcpuFlags, /* 5.6.0 */
 .domainGetVcpus = testDomainGetVcpus, /* 0.7.3 */
 .domainGetVcpuPinInfo = testDomainGetVcpuPinInfo, /* 1.2.18 */
 .domainGetMaxVcpus = testDomainGetMaxVcpus, /* 0.7.3 */
-- 
2.20.1

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