[fedora-virt] ANNOUNCE: Augeas support added to libguestfs
Ján ONDREJ (SAL)
ondrejj at salstar.sk
Thu Apr 9 17:57:59 UTC 2009
Looks nice.
Is it possible to implment something like qemu-img convert, which can dump
whole filesystem to stdout and restore from it into liguestfs?
I am developing an application, which can make offline backups for virtual
hosts. It now can use:
- dd to copy whole disk from disk to disk
- rsync partition content
Now tryinng to implement:
- rsync disk devices, --copy-devices patch to rsync required BZ#494313
- copy image content only (qemu-img convert -c to stdout, but this is not
possible, so I have no solution now)
My project can copy offline backups, which are snapshots of LVM volumes.
Before snapshot "sync" is sent to virtual machine to save whole content.
Planning to implment also something like suspend as before live migration
to save an image fully consistent (disk image is an snapshot, but there is
also an vm image, where caches and transactions are stored).
This should be based on ideas from here:
http://lists.xensource.com/archives/html/xen-devel/2006-12/msg00685.html
Is something similar possible for KVM too? This is required for this
operation:
- pause virtual machine
- create LVM snapshot
- save virtual machine, but leave it running
- unpause virtual machine
- copy LVM snapshot
- drop LVM snapshot
Can I save KVM machine without stopping it? Everythin between pause-unpause
should run in a few seconds.
SAL
On Thu, Apr 09, 2009 at 01:34:29PM +0100, Richard W.M. Jones wrote:
> Augeas, meet libguestfs.
>
> Libguestfs is a library I'm writing which lets you examine and modify
> virtual machine disk images, so you can perform sysadmin tasks on
> virtual machines without needing to bring them up or log into them.
>
> As of a few minutes ago, libguestfs now supports Augeas, so you can
> use Augeas to edit configuration files within the virtual machine.
> You will need the git version of libguestfs to get this at the moment,
> or it will appear in version 0.7 when I release it.
>
> http://et.redhat.com/~rjones/libguestfs/
> http://git.et.redhat.com/?p=libguestfs.git;a=summary
>
> Here's an example session using the shell tool, editing the /etc/hosts
> file from a RHEL 5.2 virtual machine:
>
> $ guestfish -a RHEL52PV32.img -m /dev/VolGroup00/LogVol00
>
> Welcome to guestfish, the libguestfs filesystem interactive shell for
> editing virtual machine filesystems.
>
> Type: 'help' for help with commands
> 'quit' to quit the shell
>
> ><fs> aug-init / 0
> ><fs> aug-match /augeas/*
> /augeas/root
> /augeas/save
> /augeas/files
> ><fs> aug-match /files//error
> ><fs> aug-match /augeas//error
> ><fs> aug-match /augeas/root/*
> ><fs> aug-match /files/etc/*
> /files/etc/ldap.conf
> /files/etc/aliases
> /files/etc/yum.repos.d
> /files/etc/yum.conf
> /files/etc/sysconfig
> /files/etc/default
> /files/etc/inittab
> /files/etc/sysctl.conf
> /files/etc/hosts
> /files/etc/pam.d
> /files/etc/logrotate.d
> /files/etc/samba
> /files/etc/xinetd.conf
> /files/etc/xinetd.d
> /files/etc/fstab
> /files/etc/ssh
> /files/etc/exports
> ><fs> aug-match /files/etc/hosts/*
> /files/etc/hosts/comment[1]
> /files/etc/hosts/comment[2]
> /files/etc/hosts/1
> /files/etc/hosts/2
> ><fs> cat /etc/hosts
> # Do not remove the following line, or various programs
> # that require network functionality will fail.
> 127.0.0.1 localhost.localdomain localhost
> ::1 localhost6.localdomain6 localhost6
>
> ><fs> aug-get /files/etc/hosts/comment[1]
> Do not remove the following line, or various programs
> ><fs> help aug-insert
> aug-insert - insert a sibling Augeas node
> aug-insert <path> <label> <before>
>
> Create a new sibling "label" for "path", inserting it into the tree
> before or after "path" (depending on the boolean flag "before").
>
> "path" must match exactly one existing node in the tree, and "label"
> must be a label, ie. not contain "/", "*" or end with a bracketed index
> "[N]".
>
> ><fs> aug-insert /files/etc/hosts/comment[2] comment false
> ><fs> aug-match /files/etc/hosts/*
> /files/etc/hosts/comment[1]
> /files/etc/hosts/comment[2]
> /files/etc/hosts/comment[3]
> /files/etc/hosts/1
> /files/etc/hosts/2
> ><fs> aug-set /files/etc/hosts/comment[3] HELLO
> ><fs> aug-save
> ><fs> cat /etc/hosts
> # Do not remove the following line, or various programs
> # that require network functionality will fail.
> # HELLO
> 127.0.0.1 localhost.localdomain localhost
> ::1 localhost6.localdomain6 localhost6
>
> ><fs> help
> Command Description
> help display a list of commands or help on a command
> quit quit guestfish
> alloc allocate an image
> add-cdrom add a CD-ROM disk image to examine
> add-drive add an image to examine or modify
> aug-close close the current Augeas handle
> aug-defnode define an Augeas node
> aug-defvar define an Augeas variable
> aug-get look up the value of an Augeas path
> aug-init create a new Augeas handle
> aug-insert insert a sibling Augeas node
> aug-load load files into the tree
> aug-match return Augeas nodes which match path
> aug-mv move Augeas node
> aug-rm remove an Augeas path
> aug-save write all pending Augeas changes to disk
> aug-set set Augeas path to value
> cat list the contents of a file
> config add qemu parameters
> get-autosync get autosync mode
> get-path get the search path
> get-verbose get verbose mode
> kill-subprocess kill the qemu subprocess
> launch launch the qemu subprocess
> list-devices list the block devices
> list-partitions list the partitions
> ll list the files in a directory (long format)
> ls list the files in a directory
> lvs list the LVM logical volumes (LVs)
> lvs-full list the LVM logical volumes (LVs)
> mount mount a guest disk at a position in the filesystem
> pvs list the LVM physical volumes (PVs)
> pvs-full list the LVM physical volumes (PVs)
> read-lines read file as lines
> set-autosync set autosync mode
> set-path set the search path
> set-verbose set verbose mode
> sync sync disks, writes are flushed through to the disk image
> touch update file timestamps or create a new file
> vgs list the LVM volume groups (VGs)
> vgs-full list the LVM volume groups (VGs)
> Use -h <cmd> / help <cmd> to show detailed help for a command.
>
> Rich.
>
> --
> Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones
> virt-top is 'top' for virtual machines. Tiny program with many
> powerful monitoring features, net stats, disk stats, logging, etc.
> http://et.redhat.com/~rjones/virt-top
>
> _______________________________________________
> Fedora-virt mailing list
> Fedora-virt at redhat.com
> https://www.redhat.com/mailman/listinfo/fedora-virt
More information about the Fedora-virt
mailing list