plucky (3) guestfs-golang.3.gz

Provided by: golang-guestfs-dev_1.54.1-1ubuntu1_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.

   LIMITATIONS
       •   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-gobject(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")

       Copyright (C) 2013 Red Hat Inc.

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.