X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=perl%2Flib%2FSys%2FGuestfs.pm;h=5b87b27e80744e198ca3e0351bde5f495093d6ef;hb=0703248d233744047515418893dac05ce013a642;hp=0a8226fea8b7864d9e0c0ab6c0291c4d5231d711;hpb=9908e03e922b670437bcd89b6873f9ebc914567e;p=libguestfs.git diff --git a/perl/lib/Sys/Guestfs.pm b/perl/lib/Sys/Guestfs.pm index 0a8226f..5b87b27 100644 --- a/perl/lib/Sys/Guestfs.pm +++ b/perl/lib/Sys/Guestfs.pm @@ -91,10 +91,14 @@ sub new { return $self; } -=item $h->add_drive ($filename); - =item $h->add_cdrom ($filename); +This function adds a virtual CD-ROM disk image to the guest. + +This is equivalent to the qemu parameter C<-cdrom filename>. + +=item $h->add_drive ($filename); + This function adds a virtual machine disk image C to the guest. The first time you call this function, the disk appears as IDE disk 0 (C) in the guest, the second time as C, and @@ -106,60 +110,472 @@ for whatever operations you want to perform (ie. read access if you just want to read the image or write access if you want to modify the image). -The C variation adds a CD-ROM device. +This is equivalent to the qemu parameter C<-drive file=filename>. -=item $h->config ($param, $value); +=item $h->aug_close (); -=item $h->config ($param); +Close the current Augeas handle and free up any resources +used by it. After calling this, you have to call +C<$h-Eaug_init> again before you can use any other +Augeas functions. -Use this to add arbitrary parameters to the C command line. -See L. +=item ($nrnodes, $created) = $h->aug_defnode ($name, $expr, $val); -=item $h->launch (); +Defines a variable C whose value is the result of +evaluating C. -=item $h->wait_ready (); +If C evaluates to an empty nodeset, a node is created, +equivalent to calling C<$h-Eaug_set> C, C. +C will be the nodeset containing that single node. -Internally libguestfs is implemented by running a virtual machine -using L. These calls are necessary in order to boot the -virtual machine. +On success this returns a pair containing the +number of nodes in the nodeset, and a boolean flag +if a node was created. -You should call these two functions after configuring the handle -(eg. adding drives) but before performing any actions. +=item $nrnodes = $h->aug_defvar ($name, $expr); -=item $h->set_path ($path); +Defines an Augeas variable C whose value is the result +of evaluating C. If C is NULL, then C is +undefined. -=item $path = $h->get_path (); +On success this returns the number of nodes in C, or +C<0> if C evaluates to something which is not a nodeset. -See the discussion of C in the L -manpage. +=item $val = $h->aug_get ($path); -=item $h->set_autosync ($autosync); +Look up the value associated with C. If C +matches exactly one node, the C is returned. -=item $autosync = $h->get_autosync (); +=item $h->aug_init ($root, $flags); -See the discussion of I in the L -manpage. +Create a new Augeas handle for editing configuration files. +If there was any previous Augeas handle associated with this +guestfs session, then it is closed. -=item $h->set_verbose ($verbose); +You must call this before using any other C<$h-Eaug_*> +commands. -=item $verbose = $h->get_verbose (); +C is the filesystem root. C must not be NULL, +use C instead. + +The flags are the same as the flags defined in +Eaugeas.hE, the logical I of the following +integers: + +=over 4 + +=item C = 1 + +Keep the original file with a C<.augsave> extension. + +=item C = 2 + +Save changes into a file with extension C<.augnew>, and +do not overwrite original. Overrides C. + +=item C = 4 + +Typecheck lenses (can be expensive). + +=item C = 8 + +Do not use standard load path for modules. + +=item C = 16 + +Make save a no-op, just record what would have been changed. + +=item C = 32 + +Do not load the tree in C<$h-Eaug_init>. + +=back + +To close the handle, you can call C<$h-Eaug_close>. + +To find out more about Augeas, see L. + +=item $h->aug_insert ($path, $label, $before); + +Create a new sibling C