[libvirt] [PATCH v2] LXC: trivially support flag VIR_DRV_FEATURE_TYPED_PARAM_STRING

2014-06-24 Thread Chen Hanxiao
fix:
virsh -c lxc:/// memtune DOMAIN
error: Unable to get number of memory parameters
error: unsupported flags (0x4) in function lxcDomainGetMemoryParameters

Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com
---
v2: also fix a similar issue in lxcDomainGetSchedulerParametersFlags

 src/lxc/lxc_driver.c | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 06f3e18..d8a31d3 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -895,7 +895,13 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
 size_t i;
 
 virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
-  VIR_DOMAIN_AFFECT_CONFIG, -1);
+  VIR_DOMAIN_AFFECT_CONFIG,
+  VIR_TYPED_PARAM_STRING_OKAY, -1);
+
+/* We blindly return a string, and let libvirt.c and
+ * remote_driver.c do the filtering on behalf of older clients
+ * that can't parse it.  */
+flags = ~VIR_TYPED_PARAM_STRING_OKAY;
 
 if (!(vm = lxcDomObjFromDomain(dom)))
 goto cleanup;
@@ -1993,7 +1999,13 @@ lxcDomainGetSchedulerParametersFlags(virDomainPtr dom,
 virLXCDomainObjPrivatePtr priv;
 
 virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
-  VIR_DOMAIN_AFFECT_CONFIG, -1);
+  VIR_DOMAIN_AFFECT_CONFIG |
+  VIR_TYPED_PARAM_STRING_OKAY, -1);
+
+/* We blindly return a string, and let libvirt.c and
+ * remote_driver.c do the filtering on behalf of older clients
+ * that can't parse it.  */
+flags = ~VIR_TYPED_PARAM_STRING_OKAY;
 
 if (!(vm = lxcDomObjFromDomain(dom)))
 goto cleanup;
-- 
1.9.0

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


Re: [libvirt] [PATCH v2] LXC: trivially support flag VIR_DRV_FEATURE_TYPED_PARAM_STRING

2014-06-24 Thread Ján Tomko
On 06/24/2014 09:24 AM, Chen Hanxiao wrote:
 fix:
 virsh -c lxc:/// memtune DOMAIN
 error: Unable to get number of memory parameters
 error: unsupported flags (0x4) in function lxcDomainGetMemoryParameters
 
 Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com
 ---
 v2: also fix a similar issue in lxcDomainGetSchedulerParametersFlags
 
  src/lxc/lxc_driver.c | 16 ++--
  1 file changed, 14 insertions(+), 2 deletions(-)
 
 diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
 index 06f3e18..d8a31d3 100644
 --- a/src/lxc/lxc_driver.c
 +++ b/src/lxc/lxc_driver.c
 @@ -895,7 +895,13 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
  size_t i;
  
  virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
 -  VIR_DOMAIN_AFFECT_CONFIG, -1);
 +  VIR_DOMAIN_AFFECT_CONFIG,
 +  VIR_TYPED_PARAM_STRING_OKAY, -1);

This fails to compile for me:
  CC   lxc/libvirt_driver_lxc_impl_la-lxc_driver.lo
lxc/lxc_driver.c:899:48: error: too many arguments provided to function-like
macro invocation
  VIR_TYPED_PARAM_STRING_OKAY, -1);
   ^


 +
 +/* We blindly return a string, and let libvirt.c and
 + * remote_driver.c do the filtering on behalf of older clients
 + * that can't parse it.  */

The original comment was OK. This is incorrect - neither of these APIs return
a string.

 +flags = ~VIR_TYPED_PARAM_STRING_OKAY;
  
  if (!(vm = lxcDomObjFromDomain(dom)))
  goto cleanup;
 @@ -1993,7 +1999,13 @@ lxcDomainGetSchedulerParametersFlags(virDomainPtr dom,
  virLXCDomainObjPrivatePtr priv;
  
  virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
 -  VIR_DOMAIN_AFFECT_CONFIG, -1);
 +  VIR_DOMAIN_AFFECT_CONFIG |
 +  VIR_TYPED_PARAM_STRING_OKAY, -1);
 +
 +/* We blindly return a string, and let libvirt.c and
 + * remote_driver.c do the filtering on behalf of older clients
 + * that can't parse it.  */

Same here.

 +flags = ~VIR_TYPED_PARAM_STRING_OKAY;
  
  if (!(vm = lxcDomObjFromDomain(dom)))
  goto cleanup;
 

Jan



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 v2] LXC: trivially support flag VIR_DRV_FEATURE_TYPED_PARAM_STRING

2014-06-24 Thread chenhanx...@cn.fujitsu.com


 -Original Message-
 From: Ján Tomko [mailto:jto...@redhat.com]
 Sent: Tuesday, June 24, 2014 4:57 PM
 To: Chen, Hanxiao/陈 晗霄; libvir-list@redhat.com
 Subject: Re: [libvirt] [PATCH v2] LXC: trivially support flag
 VIR_DRV_FEATURE_TYPED_PARAM_STRING
 
 On 06/24/2014 09:24 AM, Chen Hanxiao wrote:
  fix:
  virsh -c lxc:/// memtune DOMAIN
  error: Unable to get number of memory parameters
  error: unsupported flags (0x4) in function lxcDomainGetMemoryParameters
 
  Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com
  ---
  v2: also fix a similar issue in lxcDomainGetSchedulerParametersFlags
 
   src/lxc/lxc_driver.c | 16 ++--
   1 file changed, 14 insertions(+), 2 deletions(-)
 
  diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
  index 06f3e18..d8a31d3 100644
  --- a/src/lxc/lxc_driver.c
  +++ b/src/lxc/lxc_driver.c
  @@ -895,7 +895,13 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
   size_t i;
 
   virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
  -  VIR_DOMAIN_AFFECT_CONFIG, -1);
  +  VIR_DOMAIN_AFFECT_CONFIG,
  +  VIR_TYPED_PARAM_STRING_OKAY, -1);
 
 This fails to compile for me:
   CC   lxc/libvirt_driver_lxc_impl_la-lxc_driver.lo
 lxc/lxc_driver.c:899:48: error: too many arguments provided to function-like
 macro invocation
   VIR_TYPED_PARAM_STRING_OKAY, -1);
^
 
Sorry for my mistake.

 
  +
  +/* We blindly return a string, and let libvirt.c and
  + * remote_driver.c do the filtering on behalf of older clients
  + * that can't parse it.  */
 
 The original comment was OK. This is incorrect - neither of these APIs return
 a string.
 

Thanks, I see.

  +flags = ~VIR_TYPED_PARAM_STRING_OKAY;
 
   if (!(vm = lxcDomObjFromDomain(dom)))
   goto cleanup;
  @@ -1993,7 +1999,13 @@ lxcDomainGetSchedulerParametersFlags(virDomainPtr 
  dom,
   virLXCDomainObjPrivatePtr priv;
 
   virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
  -  VIR_DOMAIN_AFFECT_CONFIG, -1);
  +  VIR_DOMAIN_AFFECT_CONFIG |
  +  VIR_TYPED_PARAM_STRING_OKAY, -1);
  +
  +/* We blindly return a string, and let libvirt.c and
  + * remote_driver.c do the filtering on behalf of older clients
  + * that can't parse it.  */
 
 Same here.
 
  +flags = ~VIR_TYPED_PARAM_STRING_OKAY;
 
   if (!(vm = lxcDomObjFromDomain(dom)))
   goto cleanup;
 
 
 Jan


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