[Libvir] New style CDROM config in Xen 3.0.3
by Daniel P. Berrange
So in a recent change to xen-unstable.hg the way CDROM devices are configured
for HVM guests changed. They are now treated as regular IDE devices, and a
CDROM is signified by presence of ':cdrom' suffix on the device name
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00369.html
libvirt obviously needs to support both this new style config, and the old
(<= 3.0.2) style configs. Thus I requested addition of 'xend_config_format'
attribute in the /xend/node SEXPR data from XenD. Christian recently
committed this patch, so we can now support both CDROM style configs in
libvirt. I am attaching a patch to implement this support - basically it
touches xend_internal.c to fix XML->SEXPR conversion, and xml.c to fix
SEXPR->XML conversion. Then this is corresponding additions to the unit
tests to validate the new code, and also validate that I didn't break
existing code.
I am attaching the patches, but I don't intend to commit them to libvirt
just yet because I don't actually have the new 3.0.3 xend running on my
test systems fully yet. If anyone is using 3.0.3 any testing would be
appreciated, otherwise I aim to test this towards end of next week.
Regards,
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 -=|
18 years, 3 months
[Libvir] [PATCH] Support setting vnc port
by Jeremy Katz
We display the vncport, but never used it when creating the Xen sexpr.
Attached fixes that. It also adds support for "port=-1" implying "use
the first unused port"[1]
Jeremy
[1] The xen and qemu "vncunused" parameter
18 years, 3 months
[Libvir] Semantics for ListDomains/ ListDefinedDomains
by Daniel P. Berrange
So I was thinking a little about lifecycle support for passive domains in
libvirt and wanted to clarify the intended semantics of the two methods:
virConnectListDomains
virConnectListDefinedDomains
Am I correct in thinking that virConnectListDefinedDomains will list a
domain if-and-only-if its state == 'shutoff', and that virConnectListDomains
will list a domain if-and-only-if its state != 'shutoff'
ie, when I start a defined domain with 'virDomainCreate', it will be removed
from the 'ListDefinedDomains' set and added to the 'ListDomains' set.
Likewise when shutting down it'll move back the other way. Or will the
virConnectListDefinedDomains call always list a domain with a config
file, even if it is running ?
I realize this is a little hypothetical since XenD doesn't have lifecycle
management yet, but it matters to the test backend, and any potential
QEMU / UML backend, and the future XenD XML-RPC backend
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 -=|
18 years, 3 months
[Libvir] [QEMU 3/3] the qemu driver & daemon
by Daniel P. Berrange
Attached is the patch for the qemu driver & daemon process
Since there is no scalable way to determine active standalone QEMU instances,
or access their monitor connection, the backend implements a management
daemon - called 'qemud' - which takes care of managing the complete lifecycle
of QEMU virtual machines. The libvirt driver is a thin shim which talks to
qemud via a UNIX domain socket - the wire protocol is modelled after the
protocol used for libvirt_proxy, but obviously contains alot more functions
since its full read/write, not just read-only.
There is intended to be one qemud instance per UNIX user - the so called
'session' instance, and optionally one system global instance runing as
root (or a system daemon account?) - the so called 'system' instance. When
using libvirt, the URIs for each are 'qemu:///session' and 'qemu:///system'
respectively. The UNIX socket for session instances is $HOME/.qemud and is
chmod 0700 - no support is provided for users connecting to each other's
instances. Although we could trivially extend to create a read-only socket
$HOME/.qemud-ro if desired. The system instance is currently not finished
but intended to run in /var/run/qemud or some such.
The backend code is in src/qemu_internal.h, src/qemu_internal.c, the daemon
code is in qemud/* with qemud/protocol.h defining the network wire protocol.
This latter header file is also included by src/qemu_internal.c
- qemud.c - the main daemon management code - handles all network I/O and
forking / cleanup of QEMU processes. The implementation is
poll() based & completely non-blocking. All requests/replies
from a single client are, however, serialized.
- dispatch.c - takes care of serializing/de-serializing requests/replies
from/to libvirt - called from qemud.c when a complete
message is available.
- driver.c - the implementation of each request from libvirt - called
from dispatch.c
- config.c - manages reading & writing of XML files for inactive domains
in the $HOME/.qemud.d/*.xml. Also takes care of generating
a suitable command line for execing qemu.
In terms of hardware, there is support for
- harddisk - floppy, cdrom, harddisk
- graphics - VNC
- memory
- virtual CPUs
In particular no support for
- networking
- sound
- non-native CPU types
- boot order
But its enough to demonstrate the practice.
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 -=|
18 years, 3 months
[Libvir] Added gettext translation support
by Daniel P. Berrange
The attached patch adds support for translating all text strings in libvirt
and virsh using gettext. It also fixes up many error messages, and updates
others to use a consistent style - so we don't have lots of slightly differenet
translations of the same thing.
It also adds an 'autoclean.sh' which deletes all autotools generated junk
so you can more easily generate useful patches using diff against a pristine
source tree.
The patch adds a placeholder en_GB.po file (with no changes). It is expected
that real translations for a large number of languages will be completed
over course of next couple of months
Regards,
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 -=|
18 years, 4 months
[Libvir] [QEMU 2/3] add commands for inactive domains to virsh
by Daniel P. Berrange
The attached patch adds new commands to virsh, and modifies the list
command.
* 'list' is given two additional parameters '--inactive' to tell it to
list inactive instances, instead of active instances, and --all to
tell it to list both active & instance domains. NB inactive domains
will show with an ID of -1 and state 'shut off'.
* 'define' defines an inactive domain - instructing the backend to
save the XML definition in some persist location. The domain is
not started.
* 'undefine' removes an inactive domain - the persist config file
managed by the backend is deleted. The domain must not be running
when this is run.
* 'start' starts up an inactive domain which was previously defined
via the 'define' command.
Regards,
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 -=|
18 years, 4 months
[Libvir] [QEMU 1/3] hook up driver methods for inactive domains
by Daniel P. Berrange
The attached patch prepares the driver method API to support inactive
domains. The following methods are hooked up:
* virConnectListDefinedDomains
* virConnectNumOfDefinedDomains
* virDomainDefineXML
* virDomainUndefine
* virDomainCreate
It sets all existing drivers to have NULL in these fields.
The existing code in virDomainDefineXML was ripped out since it was found
to be more trouble than it was worth - the backend driver needed to repeat
most of the logic anyway - so better just to delegate the whole lot.
Regards,
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 -=|
18 years, 4 months
[Libvir] generator.py -- why?
by pvetere@redhat.com
Hi all. So, I found a bug in the python bindings that I'd really like to fix,
but when I sat down to do so I quickly found myself mired in a swampy mess of
code generation: generator.py. :-) Now, I feel compelled to ask -- why don't
we just have a static libvirt.py file that is WYSIWYG? The generator.py
program alone is longer than the file it generates, and having a static file
would not only make the code easier to read, but would also make bug fixing
much simpler. But, I'm sure there's got to be a good reason for it. :-)
Here's a program that produces the bug I tried to address:
import libvirt
def get_domain(dom_name):
conn = libvirt.openReadOnly(None)
domain = conn.lookupByName(dom_name)
return domain
d = get_domain("mydomain")
print d.info()
This is a fairly typical "factory" pattern I could imagine people using. The
problem is that the connection object falls out of scope after the get_domain
routine ends, and is therefore garbage collected. This leaves the "d" domain
object with no valid connection, resulting in a "libvir: Xen error : failed Xen
syscall ioctl 3166208" error. The simple solution would be for the connection
object to pass a reference to itself into each domain object it creates. The
domain objects would then maintain the reference until they are destroyed.
I valiantly tried to follow the table-based patterns used in generator.py to fix
this problem, but I found myself inventing somewhat arbitrary rules just to
force the code I wanted it to output.
And hence, $SUBJECT. :-)
Pete
18 years, 4 months
[Libvir] [QEMU 0/3] QEMU support for libvirt
by Daniel P. Berrange
The following series of patches add support for QEMU to libvirt. The
patches are:
- libvirt-drivers-qemu.patch - hook up methods for inactive domains
- libvirt-virsh-qemu.patch - hook up inactive domain methods to virsh
- libvirt-backend-qemu.patch - the main QEMU backend
The patches will be explained further in each email which follows.
NB, the first two patches are ready for inclusion, but the last one needs
more error handling, and another audit of the networking code to check
in particular buffer sizes.
For testing I used Damn Small Linux, and QEMU 0.8.1 from Fedora Core 5
(the one with VNC support)
wget http://distro.ibiblio.org/pub/linux/distributions/damnsmall/current/dsl-3...
Here is a suitable config file:
<domain type='qemu'>
<name>dsl</name>
<uuid>fff64701-45b9-11cb-88e3-afbfe5370493</uuid>
<memory>131072</memory>
<vcpu>20</vcpu>
<devices>
<disk type='file' device='cdrom'>
<source file='/home/berrange/dsl-3.0.1.iso'/>
<target dev='hdc'/>
</disk>
<graphics type='vnc' port='5906'/>
</devices>
</domain>
An example session with virsh:
[berrange@aubergine ~]$ export VIRSH_DEFAULT_CONNECT_URI=qemu:///session
[berrange@aubergine ~]$ virsh list
Id Name State
----------------------------------
[berrange@aubergine ~]$ virsh define $HOME/dsl.xml
Domain dsl defined from /home/berrange/dsl.xml
[berrange@aubergine ~]$ virsh list --all
Id Name State
----------------------------------
-1 dsl shut off
[berrange@aubergine ~]$ virsh dominfo dsl
Id: -1
Name: dsl
UUID: fff64701-45b9-11cb-88e3-afbfe5370493
OS Type: linux
State: shut off
CPU(s): 20
Max memory: 131072 kB
Used memory: 131072 kB
[berrange@aubergine ~]$ virsh start dsl
Domain dsl started
[berrange@aubergine ~]$ virsh list --all
Id Name State
----------------------------------
1 dsl running
[berrange@aubergine ~]$ virsh dumpxml dsl
<domain type='qemu' id='1'>
<name>dsl</name>
<uuid>fff64701-45b9-11cb-88e3-afbfe5370493</uuid>
<memory>131072</memory>
<vcpu>20</vcpu>
<devices>
<disk type='file' device='cdrom'>
<source file='/home/berrange/dsl-3.0.1.iso'/>
<target dev='hdc'/>
<readonly/>
</disk>
<graphics type='vnc' port='5906'/>
</devices>
</domain>
[berrange@aubergine ~]$ virsh destroy dsl
Domain dsl destroyed
[berrange@aubergine ~]$ virsh list --all
Id Name State
----------------------------------
-1 dsl shut off
I'm also happy to report that it is also possible to use virt-manager
with the QEMU support - just enter qemu:///session as the URI. That
said you can't use the VM creation wizard, but it should be easy to
hook that up. The fact that virt-manager works without modification
is a really great proof of the value of libvirt abstract driver backend
API concept - validating the decision not to make a Xen specific API.
Regards,
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 -=|
18 years, 4 months
[Libvir] Support graphical console for PV Xen guests
by Jeremy Katz
With the paravirt framebuffer patches for Xen, we can support having a
graphical console for PV as well as HVM guests. The attached adds
support to libvirt by breaking out the <graphics> parsing into its own
function that can be used by both PV and HVM guests. It also adds
support for looking at the appropriate sexpr for the vnc/sdl console for
PV guests.
One thing that is potentially not okay is that I've changed sexpr_node
to take a format string instead of just a const char *, but since it's
not public API and doesn't actually change anything for callers I think
it should be fine. If not, let me know and I can change it.
Jeremy
18 years, 4 months