xenial (3) guestfs-golang.3.gz

Provided by: golang-guestfs-dev_1.32.2-4ubuntu2.2_all bug

НАЗВА

       guestfs-golang - How to use libguestfs from Go

КОРОТКИЙ ОПИС

        import "libguestfs.org/guestfs"

        g, errno := guestfs.Create ()
        if errno != nil {
            panic (fmt.Sprintf ("could not create handle: %s", errno))
        }
        defer g.Close ()
        if err := g.Add_drive ("test.img"); err != nil {
            panic (err)
        }
        if err := g.Launch (); err != nil {
            panic (err)
        }
        if err := g.Shutdown (); err != nil {
            panic (err)
        }

ОПИС

       This manual page documents how to call libguestfs from the Go programming language.  This page just
       documents the differences from the C API and gives some examples.  If you are not familiar with using
       libguestfs, you also need to read guestfs(3).

   IMPORTING THE MODULE
       The module is called "guestfs".  The full package name to import is "libguestfs.org/guestfs".

   CREATING AND CLOSING THE HANDLE
       Use either "guestfs.Create" or "guestfs.Create_flags" to create the handle.  The handle is closed
       implicitly if it is garbage collected.  However it is probably a good idea to close it explicitly, either
       by calling "g.Close ()" or by deferring the same.

   ПОМИЛКИ
       "guestfs.Create" and "guestfs.Create_flags" return a simple *error, which is really just a C "errno"
       wrapped up in the appropriate golang struct.

       All other calls return a *GuestfsError which (if non-nil) is a richer struct that contains the error
       string from libguestfs, the errno (if available) and the operation which failed.  This can also be
       converted to a string for display.

   ОБМЕЖЕННЯ
       •   No support for events (see "EVENTS" in guestfs(3)).

       •   UUIDs are not returned in structures.

ПРИКЛАД 1. СТВОРЕННЯ ОБРАЗУ ДИСКА

       @EXAMPLE1@

ПРИКЛАД 2. ПЕРЕВІРКА ОБРАЗУ ДИСКА ВІРТУАЛЬНОЇ МАШИНИ

       @EXAMPLE2@

ТАКОЖ ПЕРЕГЛЯНЬТЕ

       guestfs(3), guestfs-examples(3), guestfs-erlang(3), guestfs-java(3), guestfs-lua(3), guestfs-ocaml(3),
       guestfs-perl(3), guestfs-python(3), guestfs-recipes(1), guestfs-ruby(3), http://www.golang.org/,
       http://libguestfs.org/.

АВТОРИ

       Richard W.M. Jones ("rjones at redhat dot com")

АВТОРСЬКІ ПРАВА

       © Red Hat Inc., 2013

LICENSE

BUGS

       To get a list of bugs against libguestfs, use this link:
       https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools

       To report a new bug against libguestfs, use this link:
       https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools

       When reporting a bug, please supply:

       •   The version of libguestfs.

       •   Where you got libguestfs (eg. which Linux distro, compiled from source, etc)

       •   Describe the bug accurately and give a way to reproduce it.

       •   Run libguestfs-test-tool(1) and paste the complete, unedited output into the bug report.