2 Create a disk containing LV and filesystem.
6 // See comment in php/run-php-tests.sh.
7 //putenv ('LIBGUESTFS_DEBUG=1');
9 $g = guestfs_create ();
11 die ("Failed to create guestfs_php handle.\n");
14 $tmp = dirname(__FILE__)."/test.img";
15 $size = 100 * 1024 * 1024;
16 if (! $fp = fopen ($tmp, 'w+')) {
17 die ("Error: cannot create file '".$tmp."'\n");
19 ftruncate ($fp, $size);
22 if (! guestfs_add_drive ($g, "test.img") ||
23 ! guestfs_launch ($g) ||
24 ! guestfs_part_disk ($g, "/dev/sda", "mbr") ||
25 ! guestfs_pvcreate ($g, "/dev/sda") ||
26 ! guestfs_vgcreate ($g, "VG", array ("/dev/sda")) ||
27 ! guestfs_lvcreate ($g, "LV", "VG", 64) ||
28 ! guestfs_mkfs ($g, "ext2", "/dev/VG/LV")) {
29 die ("Error: ".guestfs_last_error ($g)."\n");
35 $tmp = dirname(__FILE__)."/test.img";