[Libvir] save and restore guest
by Farkas Levente
hi,
if i use xen with xendomain it's possible to save and restore guest
state. if i use libvirt it's not working (at least by default with kvm).
i mean if i stop or restart libvirtd all guests a stopped and even if i
restart libvirtd i've to start all guests manually. imho this's a very
essential feature. what is the reason this not working with libvirtd?:
- this feature is missing from libvirtd? or
- this feature is not turned on by default? or
- this feature is missing from kvm/qemu? or
something else?
thanks in advance.
--
Levente "Si vis pacem para bellum!"
17 years, 1 month
[Libvir] Proposal for the storage API (for discussion only)
by Richard W.M. Jones
This is an outline for the storage API, for discussion only. It is
mostly unimplemented, but presented as a kind of "literate patch", so
you can read the API calls and how they could be implemented.
I've tried to follow as far as possible operations which are needed in
order to make virt-install / virt-manager work in the remote case, and
also to support discovery and creation of partitions / LVs / iSCSI LUNs.
The new API calls are:
virStorageFileLocations
- returns a list of locations which can be used
for creating file-backed guests
virStorageFileStat
virStorageFileStatVFS
virStorageCreateFile
- for creating file-backed guest storage
virStorageListGroups
virStorageCreateVolume
- for discovering and creating partitions, LVs, LUNs, &c.
Rich.
--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in
England and Wales under Company Registration No. 03798903
17 years, 1 month
[Libvir] Concepts in storage management
by Daniel P. Berrange
So we've had many email threads on the subject of storage, but none have
resulted in a satisfactory way forward to implementing any storage mgmt
apis. Part of the problem I think is that we've not tried to understand
all the various concepts / technologies which are available & how they
relate to each other. This mail attempts to outline all the different
technologies. There's a short list of API operations, but I don't want
to particularly get into API details until we have a good undersatnding
of the concepts.
First and foremost I don't believe it is acceptable to say we're only
going to allow one kind of storage. Storage is the key piece of infrastructure
for any serious network, and we have to be able to adapt to deployment
scenarios that present themselves.
Second, there is clearly a huge number of storage technologies here and
there's no way we'll implement support for all of them in one go. So we
need to prioritize getting the conceptual model correct, to allow us to
incrementally support new types of storage backend.
Taxonomy of storage types
=========================
|
+- Block
| |
| +- Disk
| | |
| | +- Direct attached
| | | |
| | | +- IDE/ATA disk
| | | +- SCSI disk
| | | +- FibreChannel disk
| | | +- USB disk/flash
| | | +- FireWire disk/flash
| | |
| | +- Remote attached
| | |
| | +- iSCSI disk
| | +- GNBD disk
| |
| +- Partition
| |
| +- Virtual
| |
| +- Direct attached
| | |
| | +- LVM
| | +- ZFS
| |
| +- Remote attached
| |
| +- Cluster LVM
|
+- FileSystem
| |
| +- Directed attached
| | |
| | +- ext2/3/4
| | +- xfs
| | +- ZFS
| |
| +- Remote attached
| |
| +- NFS
| +- GFS
| +- OCFS2
|
+- Directory
|
+- File
|
+- Raw allocated
+- Raw sparse
+- QCow2
+- VMDK
Storage attributes
==================
- Local vs network (ext3 vs NFS, SCSI vs iSCSI)
- Private vs shared (IDE vs FibreChannel)
- Pool vs volume (LVM VG vs LV, Directory vs File, Disk vs Partition)
- Container vs guest (OpenVZ vs Xen)
- Attributes
- Compressed
- Encrypted
- Auto-extend
- Snapshots
- RO
- RW
- Partition table
- MBR
- GPT
- UUID
- 16 hex digits
- Unique string
- SCSI WWID (world wide ID)
- Local Path(s) (/dev/sda, /var/lib/xen/images/foo.img)
- Server Hostname
- Server Identifier (export path/target)
- MAC security label (SELinux)
- Redundancy
- Mirrored
- Striped
- Multipath
- Pool operation
- RO
- RW
Nesting hierarchy
=================
Many possibilities...
- 1 x Host -> N x iSCSI target -> N x LUN -> N x Partition
- N x Disk/Partition -> 1 x LVM VG -> B x LVM LV
- 1 x Filesystem -> N x directory -> N x file
- 1 x File -> 1 x Block (loopback)
Application users
=================
- virt-manager / virt-install
- Enumerate available pools
- Allocate volume from pool
- Create guest with volume
- virt-clone
- Copy disks
- Snapshot disks
- virt-df
- Filesystem usage
- pygrub
- Extract kernel/initrd from filesystem
- virt-factory
- Manage storage pools
- Pre-migration sanity checks
- virt-backup
- Snapshot disks
- virt-p2v
- Snapshot disks
Storage representation
======================
Two core concepts
- Volume
- a chunk of storage
- assignable to a guest
- assignable to a pool
- optionally part of a pool
- Pool
- a chunk of storage
- contains free space
- allocate to provide volumes
- compromised of volumes
Recursive!
n x Volume -> Pool -> n x Volume
Nesting to many levels...
Do we need an explicit Filesystem concept ?
Operations
==========
Limited set of operations to perform
- List host volumes (physical attached devices)
- List pools (logical volume groups, partitioned devs, filesystems)
- List pool volumes (dev partitions, LVM logical volumes, files)
- Define pool (eg create directory, or define iSCSI target)
- Undefine pool (delete directory, undefine iSCSI config
- Activate pool (mount NFS volume, login to iSCSI target)
- Deactivate pool (unmount volume, logout of iSCSI)
- Dump pool XML (get all the metadata)
- Lookup by path
- Lookup by UUID
- Lookup by name
- Create volume (create a file, allocate a LVM LV, etc)
- Destroy volume (delete a file, deallocate a LVM LV)
- Resize volume (grow or shrink volume)
- Copy volume (copy data between volumes)
- Snapshot volume (snapshot a volume)
- Dump volume XML (get all the metadata)
- Lookup by path
- Lookup by UUID
- Lookup by name
http://www.redhat.com/archives/libvir-list/2007-February/msg00010.html
http://www.redhat.com/archives/libvir-list/2007-September/msg00119.html
Do we also need some explicit Filesystem APIs ?
XML description
===============
The horrible recursiveness & specific attributes are all in the XML
description for different storage pool / volume types. This is where
we define things like what physical volume are in a volume group,
iSCSI server / target names, login details, etc, etc
XXX fill in the hard stuff for metadata description here
Implementation backends
=======================
- FileSystem/Directory/File - POSIX APIs
- LVM - LVM tools, or libLVM
- Disk/partitions - sysfs / parted
- iSCSI - sysfs / iscsi utils
- ZFS - ZFS tools
Implementation strategy
=======================
Should prioritize implementation according to immediate application needs
Initial goal to support remote guest creation on par with current
capabilities:
- Directory + allocateing raw sparse files
- Enumerate existing disks, partitions & LVM volumes
Further work:
- Allocating LVM volumes
- Defining LVM volume groups
- Partitioning disks
- Mounting networked filesystems
- Accessing iSCSI volumes
- Copying existing volumes
- Snapshotting volumes
- Cluster aware filesystems (GFS)
- Various file formats (QCow, VMDK, etc)
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/ -=|
|=- Projects: http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
17 years, 1 month
Re: [Libvir] Problem to compile virt-manager in debian etch
by Richard W.M. Jones
Marco Sinhoreli wrote:
> The configure script was found, but the Makefile hasn't been created.
Need to see the full messages.
Rich.
--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in
England and Wales under Company Registration No. 03798903
17 years, 1 month
[Libvir] [PATCH] fix negative value handling of virConfParseLong()
by Tatsuro Enokura
Hi,
I found a bug about negative value at virConfParseLong() in conf.c.
This patch fixes it.
Signed-off-by: Tatsuro Enokura <fj7716hz(a)aa.jp.fujitsu.com>
Thanks,
Tatsuro Enokura.
--------------------------------------------------------------------------
Index: libvirt/src/conf.c
===================================================================
RCS file: /data/cvs/libvirt/src/conf.c,v
retrieving revision 1.11
diff -u -p -r1.11 conf.c
--- libvirt/src/conf.c 4 Jul 2007 09:16:23 -0000 1.11
+++ libvirt/src/conf.c 19 Oct 2007 08:37:36 -0000
@@ -345,6 +345,8 @@ virConfParseLong(virConfParserCtxtPtr ct
l = l * 10 + (CUR - '0');
NEXT;
}
+ if (neg)
+ l *= -1;
*val = l;
return(0);
}
--------------------------------------------------------------------------
17 years, 1 month
[Libvir] Opening KVM guest in xterm rather than vnc
by David Mueller
I'm trying to setup my virtual machines to display in an xterm window
rather than a VNC window. The guests and host are Fedora 7; the guest
only needs to run in a console mode (no X11). I see a bit on
http://libvirt.org/format.html about using a console tag instead of
graphics in my XML, but I can't figure out how to connect to that.
With our older Xen on Fedora Core 5 setup, we used the following
command to create a guest and it worked great; I'm trying to
approximate something similar with libvirt/KVM on Fedora 7:
xterm -e "/usr/sbin/xm create -c guest.xen"
A notable advantage of using an xterm over VNC is that we can resize
the window; with VNC as far as I've been able to see, we've been stuck
with the default 80x24 window. We also can't copy and paste text from
the VNC window to other applications.
Any suggestions would be appreciated. I am currently using
libvirt-0.3.2-1.fc7; if this is something that we'll have to wait for
a newer version that will be in Fedora 8, that's okay.
- David
17 years, 1 month
[Libvir] memory error in another test
by Jim Meyering
Running tests under valgrind exposed this:
(line numbers are slightly off, due to local changes)
==27876== ERROR SUMMARY: 32 errors from 2 contexts (suppressed: 5 from 2)
==27876==
==27876== 16 errors in context 1 of 2:
==27876== Conditional jump or move depends on uninitialised value(s)
==27876== at 0x41BA18: qemudBuildCommandLine (qemu_conf.c:1871)
==27876== by 0x406764: testCompareXMLToArgvFiles (qemuxml2argvtest.c:46)
==27876== by 0x4069DA: testCompareXMLToArgvHelper (qemuxml2argvtest.c:97)
==27876== by 0x406D60: virtTestRun (testutils.c:69)
==27876== by 0x406A46: main (qemuxml2argvtest.c:114)
==27876==
==27876== 16 errors in context 2 of 2:
==27876== Conditional jump or move depends on uninitialised value(s)
==27876== at 0x41AA45: qemudBuildCommandLine (qemu_conf.c:1606)
==27876== by 0x406764: testCompareXMLToArgvFiles (qemuxml2argvtest.c:46)
==27876== by 0x4069DA: testCompareXMLToArgvHelper (qemuxml2argvtest.c:97)
==27876== by 0x406D60: virtTestRun (testutils.c:69)
==27876== by 0x406A46: main (qemuxml2argvtest.c:114)
Both of those are due to uses of uninitialized vm->migrateFrom[0].
Here's the fix:
Avoid memory error in a test program.
* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Initialize
vm.migrateFrom[0], to avoid "read-uninitialized" error
from within qemudBuildCommandLine.
Index: tests/qemuxml2argvtest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/qemuxml2argvtest.c,v
retrieving revision 1.5
diff -u -p -r1.5 qemuxml2argvtest.c
--- tests/qemuxml2argvtest.c 21 Sep 2007 21:20:32 -0000 1.5
+++ tests/qemuxml2argvtest.c 17 Oct 2007 13:42:15 -0000
@@ -40,6 +40,7 @@ static int testCompareXMLToArgvFiles(con
vm.qemuVersion = 0 * 1000 * 100 + (8 * 1000) + 1;
vm.qemuCmdFlags = QEMUD_CMD_FLAG_VNC_COLON |
QEMUD_CMD_FLAG_NO_REBOOT;
+ vm.migrateFrom[0] = '\0';
vmdef->vncActivePort = vmdef->vncPort;
17 years, 1 month
[Libvir] avoid reading uninitialized memory in test program
by Jim Meyering
valgrind complained about the printf in conftest.c.
Here's the fix:
* src/conf.c (__virConfWriteMem): Fix typos in comment.
* tests/conftest.c (main): Use fwrite, not printf, since the
result buffer is not NUL-terminated.
===================================================================
RCS file: /data/cvs/libvirt/src/conf.c,v
retrieving revision 1.11
diff -u -p -r1.11 conf.c
--- src/conf.c 4 Jul 2007 09:16:23 -0000 1.11
+++ src/conf.c 17 Oct 2007 11:31:54 -0000
@@ -1,7 +1,7 @@
/**
* conf.c: parser for a subset of the Python encoded Xen configuration files
*
- * Copyright (C) 2006 Red Hat, Inc.
+ * Copyright (C) 2006, 2007 Red Hat, Inc.
*
* See COPYING.LIB for the License of this software
*
@@ -916,7 +916,7 @@ error:
/**
* __virConfWriteMem:
* @memory: pointer to the memory to store the config file
- * @len: pointer to the lenght in byte of the store, on output the size
+ * @len: pointer to the length in bytes of the store, on output the size
* @conf: the conf
*
* Writes a configuration file back to a memory area. @len is an IN/OUT
===================================================================
RCS file: /data/cvs/libvirt/tests/conftest.c,v
retrieving revision 1.1
diff -u -p -r1.1 conftest.c
--- tests/conftest.c 29 Aug 2006 22:27:07 -0000 1.1
+++ tests/conftest.c 17 Oct 2007 11:31:54 -0000
@@ -24,7 +24,10 @@ int main(int argc, char **argv) {
fprintf(stderr, "Failed to serialize %s back\n", argv[1]);
exit(3);
}
- printf("%s", buffer);
virConfFree(conf);
+ if (fwrite(buffer, len, 1, stdout) != len) {
+ fprintf(stderr, "Write failed\n");
+ exit(1);
+ }
exit(0);
}
17 years, 1 month