Re: [libvirt] [PATCH] conf: fix running vm numa settings disappear after restart libvirtd

2015-03-24 Thread Peter Krempa
On Mon, Mar 23, 2015 at 20:11:19 +0800, Luyao Huang wrote:
> 
> On 03/23/2015 06:10 PM, Peter Krempa wrote:
> > On Thu, Mar 19, 2015 at 18:13:04 +0800, Luyao Huang wrote:
> >> 5bba61f introduce a issue : when start a vm with  settings and
> >> restart libvirtd, numa settings will disappear. Because when parse the
> >> vm states file, there is no node in "/domain/cpu/numa" this place.
> >>
> >> Change to use ./cpu/numa instead of /domain/cpu/numa.
> >>
> >> Signed-off-by: Luyao Huang 
> >> ---
> >>   src/conf/numa_conf.c | 4 ++--
> >>   1 file changed, 2 insertions(+), 2 deletions(-)
> > Indeed the status XML wraps the   element with another container
> > element.
> 
> Yes, i just didn't know how to describe it in a right way when i wrote 
> this :)
> 
> >> diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
> >> index b92cb44..c34ba5f 100644
> >> --- a/src/conf/numa_conf.c
> >> +++ b/src/conf/numa_conf.c
> >> @@ -663,10 +663,10 @@ virDomainNumaDefCPUParseXML(virDomainNumaPtr def,
> >>   int ret = -1;
> >>   
> >>   /* check if NUMA definition is present */
> >> -if (!virXPathNode("/domain/cpu/numa[1]", ctxt))
> >> +if (!virXPathNode("./cpu/numa[1]", ctxt))
> >>   return 0;
> >>   
> >> -if ((n = virXPathNodeSet("/domain/cpu/numa[1]/cell", ctxt, &nodes)) 
> >> <= 0) {
> >> +if ((n = virXPathNodeSet("./cpu/numa[1]/cell", ctxt, &nodes)) <= 0) {
> >>   virReportError(VIR_ERR_XML_ERROR, "%s",
> >>  _("NUMA topology defined without NUMA cells"));
> >>   goto cleanup;
> >> -- 
> > ACK, I'll push your patch after I figure out how to add tests for
> > problems like this.

I've pushed this patch as I've written tests that don't work without it.
I'll submit the tests later today.

Peter


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

Re: [libvirt] [PATCH] conf: fix running vm numa settings disappear after restart libvirtd

2015-03-23 Thread Luyao Huang


On 03/23/2015 06:10 PM, Peter Krempa wrote:

On Thu, Mar 19, 2015 at 18:13:04 +0800, Luyao Huang wrote:

5bba61f introduce a issue : when start a vm with  settings and
restart libvirtd, numa settings will disappear. Because when parse the
vm states file, there is no node in "/domain/cpu/numa" this place.

Change to use ./cpu/numa instead of /domain/cpu/numa.

Signed-off-by: Luyao Huang 
---
  src/conf/numa_conf.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

Indeed the status XML wraps the   element with another container
element.


Yes, i just didn't know how to describe it in a right way when i wrote 
this :)



diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index b92cb44..c34ba5f 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -663,10 +663,10 @@ virDomainNumaDefCPUParseXML(virDomainNumaPtr def,
  int ret = -1;
  
  /* check if NUMA definition is present */

-if (!virXPathNode("/domain/cpu/numa[1]", ctxt))
+if (!virXPathNode("./cpu/numa[1]", ctxt))
  return 0;
  
-if ((n = virXPathNodeSet("/domain/cpu/numa[1]/cell", ctxt, &nodes)) <= 0) {

+if ((n = virXPathNodeSet("./cpu/numa[1]/cell", ctxt, &nodes)) <= 0) {
  virReportError(VIR_ERR_XML_ERROR, "%s",
 _("NUMA topology defined without NUMA cells"));
  goto cleanup;
--

ACK, I'll push your patch after I figure out how to add tests for
problems like this.


Thanks for your review.



Peter


Luyao

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


Re: [libvirt] [PATCH] conf: fix running vm numa settings disappear after restart libvirtd

2015-03-23 Thread Peter Krempa
On Thu, Mar 19, 2015 at 18:13:04 +0800, Luyao Huang wrote:
> 5bba61f introduce a issue : when start a vm with  settings and
> restart libvirtd, numa settings will disappear. Because when parse the
> vm states file, there is no node in "/domain/cpu/numa" this place.
> 
> Change to use ./cpu/numa instead of /domain/cpu/numa.
> 
> Signed-off-by: Luyao Huang 
> ---
>  src/conf/numa_conf.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Indeed the status XML wraps the   element with another container
element.

> 
> diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
> index b92cb44..c34ba5f 100644
> --- a/src/conf/numa_conf.c
> +++ b/src/conf/numa_conf.c
> @@ -663,10 +663,10 @@ virDomainNumaDefCPUParseXML(virDomainNumaPtr def,
>  int ret = -1;
>  
>  /* check if NUMA definition is present */
> -if (!virXPathNode("/domain/cpu/numa[1]", ctxt))
> +if (!virXPathNode("./cpu/numa[1]", ctxt))
>  return 0;
>  
> -if ((n = virXPathNodeSet("/domain/cpu/numa[1]/cell", ctxt, &nodes)) <= 
> 0) {
> +if ((n = virXPathNodeSet("./cpu/numa[1]/cell", ctxt, &nodes)) <= 0) {
>  virReportError(VIR_ERR_XML_ERROR, "%s",
> _("NUMA topology defined without NUMA cells"));
>  goto cleanup;
> -- 

ACK, I'll push your patch after I figure out how to add tests for
problems like this.

Peter


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

[libvirt] [PATCH] conf: fix running vm numa settings disappear after restart libvirtd

2015-03-19 Thread Luyao Huang
5bba61f introduce a issue : when start a vm with  settings and
restart libvirtd, numa settings will disappear. Because when parse the
vm states file, there is no node in "/domain/cpu/numa" this place.

Change to use ./cpu/numa instead of /domain/cpu/numa.

Signed-off-by: Luyao Huang 
---
 src/conf/numa_conf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index b92cb44..c34ba5f 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -663,10 +663,10 @@ virDomainNumaDefCPUParseXML(virDomainNumaPtr def,
 int ret = -1;
 
 /* check if NUMA definition is present */
-if (!virXPathNode("/domain/cpu/numa[1]", ctxt))
+if (!virXPathNode("./cpu/numa[1]", ctxt))
 return 0;
 
-if ((n = virXPathNodeSet("/domain/cpu/numa[1]/cell", ctxt, &nodes)) <= 0) {
+if ((n = virXPathNodeSet("./cpu/numa[1]/cell", ctxt, &nodes)) <= 0) {
 virReportError(VIR_ERR_XML_ERROR, "%s",
_("NUMA topology defined without NUMA cells"));
 goto cleanup;
-- 
1.8.3.1

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