From cngesaint at gmail.com Mon Jul 1 01:00:05 2013 From: cngesaint at gmail.com (Xu Wang) Date: Mon, 1 Jul 2013 09:00:05 +0800 Subject: [Libvirt-cim] [PATCH V4] Fix kvm support check logic Message-ID: <1372640405-2000-1-git-send-email-cngesaint@gmail.com> Now system_has_kvm() would check all type value of domain label in caps. If any of them type is "kvm", system_has_kvm() return 1 as true result. Signed-off-by: Xu Wang --- libxkutil/device_parsing.c | 13 +++++-------- libxkutil/device_parsing.h | 2 +- src/Virt_VirtualSystemManagementService.c | 7 +------ 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c index 16195da..98c6c54 100644 --- a/libxkutil/device_parsing.c +++ b/libxkutil/device_parsing.c @@ -396,7 +396,7 @@ err: return 0; } -int parse_domain_type(xmlNodePtr node, char **value) +int has_kvm_domain_type(xmlNodePtr node) { xmlNodePtr child = NULL; char *type = NULL; @@ -405,22 +405,19 @@ int parse_domain_type(xmlNodePtr node, char **value) while (child != NULL) { if (XSTREQ(child->name, "domain")) { type = get_attr_value(child, "type"); - if (type != NULL) { - *value = strdup(type); - goto out; + if (XSTREQ(type, "kvm")) { + return 1; } } - if (parse_domain_type(child, value) == 1) { - goto out; + if (has_kvm_domain_type(child) == 1) { + return 1; } child = child->next; } return 0; -out: - return 1; } static int parse_net_device(xmlNode *inode, struct virt_device **vdevs) diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h index 733324f..6abcf14 100644 --- a/libxkutil/device_parsing.h +++ b/libxkutil/device_parsing.h @@ -221,7 +221,7 @@ int attach_device(virDomainPtr dom, struct virt_device *dev); int detach_device(virDomainPtr dom, struct virt_device *dev); int change_device(virDomainPtr dom, struct virt_device *dev); -int parse_domain_type(xmlNodePtr node, char **value); +int has_kvm_domain_type(xmlNodePtr node); #define XSTREQ(x, y) (STREQ((char *)x, y)) #define STRPROP(d, p, n) (d->p = get_node_content(n)) diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c index 8e1e6b1..199ab2d 100644 --- a/src/Virt_VirtualSystemManagementService.c +++ b/src/Virt_VirtualSystemManagementService.c @@ -394,7 +394,6 @@ static bool system_has_kvm(const char *pfx) virConnectPtr conn; char *caps = NULL; bool disable_kvm = get_disable_kvm(); - char *val = NULL; xmlDocPtr doc = NULL; xmlNodePtr node = NULL; int len; @@ -427,19 +426,15 @@ static bool system_has_kvm(const char *pfx) goto out; } - if (parse_domain_type(node, &val) && - STREQC(val, "kvm")) { + if (has_kvm_domain_type(node)) { CU_DEBUG("The system support kvm!"); kvm = true; - } else { - CU_DEBUG("Domain type is %s.", val); } } out: free(caps); free(doc); - free(val); virConnectClose(conn); -- 1.7.1 From mihajlov at linux.vnet.ibm.com Mon Jul 1 12:42:06 2013 From: mihajlov at linux.vnet.ibm.com (Viktor Mihajlovski) Date: Mon, 01 Jul 2013 14:42:06 +0200 Subject: [Libvirt-cim] [PATCH V4] Fix kvm support check logic In-Reply-To: <1372640405-2000-1-git-send-email-cngesaint@gmail.com> References: <1372640405-2000-1-git-send-email-cngesaint@gmail.com> Message-ID: <51D1791E.4050509@linux.vnet.ibm.com> On 07/01/2013 03:00 AM, Xu Wang wrote: > Now system_has_kvm() would check all type value of domain label in > caps. If any of them type is "kvm", system_has_kvm() return 1 as > true result. > > Signed-off-by: Xu Wang > --- > libxkutil/device_parsing.c | 13 +++++-------- > libxkutil/device_parsing.h | 2 +- > src/Virt_VirtualSystemManagementService.c | 7 +------ > 3 files changed, 7 insertions(+), 15 deletions(-) > Looks good to me. John, could you review the patch? Thx! -- Mit freundlichen Gr??en/Kind Regards Viktor Mihajlovski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martina K?deritz Gesch?ftsf?hrung: Dirk Wittkopp Sitz der Gesellschaft: B?blingen Registergericht: Amtsgericht Stuttgart, HRB 243294 From jferlan at redhat.com Mon Jul 1 15:01:19 2013 From: jferlan at redhat.com (John Ferlan) Date: Mon, 01 Jul 2013 11:01:19 -0400 Subject: [Libvirt-cim] [PATCH V4] Fix kvm support check logic In-Reply-To: <51D1791E.4050509@linux.vnet.ibm.com> References: <1372640405-2000-1-git-send-email-cngesaint@gmail.com> <51D1791E.4050509@linux.vnet.ibm.com> Message-ID: <51D199BF.8050006@redhat.com> On 07/01/2013 08:42 AM, Viktor Mihajlovski wrote: > On 07/01/2013 03:00 AM, Xu Wang wrote: >> Now system_has_kvm() would check all type value of domain label in >> caps. If any of them type is "kvm", system_has_kvm() return 1 as >> true result. >> >> Signed-off-by: Xu Wang >> --- >> libxkutil/device_parsing.c | 13 +++++-------- >> libxkutil/device_parsing.h | 2 +- >> src/Virt_VirtualSystemManagementService.c | 7 +------ >> 3 files changed, 7 insertions(+), 15 deletions(-) >> > > Looks good to me. John, could you review the patch? Thx! > I'm OK with the patch - I suppose the desire though is to have me push it right :-)? Curious - are there other patches coming shortly or is this it for a while? Reason I'm asking deals with Red Hat releases - specifically the need to have something for the 7.0 release. I'm thinking the desire is to perhaps generate a release with everything up to date. That could then be pushed into the RHEL 7.0. John From mihajlov at linux.vnet.ibm.com Mon Jul 1 15:54:18 2013 From: mihajlov at linux.vnet.ibm.com (Viktor Mihajlovski) Date: Mon, 01 Jul 2013 17:54:18 +0200 Subject: [Libvirt-cim] [PATCH V4] Fix kvm support check logic In-Reply-To: <51D199BF.8050006@redhat.com> References: <1372640405-2000-1-git-send-email-cngesaint@gmail.com> <51D1791E.4050509@linux.vnet.ibm.com> <51D199BF.8050006@redhat.com> Message-ID: <51D1A62A.1030704@linux.vnet.ibm.com> On 07/01/2013 05:01 PM, John Ferlan wrote: > > I'm OK with the patch - I suppose the desire though is to have me push > it right :-)? well, I am not yet acquainted with the libvirt-cim who-is-who (or who-can-push) but I would appreciate this patch to go upstream. > > Curious - are there other patches coming shortly or is this it for a > while? Reason I'm asking deals with Red Hat releases - specifically the > need to have something for the 7.0 release. I'm thinking the desire is > to perhaps generate a release with everything up to date. That could > then be pushed into the RHEL 7.0. > Hm, it happens that I am currently looking at portability aspects of libvirt-cim. And although some patches could well result from this exercise I am not yet able to tell whether this would be in time for a specific distribution release level. Sorry for not being able to offer more at this point in time. -- Mit freundlichen Gr??en/Kind Regards Viktor Mihajlovski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martina K?deritz Gesch?ftsf?hrung: Dirk Wittkopp Sitz der Gesellschaft: B?blingen Registergericht: Amtsgericht Stuttgart, HRB 243294 From fiuczy at linux.vnet.ibm.com Tue Jul 2 15:30:11 2013 From: fiuczy at linux.vnet.ibm.com (Boris Fiuczynski) Date: Tue, 02 Jul 2013 17:30:11 +0200 Subject: [Libvirt-cim] [PATCH V4] Fix kvm support check logic Message-ID: <51D2F203.5060408@linux.vnet.ibm.com> Xu Wang, it looks like there is still a memory leak on variable type in method has_kvm_domain_type. Mit freundlichen Gr??en/Kind Regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martina K?deritz Gesch?ftsf?hrung: Dirk Wittkopp Sitz der Gesellschaft: B?blingen Registergericht: Amtsgericht Stuttgart, HRB 243294 > Now system_has_kvm() would check all type value of domain label in > caps. If any of them type is "kvm", system_has_kvm() return 1 as > true result. > > Signed-off-by: Xu Wang > --- > libxkutil/device_parsing.c | 13 +++++-------- > libxkutil/device_parsing.h | 2 +- > src/Virt_VirtualSystemManagementService.c | 7 +------ > 3 files changed, 7 insertions(+), 15 deletions(-) > > diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c > index 16195da..98c6c54 100644 > --- a/libxkutil/device_parsing.c > +++ b/libxkutil/device_parsing.c > @@ -396,7 +396,7 @@ err: > return 0; > } > > -int parse_domain_type(xmlNodePtr node, char **value) > +int has_kvm_domain_type(xmlNodePtr node) > { > xmlNodePtr child = NULL; > char *type = NULL; > @@ -405,22 +405,19 @@ int parse_domain_type(xmlNodePtr node, char **value) > while (child != NULL) { > if (XSTREQ(child->name, "domain")) { > type = get_attr_value(child, "type"); > - if (type != NULL) { > - *value = strdup(type); > - goto out; > + if (XSTREQ(type, "kvm")) { > + return 1; When leaving the method here type is leaking memory. > } > } > > - if (parse_domain_type(child, value) == 1) { > - goto out; > + if (has_kvm_domain_type(child) == 1) { > + return 1; > } > > child = child->next; > } > > return 0; > -out: > - return 1; > } > > static int parse_net_device(xmlNode *inode, struct virt_device **vdevs) > diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h > index 733324f..6abcf14 100644 > --- a/libxkutil/device_parsing.h > +++ b/libxkutil/device_parsing.h > @@ -221,7 +221,7 @@ int attach_device(virDomainPtr dom, struct virt_device *dev); > int detach_device(virDomainPtr dom, struct virt_device *dev); > int change_device(virDomainPtr dom, struct virt_device *dev); > > -int parse_domain_type(xmlNodePtr node, char **value); > +int has_kvm_domain_type(xmlNodePtr node); > > #define XSTREQ(x, y) (STREQ((char *)x, y)) > #define STRPROP(d, p, n) (d->p = get_node_content(n)) > diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c > index 8e1e6b1..199ab2d 100644 > --- a/src/Virt_VirtualSystemManagementService.c > +++ b/src/Virt_VirtualSystemManagementService.c > @@ -394,7 +394,6 @@ static bool system_has_kvm(const char *pfx) > virConnectPtr conn; > char *caps = NULL; > bool disable_kvm = get_disable_kvm(); > - char *val = NULL; > xmlDocPtr doc = NULL; > xmlNodePtr node = NULL; > int len; > @@ -427,19 +426,15 @@ static bool system_has_kvm(const char *pfx) > goto out; > } > > - if (parse_domain_type(node, &val) && > - STREQC(val, "kvm")) { > + if (has_kvm_domain_type(node)) { > CU_DEBUG("The system support kvm!"); > kvm = true; > - } else { > - CU_DEBUG("Domain type is %s.", val); > } > } > > out: > free(caps); > free(doc); > - free(val); > > virConnectClose(conn); > > -- > 1.7.1 From jferlan at redhat.com Tue Jul 2 16:44:18 2013 From: jferlan at redhat.com (John Ferlan) Date: Tue, 02 Jul 2013 12:44:18 -0400 Subject: [Libvirt-cim] [PATCH V4] Fix kvm support check logic In-Reply-To: <51D1A62A.1030704@linux.vnet.ibm.com> References: <1372640405-2000-1-git-send-email-cngesaint@gmail.com> <51D1791E.4050509@linux.vnet.ibm.com> <51D199BF.8050006@redhat.com> <51D1A62A.1030704@linux.vnet.ibm.com> Message-ID: <51D30362.6020503@redhat.com> On 07/01/2013 11:54 AM, Viktor Mihajlovski wrote: > On 07/01/2013 05:01 PM, John Ferlan wrote: >> >> I'm OK with the patch - I suppose the desire though is to have me push >> it right :-)? > well, I am not yet acquainted with the libvirt-cim who-is-who (or > who-can-push) but I would appreciate this patch to go upstream. It was more a question for the author since I've pushed the last couple of patches I wasn't sure who would do this one. In any case, I had to make one small adjustment to the patch output, but I was able to 'git am', run a test build, but I'm having some issues during testing. I think those are a self inflicted environment though. The adjustment involved the difference line: virConnectPtr conn; which did not have the prior update to add the "NULL" to the def: virConnectPtr conn = NULL; because the following can go to out before conn was defined: if (disable_kvm) { CU_DEBUG("Enter disable kvm mode!"); goto out; } Before pushing I'd like to get verification from the author that the cimtest works. >> >> Curious - are there other patches coming shortly or is this it for a >> while? Reason I'm asking deals with Red Hat releases - specifically the >> need to have something for the 7.0 release. I'm thinking the desire is >> to perhaps generate a release with everything up to date. That could >> then be pushed into the RHEL 7.0. >> > Hm, it happens that I am currently looking at portability aspects > of libvirt-cim. And although some patches could well result from this > exercise I am not yet able to tell whether this would be in time for > a specific distribution release level. Sorry for not being able to > offer more at this point in time. > Fair enough - it's probably a "this month" type timeframe. John From cngesaint at gmail.com Wed Jul 3 02:03:12 2013 From: cngesaint at gmail.com (Xu Wang) Date: Wed, 3 Jul 2013 10:03:12 +0800 Subject: [Libvirt-cim] [PATCH V5] Fix kvm support check logic Message-ID: <1372816992-12619-1-git-send-email-cngesaint@gmail.com> Now system_has_kvm() would check all type value of domain label in caps. If any of them type is "kvm", system_has_kvm() return 1 as true result. Signed-off-by: Xu Wang --- libxkutil/device_parsing.c | 16 +++++++++------- libxkutil/device_parsing.h | 2 +- src/Virt_VirtualSystemManagementService.c | 7 +------ 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c index 16195da..9d7ddb4 100644 --- a/libxkutil/device_parsing.c +++ b/libxkutil/device_parsing.c @@ -396,31 +396,33 @@ err: return 0; } -int parse_domain_type(xmlNodePtr node, char **value) +bool has_kvm_domain_type(xmlNodePtr node) { xmlNodePtr child = NULL; char *type = NULL; + bool ret = false; child = node->children; while (child != NULL) { if (XSTREQ(child->name, "domain")) { type = get_attr_value(child, "type"); - if (type != NULL) { - *value = strdup(type); + if (XSTREQ(type, "kvm")) { + ret = true; goto out; } } - if (parse_domain_type(child, value) == 1) { + if (has_kvm_domain_type(child) == 1) { + ret = true; goto out; } child = child->next; } - return 0; -out: - return 1; + out: + free(type); + return ret; } static int parse_net_device(xmlNode *inode, struct virt_device **vdevs) diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h index 733324f..2a4c911 100644 --- a/libxkutil/device_parsing.h +++ b/libxkutil/device_parsing.h @@ -221,7 +221,7 @@ int attach_device(virDomainPtr dom, struct virt_device *dev); int detach_device(virDomainPtr dom, struct virt_device *dev); int change_device(virDomainPtr dom, struct virt_device *dev); -int parse_domain_type(xmlNodePtr node, char **value); +bool has_kvm_domain_type(xmlNodePtr node); #define XSTREQ(x, y) (STREQ((char *)x, y)) #define STRPROP(d, p, n) (d->p = get_node_content(n)) diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c index 8e1e6b1..199ab2d 100644 --- a/src/Virt_VirtualSystemManagementService.c +++ b/src/Virt_VirtualSystemManagementService.c @@ -394,7 +394,6 @@ static bool system_has_kvm(const char *pfx) virConnectPtr conn = NULL; char *caps = NULL; bool disable_kvm = get_disable_kvm(); - char *val = NULL; xmlDocPtr doc = NULL; xmlNodePtr node = NULL; int len; @@ -427,19 +426,15 @@ static bool system_has_kvm(const char *pfx) goto out; } - if (parse_domain_type(node, &val) && - STREQC(val, "kvm")) { + if (has_kvm_domain_type(node)) { CU_DEBUG("The system support kvm!"); kvm = true; - } else { - CU_DEBUG("Domain type is %s.", val); } } out: free(caps); free(doc); - free(val); virConnectClose(conn); -- 1.7.1 From cngesaint at gmail.com Wed Jul 3 02:05:53 2013 From: cngesaint at gmail.com (Xu Wang) Date: Wed, 03 Jul 2013 10:05:53 +0800 Subject: [Libvirt-cim] [PATCH V4] Fix kvm support check logic In-Reply-To: <51D2F203.5060408@linux.vnet.ibm.com> References: <51D2F203.5060408@linux.vnet.ibm.com> Message-ID: <51D38701.6010206@gmail.com> ? 2013-07-02 23:30, Boris Fiuczynski ??: > Xu Wang, > it looks like there is still a memory leak on variable type in method > has_kvm_domain_type. > > Mit freundlichen Gr??en/Kind Regards > Boris Fiuczynski > > IBM Deutschland Research & Development GmbH > Vorsitzender des Aufsichtsrats: Martina K?deritz > Gesch?ftsf?hrung: Dirk Wittkopp > Sitz der Gesellschaft: B?blingen > Registergericht: Amtsgericht Stuttgart, HRB 243294 > > >> Now system_has_kvm() would check all type value of domain label in >> caps. If any of them type is "kvm", system_has_kvm() return 1 as >> true result. >> >> Signed-off-by: Xu Wang >> --- >> libxkutil/device_parsing.c | 13 +++++-------- >> libxkutil/device_parsing.h | 2 +- >> src/Virt_VirtualSystemManagementService.c | 7 +------ >> 3 files changed, 7 insertions(+), 15 deletions(-) >> >> diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c >> index 16195da..98c6c54 100644 >> --- a/libxkutil/device_parsing.c >> +++ b/libxkutil/device_parsing.c >> @@ -396,7 +396,7 @@ err: >> return 0; >> } >> >> -int parse_domain_type(xmlNodePtr node, char **value) >> +int has_kvm_domain_type(xmlNodePtr node) >> { >> xmlNodePtr child = NULL; >> char *type = NULL; >> @@ -405,22 +405,19 @@ int parse_domain_type(xmlNodePtr node, char >> **value) >> while (child != NULL) { >> if (XSTREQ(child->name, "domain")) { >> type = get_attr_value(child, "type"); >> - if (type != NULL) { >> - *value = strdup(type); >> - goto out; >> + if (XSTREQ(type, "kvm")) { >> + return 1; > When leaving the method here type is leaking memory. Thank you for your advice. I have repaired it in the new patch:-) Xu Wang > >> } >> } >> >> - if (parse_domain_type(child, value) == 1) { >> - goto out; >> + if (has_kvm_domain_type(child) == 1) { >> + return 1; >> } >> >> child = child->next; >> } >> >> return 0; >> -out: >> - return 1; >> } >> >> static int parse_net_device(xmlNode *inode, struct virt_device **vdevs) >> diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h >> index 733324f..6abcf14 100644 >> --- a/libxkutil/device_parsing.h >> +++ b/libxkutil/device_parsing.h >> @@ -221,7 +221,7 @@ int attach_device(virDomainPtr dom, struct >> virt_device *dev); >> int detach_device(virDomainPtr dom, struct virt_device *dev); >> int change_device(virDomainPtr dom, struct virt_device *dev); >> >> -int parse_domain_type(xmlNodePtr node, char **value); >> +int has_kvm_domain_type(xmlNodePtr node); >> >> #define XSTREQ(x, y) (STREQ((char *)x, y)) >> #define STRPROP(d, p, n) (d->p = get_node_content(n)) >> diff --git a/src/Virt_VirtualSystemManagementService.c >> b/src/Virt_VirtualSystemManagementService.c >> index 8e1e6b1..199ab2d 100644 >> --- a/src/Virt_VirtualSystemManagementService.c >> +++ b/src/Virt_VirtualSystemManagementService.c >> @@ -394,7 +394,6 @@ static bool system_has_kvm(const char *pfx) >> virConnectPtr conn; >> char *caps = NULL; >> bool disable_kvm = get_disable_kvm(); >> - char *val = NULL; >> xmlDocPtr doc = NULL; >> xmlNodePtr node = NULL; >> int len; >> @@ -427,19 +426,15 @@ static bool system_has_kvm(const char *pfx) >> goto out; >> } >> >> - if (parse_domain_type(node, &val) && >> - STREQC(val, "kvm")) { >> + if (has_kvm_domain_type(node)) { >> CU_DEBUG("The system support kvm!"); >> kvm = true; >> - } else { >> - CU_DEBUG("Domain type is %s.", val); >> } >> } >> >> out: >> free(caps); >> free(doc); >> - free(val); >> >> virConnectClose(conn); >> >> -- >> 1.7.1 > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From cngesaint at gmail.com Wed Jul 3 02:12:14 2013 From: cngesaint at gmail.com (Xu Wang) Date: Wed, 03 Jul 2013 10:12:14 +0800 Subject: [Libvirt-cim] [PATCH V4] Fix kvm support check logic In-Reply-To: <51D30362.6020503@redhat.com> References: <1372640405-2000-1-git-send-email-cngesaint@gmail.com> <51D1791E.4050509@linux.vnet.ibm.com> <51D199BF.8050006@redhat.com> <51D1A62A.1030704@linux.vnet.ibm.com> <51D30362.6020503@redhat.com> Message-ID: <51D3887E.9020106@gmail.com> ? 2013-07-03 00:44, John Ferlan ??: > On 07/01/2013 11:54 AM, Viktor Mihajlovski wrote: >> On 07/01/2013 05:01 PM, John Ferlan wrote: >>> >>> I'm OK with the patch - I suppose the desire though is to have me push >>> it right :-)? >> well, I am not yet acquainted with the libvirt-cim who-is-who (or >> who-can-push) but I would appreciate this patch to go upstream. > > It was more a question for the author since I've pushed the last couple > of patches I wasn't sure who would do this one. In any case, I had to > make one small adjustment to the patch output, but I was able to 'git > am', run a test build, but I'm having some issues during testing. I > think those are a self inflicted environment though. > > The adjustment involved the difference line: > > virConnectPtr conn; > > which did not have the prior update to add the "NULL" to the def: > > virConnectPtr conn = NULL; > > because the following can go to out before conn was defined: > > if (disable_kvm) { > CU_DEBUG("Enter disable kvm mode!"); > goto out; > } > > > Before pushing I'd like to get verification from the author that the > cimtest works. Sorry for it. I think I didn't update my local git on time. Now the patch V5 should solved this issue and another memory leak. I just rerun cimtest and it works well. If no problem, please push it into upstream. Thank you:-) Sincerely yours, Xu Wang > > >>> >>> Curious - are there other patches coming shortly or is this it for a >>> while? Reason I'm asking deals with Red Hat releases - specifically the >>> need to have something for the 7.0 release. I'm thinking the desire is >>> to perhaps generate a release with everything up to date. That could >>> then be pushed into the RHEL 7.0. >>> >> Hm, it happens that I am currently looking at portability aspects >> of libvirt-cim. And although some patches could well result from this >> exercise I am not yet able to tell whether this would be in time for >> a specific distribution release level. Sorry for not being able to >> offer more at this point in time. >> > > Fair enough - it's probably a "this month" type timeframe. > > John > From cngesaint at outlook.com Mon Jul 8 08:16:45 2013 From: cngesaint at outlook.com (WangXu) Date: Mon, 8 Jul 2013 08:16:45 +0000 Subject: [Libvirt-cim] FW: [PATCH V5] Fix kvm support check logic In-Reply-To: <1372816992-12619-1-git-send-email-cngesaint@gmail.com> References: <1372816992-12619-1-git-send-email-cngesaint@gmail.com> Message-ID: Dear John? ? If you feel it is OK please insert it into upstream. Thank you:-) Sincerely yours, ? Xu Wang ---------------------------------------- > From: cngesaint at gmail.com > To: libvirt-cim at redhat.com > Date: Wed, 3 Jul 2013 10:03:12 +0800 > Subject: [Libvirt-cim] [PATCH V5] Fix kvm support check logic > > Now system_has_kvm() would check all type value of domain label in > caps. If any of them type is "kvm", system_has_kvm() return 1 as > true result. > > Signed-off-by: Xu Wang > --- > libxkutil/device_parsing.c | 16 +++++++++------- > libxkutil/device_parsing.h | 2 +- > src/Virt_VirtualSystemManagementService.c | 7 +------ > 3 files changed, 11 insertions(+), 14 deletions(-) > > diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c > index 16195da..9d7ddb4 100644 > --- a/libxkutil/device_parsing.c > +++ b/libxkutil/device_parsing.c > @@ -396,31 +396,33 @@ err: > return 0; > } > > -int parse_domain_type(xmlNodePtr node, char **value) > +bool has_kvm_domain_type(xmlNodePtr node) > { > xmlNodePtr child = NULL; > char *type = NULL; > + bool ret = false; > > child = node->children; > while (child != NULL) { > if (XSTREQ(child->name, "domain")) { > type = get_attr_value(child, "type"); > - if (type != NULL) { > - *value = strdup(type); > + if (XSTREQ(type, "kvm")) { > + ret = true; > goto out; > } > } > > - if (parse_domain_type(child, value) == 1) { > + if (has_kvm_domain_type(child) == 1) { > + ret = true; > goto out; > } > > child = child->next; > } > > - return 0; > -out: > - return 1; > + out: > + free(type); > + return ret; > } > > static int parse_net_device(xmlNode *inode, struct virt_device **vdevs) > diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h > index 733324f..2a4c911 100644 > --- a/libxkutil/device_parsing.h > +++ b/libxkutil/device_parsing.h > @@ -221,7 +221,7 @@ int attach_device(virDomainPtr dom, struct virt_device *dev); > int detach_device(virDomainPtr dom, struct virt_device *dev); > int change_device(virDomainPtr dom, struct virt_device *dev); > > -int parse_domain_type(xmlNodePtr node, char **value); > +bool has_kvm_domain_type(xmlNodePtr node); > > #define XSTREQ(x, y) (STREQ((char *)x, y)) > #define STRPROP(d, p, n) (d->p = get_node_content(n)) > diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c > index 8e1e6b1..199ab2d 100644 > --- a/src/Virt_VirtualSystemManagementService.c > +++ b/src/Virt_VirtualSystemManagementService.c > @@ -394,7 +394,6 @@ static bool system_has_kvm(const char *pfx) > virConnectPtr conn = NULL; > char *caps = NULL; > bool disable_kvm = get_disable_kvm(); > - char *val = NULL; > xmlDocPtr doc = NULL; > xmlNodePtr node = NULL; > int len; > @@ -427,19 +426,15 @@ static bool system_has_kvm(const char *pfx) > goto out; > } > > - if (parse_domain_type(node, &val) && > - STREQC(val, "kvm")) { > + if (has_kvm_domain_type(node)) { > CU_DEBUG("The system support kvm!"); > kvm = true; > - } else { > - CU_DEBUG("Domain type is %s.", val); > } > } > > out: > free(caps); > free(doc); > - free(val); > > virConnectClose(conn); > > -- > 1.7.1 > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From jferlan at redhat.com Mon Jul 8 13:09:57 2013 From: jferlan at redhat.com (John Ferlan) Date: Mon, 08 Jul 2013 09:09:57 -0400 Subject: [Libvirt-cim] [PATCH V5] Fix kvm support check logic In-Reply-To: <1372816992-12619-1-git-send-email-cngesaint@gmail.com> References: <1372816992-12619-1-git-send-email-cngesaint@gmail.com> Message-ID: <51DABA25.4060206@redhat.com> On 07/02/2013 10:03 PM, Xu Wang wrote: > Now system_has_kvm() would check all type value of domain label in > caps. If any of them type is "kvm", system_has_kvm() return 1 as > true result. > > Signed-off-by: Xu Wang > --- > libxkutil/device_parsing.c | 16 +++++++++------- > libxkutil/device_parsing.h | 2 +- > src/Virt_VirtualSystemManagementService.c | 7 +------ > 3 files changed, 11 insertions(+), 14 deletions(-) > I pushed these today. John From jferlan at redhat.com Mon Jul 8 13:17:53 2013 From: jferlan at redhat.com (John Ferlan) Date: Mon, 8 Jul 2013 09:17:53 -0400 Subject: [Libvirt-cim] [PATCH 0/2] Couple of fixes for cimtest Message-ID: <1373289475-26388-1-git-send-email-jferlan@redhat.com> I've been using the changes in this patchset for a while, just hadn't posted them. The changes resolve issues seen in the 22_multi_brg_interface test. While testing I also found a latent issue elsewhere - I cannot remember where I ran the test, only that it failed for the reasons indicated in the commit. With these patches installed, I get the following test results as shown in the 'suites/libvirt-cim/run_report.txt' output: ================================================= Test Run Summary (Jul 08 2013): KVM on Fedora release 18 (Spherical Cow) with Pe gasus ================================================= Distro: Fedora release 18 (Spherical Cow) Kernel: 3.9.6-200.fc18.x86_64 libvirt: 1.1.0 Hypervisor: QEMU 1.5.50 CIMOM: Pegasus 2.12.0 Libvirt-cim revision: 1225 Libvirt-cim changeset: 07adabc Cimtest revision: 907 Cimtest changeset: 442a7b1 Total test execution: Unknown ================================================= FAIL : 3 XFAIL : 3 SKIP : 11 PASS : 175 ----------------- Total : 192 ================================================= FAIL Test Summary: ComputerSystemIndication - 01_created_indication.py: FAIL RASDIndications - 01_guest_states_rasd_ind.py: FAIL RASDIndications - 02_guest_add_mod_rem_rasd_ind.py: FAIL ================================================= XFAIL Test Summary: SwitchService - 01_enum.py: XFAIL VirtualSystemManagementService - 28_definesystem_with_vsi_profile.py: XFAIL VirtualSystemManagementService - 30_dynamic_disk_mod.py: XFAIL ================================================= SKIP Test Summary: ComputerSystem - 02_nosystems.py: SKIP ComputerSystemMigrationJobIndication - 01_csmig_ind_for_offline_mig.py: SKIP LogicalDisk - 02_nodevs.py: SKIP Profile - 04_verify_libvirt_cim_slp_profiles.py: SKIP VirtualSystemMigrationService - 01_migratable_host.py: SKIP VirtualSystemMigrationService - 02_host_migrate_type.py: SKIP VirtualSystemMigrationService - 05_migratable_host_errs.py: SKIP VirtualSystemMigrationService - 06_remote_live_migration.py: SKIP VirtualSystemMigrationService - 07_remote_offline_migration.py: SKIP VirtualSystemMigrationService - 08_remote_restart_resume_migration.py: SKIP VSSD - 02_bootldr.py: SKIP NOTE: The *Indications tests have not worked in my environment ever. I chased the issue down to network configuration within whatever segment of the Red Hat domain I'm in. John Ferlan (2): Allow adding bridged network for running domain Remove extranous or unnecessary parameter from error messages .../cimtest/Profile/03_rprofile_gi_errs.py | 2 +- suites/libvirt-cim/cimtest/RASD/03_rasd_errs.py | 2 +- .../cimtest/ResourcePool/02_rp_gi_errors.py | 2 +- .../22_addmulti_brg_interface.py | 9 +++++++-- suites/libvirt-cim/lib/XenKvmLib/vsms_util.py | 23 +++++++++++++++++----- 5 files changed, 28 insertions(+), 10 deletions(-) -- 1.8.1.4 From jferlan at redhat.com Mon Jul 8 13:17:55 2013 From: jferlan at redhat.com (John Ferlan) Date: Mon, 8 Jul 2013 09:17:55 -0400 Subject: [Libvirt-cim] [PATCH 2/2] Remove extranous or unnecessary parameter from error messages In-Reply-To: <1373289475-26388-1-git-send-email-jferlan@redhat.com> References: <1373289475-26388-1-git-send-email-jferlan@redhat.com> Message-ID: <1373289475-26388-3-git-send-email-jferlan@redhat.com> Testing on a system failed with: Profile - 03_rprofile_gi_errs.py: FAIL ERROR - Unexpected errno 5, desc Class not found ERROR - Expected No such instance 6 ERROR - NameError : global name 'tc' is not defined Traceback (most recent call last): File "/root/cimtest/suites/libvirt-cim/lib/XenKvmLib/const.py", line 141, in do_try rc = f() File "03_rprofile_gi_errs.py", line 85, in main logger.error("------ FAILED: %s %s ------", cn, tc) NameError: global name 'tc' is not defined ERROR - None Turns out the profile test doesn't define/use tc. Found 2 other such occurrances and fixed them as well. --- suites/libvirt-cim/cimtest/Profile/03_rprofile_gi_errs.py | 2 +- suites/libvirt-cim/cimtest/RASD/03_rasd_errs.py | 2 +- suites/libvirt-cim/cimtest/ResourcePool/02_rp_gi_errors.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/suites/libvirt-cim/cimtest/Profile/03_rprofile_gi_errs.py b/suites/libvirt-cim/cimtest/Profile/03_rprofile_gi_errs.py index 4633cce..fa2a634 100644 --- a/suites/libvirt-cim/cimtest/Profile/03_rprofile_gi_errs.py +++ b/suites/libvirt-cim/cimtest/Profile/03_rprofile_gi_errs.py @@ -82,7 +82,7 @@ def main(): logger.error("Expected %s %s", exp_desc, exp_rc) if status != PASS: - logger.error("------ FAILED: %s %s ------", cn, tc) + logger.error("------ FAILED: InstanceID Key Value. ------") Globals.CIM_NS = prev_namespace return status diff --git a/suites/libvirt-cim/cimtest/RASD/03_rasd_errs.py b/suites/libvirt-cim/cimtest/RASD/03_rasd_errs.py index 48cc34c..d582ffb 100644 --- a/suites/libvirt-cim/cimtest/RASD/03_rasd_errs.py +++ b/suites/libvirt-cim/cimtest/RASD/03_rasd_errs.py @@ -133,7 +133,7 @@ def main(): logger.error("Expected %s %s", exp_desc, exp_rc) if status != PASS: - logger.error("------ FAILED: %s %s ------", cn, tc) + logger.error("------ FAILED: %s ------", cn) break vsxml.undefine(server) diff --git a/suites/libvirt-cim/cimtest/ResourcePool/02_rp_gi_errors.py b/suites/libvirt-cim/cimtest/ResourcePool/02_rp_gi_errors.py index d06778e..6215684 100644 --- a/suites/libvirt-cim/cimtest/ResourcePool/02_rp_gi_errors.py +++ b/suites/libvirt-cim/cimtest/ResourcePool/02_rp_gi_errors.py @@ -94,7 +94,7 @@ def main(): logger.error("Expected %s %s", exp_desc, exp_rc) if status != PASS: - logger.error("------ FAILED: %s %s ------", cn, tc) + logger.error("------ FAILED: %s ------", cn) break return status -- 1.8.1.4 From jferlan at redhat.com Mon Jul 8 13:17:54 2013 From: jferlan at redhat.com (John Ferlan) Date: Mon, 8 Jul 2013 09:17:54 -0400 Subject: [Libvirt-cim] [PATCH 1/2] Allow adding bridged network for running domain In-Reply-To: <1373289475-26388-1-git-send-email-jferlan@redhat.com> References: <1373289475-26388-1-git-send-email-jferlan@redhat.com> Message-ID: <1373289475-26388-2-git-send-email-jferlan@redhat.com> Test failed with following: VirtualSystemManagementService - 22_addmulti_brg_interface.py: XFAIL ERROR - (1, u"CIM_ERR_FAILED: Unable to change (0) device: internal error unable to execute QEMU command 'device_add': Bus 'pci.0' does not support hotplugging") ERROR - Error invoking AddRS: add_net_res ERROR - AddResourceSettings call failed ERROR - Failed to destroy Virtual Network 'my_network1' InvokeMethod(AddResourceSettings): CIM_ERR_FAILED: Unable to change (0) device: internal error unable to execute QEMU command 'device_add': Bus 'pci.0' does not support hotplugging Bug:<00015> The fix for this was that the domain needed to be created with the "acpi=True" flag. This allowed the test to get a bit further, but it then failed with the following: VirtualSystemManagementService - 22_addmulti_brg_interface.py: XFAIL ERROR - Got 88:aa:bb:cc:ee:ff, exp 88:aa:bb:cc:ee:ff. Got None, exp my_network1. ERROR - Error invoking AddRS: add_net_res ERROR - Error adding rs for net mac ERROR - Failed to destroy Virtual Network 'my_network1' The issue here is that the created network bridge doesn't have an xml resource "source network" as 'my_network1', rather that name is assigned to the pool. A network bridge type object has a resource "source bridge" which correlates to the 'virt_net' attribute while network type object correlates to the 'net_name' attribute. Since I wasn't sure how a Xen domain would look I separated the validation comparisons --- .../22_addmulti_brg_interface.py | 9 +++++++-- suites/libvirt-cim/lib/XenKvmLib/vsms_util.py | 23 +++++++++++++++++----- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/22_addmulti_brg_interface.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/22_addmulti_brg_interface.py index 36d1873..0452bf6 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/22_addmulti_brg_interface.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/22_addmulti_brg_interface.py @@ -63,8 +63,13 @@ def main(): service = get_vsms_class(options.virt)(options.ip) classname = get_typed_class(options.virt, 'VirtualSystemSettingData') - vsxml = get_class(options.virt)(test_dom, mac=default_mac, ntype=ntype, - net_name=default_brg) + # Seems ACPI needs to be set for KVM in order for hotplug to work right + if options.virt == "KVM": + vsxml = get_class(options.virt)(test_dom, mac=default_mac, ntype=ntype, + net_name=default_brg, acpi=True) + else: + vsxml = get_class(options.virt)(test_dom, mac=default_mac, ntype=ntype, + net_name=default_brg) try: ret = vsxml.cim_define(options.ip) if not ret: diff --git a/suites/libvirt-cim/lib/XenKvmLib/vsms_util.py b/suites/libvirt-cim/lib/XenKvmLib/vsms_util.py index 075c09f..3c3d0fc 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/vsms_util.py +++ b/suites/libvirt-cim/lib/XenKvmLib/vsms_util.py @@ -189,9 +189,22 @@ def add_net_res(server, service, virt, cxml, vssd_ref, nasd, attr): % attr['nmac']) if virt == "KVM": - name = cxml.get_value_xpath( + # For KVM bridge types, compare the source bridge + if attr['ntype'] == 'bridge': + name = cxml.get_value_xpath( + '/domain/devices/interface/source/@bridge[. = "%s"]' + % attr['virt_net']) + attr_name = attr['virt_net'] + # For KVM network types, compare the network name + else: + name = cxml.get_value_xpath( '/domain/devices/interface/source/@network[. = "%s"]' % attr['net_name']) + attr_name = attr['net_name'] + if mac != attr['nmac'] or name != attr_name: + logger.error("MAC: Got %s, exp %s. NAME: Got %s, exp %s.", + mac, attr['nmac'], name, attr['virt_net']) + raise Exception('Error adding rs for net mac') else: # For Xen, network interfaces are converted to bridge interfaces. @@ -202,10 +215,10 @@ def add_net_res(server, service, virt, cxml, vssd_ref, nasd, attr): if name != None: name = attr['net_name'] - if mac != attr['nmac'] or name != attr['net_name']: - logger.error("Got %s, exp %s. Got %s, exp %s.", mac, - attr['nmac'], name, attr['net_name']) - raise Exception('Error adding rs for net mac') + if mac != attr['nmac'] or name != attr['net_name']: + logger.error("MAC: Got %s, exp %s. NAME: Got %s, exp %s. br %s", + mac, attr['nmac'], name, attr['net_name'], br) + raise Exception('Error adding rs for net mac') logger.info('good status for net_mac') except Exception, details: -- 1.8.1.4 From cngesaint at gmail.com Tue Jul 9 05:58:45 2013 From: cngesaint at gmail.com (Xu Wang) Date: Tue, 9 Jul 2013 13:58:45 +0800 Subject: [Libvirt-cim] [PATCH] Add default network card name existence check Message-ID: <1373349525-27105-1-git-send-email-cngesaint@gmail.com> Default network card name was set as 'eth1' or 'em1'. But when os has no network card named like that, FAIL would occured. This patch added check if default name exists in the network card list and if not, change the default value into the 1st one in the list. Signed-off-by: Xu Wang --- .../27_definesystem_macvtap_dev.py | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py index 36bf52f..7832e90 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py @@ -30,6 +30,7 @@ # import sys +import os from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS, SKIP from VirtLib import utils @@ -132,6 +133,14 @@ def main(): else: source_dev = "eth1" + # The default device name may not named 'eth1' or 'em1' so this case would + # return FAIL. The following code will check if default device exists in + # the network card list and if not, source_dev will be changed into the 1st + # network card in the list. + net_info = os.popen('ifconfig').read() + if net_info.find(source_dev) == -1: + source_dev = net_info.split(' ')[0] + guest_defined = False try: -- 1.7.1 From fiuczy at linux.vnet.ibm.com Wed Jul 10 11:43:33 2013 From: fiuczy at linux.vnet.ibm.com (Boris Fiuczynski) Date: Wed, 10 Jul 2013 13:43:33 +0200 Subject: [Libvirt-cim] [PATCH] Add default network card name existence check In-Reply-To: <1373349525-27105-1-git-send-email-cngesaint@gmail.com> References: <1373349525-27105-1-git-send-email-cngesaint@gmail.com> Message-ID: <51DD48E5.8040704@linux.vnet.ibm.com> Xu, please see below. On 07/09/2013 07:58 AM, Xu Wang wrote: > Default network card name was set as 'eth1' or 'em1'. But when os has no network card named like that, FAIL > would occured. This patch added check if default name exists in the network card list and if not, change > the default value into the 1st one in the list. > > Signed-off-by: Xu Wang > --- > .../27_definesystem_macvtap_dev.py | 9 +++++++++ > 1 files changed, 9 insertions(+), 0 deletions(-) > > diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py > index 36bf52f..7832e90 100644 > --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py > +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py > @@ -30,6 +30,7 @@ > # > > import sys > +import os > from CimTest.Globals import logger > from CimTest.ReturnCodes import FAIL, PASS, SKIP > from VirtLib import utils > @@ -132,6 +133,14 @@ def main(): > else: > source_dev = "eth1" > > + # The default device name may not named 'eth1' or 'em1' so this case would > + # return FAIL. The following code will check if default device exists in > + # the network card list and if not, source_dev will be changed into the 1st > + # network card in the list. > + net_info = os.popen('ifconfig').read() > + if net_info.find(source_dev) == -1: > + source_dev = net_info.split(' ')[0] My guess is this would end up with trailing colon e.g. eth0: Wouldn't it better to do the splits on the colon? > + > guest_defined = False > > try: > -- Mit freundlichen Gr??en/Kind Regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martina K?deritz Gesch?ftsf?hrung: Dirk Wittkopp Sitz der Gesellschaft: B?blingen Registergericht: Amtsgericht Stuttgart, HRB 243294 From cngesaint at gmail.com Thu Jul 11 06:48:37 2013 From: cngesaint at gmail.com (Xu Wang) Date: Thu, 11 Jul 2013 14:48:37 +0800 Subject: [Libvirt-cim] [PATCH] Add default network card name existence check In-Reply-To: <51DD48E5.8040704@linux.vnet.ibm.com> References: <1373349525-27105-1-git-send-email-cngesaint@gmail.com> <51DD48E5.8040704@linux.vnet.ibm.com> Message-ID: <51DE5545.4030604@gmail.com> ? 2013-07-10 19:43, Boris Fiuczynski ??: > Xu, > please see below. > > On 07/09/2013 07:58 AM, Xu Wang wrote: >> Default network card name was set as 'eth1' or 'em1'. But when os has >> no network card named like that, FAIL >> would occured. This patch added check if default name exists in the >> network card list and if not, change >> the default value into the 1st one in the list. >> >> Signed-off-by: Xu Wang >> --- >> .../27_definesystem_macvtap_dev.py | 9 +++++++++ >> 1 files changed, 9 insertions(+), 0 deletions(-) >> >> diff --git >> a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py >> b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py >> >> index 36bf52f..7832e90 100644 >> --- >> a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py >> >> +++ >> b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py >> >> @@ -30,6 +30,7 @@ >> # >> >> import sys >> +import os >> from CimTest.Globals import logger >> from CimTest.ReturnCodes import FAIL, PASS, SKIP >> from VirtLib import utils >> @@ -132,6 +133,14 @@ def main(): >> else: >> source_dev = "eth1" >> >> + # The default device name may not named 'eth1' or 'em1' so this >> case would >> + # return FAIL. The following code will check if default device >> exists in >> + # the network card list and if not, source_dev will be changed >> into the 1st >> + # network card in the list. >> + net_info = os.popen('ifconfig').read() >> + if net_info.find(source_dev) == -1: >> + source_dev = net_info.split(' ')[0] > My guess is this would end up with trailing colon e.g. eth0: > Wouldn't it better to do the splits on the colon? So it is, on some os like Fedora 18. I find that output format of 'ip addr' is same between Fedora, Ubuntu, RHEL and CentOS. Hence in my new version patch I'll use it to recognize network card:-) Xu Wang > >> + >> guest_defined = False >> >> try: >> > From jferlan at redhat.com Fri Jul 12 00:08:50 2013 From: jferlan at redhat.com (John Ferlan) Date: Thu, 11 Jul 2013 20:08:50 -0400 Subject: [Libvirt-cim] Should we generate a new release? 0.6.3? Message-ID: <51DF4912.6070708@redhat.com> There's been a few functional changes and some cleanup - it would be nice to generate a release baseline that could then be moved into the RHEL7.0 release as well rather than picking 0.6.2 and trying to "patch in" changes that are now upstream. The last release was 4/15 so it's about 3 months later. Thoughts? John From cngesaint at gmail.com Fri Jul 12 01:19:57 2013 From: cngesaint at gmail.com (Xu Wang) Date: Fri, 12 Jul 2013 09:19:57 +0800 Subject: [Libvirt-cim] [PATCH V2] Add default network card name existence check Message-ID: <1373591997-3465-1-git-send-email-cngesaint@gmail.com> Default network card name was set as 'eth1' or 'em1'. But when os has no network card named like that, FAIL would occured. This patch added check if default name exists in the network card list and if not, change the default value into the 1st one in the list. Signed-off-by: Xu Wang --- .../27_definesystem_macvtap_dev.py | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py index 36bf52f..e096e98 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py @@ -30,6 +30,7 @@ # import sys +import os from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS, SKIP from VirtLib import utils @@ -132,6 +133,14 @@ def main(): else: source_dev = "eth1" + # The default device name may not named 'eth1' or 'em1' so this case would + # return FAIL. The following code will check if default device exists in + # the network card list and if not, source_dev will be changed into the 1st + # network card in the list. + net_info = os.popen('ip addr').read() + if net_info.find(source_dev) == -1: + source_dev = net_info.split(': ')[3] + guest_defined = False try: -- 1.7.1 From veillard at redhat.com Sat Jul 13 13:16:23 2013 From: veillard at redhat.com (Daniel Veillard) Date: Sat, 13 Jul 2013 21:16:23 +0800 Subject: [Libvirt-cim] Should we generate a new release? 0.6.3? In-Reply-To: <51DF4912.6070708@redhat.com> References: <51DF4912.6070708@redhat.com> Message-ID: <20130713131623.GO458@redhat.com> On Thu, Jul 11, 2013 at 08:08:50PM -0400, John Ferlan wrote: > > > There's been a few functional changes and some cleanup - it would be > nice to generate a release baseline that could then be moved into the > RHEL7.0 release as well rather than picking 0.6.2 and trying to "patch > in" changes that are now upstream. The last release was 4/15 so it's > about 3 months later. Fine by me, I can do this next week or later if you need a bit more cooking, Daniel -- Daniel Veillard | Open Source and Standards, Red Hat veillard at redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/ From jferlan at redhat.com Fri Jul 19 18:28:58 2013 From: jferlan at redhat.com (John Ferlan) Date: Fri, 19 Jul 2013 14:28:58 -0400 Subject: [Libvirt-cim] [PATCH 2/2] Resolve Coverity complaint In-Reply-To: <1374258538-12133-1-git-send-email-jferlan@redhat.com> References: <1374258538-12133-1-git-send-email-jferlan@redhat.com> Message-ID: <1374258538-12133-3-git-send-email-jferlan@redhat.com> Found by a scan done on the Red Hat libvirt-cim code, but still valid for the upstream code. Error: SECURE_TEMP (CWE-377): [#def23] libvirt-cim-0.6.1/src/Virt_VSMigrationService.c:504: cond_true: Condition "__retval != NULL", taking true branch libvirt-cim-0.6.1/src/Virt_VSMigrationService.c:507: cond_false: Condition "filename == NULL", taking false branch libvirt-cim-0.6.1/src/Virt_VSMigrationService.c:510: if_end: End of if statement libvirt-cim-0.6.1/src/Virt_VSMigrationService.c:512: secure_temp: Calling "mkstemp(char *)" without securely setting umask first. Resolve by adding umask code --- src/Virt_VSMigrationService.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Virt_VSMigrationService.c b/src/Virt_VSMigrationService.c index f48d56b..78f9e05 100644 --- a/src/Virt_VSMigrationService.c +++ b/src/Virt_VSMigrationService.c @@ -569,6 +569,7 @@ static char *write_params(CMPIArray *array) { int i; int fd; + mode_t cur_umask = umask(S_IRWXO|S_IRWXG); char *filename = strdup("/tmp/libvirtcim_mig.XXXXXX"); FILE *file = NULL; @@ -578,6 +579,7 @@ static char *write_params(CMPIArray *array) } fd = mkstemp(filename); + umask(cur_umask); if (fd < 0) { CU_DEBUG("Unable to get temporary file: %s", strerror(errno)); free(filename); -- 1.8.1.4 From jferlan at redhat.com Fri Jul 19 18:28:56 2013 From: jferlan at redhat.com (John Ferlan) Date: Fri, 19 Jul 2013 14:28:56 -0400 Subject: [Libvirt-cim] [PATCH 0/2] Address Coverity issues Message-ID: <1374258538-12133-1-git-send-email-jferlan@redhat.com> During a scan of the Red Hat libvirt-cim sources there were 3 issues discovered that weren't already address by upstream patches. See https://bugzilla.redhat.com/show_bug.cgi?id=885104 These patches address them... I'd like to get these in and then cut a release so that it can be included in RHEL7.0 pools which are set to close at the end of July. I ran these changes through cimtest with no new regression. John Ferlan (2): CSI: Address two Coverity isssues Resolve Coverity complaint src/Virt_ComputerSystemIndication.c | 14 ++++++++------ src/Virt_VSMigrationService.c | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-) -- 1.8.1.4 From jferlan at redhat.com Fri Jul 19 18:28:57 2013 From: jferlan at redhat.com (John Ferlan) Date: Fri, 19 Jul 2013 14:28:57 -0400 Subject: [Libvirt-cim] [PATCH 1/2] CSI: Address two Coverity isssues In-Reply-To: <1374258538-12133-1-git-send-email-jferlan@redhat.com> References: <1374258538-12133-1-git-send-email-jferlan@redhat.com> Message-ID: <1374258538-12133-2-git-send-email-jferlan@redhat.com> Found by a scan done on the Red Hat libvirt-cim code, but still valid for the upstream code. Error: CHECKED_RETURN (CWE-252): libvirt-cim-0.6.1/src/Virt_ComputerSystemIndication.c:507: switch: Switch case value "0" libvirt-cim-0.6.1/src/Virt_ComputerSystemIndication.c:508: switch_case: Reached case "0" libvirt-cim-0.6.1/src/Virt_ComputerSystemIndication.c:509: cond_false: Condition "detail == VIR_DOMAIN_EVENT_DEFINED_ADDED", taking false branch libvirt-cim-0.6.1/src/Virt_ComputerSystemIndication.c:513: else_branch: Reached else branch libvirt-cim-0.6.1/src/Virt_ComputerSystemIndication.c:513: cond_true: Condition "detail == VIR_DOMAIN_EVENT_DEFINED_UPDATED", taking true branch libvirt-cim-0.6.1/src/Virt_ComputerSystemIndication.c:518: break: Breaking from switch libvirt-cim-0.6.1/src/Virt_ComputerSystemIndication.c:529: switch_end: Reached end of switch libvirt-cim-0.6.1/src/Virt_ComputerSystemIndication.c:531: cond_true: Condition "cs_event != CS_CREATED", taking true branch libvirt-cim-0.6.1/src/Virt_ComputerSystemIndication.c:533: check_return: Calling function "virDomainGetUUIDString(virDomainPtr, char *)" without checking return value (as is done elsewhere 4 out of 5 times). libvirt-cim-0.6.1/libxkutil/infostore.c:287: example_checked: "virDomainGetUUIDString(dom, uuid)" has its value checked in "virDomainGetUUIDString(dom, uuid) != 0". libvirt-cim-0.6.1/src/Virt_ComputerSystem.c:76: example_assign: Assigning: "ret" = return value from "virDomainGetUUIDString(dom, uuid)". libvirt-cim-0.6.1/src/Virt_ComputerSystem.c:77: example_checked: "ret" has its value checked in "ret != 0". libvirt-cim-0.6.1/src/Virt_ComputerSystemIndication.c:143: example_assign: Assigning: "rc" = return value from "virDomainGetUUIDString(dom_ptr, dom->uuid)". libvirt-cim-0.6.1/src/Virt_ComputerSystemIndication.c:144: example_checked: "rc" has its value checked in "rc == -1". libvirt-cim-0.6.1/src/Virt_VSMigrationService.c:847: example_checked: "virDomainGetUUIDString(dom, uuid)" has its value checked in "virDomainGetUUIDString(dom, uuid) != 0". libvirt-cim-0.6.1/src/Virt_ComputerSystemIndication.c:533: unchecked_value: No check of the return value of "virDomainGetUUIDString(dom, &uuid[0])". Simple case of return value not being checked. In this instance the UUID would not have been filled in and the ensuing code to 'list_find' would probably fail resulting in 'dom_xml' being returned as NULL and a failure in the dom_xml == NULL check. 2. Error: DEADCODE (CWE-561): libvirt-cim-0.6.1/src/Virt_ComputerSystemIndication.c:553: dead_error_condition: The condition "event == 0" cannot be true. libvirt-cim-0.6.1/src/Virt_ComputerSystemIndication.c:553: dead_error_line: Execution cannot reach this expression "detail == 0" inside statement "if (event == 0 && detail ==...". In 'csi_domain_event_cb', the else if condition could never be reached so I just moved it inside the existing if condition. --- src/Virt_ComputerSystemIndication.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Virt_ComputerSystemIndication.c b/src/Virt_ComputerSystemIndication.c index a4d30ab..20c60bc 100644 --- a/src/Virt_ComputerSystemIndication.c +++ b/src/Virt_ComputerSystemIndication.c @@ -1269,7 +1269,10 @@ static void csi_domain_event_cb(virConnectPtr conn, if (cs_event != CS_CREATED) { char uuid[VIR_UUID_STRING_BUFLEN] = {0}; - virDomainGetUUIDString(dom, &uuid[0]); + if (virDomainGetUUIDString(dom, &uuid[0]) == -1) { + CU_DEBUG("Failed to get domain UUID"); + goto end; + } pthread_mutex_lock(&lifecycle_mutex); dom_xml = list_find(thread->dom_list, uuid); pthread_mutex_unlock(&lifecycle_mutex); @@ -1294,12 +1297,11 @@ static void csi_domain_event_cb(virConnectPtr conn, free(dom_xml->name); free(dom_xml->xml); csi_dom_xml_set(dom_xml, dom, &s); + } else if (detail == VIR_DOMAIN_EVENT_UNDEFINED_REMOVED) { + pthread_mutex_lock(&lifecycle_mutex); + list_remove(thread->dom_list, dom_xml); + pthread_mutex_unlock(&lifecycle_mutex); } - } else if (event == VIR_DOMAIN_EVENT_DEFINED && - detail == VIR_DOMAIN_EVENT_UNDEFINED_REMOVED) { - pthread_mutex_lock(&lifecycle_mutex); - list_remove(thread->dom_list, dom_xml); - pthread_mutex_unlock(&lifecycle_mutex); } end: -- 1.8.1.4 From jferlan at redhat.com Mon Jul 22 11:06:16 2013 From: jferlan at redhat.com (John Ferlan) Date: Mon, 22 Jul 2013 07:06:16 -0400 Subject: [Libvirt-cim] [PATCH V2] Add default network card name existence check In-Reply-To: <1373591997-3465-1-git-send-email-cngesaint@gmail.com> References: <1373591997-3465-1-git-send-email-cngesaint@gmail.com> Message-ID: <51ED1228.8070901@redhat.com> On 07/11/2013 09:19 PM, Xu Wang wrote: > Default network card name was set as 'eth1' or 'em1'. But when os has no network card named like that, FAIL > would occured. This patch added check if default name exists in the network card list and if not, change > the default value into the 1st one in the list. > > Signed-off-by: Xu Wang > --- > .../27_definesystem_macvtap_dev.py | 9 +++++++++ > 1 files changed, 9 insertions(+), 0 deletions(-) > > diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py > index 36bf52f..e096e98 100644 > --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py > +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py > @@ -30,6 +30,7 @@ > # > > import sys > +import os > from CimTest.Globals import logger > from CimTest.ReturnCodes import FAIL, PASS, SKIP > from VirtLib import utils > @@ -132,6 +133,14 @@ def main(): > else: > source_dev = "eth1" > > + # The default device name may not named 'eth1' or 'em1' so this case would > + # return FAIL. The following code will check if default device exists in > + # the network card list and if not, source_dev will be changed into the 1st > + # network card in the list. > + net_info = os.popen('ip addr').read() > + if net_info.find(source_dev) == -1: > + source_dev = net_info.split(': ')[3] > + > guest_defined = False > > try: > Could a similar check be added to 28_definesystem_with_vsi_profile.py? The comments in that module were from me when I was going through all the tests. How about RASD/06_parent_net_pool.py? John From cngesaint at gmail.com Wed Jul 24 02:49:19 2013 From: cngesaint at gmail.com (cngesaint at gmail.com) Date: Wed, 24 Jul 2013 10:49:19 +0800 Subject: [Libvirt-cim] [PATCH] Add shareable property to disk Message-ID: <51ef40c0.6ba8420a.7121.ffff91b7@mx.google.com> From: Xu Wang This patch adds shareable property to disks. Signed-off-by: Xu Wang --- schema/ResourceAllocationSettingData.mof | 6 ++++++ src/Virt_RASD.c | 6 ++++++ src/Virt_SettingsDefineCapabilities.c | 14 ++++++++++++++ src/Virt_VirtualSystemManagementService.c | 6 ++++++ 4 files changed, 32 insertions(+), 0 deletions(-) diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof index 108dff7..871ab04 100644 --- a/schema/ResourceAllocationSettingData.mof +++ b/schema/ResourceAllocationSettingData.mof @@ -28,6 +28,9 @@ class Xen_DiskResourceAllocationSettingData : Xen_ResourceAllocationSettingData [Description ("cache setting for device")] string DriverCache; + + [Description ("if device is shareable")] + boolean shareable; }; [Description ("KVM virtual disk configuration"), @@ -61,6 +64,9 @@ class KVM_DiskResourceAllocationSettingData : KVM_ResourceAllocationSettingData [Description ("filesystem access mode")] string AccessMode; + + [Description ("if device is shareable")] + boolean shareable; }; [Description ("LXC virtual disk configuration"), diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c index baf4331..150ccd3 100644 --- a/src/Virt_RASD.c +++ b/src/Virt_RASD.c @@ -421,6 +421,12 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker, (CMPIValue *)dev->dev.disk.access_mode, CMPI_chars); + if(dev->dev.disk.shareable) + CMSetProperty(inst, + "shareable", + (CMPIValue *)&(dev->dev.disk.shareable), + CMPI_boolean); + virStoragePoolFree(pool); virStorageVolFree(vol); virConnectClose(conn); diff --git a/src/Virt_SettingsDefineCapabilities.c b/src/Virt_SettingsDefineCapabilities.c index 2c35d84..78c128c 100644 --- a/src/Virt_SettingsDefineCapabilities.c +++ b/src/Virt_SettingsDefineCapabilities.c @@ -1039,6 +1039,7 @@ static CMPIStatus set_disk_props(int type, uint64_t disk_size, uint16_t emu_type, bool readonly, + bool shareable, const char *cache, struct inst_list *list) { @@ -1087,6 +1088,10 @@ static CMPIStatus set_disk_props(int type, CMSetProperty(inst, "readonly", (CMPIValue *)&readonly, CMPI_boolean); + if(shareable) + CMSetProperty(inst, "shareable", + (CMPIValue *)&shareable, CMPI_boolean); + if(cache != NULL) CMSetProperty(inst, "cache", (CMPIValue *)cache, CMPI_chars); @@ -1111,6 +1116,7 @@ static CMPIStatus cdrom_or_floppy_template(const CMPIObjectPath *ref, const char *dev_str = NULL; char *id_str = NULL; bool readonly = true; + bool shareable = false; const char *cache = "none"; if (emu_type == VIRT_DISK_TYPE_CDROM) @@ -1158,6 +1164,7 @@ static CMPIStatus cdrom_or_floppy_template(const CMPIObjectPath *ref, vol_size, emu_type, readonly, + shareable, cache, list); } @@ -1169,6 +1176,7 @@ static CMPIStatus cdrom_or_floppy_template(const CMPIObjectPath *ref, vol_size, emu_type, readonly, + shareable, cache, list); @@ -1244,6 +1252,7 @@ static CMPIStatus default_disk_template(const CMPIObjectPath *ref, int type = 0; bool ret; bool readonly = true; + bool shareable = false; const char *cache = "none"; CMPIStatus s = {CMPI_RC_OK, NULL}; @@ -1296,6 +1305,7 @@ static CMPIStatus default_disk_template(const CMPIObjectPath *ref, disk_size, emu_type, readonly, + shareable, cache, list); if (s.rc != CMPI_RC_OK) @@ -1317,6 +1327,7 @@ static CMPIStatus default_disk_template(const CMPIObjectPath *ref, disk_size, emu_type, readonly, + shareable, cache, list); } @@ -1444,6 +1455,7 @@ static CMPIStatus avail_volume_template(const CMPIObjectPath *ref, int ret; uint16_t emu_type = 0; bool readonly = false; + bool shareable = false; const char *cache = "none"; ret = virStorageVolGetInfo(volume_ptr, &vol_info); @@ -1502,6 +1514,7 @@ static CMPIStatus avail_volume_template(const CMPIObjectPath *ref, vol_size, emu_type, readonly, + shareable, cache, list); } @@ -1513,6 +1526,7 @@ static CMPIStatus avail_volume_template(const CMPIObjectPath *ref, vol_size, emu_type, readonly, + shareable, cache, list); } else { diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c index 5adfe20..8ced2d6 100644 --- a/src/Virt_VirtualSystemManagementService.c +++ b/src/Virt_VirtualSystemManagementService.c @@ -994,6 +994,7 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, uint16_t type; bool read = false; int rc; + bool shareable = false; CU_DEBUG("Enter disk_rasd_to_vdev"); if (cu_get_str_prop(inst, "VirtualDevice", &val) != CMPI_RC_OK) @@ -1093,6 +1094,11 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, else dev->dev.disk.access_mode = strdup(val); + if (cu_get_bool_prop(inst, "shareable", &shareable) != CMPI_RC_OK) + dev->dev.disk.shareable = false; + else + dev->dev.disk.shareable = shareable; + free(dev->id); dev->id = strdup(dev->dev.disk.virtual_dev); -- 1.7.1 From veillard at redhat.com Thu Jul 25 06:47:46 2013 From: veillard at redhat.com (Daniel Veillard) Date: Thu, 25 Jul 2013 14:47:46 +0800 Subject: [Libvirt-cim] [PATCH V2] Add default network card name existence check In-Reply-To: <1373591997-3465-1-git-send-email-cngesaint@gmail.com> References: <1373591997-3465-1-git-send-email-cngesaint@gmail.com> Message-ID: <20130725064746.GK2278@redhat.com> On Fri, Jul 12, 2013 at 09:19:57AM +0800, Xu Wang wrote: > Default network card name was set as 'eth1' or 'em1'. But when os has no network card named like that, FAIL > would occured. This patch added check if default name exists in the network card list and if not, change > the default value into the 1st one in the list. > > Signed-off-by: Xu Wang > --- > .../27_definesystem_macvtap_dev.py | 9 +++++++++ > 1 files changed, 9 insertions(+), 0 deletions(-) Looks reasonnable, pushed, thanks ! Daniel -- Daniel Veillard | Open Source and Standards, Red Hat veillard at redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/ From veillard at redhat.com Thu Jul 25 07:29:11 2013 From: veillard at redhat.com (Daniel Veillard) Date: Thu, 25 Jul 2013 15:29:11 +0800 Subject: [Libvirt-cim] [PATCH 0/2] Address Coverity issues In-Reply-To: <1374258538-12133-1-git-send-email-jferlan@redhat.com> References: <1374258538-12133-1-git-send-email-jferlan@redhat.com> Message-ID: <20130725072910.GL2278@redhat.com> On Fri, Jul 19, 2013 at 02:28:56PM -0400, John Ferlan wrote: > During a scan of the Red Hat libvirt-cim sources there were 3 issues > discovered that weren't already address by upstream patches. See > > https://bugzilla.redhat.com/show_bug.cgi?id=885104 > > These patches address them... I'd like to get these in and then cut a > release so that it can be included in RHEL7.0 pools which are set to > close at the end of July. > > I ran these changes through cimtest with no new regression. > > John Ferlan (2): > CSI: Address two Coverity isssues > Resolve Coverity complaint > > src/Virt_ComputerSystemIndication.c | 14 ++++++++------ > src/Virt_VSMigrationService.c | 2 ++ > 2 files changed, 10 insertions(+), 6 deletions(-) Okay, from an eye review both patches looks fine, so applied and pushed ! thanks ! Daniel -- Daniel Veillard | Open Source and Standards, Red Hat veillard at redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/ From veillard at redhat.com Thu Jul 25 07:33:14 2013 From: veillard at redhat.com (Daniel Veillard) Date: Thu, 25 Jul 2013 15:33:14 +0800 Subject: [Libvirt-cim] [PATCH] Add shareable property to disk In-Reply-To: <51ef40c0.6ba8420a.7121.ffff91b7@mx.google.com> References: <51ef40c0.6ba8420a.7121.ffff91b7@mx.google.com> Message-ID: <20130725073314.GM2278@redhat.com> On Wed, Jul 24, 2013 at 10:49:19AM +0800, cngesaint at gmail.com wrote: > From: Xu Wang > > This patch adds shareable property to disks. > > Signed-off-by: Xu Wang > --- > schema/ResourceAllocationSettingData.mof | 6 ++++++ > src/Virt_RASD.c | 6 ++++++ > src/Virt_SettingsDefineCapabilities.c | 14 ++++++++++++++ > src/Virt_VirtualSystemManagementService.c | 6 ++++++ > 4 files changed, 32 insertions(+), 0 deletions(-) > > diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof > index 108dff7..871ab04 100644 > --- a/schema/ResourceAllocationSettingData.mof > +++ b/schema/ResourceAllocationSettingData.mof > @@ -28,6 +28,9 @@ class Xen_DiskResourceAllocationSettingData : Xen_ResourceAllocationSettingData > > [Description ("cache setting for device")] > string DriverCache; > + > + [Description ("if device is shareable")] > + boolean shareable; > }; > > [Description ("KVM virtual disk configuration"), > @@ -61,6 +64,9 @@ class KVM_DiskResourceAllocationSettingData : KVM_ResourceAllocationSettingData > > [Description ("filesystem access mode")] > string AccessMode; > + > + [Description ("if device is shareable")] > + boolean shareable; > }; > > [Description ("LXC virtual disk configuration"), > diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c > index baf4331..150ccd3 100644 > --- a/src/Virt_RASD.c > +++ b/src/Virt_RASD.c > @@ -421,6 +421,12 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker, > (CMPIValue *)dev->dev.disk.access_mode, > CMPI_chars); > > + if(dev->dev.disk.shareable) > + CMSetProperty(inst, > + "shareable", > + (CMPIValue *)&(dev->dev.disk.shareable), > + CMPI_boolean); > + > virStoragePoolFree(pool); > virStorageVolFree(vol); > virConnectClose(conn); > diff --git a/src/Virt_SettingsDefineCapabilities.c b/src/Virt_SettingsDefineCapabilities.c > index 2c35d84..78c128c 100644 > --- a/src/Virt_SettingsDefineCapabilities.c > +++ b/src/Virt_SettingsDefineCapabilities.c > @@ -1039,6 +1039,7 @@ static CMPIStatus set_disk_props(int type, > uint64_t disk_size, > uint16_t emu_type, > bool readonly, > + bool shareable, > const char *cache, > struct inst_list *list) > { > @@ -1087,6 +1088,10 @@ static CMPIStatus set_disk_props(int type, > CMSetProperty(inst, "readonly", > (CMPIValue *)&readonly, CMPI_boolean); > > + if(shareable) > + CMSetProperty(inst, "shareable", > + (CMPIValue *)&shareable, CMPI_boolean); > + > if(cache != NULL) > CMSetProperty(inst, "cache", > (CMPIValue *)cache, CMPI_chars); > @@ -1111,6 +1116,7 @@ static CMPIStatus cdrom_or_floppy_template(const CMPIObjectPath *ref, > const char *dev_str = NULL; > char *id_str = NULL; > bool readonly = true; > + bool shareable = false; > const char *cache = "none"; > > if (emu_type == VIRT_DISK_TYPE_CDROM) > @@ -1158,6 +1164,7 @@ static CMPIStatus cdrom_or_floppy_template(const CMPIObjectPath *ref, > vol_size, > emu_type, > readonly, > + shareable, > cache, > list); > } > @@ -1169,6 +1176,7 @@ static CMPIStatus cdrom_or_floppy_template(const CMPIObjectPath *ref, > vol_size, > emu_type, > readonly, > + shareable, > cache, > list); > > @@ -1244,6 +1252,7 @@ static CMPIStatus default_disk_template(const CMPIObjectPath *ref, > int type = 0; > bool ret; > bool readonly = true; > + bool shareable = false; > const char *cache = "none"; > > CMPIStatus s = {CMPI_RC_OK, NULL}; > @@ -1296,6 +1305,7 @@ static CMPIStatus default_disk_template(const CMPIObjectPath *ref, > disk_size, > emu_type, > readonly, > + shareable, > cache, > list); > if (s.rc != CMPI_RC_OK) > @@ -1317,6 +1327,7 @@ static CMPIStatus default_disk_template(const CMPIObjectPath *ref, > disk_size, > emu_type, > readonly, > + shareable, > cache, > list); > } > @@ -1444,6 +1455,7 @@ static CMPIStatus avail_volume_template(const CMPIObjectPath *ref, > int ret; > uint16_t emu_type = 0; > bool readonly = false; > + bool shareable = false; > const char *cache = "none"; > > ret = virStorageVolGetInfo(volume_ptr, &vol_info); > @@ -1502,6 +1514,7 @@ static CMPIStatus avail_volume_template(const CMPIObjectPath *ref, > vol_size, > emu_type, > readonly, > + shareable, > cache, > list); > } > @@ -1513,6 +1526,7 @@ static CMPIStatus avail_volume_template(const CMPIObjectPath *ref, > vol_size, > emu_type, > readonly, > + shareable, > cache, > list); > } else { > diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c > index 5adfe20..8ced2d6 100644 > --- a/src/Virt_VirtualSystemManagementService.c > +++ b/src/Virt_VirtualSystemManagementService.c > @@ -994,6 +994,7 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, > uint16_t type; > bool read = false; > int rc; > + bool shareable = false; > > CU_DEBUG("Enter disk_rasd_to_vdev"); > if (cu_get_str_prop(inst, "VirtualDevice", &val) != CMPI_RC_OK) > @@ -1093,6 +1094,11 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, > else > dev->dev.disk.access_mode = strdup(val); > > + if (cu_get_bool_prop(inst, "shareable", &shareable) != CMPI_RC_OK) > + dev->dev.disk.shareable = false; > + else > + dev->dev.disk.shareable = shareable; > + > free(dev->id); > dev->id = strdup(dev->dev.disk.virtual_dev); > > -- > 1.7.1 This looks rather simple. My only worry is if this could change some of the public ABI, but exposing that property is important, and in the case of breaking ABI I would rather do it now than later, So I'm pushing this patch now, before the release, hopefully this is the right decision... thanks, Daniel -- Daniel Veillard | Open Source and Standards, Red Hat veillard at redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/ From cngesaint at gmail.com Thu Jul 25 07:52:36 2013 From: cngesaint at gmail.com (Xu Wang) Date: Thu, 25 Jul 2013 15:52:36 +0800 Subject: [Libvirt-cim] [PATCH] Add OS version check to decide use service or systemctl command Message-ID: <1374738756-5891-1-git-send-email-cngesaint@gmail.com> Only when version of Fedora more than/equal with 17 or version of RHEL more than/equal with 7, the system could use systemd to manage services. Except above systems only "service" command could be used instead of systemctl. This patch checks system version before restart service after installation finished and decide which command to be used to avoid "systemctl: Command not found" error happened on some system such as RHEL6.4. Signed-off-by: Xu Wang --- libvirt-cim.spec.in | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-) diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in index d024c59..7b6221e 100644 --- a/libvirt-cim.spec.in +++ b/libvirt-cim.spec.in @@ -89,15 +89,19 @@ rm -fr $RPM_BUILD_ROOT %{_datadir}/%{name}/install_base_schema.sh %{_datadir}/%{name} -if [ "`systemctl is-active tog-pegasus.service`" = "active" ] -then - systemctl restart tog-pegasus.service -fi - -if [ "`systemctl is-active sblim-sfcb.service`" = "active" ] -then - systemctl restart sblim-sfcb.service -fi +%if 0%{?Fedora} >= 17 || 0%{?rhel} >= 7 + if [ "`systemctl is-active tog-pegasus.service`" = "active" ] + then + systemctl restart tog-pegasus.service + fi + + if [ "`systemctl is-active sblim-sfcb.service`" = "active" ] + then + systemctl restart sblim-sfcb.service + fi +%else + /etc/init.d/tog-pegasus condrestart +%endif if [ -x /usr/sbin/cimserver ] then -- 1.7.1 From cngesaint at outlook.com Thu Jul 25 08:03:13 2013 From: cngesaint at outlook.com (WangXu) Date: Thu, 25 Jul 2013 08:03:13 +0000 Subject: [Libvirt-cim] [PATCH] Add shareable property to disk In-Reply-To: <20130725073314.GM2278@redhat.com> References: <51ef40c0.6ba8420a.7121.ffff91b7@mx.google.com>, <20130725073314.GM2278@redhat.com> Message-ID: ---------------------------------------- > Date: Thu, 25 Jul 2013 15:33:14 +0800 > From: veillard at redhat.com > To: libvirt-cim at redhat.com > Subject: Re: [Libvirt-cim] [PATCH] Add shareable property to disk > > On Wed, Jul 24, 2013 at 10:49:19AM +0800, cngesaint at gmail.com wrote: >> From: Xu Wang >> >> This patch adds shareable property to disks. >> >> Signed-off-by: Xu Wang >> --- >> schema/ResourceAllocationSettingData.mof | 6 ++++++ >> src/Virt_RASD.c | 6 ++++++ >> src/Virt_SettingsDefineCapabilities.c | 14 ++++++++++++++ >> src/Virt_VirtualSystemManagementService.c | 6 ++++++ >> 4 files changed, 32 insertions(+), 0 deletions(-) >> >> diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof >> index 108dff7..871ab04 100644 >> --- a/schema/ResourceAllocationSettingData.mof >> +++ b/schema/ResourceAllocationSettingData.mof >> @@ -28,6 +28,9 @@ class Xen_DiskResourceAllocationSettingData : Xen_ResourceAllocationSettingData >> >> [Description ("cache setting for device")] >> string DriverCache; >> + >> + [Description ("if device is shareable")] >> + boolean shareable; >> }; >> >> [Description ("KVM virtual disk configuration"), >> @@ -61,6 +64,9 @@ class KVM_DiskResourceAllocationSettingData : KVM_ResourceAllocationSettingData >> >> [Description ("filesystem access mode")] >> string AccessMode; >> + >> + [Description ("if device is shareable")] >> + boolean shareable; >> }; >> >> [Description ("LXC virtual disk configuration"), >> diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c >> index baf4331..150ccd3 100644 >> --- a/src/Virt_RASD.c >> +++ b/src/Virt_RASD.c >> @@ -421,6 +421,12 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker, >> (CMPIValue *)dev->dev.disk.access_mode, >> CMPI_chars); >> >> + if(dev->dev.disk.shareable) >> + CMSetProperty(inst, >> + "shareable", >> + (CMPIValue *)&(dev->dev.disk.shareable), >> + CMPI_boolean); >> + >> virStoragePoolFree(pool); >> virStorageVolFree(vol); >> virConnectClose(conn); >> diff --git a/src/Virt_SettingsDefineCapabilities.c b/src/Virt_SettingsDefineCapabilities.c >> index 2c35d84..78c128c 100644 >> --- a/src/Virt_SettingsDefineCapabilities.c >> +++ b/src/Virt_SettingsDefineCapabilities.c >> @@ -1039,6 +1039,7 @@ static CMPIStatus set_disk_props(int type, >> uint64_t disk_size, >> uint16_t emu_type, >> bool readonly, >> + bool shareable, >> const char *cache, >> struct inst_list *list) >> { >> @@ -1087,6 +1088,10 @@ static CMPIStatus set_disk_props(int type, >> CMSetProperty(inst, "readonly", >> (CMPIValue *)&readonly, CMPI_boolean); >> >> + if(shareable) >> + CMSetProperty(inst, "shareable", >> + (CMPIValue *)&shareable, CMPI_boolean); >> + >> if(cache != NULL) >> CMSetProperty(inst, "cache", >> (CMPIValue *)cache, CMPI_chars); >> @@ -1111,6 +1116,7 @@ static CMPIStatus cdrom_or_floppy_template(const CMPIObjectPath *ref, >> const char *dev_str = NULL; >> char *id_str = NULL; >> bool readonly = true; >> + bool shareable = false; >> const char *cache = "none"; >> >> if (emu_type == VIRT_DISK_TYPE_CDROM) >> @@ -1158,6 +1164,7 @@ static CMPIStatus cdrom_or_floppy_template(const CMPIObjectPath *ref, >> vol_size, >> emu_type, >> readonly, >> + shareable, >> cache, >> list); >> } >> @@ -1169,6 +1176,7 @@ static CMPIStatus cdrom_or_floppy_template(const CMPIObjectPath *ref, >> vol_size, >> emu_type, >> readonly, >> + shareable, >> cache, >> list); >> >> @@ -1244,6 +1252,7 @@ static CMPIStatus default_disk_template(const CMPIObjectPath *ref, >> int type = 0; >> bool ret; >> bool readonly = true; >> + bool shareable = false; >> const char *cache = "none"; >> >> CMPIStatus s = {CMPI_RC_OK, NULL}; >> @@ -1296,6 +1305,7 @@ static CMPIStatus default_disk_template(const CMPIObjectPath *ref, >> disk_size, >> emu_type, >> readonly, >> + shareable, >> cache, >> list); >> if (s.rc != CMPI_RC_OK) >> @@ -1317,6 +1327,7 @@ static CMPIStatus default_disk_template(const CMPIObjectPath *ref, >> disk_size, >> emu_type, >> readonly, >> + shareable, >> cache, >> list); >> } >> @@ -1444,6 +1455,7 @@ static CMPIStatus avail_volume_template(const CMPIObjectPath *ref, >> int ret; >> uint16_t emu_type = 0; >> bool readonly = false; >> + bool shareable = false; >> const char *cache = "none"; >> >> ret = virStorageVolGetInfo(volume_ptr, &vol_info); >> @@ -1502,6 +1514,7 @@ static CMPIStatus avail_volume_template(const CMPIObjectPath *ref, >> vol_size, >> emu_type, >> readonly, >> + shareable, >> cache, >> list); >> } >> @@ -1513,6 +1526,7 @@ static CMPIStatus avail_volume_template(const CMPIObjectPath *ref, >> vol_size, >> emu_type, >> readonly, >> + shareable, >> cache, >> list); >> } else { >> diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c >> index 5adfe20..8ced2d6 100644 >> --- a/src/Virt_VirtualSystemManagementService.c >> +++ b/src/Virt_VirtualSystemManagementService.c >> @@ -994,6 +994,7 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, >> uint16_t type; >> bool read = false; >> int rc; >> + bool shareable = false; >> >> CU_DEBUG("Enter disk_rasd_to_vdev"); >> if (cu_get_str_prop(inst, "VirtualDevice", &val) != CMPI_RC_OK) >> @@ -1093,6 +1094,11 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, >> else >> dev->dev.disk.access_mode = strdup(val); >> >> + if (cu_get_bool_prop(inst, "shareable", &shareable) != CMPI_RC_OK) >> + dev->dev.disk.shareable = false; >> + else >> + dev->dev.disk.shareable = shareable; >> + >> free(dev->id); >> dev->id = strdup(dev->dev.disk.virtual_dev); >> >> -- >> 1.7.1 > > This looks rather simple. My only worry is if this could change some > of the public ABI, but exposing that property is important, and in the > case of breaking ABI I would rather do it now than later, > > So I'm pushing this patch now, before the release, hopefully this > is the right decision... > > thanks, > > Daniel I made this patch because some others reported a bug and there is such a request to need shareable added into public API. There was part of it implemented before I made my patch. If shareable tag was added, it would not effect the old users and satisfied the new request from users. So please don't worry about that. If some others have better suggestions I'd like to take them into consideration :-) Xu Wang > > -- > Daniel Veillard | Open Source and Standards, Red Hat > veillard at redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ > http://veillard.com/ | virtualization library http://libvirt.org/ > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From veillard at redhat.com Thu Jul 25 09:05:09 2013 From: veillard at redhat.com (Daniel Veillard) Date: Thu, 25 Jul 2013 17:05:09 +0800 Subject: [Libvirt-cim] [PATCH] Add OS version check to decide use service or systemctl command In-Reply-To: <1374738756-5891-1-git-send-email-cngesaint@gmail.com> References: <1374738756-5891-1-git-send-email-cngesaint@gmail.com> Message-ID: <20130725090509.GN2278@redhat.com> On Thu, Jul 25, 2013 at 03:52:36PM +0800, Xu Wang wrote: > Only when version of Fedora more than/equal with 17 or version of > RHEL more than/equal with 7, the system could use systemd to manage > services. Except above systems only "service" command could be used > instead of systemctl. This patch checks system version before restart > service after installation finished and decide which command to be > used to avoid "systemctl: Command not found" error happened on some > system such as RHEL6.4. > > Signed-off-by: Xu Wang > --- > libvirt-cim.spec.in | 22 +++++++++++++--------- > 1 files changed, 13 insertions(+), 9 deletions(-) > > diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in > index d024c59..7b6221e 100644 > --- a/libvirt-cim.spec.in > +++ b/libvirt-cim.spec.in > @@ -89,15 +89,19 @@ rm -fr $RPM_BUILD_ROOT > > %{_datadir}/%{name}/install_base_schema.sh %{_datadir}/%{name} > > -if [ "`systemctl is-active tog-pegasus.service`" = "active" ] > -then > - systemctl restart tog-pegasus.service > -fi > - > -if [ "`systemctl is-active sblim-sfcb.service`" = "active" ] > -then > - systemctl restart sblim-sfcb.service > -fi > +%if 0%{?Fedora} >= 17 || 0%{?rhel} >= 7 > + if [ "`systemctl is-active tog-pegasus.service`" = "active" ] > + then > + systemctl restart tog-pegasus.service > + fi > + > + if [ "`systemctl is-active sblim-sfcb.service`" = "active" ] > + then > + systemctl restart sblim-sfcb.service > + fi > +%else > + /etc/init.d/tog-pegasus condrestart > +%endif > > if [ -x /usr/sbin/cimserver ] > then > -- > 1.7.1 okay, it's reasonable to keep this working on RHEL-6 for example, I didn't realized I had broken this, ACK, and pushed, thanks ! Daniel -- Daniel Veillard | Open Source and Standards, Red Hat veillard at redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/ From veillard at redhat.com Thu Jul 25 09:17:28 2013 From: veillard at redhat.com (Daniel Veillard) Date: Thu, 25 Jul 2013 17:17:28 +0800 Subject: [Libvirt-cim] Release of libvirt-cim 0.6.3 Message-ID: <20130725091728.GP2278@redhat.com> As promised I looked at the set of patches left without attention, all looked okay, so I pushed them and making the expected release. libvirt-cim-0.6.3 is now tagged in git and available in tarballs and rpms at the usual FTP location: ftp://libvirt.org/libvirt-cim/ This is mostly a bug fix release as John chased all the Coverity reports on the code base and provided fixes, there is also a few improvement from Xu Wang: Improvements: - Add shareable property to disk (Xu Wang) - Update GPL (John Ferlan) - Improve support of nested KVM (Xu Wang) - make lldptool command and support output configurable (Xu Wang) - add an config option to disable KVM acceleration. (Xu Wang) - Update spec file with changes coming from Fedora (Daniel Veillard) Bug fixes: - Resolve Coverity complaint (John Ferlan) - CSI: Address two Coverity isssues (John Ferlan) - Fix kvm support check logic (Xu Wang) - Coverity: Resolve ARRAY_VS_SINGLETON - get_dev_paths() and callers (John Ferlan) - Coverity: Resolve USE_AFTER_FREE - lifecycle_thread_native() (John Ferlan) - Coverity: Resolve UNUSED_VALUE - system_xml() && mem_xml() (John Ferlan) - Coverity: Resolve UNINIT - vsss_delete_snapshot() (John Ferlan) - Coverity: Resolve REVERSE_INULL - lifecycle_thread_native() (John Ferlan) - Coverity: Resolve REVERSE_INULL - doms_to_xml() (John Ferlan) - Coverity: Resolve RESOURCE_LEAK - parse_os() (John Ferlan) - Coverity: Resolve NO_EFFECT - _set_fv_prop() (John Ferlan) - Coverity: Resolve NO_EFFECT - set_proc_rasd_params() (John Ferlan) - Coverity: Resolve DEADCODE - octets_from_ip() (John Ferlan) - Coverity: Resolve DEADCODE - get_hypervisor_enabled() (John Ferlan) - Coverity: Resolve DEADCODE - do_parse() (John Ferlan) - Coverity: Resolve CHECKED_RETURN - return_enum_rasds() (John Ferlan) - Coverity: Resolve CHECKED_RETURN - mem_rasd_to_vdev() (John Ferlan) - Coverity: Resolve CHECKED_RETURN - get_pools() (John Ferlan) - Coverity: Resolve CHECKED_RETURN - get_dev_from_pool (John Ferlan) - Coverity: Resolve CHECKED_RETURN - filter_by_pool() (John Ferlan) - Coverity: Resolve CHECKED_RETURN - _generic_infostore_open() (John Ferlan) - Coverity: Resolve BAD_COMPARE - ActivateFilter() (John Ferlan) - VSMS: tip error for invalid disk resource (Xu Wang) thanks for the patches and efforts to bring up this release :-) ! Daniel -- Daniel Veillard | Open Source and Standards, Red Hat veillard at redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/