Skip to contentSkip to conversation

libvirt: Pass correct arguments to virsh migrate

PATCH In review Ian Campbell 2 participants 3 messages Aug 5, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

Fix the prototype too while editing this function.

---
v2: Fix the prototype as well.

---
 Osstest/Toolstack/libvirt.pm | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
Osstest/Toolstack/libvirt.pm +5 -4
index 32dca84..bfb5ccb 100644
@@ -103,11 +103,12 @@ sub saverestore_check ($) {
     return check_for_command($self, "save");
 }
 
-sub migrate ($) {
-    my ($self,$gho,$dst,$timeout) = @_;
-    my $ho = $self->{Host};
+sub migrate ($$$$) {
+    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
Acked-by on v2 1/1
#1 lore raw
Quoted 11 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}.

Quoted 6 lines

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

Fix the prototype too while editing this function.

Thanks for the fix!

Quoted 29 lines

---
v2: Fix the prototype as well.

---
 Osstest/Toolstack/libvirt.pm | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
Osstest/Toolstack/libvirt.pm +5 -4
index 32dca84..bfb5ccb 100644
@@ -103,11 +103,12 @@ sub saverestore_check ($) {
     return check_for_command($self, "save");
 }
 
-sub migrate ($) {
-    my ($self,$gho,$dst,$timeout) = @_;
-    my $ho = $self->{Host};
+sub migrate ($$$$) {
+    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 15 lines · Wei Liu
Quoted 14 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.

Quoted 7 lines
Quoted 3 lines

Fix the prototype too while editing this function.

Thanks for the fix!

NP. I've pushed this to pretest and killed flight 60606 which hadn't alloca ted any hosts yet.

Ian.