diff mbox

[OSSTEST,v2,08/19] ts-guests-nbd-mirror: use target_{get, put}file_root to transfter cfg

Message ID 20171031135203.11537-9-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu Oct. 31, 2017, 1:51 p.m. UTC
The original code used target_cmd_output_root which caused a trailing
new line to be deleted, which caused libvirt converter to fail.

It wasn't discovered until now because we appended too many "\n".

Use target_{get,put}file_root to do the job.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 ts-guests-nbd-mirror | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/ts-guests-nbd-mirror b/ts-guests-nbd-mirror
index ca8300d..3032204 100755
--- a/ts-guests-nbd-mirror
+++ b/ts-guests-nbd-mirror
@@ -115,8 +115,11 @@  sub shuffleconfigs () {
 	my $gn= $gns[$i];
 	my $gho= $ghos[$i];
 	my $cfgpath= $r{ "$gho->{Guest}_cfgpath" };
-	my $cfgdata= target_cmd_output_root($sho,"cat $cfgpath");
-	target_putfilecontents_root_stash($cho,10,$cfgdata,$cfgpath);
+	my $file= $cfgpath;
+	$file=~ s,/,-,g;
+	$file= "$stash/".hostnamepath($cho)."--$file";
+	target_getfile_root($sho, 60, $cfgpath, $file);
+	target_putfile_root($cho, 60, $file, $cfgpath);
     }
 }