Skip to contentSkip to conversation

libvirt: Pass correct arguments to virsh migrate

PATCH Superseded Ian Campbell 2 participants 3 messages Aug 5, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libvirt: Pass correct arguments to virsh migrate

$dst is a host hash/object, resulting in:

2015-08-04 22:35:25 Z executing ssh ... [email protected] virsh

migrate debian.guest.osstest HASH(0x28f4310)
bash: -c: line 0: syntax error near unexpected token `('
bash: -c: line 0: `virsh migrate debian.guest.osstest HASH(0x28f4310)'

Switch to using the same pattern as xl.pm, which is to call the argument (containing the host hash) $dho and for $dst to be a local variable containing $dho->{Name}.

Also s/$ho/$sho/ to match xl.pm, since I think that is clearer about what role everything has.

---
 Osstest/Toolstack/libvirt.pm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Osstest/Toolstack/libvirt.pm +4 -3
index 32dca84..e2d646c 100644
@@ -104,10 +104,11 @@ sub saverestore_check ($) {
 }
 
 sub migrate ($) {
-    my ($self,$gho,$dst,$timeout) = @_;
-    my $ho = $self->{Host};
+    my ($self,$gho,$dho,$timeout) = @_;
+    my $sho = $self->{Host};
+    my $dst = $dho->{Name};
     my $gn = $gho->{Name};
-    target_cmd_root($ho, "virsh migrate $gn $dst", $timeout);
+    target_cmd_root($sho, "virsh migrate $gn $dst", $timeout);
 }
 
 sub save ($$$$) {
Signature · 1 line
2.1.4
#1 lore raw
Quoted 24 lines · Ian Campbell

$dst is a host hash/object, resulting in:

2015-08-04 22:35:25 Z executing ssh ... [email protected] virsh

migrate debian.guest.osstest HASH(0x28f4310)
bash: -c: line 0: syntax error near unexpected token `('
bash: -c: line 0: `virsh migrate debian.guest.osstest HASH(0x28f4310)'

Switch to using the same pattern as xl.pm, which is to call the argument (containing the host hash) $dho and for $dst to be a local variable containing $dho->{Name}.

Also s/$ho/$sho/ to match xl.pm, since I think that is clearer about what role everything has.

---
 Osstest/Toolstack/libvirt.pm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Osstest/Toolstack/libvirt.pm +0 -0
index 32dca84..e2d646c 100644

Osstest/Toolstack/libvirt.pm sub saverestore_check ($) { · line 106

Quoted 3 lines
Osstest/Toolstack/libvirt.pm +0 -0
@@ -104,10 +104,11 @@ sub saverestore_check ($) {
 }
 
 sub migrate ($) {

sub migrate ($$$$) ?

Quoted 13 lines
Osstest/Toolstack/libvirt.pm +4 -3
-    my ($self,$gho,$dst,$timeout) = @_;
-    my $ho = $self->{Host};
+    my ($self,$gho,$dho,$timeout) = @_;
+    my $sho = $self->{Host};
+    my $dst = $dho->{Name};
     my $gn = $gho->{Name};
-    target_cmd_root($ho, "virsh migrate $gn $dst", $timeout);
+    target_cmd_root($sho, "virsh migrate $gn $dst", $timeout);
 }
 
 sub save ($$$$) {
Signature · 1 line
2.1.4
#2 lore raw
Quoted 28 lines · Wei Liu
Quoted 27 lines · Ian Campbell

$dst is a host hash/object, resulting in:

2015-08-04 22:35:25 Z executing ssh ... [email protected] virsh

migrate debian.guest.osstest HASH(0x28f4310)
bash: -c: line 0: syntax error near unexpected token `('
bash: -c: line 0: `virsh migrate debian.guest.osstest HASH(0x28f4310)'

Switch to using the same pattern as xl.pm, which is to call the argument (containing the host hash) $dho and for $dst to be a local variable containing $dho->{Name}.

Also s/$ho/$sho/ to match xl.pm, since I think that is clearer about what role everything has.

---
 Osstest/Toolstack/libvirt.pm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Osstest/Toolstack/libvirt.pm +0 -0
index 32dca84..e2d646c 100644
@@ -104,10 +104,11 @@ sub saverestore_check ($) {
 }
 
Quoted 3 lines

Osstest/Toolstack/libvirt.pm sub saverestore_check ($) { · line 106

Quoted 1 line
Osstest/Toolstack/libvirt.pm +0 -0
 sub migrate ($) {

sub migrate ($$$$) ?

I think so, I wonder why Perl wasn't complaining about that...

I'll respin.

Quoted 12 lines
Quoted 12 lines
Osstest/Toolstack/libvirt.pm +4 -3
-    my ($self,$gho,$dst,$timeout) = @_;
-    my $ho = $self->{Host};
+    my ($self,$gho,$dho,$timeout) = @_;
+    my $sho = $self->{Host};
+    my $dst = $dho->{Name};
     my $gn = $gho->{Name};
-    target_cmd_root($ho, "virsh migrate $gn $dst", $timeout);
+    target_cmd_root($sho, "virsh migrate $gn $dst", $timeout);
 }
 
 sub save ($$$$) {