[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 09/22] LVM: Break out lv_create



We are going to want to reuse this.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Signed-off-by: Robert Ho <robert.hu@xxxxxxxxx>
Tested-by: Robert Ho <robert.hu@xxxxxxxxx>
---
v14: New patch
v15: Change some trivial typo, so to resolve conflicts with
     production tree.
---
 Osstest/TestSupport.pm |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index b70f19f..b507ada 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -63,7 +63,7 @@ BEGIN {
                       target_install_packages target_install_packages_norec
                       target_jobdir target_extract_jobdistpath_subdir
                       target_extract_jobdistpath
-                      lv_dev_mapper
+                      lv_create lv_dev_mapper
 
                       poll_loop tcpconnect await_tcp
                       contents_make_cpio file_simple_write_contents
@@ -713,6 +713,15 @@ sub poll_loop ($$$&) {
     logm("$what: ok. (${waited}s)");
 }
 
+sub lv_create ($$$$) {
+    my ($ho, $vg, $lv, $mb) = @_;
+    my $lvdev = "/dev/$vg/$lv";
+    target_cmd_root($ho, "lvremove -f $lvdev ||:");
+    target_cmd_root($ho, "lvcreate -L ${mb}M -n $lv $vg");
+    target_cmd_root($ho, "dd if=/dev/zero of=$lvdev count=10");
+    return $lvdev;
+}
+
 sub lv_dev_mapper ($$) {
     my ($vg,$lv) = @_;
     $vg =~ s/-/--/g;
@@ -1692,9 +1701,7 @@ sub prepareguest ($$$$$$) {
 
 sub prepareguest_part_lvmdisk ($$$) {
     my ($ho, $gho, $disk_mb) = @_;
-    target_cmd_root($ho, "lvremove -f $gho->{Lvdev} ||:");
-    target_cmd_root($ho, "lvcreate -L ${disk_mb}M -n $gho->{Lv} $gho->{Vg}");
-    target_cmd_root($ho, "dd if=/dev/zero of=$gho->{Lvdev} count=10");
+    lv_create($ho, $gho->{Vg}, $gho->{Lv}, $disk_mb);
 }
 
 sub make_vhd ($$$) {
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.