[libvirt] [PATCH tck 1/3] Rename volume1 variables

Mike Latimer mlatimer at suse.com
Tue Oct 6 00:13:59 UTC 2015


To avoid confusion between 'dst' and 'dst2' type of variables, rename
all variables relating to the fully allocated raw volume to include
the number '1'. (e.g. dst -> dst1, path -> path1, vol -> vol1, etc...)

Signed-off-by: Mike Latimer <mlatimer at suse.com>
---
 scripts/domain/121-block-info.t | 48 ++++++++++++++++++++---------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/scripts/domain/121-block-info.t b/scripts/domain/121-block-info.t
index 6fa7780..b9f8e0c 100644
--- a/scripts/domain/121-block-info.t
+++ b/scripts/domain/121-block-info.t
@@ -55,9 +55,9 @@ ok_pool(sub { $pool = $conn->define_storage_pool($xml) }, "define transient stor
 lives_ok(sub { $pool->build(0) }, "built storage pool");
 lives_ok(sub { $pool->create }, "started storage pool");
 
-my $volallocxml = $tck->generic_volume("tck", "raw", 1024*1024*50)->allocation(1024*1024*50)->as_xml;
-my ($vol, $path, $st);
-ok_volume { $vol = $pool->create_volume($volallocxml) } "create fully allocated raw volume";
+my $volallocxml1 = $tck->generic_volume("tck1", "raw", 1024*1024*50)->allocation(1024*1024*50)->as_xml;
+my ($vol1, $path1, $st1);
+ok_volume { $vol1 = $pool->create_volume($volallocxml1) } "create fully allocated raw volume";
 
 my $volallocxml2 = $tck->generic_volume("tck2", "raw", 1024*1024*50)->allocation(1024*1024)->as_xml;
 my ($vol2, $path2, $st2);
@@ -67,10 +67,10 @@ my $volallocxml3 = $tck->generic_volume("tck3", "qcow2", 1024*1024*50)->allocati
 my ($vol3, $path3, $st3);
 ok_volume { $vol3 = $pool->create_volume($volallocxml3) } "create qcow2 volume";
 
-$path = xpath($vol, "string(/volume/target/path)");
-$st = stat($path);
-ok($st, "path $path exists");
-is($st->size, 1024*1024*50, "size is 50M");
+$path1 = xpath($vol1, "string(/volume/target/path)");
+$st1 = stat($path1);
+ok($st1, "path $path1 exists");
+is($st1->size, 1024*1024*50, "size is 50M");
 
 $path2 = xpath($vol2, "string(/volume/target/path)");
 $st2 = stat($path2);
@@ -82,13 +82,13 @@ ok($st3, "path $path3 exists");
 
 diag "Generic guest with previous created vol";
 my $disktype = "raw";
-my $dst = "vda";
+my $dst1 = "vda";
 my $dst2 = "vdb";
 my $dst3 = "vdc";
 my $guest = $tck->generic_domain(name => "tck");
 $guest->rmdisk();
 
-$guest->disk(format => { name => "qemu", type => $disktype }, type => "file", src => $path, dst => $dst);
+$guest->disk(format => { name => "qemu", type => $disktype }, type => "file", src => $path1, dst => $dst1);
 $guest->disk(format => { name => "qemu", type => $disktype }, type => "file", src=> $path2, dst => $dst2);
 $guest->disk(format => { name => "qemu", type => "qcow2" }, type => "file", src=> $path3, dst => $dst3);
 
@@ -102,32 +102,32 @@ is($dom->get_block_info($dst2,0)->{allocation}, 1024*1024, "Get disk allocation
 is($dom->get_block_info($dst2,0)->{physical}, 1024*1024, "Get disk physical info");
 
 
-is($dom->get_block_info($dst,0)->{capacity}, 1024*1024*50, "Get disk capacity info");
-ok($dom->get_block_info($dst,0)->{allocation} >= 1024*1024*50, "Get disk allocation info");
-ok($dom->get_block_info($dst,0)->{physical} >= 1024*1024*50, "Get disk physical info");
+is($dom->get_block_info($dst1,0)->{capacity}, 1024*1024*50, "Get disk capacity info");
+ok($dom->get_block_info($dst1,0)->{allocation} >= 1024*1024*50, "Get disk allocation info");
+ok($dom->get_block_info($dst1,0)->{physical} >= 1024*1024*50, "Get disk physical info");
 
 diag "Test block_resize";
-lives_ok(sub {$dom->block_resize($dst, 512*50)}, "resize to 512*50 KB");
-$st = stat($path);
-is($st->size, 512*1024*50, "size is 25M");
+lives_ok(sub {$dom->block_resize($dst1, 512*50)}, "resize to 512*50 KB");
+$st1 = stat($path1);
+is($st1->size, 512*1024*50, "size is 25M");
 
-is($dom->get_block_info($dst,0)->{capacity}, 1024*512*50, "Get disk capacity info");
-ok($dom->get_block_info($dst,0)->{allocation} >= 1024*512*50, "Get disk allocation info");
-ok($dom->get_block_info($dst,0)->{physical} >= 1024*512*50, "Get disk physical info");
+is($dom->get_block_info($dst1,0)->{capacity}, 1024*512*50, "Get disk capacity info");
+ok($dom->get_block_info($dst1,0)->{allocation} >= 1024*512*50, "Get disk allocation info");
+ok($dom->get_block_info($dst1,0)->{physical} >= 1024*512*50, "Get disk physical info");
 
-lives_ok(sub {$dom->block_resize($dst, 1024*50)}, "resize to 1024*50 KB");
-$st = stat($path);
-is($st->size, 1024*1024*50, "size is 50M");
+lives_ok(sub {$dom->block_resize($dst1, 1024*50)}, "resize to 1024*50 KB");
+$st1 = stat($path1);
+is($st1->size, 1024*1024*50, "size is 50M");
 
 diag "Test block_peek";
 my $date = "test";
-system("echo $date > $path");
-is($dom->block_peek($path,0,4,0), $date, "Get date from raw image");
+system("echo $date > $path1");
+is($dom->block_peek($path1,0,4,0), $date, "Get date from raw image");
 
 #qcow2 file start with hexadecimal:0x51 0x46 0x49 (ASCII: "QFI")
 is($dom->block_peek($path3,0,3,0), "QFI", "Get date from qcow2 image");
 
-lives_ok(sub { $vol->delete(0) }, "deleted volume");
+lives_ok(sub { $vol1->delete(0) }, "deleted volume");
 
 diag "Destroy domain";
 $dom->destroy;
-- 
1.8.4.5




More information about the libvir-list mailing list