From: Ian Jackson Date: Mon, 16 Nov 2015 17:50:15 +0000 (+0000) Subject: Nested hosts: Use full hostnamepath in various paths X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=add1565bdaeae8fe3f4abcadcef86ae8565239a4;p=people%2Fiwj%2Fosstest.git Nested hosts: Use full hostnamepath in various paths Replace some (but not all) interpolations of $ho->{Name} in filenames with hostnamepath($ho). I searched the tree for `{Host}' and `{Name}', looking for paths which need (or might need) to be qualified with an L0 hostname in an L1 or L2 case. I have left ts-logs-capture for now; that will come in a moment. Signed-off-by: Ian Jackson Acked-by: Ian Campbell --- diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 38386d47..d0acdc66 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -469,7 +469,7 @@ sub target_somefile_getleaf ($$$) { $$lleaf_ref= $rdest; $$lleaf_ref =~ s,.*/,,; } - $$lleaf_ref= "$ho->{Name}--$$lleaf_ref"; + $$lleaf_ref= hostnamepath($ho)."--$$lleaf_ref"; } sub tpfcs_core { @@ -2345,7 +2345,7 @@ sub setup_pxelinux_bootcfg ($$) { my ($ho, $bootfile) = @_; my $f= host_pxefile($ho); file_link_contents("$ho->{Tftp}{Path}$ho->{Tftp}{PxeDir}$f", $bootfile, - "$ho->{Name}-pxelinux.cfg"); + hostnamepath($ho)."-pxelinux.cfg"); } # Systems using BIOS are configured to use pxelinux @@ -2386,14 +2386,14 @@ sub setup_grub_efi_bootcfg ($$) { my $f = "grub.cfg-$ho->{Ether}"; my $grub= $ho->{Tftp}{Path}.'/'.$ho->{Tftp}{GrubBase}.'/'. $c{TftpGrubVersion}."/pxegrub-$r{arch}.efi"; - my $pxe=$ho->{Tftp}{Path}.'/'.$ho->{Name}.'/pxe.img'; + my $pxe=$ho->{Tftp}{Path}.'/'.hostnamepath($ho).'/pxe.img'; logm("Copy $grub => $pxe"); copy($grub, $pxe) or die "Copy $grub to $pxe failed: $!"; logm("grub_efi bootcfg into $f"); file_link_contents("$ho->{Tftp}{Path}$ho->{Tftp}{TmpDir}$f", - $bootfile, "$ho->{Name}-pxegrub.cfg"); + $bootfile, hostnamepath($ho)."-pxegrub.cfg"); } # UEFI systems PXE boot using grub.efi diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm index 776432d0..69ff0bb6 100644 --- a/Osstest/Toolstack/libvirt.pm +++ b/Osstest/Toolstack/libvirt.pm @@ -48,7 +48,7 @@ sub create ($$) { my $cfg = $gho->{CfgPath}; my $lcfg = $cfg; $lcfg =~ s,/,-,g; - $lcfg = "$ho->{Name}--$lcfg"; + $lcfg = hostnamepath($ho)."--$lcfg"; target_cmd_root($ho, "virsh domxml-from-native xen-xl $cfg > $cfg.xml", 30); target_getfile_root($ho,60,"$cfg.xml", "$stash/$lcfg"); target_cmd_root($ho, "virsh create --file $cfg.xml", 100); diff --git a/ts-host-install b/ts-host-install index 1cacd07a..cfa60445 100755 --- a/ts-host-install +++ b/ts-host-install @@ -208,7 +208,7 @@ sub setup_pxeboot_firstboot($) { $kernel = "/$d_i/linux" unless $kernel; - my $initrd_overlay= "tmp/t.$ho->{Name}.initrd"; + my $initrd_overlay= "tmp/t.".hostnamepath($ho).".initrd"; system qw(rm -rf --),"$initrd_overlay.d"; mkdir "$initrd_overlay.d" or die "$initrd_overlay.d: $!"; @@ -253,7 +253,7 @@ END push @initrds, "$initrd_overlay.cpio.gz"; logm("using initrds: @initrds"); - my $initrd= "$ho->{Tftp}{TmpDir}$ho->{Name}--initrd.gz"; + my $initrd= "$ho->{Tftp}{TmpDir}".hostnamepath($ho)."--initrd.gz"; system_checked("cat -- @initrds >$ho->{Tftp}{Path}$initrd"); push @dicmdline, "domain=$c{TestHostDomain}";