[libvirt] [PATCH v3 1/4] introduce virDomainSetSchedulerParametersFlags

Hu Tao hutao at cn.fujitsu.com
Wed May 18 02:34:20 UTC 2011


On Tue, May 17, 2011 at 09:48:06AM -0600, Eric Blake wrote:
> On 05/17/2011 12:20 AM, Hu Tao wrote:
> > This new function allows aditional flags to be passed into from
> 
> s/aditional/additional/
> 
> > the virsh command line.
> > ---
> >  include/libvirt/libvirt.h.in |   14 +++++++++
> >  python/generator.py          |    1 +
> >  src/driver.h                 |    8 +++++
> >  src/libvirt.c                |   64 ++++++++++++++++++++++++++++++++++++++++++
> >  src/libvirt_public.syms      |    1 +
> >  5 files changed, 88 insertions(+), 0 deletions(-)
> > 
> > diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> > index f4d0b40..ec32b4b 100644
> > --- a/include/libvirt/libvirt.h.in
> > +++ b/include/libvirt/libvirt.h.in
> > @@ -295,6 +295,12 @@ typedef enum {
> >      VIR_DOMAIN_SCHED_FIELD_BOOLEAN = 6  /* boolean(character) case */
> >  } virSchedParameterType;
> >  
> > +typedef enum {
> > +    VIR_DOMAIN_SCHEDPARAM_CURRENT = (1 << 0), /* affect current domain state */
> 
> This should be 0,

This causes problem when setting parameters for an inactive domain, with
--current. In the case, the flags is 0, which fails flag-check in
virDomainSetSchedulerParametersFlags. Maybe we should not check flags
at this stage, and leave it for drivers.

The following patch removes the check:

9eaceed112b3d8578f1cb0ae76eb47510f7342a Mon Sep 17 00:00:00 2001
From: Hu Tao <hutao at cn.fujitsu.com>
Date: Wed, 18 May 2011 10:29:41 +0800
Subject: [PATCH] don't check flags in virDomainSetSchedulerParametersFlags

drivers implementing domainSetSchedulerParametersFlags should check
flags themselves.
---
 src/libvirt.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index 56b1257..eb2b0a0 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -5132,14 +5132,6 @@ virDomainSetSchedulerParametersFlags(virDomainPtr domain,
 
     virResetLastError();
 
-    if (!(flags & (VIR_DOMAIN_SCHEDPARAM_LIVE |
-                   VIR_DOMAIN_SCHEDPARAM_CONFIG |
-                   VIR_DOMAIN_SCHEDPARAM_CURRENT))) {
-        virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__);
-        virDispatchError(NULL);
-        return -1;
-    }
-
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
         virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         virDispatchError(NULL);
-- 
1.7.3.1




More information about the libvir-list mailing list