Hello. I'm very happy with libguestfs, but now i'm try to write packer plugin to strip images: 1) resize filesystem to minimum 2) resize partitions to minimum 3) create/resize file with needed size But golang binding have not docs. Is that possible to generate something suitable to godoc.org to determine api methods and input,output variables for functions? -- Vasiliy Tolstov, e-mail: v.tolstov@selfip.ru jabber: vase@selfip.ru
On Fri, Jul 11, 2014 at 06:18:12PM +0400, Vasiliy Tolstov wrote:
Hello. I'm very happy with libguestfs, but now i'm try to write packer plugin to strip images:
Packer is: http://www.packer.io/intro ?
1) resize filesystem to minimum 2) resize partitions to minimum 3) create/resize file with needed size
But golang binding have not docs. Is that possible to generate something suitable to godoc.org to determine api methods and input,output variables for functions?
So a few different things here: (a) Yes, we should add golang docs. However I don't know how to do that. If you can point me to some documentation about writing documentation for golang modules then I'll be glad to add it. (b) In the meantime you can read the C API documentation (in English, not Russian -- sorry!) http://libguestfs.org/guestfs.3.html and the golang examples: http://libguestfs.org/guestfs-golang.3.html and the golang tests: https://github.com/libguestfs/libguestfs/tree/master/golang/src/libguestfs.o... (c) In the API you can resize filesystems using calls like guestfs_resize2fs / g.Resize2fs and others. However note that there is no single API for doing a virt-resize -like operation. You have to actually call virt-resize if you want to resize a whole OS disk. Hope that helps, let me know if you have more questions. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
2014-07-12 0:33 GMT+04:00 Richard W.M. Jones <rjones@redhat.com>:
On Fri, Jul 11, 2014 at 06:18:12PM +0400, Vasiliy Tolstov wrote:
Hello. I'm very happy with libguestfs, but now i'm try to write packer plugin to strip images:
Packer is: http://www.packer.io/intro ?
Yes, i'm try to build cloud images using it. Does it possible to add ability to resize freebsd slices ?
1) resize filesystem to minimum 2) resize partitions to minimum 3) create/resize file with needed size
But golang binding have not docs. Is that possible to generate something suitable to godoc.org to determine api methods and input,output variables for functions?
So a few different things here:
(a) Yes, we should add golang docs. However I don't know how to do that. If you can point me to some documentation about writing documentation for golang modules then I'll be glad to add it.
I think that golang bindings need separate repo, may be autogenerate bindings and push resulted files to separate github repo.... In this case peaples can do go get github.com/libguestfs/go-libguestfs and have a package. And build it with or without CGO_ENABLED (static or dynamic). But in case of autogenerated binding i don't know how to write docs and keep it sync with code...
(b) In the meantime you can read the C API documentation (in English, not Russian -- sorry!)
Not bad.
and the golang examples:
http://libguestfs.org/guestfs-golang.3.html
and the golang tests:
https://github.com/libguestfs/libguestfs/tree/master/golang/src/libguestfs.o...
Thanks
(c) In the API you can resize filesystems using calls like guestfs_resize2fs / g.Resize2fs and others. However note that there is no single API for doing a virt-resize -like operation. You have to actually call virt-resize if you want to resize a whole OS disk.
Hope that helps, let me know if you have more questions.
Rich.
I'm try to use bindings and have trouble, that if somebody does not have installed go package with libguestfs i can't build plugin. I'm switch to use guestfish on golang code. This is sutable for me. -- Vasiliy Tolstov, e-mail: v.tolstov@selfip.ru jabber: vase@selfip.ru
On Sat, Jul 12, 2014 at 01:28:00AM +0400, Vasiliy Tolstov wrote:
2014-07-12 0:33 GMT+04:00 Richard W.M. Jones <rjones@redhat.com>:
On Fri, Jul 11, 2014 at 06:18:12PM +0400, Vasiliy Tolstov wrote:
Hello. I'm very happy with libguestfs, but now i'm try to write packer plugin to strip images:
Packer is: http://www.packer.io/intro ?
Yes, i'm try to build cloud images using it. Does it possible to add ability to resize freebsd slices ?
It depends entirely on what the Linux kernel and tools can do. If there are properly maintained Linux tools for resizing BSD slices, then it should be no problem to add this. Compare with 'ntfsresize', where ntfs-3g exists and is well-maintained and available in the majority of Linux distros.
I think that golang bindings need separate repo, may be autogenerate bindings and push resulted files to separate github repo.... In this case peaples can do go get github.com/libguestfs/go-libguestfs and have a package. And build it with or without CGO_ENABLED (static or dynamic). But in case of autogenerated binding i don't know how to write docs and keep it sync with code...
The trouble with a separate repository is that it would quickly go out of date compared to the current API. That's why we strongly prefer to keep the bindings in tree (and of course generated, not hand-written). Can we not build some kind of tarball? A similar situation was proposed for accepting libguestfs bindings into Python pypi. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
2014-07-12 14:00 GMT+04:00 Richard W.M. Jones <rjones@redhat.com>:
It depends entirely on what the Linux kernel and tools can do. If there are properly maintained Linux tools for resizing BSD slices, then it should be no problem to add this.
Compare with 'ntfsresize', where ntfs-3g exists and is well-maintained and available in the majority of Linux distros.
As i see parted have ability to work with bsd slices, also linux kernel have bsd partition support. Bud i don't know about resize file system.
I think that golang bindings need separate repo, may be autogenerate bindings and push resulted files to separate github repo.... In this case peaples can do go get github.com/libguestfs/go-libguestfs and have a package. And build it with or without CGO_ENABLED (static or dynamic). But in case of autogenerated binding i don't know how to write docs and keep it sync with code...
The trouble with a separate repository is that it would quickly go out of date compared to the current API. That's why we strongly prefer to keep the bindings in tree (and of course generated, not hand-written).
But why? As i understand binding updated when new release comes, not the big problem generate code go bindings and upload it to github, or some git repo, got get able to install package from git repos...
Can we not build some kind of tarball? A similar situation was proposed for accepting libguestfs bindings into Python pypi.
Tarball not suitable for go... Also for docs - you can create in repo file doc.go and provide interfaces/function names with extracted portion of comments from headers. This is enough to generate some docs about exiting functions... -- Vasiliy Tolstov, e-mail: v.tolstov@selfip.ru jabber: vase@selfip.ru
On Sun, Jul 13, 2014 at 11:11:54PM +0400, Vasiliy Tolstov wrote:
But why? As i understand binding updated when new release comes, not the big problem generate code go bindings and upload it to github, or some git repo, got get able to install package from git repos...
<rant> I guess we can add this to the process. It's a bit tedious that (again) golang defies conventional packaging. In Fedora, golang causes no end of trouble because it prevents, dangerously IMO, ordinary distro packaging. </rant> What does the git repo look like? Is there an example of one? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
2014-07-14 15:30 GMT+04:00 Richard W.M. Jones <rjones@redhat.com>:
<rant> I guess we can add this to the process. It's a bit tedious that (again) golang defies conventional packaging. In Fedora, golang causes no end of trouble because it prevents, dangerously IMO, ordinary distro packaging. </rant>
The main problem in current binding that it does not have source code, only compile package file, and if i simple want to rebould package without CGO (static linking) or run local godoc to see docs i can't do that.
What does the git repo look like? Is there an example of one? Nothing special - put all go files (*.go) to dir and push it to repo. About docs - before each function in go file you need // FuncName document string where FuncName - function name, document string some docs about function. Nothing special. to compile with cgo you need on top of file something like:
// #cgo CFLAGS: -DXXXXX=1 // #cgo LDFLAGS: -lguestfs // #include <libguestfs.h> import "C" -- Vasiliy Tolstov, e-mail: v.tolstov@selfip.ru jabber: vase@selfip.ru
participants (2)
-
Richard W.M. Jones -
Vasiliy Tolstov