Re: [libvirt] [OSSTEST PATCH 1/2] libvirt: Check migration capabilities using proper XML parser

2016-10-11 Thread Ian Jackson
Julien Grall writes ("Re: [OSSTEST PATCH 1/2] libvirt: Check migration 
capabilities using proper XML parser"):
> live migration is not currently the supported but will be in the future. 
> FWIW, there is a patch series on xen-devel to support dead migration 
> (first step for live migration) [1].
> 
> I hope this answer to your question.

Yes, thanks.

Thanks everyone, the patches (as discessed etc.) are now in the
osstest self-push-gate.

Ian.

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


Re: [libvirt] [OSSTEST PATCH 1/2] libvirt: Check migration capabilities using proper XML parser

2016-10-11 Thread Julien Grall

Hi Ian,

On 06/10/16 11:00, Ian Jackson wrote:

Julien Grall writes ("Re: [OSSTEST PATCH 1/2] libvirt: Check migration capabilities 
using proper XML parser"):

On 04/10/2016 10:05, Ian Jackson wrote:

Missing _.  I didn't test this again before sending it.  I'd still
like a review from libvirt (and Xen/ARM) folks.


I am not sure what kind of input you would need from Xen/ARM. This patch
set looks very libvirt specific.


It is.  Sorry to spam you with the whole thread.  The only thing I
need from Xen/ARM people is a sanity check that my understanding of
the current and likely future supported features is correct.


live migration is not currently the supported but will be in the future. 
FWIW, there is a patch series on xen-devel to support dead migration 
(first step for live migration) [1].


I hope this answer to your question.

Cheers,

[1] 
https://lists.xenproject.org/archives/html/xen-devel/2015-12/msg01053.html



--
Julien Grall

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


Re: [libvirt] [OSSTEST PATCH 1/2] libvirt: Check migration capabilities using proper XML parser

2016-10-06 Thread Ian Jackson
Julien Grall writes ("Re: [OSSTEST PATCH 1/2] libvirt: Check migration 
capabilities using proper XML parser"):
> On 04/10/2016 10:05, Ian Jackson wrote:
> > Missing _.  I didn't test this again before sending it.  I'd still
> > like a review from libvirt (and Xen/ARM) folks.
> 
> I am not sure what kind of input you would need from Xen/ARM. This patch 
> set looks very libvirt specific.

It is.  Sorry to spam you with the whole thread.  The only thing I
need from Xen/ARM people is a sanity check that my understanding of
the current and likely future supported features is correct.

Thanks,
Ian.

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


Re: [libvirt] [OSSTEST PATCH 1/2] libvirt: Check migration capabilities using proper XML parser

2016-10-05 Thread Jim Fehlig

On 10/04/2016 11:02 AM, Ian Jackson wrote:

Do not grep the virsh capabilities output (!)  Instead, parse the XML
using perl's XML modules and look for the specific feature flag using
an XPATH pattern.

AFAICT from looking at the XML, that's


  

  

But the original code does not test for .

Xen could in principle (and AIUI might in the future, on ARM) support
save/restore but not live migration.  Currently it supports neither.

I don't know whether libvirt's capabilities system can capture this
distinction.  libvirt.git#1d37a4c4 "libxl: detect support for save and
restore" suggests not.


That's correct. But as Martin suggested in 2/2, libvirt could be enhanced to 
report the distinction if/when needed.




Perhaps relatedly, I am not sure whether this test should be changed
to look for the xpath
  /capabilities/host/migration_features/live
instead.  The schema (libvirt.git/docs/schemas/capability.rng) seems
to suggest that it probably should.


Agreed. migrate_check() should look for
/capabilities/host/migration_features/live.

Regards,
Jim



For now, this osstest commit has no ultimate functional change (with
libvirt output as it currently appears to be on real hosts).

Signed-off-by: Ian Jackson 
CC: Julien Grall 
CC: Jim Fehlig 
---
 Osstest/Toolstack/libvirt.pm | 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm
index 69ff0bb..b7db7af 100644
--- a/Osstest/Toolstack/libvirt.pm
+++ b/Osstest/Toolstack/libvirt.pm
@@ -21,6 +21,8 @@ use strict;
 use warnings;

 use Osstest::TestSupport;
+use XML::LibXML::XPathContext;
+use XML::LibXML;

 sub new {
 my ($class, $ho, $methname,$asset) = @_;
@@ -72,6 +74,17 @@ sub shutdown_wait ($$$) {
 guest_await_destroy($gho,$timeout);
 }

+sub _check_capability ($$) {
+my ($self, $xpath) = @_;
+my $ho = $self->{Host};
+my $caps = target_cmd_output_root($ho, 'virsh capabilities');
+my $stash = open_unique_stashfile('virsh-capabilities');
+my $dom = XML::LibXML->load_xml(string => $caps);
+my $xc = XML::LibXML::XPathContext->new($dom);
+my @nodes = $xc->findnodes($xpath);
+return !!@nodes;
+}
+
 sub migrate_check ($$) {
 my ($self, $local) = @_;
 my $rc;
@@ -80,9 +93,7 @@ sub migrate_check ($$) {
 # local migration is not supported
 $rc = 1;
 } else {
-   my $ho = $self->{Host};
-   my $caps = target_cmd_output_root($ho, "virsh capabilities");
-   $rc = ($caps =~ m//) ? 0 : 1
+   $rc = $self->check_capability('/capabilities/host/migration_features');
 }

 logm("rc=$rc");



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


Re: [libvirt] [OSSTEST PATCH 1/2] libvirt: Check migration capabilities using proper XML parser

2016-10-05 Thread Julien Grall

Hi Ian,

On 04/10/2016 10:05, Ian Jackson wrote:

Ian Jackson writes ("[OSSTEST PATCH 1/2] libvirt: Check migration capabilities using 
proper XML parser"):

Do not grep the virsh capabilities output (!)  Instead, parse the XML
using perl's XML modules and look for the specific feature flag using
an XPATH pattern.

...>

+sub _check_capability ($$) {

...

+   $rc = $self->check_capability('/capabilities/host/migration_features');

 ^

Missing _.  I didn't test this again before sending it.  I'd still
like a review from libvirt (and Xen/ARM) folks.


I am not sure what kind of input you would need from Xen/ARM. This patch 
set looks very libvirt specific.


Cheers,

--
Julien Grall

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


Re: [libvirt] [OSSTEST PATCH 1/2] libvirt: Check migration capabilities using proper XML parser

2016-10-04 Thread Ian Jackson
Ian Jackson writes ("[OSSTEST PATCH 1/2] libvirt: Check migration capabilities 
using proper XML parser"):
> Do not grep the virsh capabilities output (!)  Instead, parse the XML
> using perl's XML modules and look for the specific feature flag using
> an XPATH pattern.
...>  
> +sub _check_capability ($$) {
...
> + $rc = $self->check_capability('/capabilities/host/migration_features');
 ^

Missing _.  I didn't test this again before sending it.  I'd still
like a review from libvirt (and Xen/ARM) folks.

Thanks,
Ian.

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


[libvirt] [OSSTEST PATCH 1/2] libvirt: Check migration capabilities using proper XML parser

2016-10-04 Thread Ian Jackson
Do not grep the virsh capabilities output (!)  Instead, parse the XML
using perl's XML modules and look for the specific feature flag using
an XPATH pattern.

AFAICT from looking at the XML, that's


  

  

But the original code does not test for .

Xen could in principle (and AIUI might in the future, on ARM) support
save/restore but not live migration.  Currently it supports neither.

I don't know whether libvirt's capabilities system can capture this
distinction.  libvirt.git#1d37a4c4 "libxl: detect support for save and
restore" suggests not.

Perhaps relatedly, I am not sure whether this test should be changed
to look for the xpath
  /capabilities/host/migration_features/live
instead.  The schema (libvirt.git/docs/schemas/capability.rng) seems
to suggest that it probably should.

For now, this osstest commit has no ultimate functional change (with
libvirt output as it currently appears to be on real hosts).

Signed-off-by: Ian Jackson 
CC: Julien Grall 
CC: Jim Fehlig 
---
 Osstest/Toolstack/libvirt.pm | 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm
index 69ff0bb..b7db7af 100644
--- a/Osstest/Toolstack/libvirt.pm
+++ b/Osstest/Toolstack/libvirt.pm
@@ -21,6 +21,8 @@ use strict;
 use warnings;
 
 use Osstest::TestSupport;
+use XML::LibXML::XPathContext;
+use XML::LibXML;
 
 sub new {
 my ($class, $ho, $methname,$asset) = @_;
@@ -72,6 +74,17 @@ sub shutdown_wait ($$$) {
 guest_await_destroy($gho,$timeout);
 }
 
+sub _check_capability ($$) {
+my ($self, $xpath) = @_;
+my $ho = $self->{Host};
+my $caps = target_cmd_output_root($ho, 'virsh capabilities');
+my $stash = open_unique_stashfile('virsh-capabilities');
+my $dom = XML::LibXML->load_xml(string => $caps);
+my $xc = XML::LibXML::XPathContext->new($dom);
+my @nodes = $xc->findnodes($xpath);
+return !!@nodes;
+}
+
 sub migrate_check ($$) {
 my ($self, $local) = @_;
 my $rc;
@@ -80,9 +93,7 @@ sub migrate_check ($$) {
 # local migration is not supported
 $rc = 1;
 } else {
-   my $ho = $self->{Host};
-   my $caps = target_cmd_output_root($ho, "virsh capabilities");
-   $rc = ($caps =~ m//) ? 0 : 1
+   $rc = $self->check_capability('/capabilities/host/migration_features');
 }
 
 logm("rc=$rc");
-- 
2.1.4

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