Import old talks from 2010 and 2011 (Boston).
[libguestfs-talks.git] / 2010 / 0225.d / disk.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 use Sys::Guestfs;
6
7 my $g = Sys::Guestfs->new ();
8 $g->add_drive_ro ("disk.img");
9 $g->launch ();
10
11 my @logvols = $g->lvs ();
12 print "logical volumes: ", join (", ", @logvols), "\n\n";
13
14 $g->mount_ro ("/dev/vg_f12x32/lv_root", "/");
15 print "----- ISSUE file: -----\n";
16 print ($g->cat ("/etc/issue"));
17 print "----- end of ISSUE file -----\n\n";
18
19 # Use Augeas to list the NTP servers.
20 $g->aug_init ("/", 16);
21 my @nodes = $g->aug_match ("/files/etc/ntp.conf/server");
22 my @ntp_servers = map { $g->aug_get ($_) } @nodes;
23 print "NTP servers: ", join (", ", @ntp_servers), "\n\n";