Re: [libvirt] RFC: Domain events add DEFINED and UNDEFINED events
On Fri, Nov 07, 2008 at 07:12:46AM -0500, Ben Guthro wrote: I think this sounds reasonable. Let me see if I understand the state machine for a newly created persistent domain: DEFINED-ADDED-STARTED-STOPPED Actually, swap ADDED DEFINED, and for completeness, if I add in an virDomainUndefine, you'd get ADDED-DEFINED-STARTED-STOPPED-UNDEFINED-REMOVED Starting, then stopping a previously defined persistent domain would just emit STARTED-STOPPED and a transient domain would be: ADDED-STARTED-STOPPED-REMOVED Yes, that's one possible path. If you were to define a config for an existing transient domain though you could end up with ADDED-STARTED-DEFINED-STOPPED-UNDEFINED-REMOVED Will it be an issue for domains that only support a subset of these events (like xen) I think it is inevitable that this happens, so we likely want some way to inform the application what events are available for the driver. Yesterday, I began looking into creating a xen driver patch for emitting the DEFINED/UNDEFINED events via inotify. It looks like the easiest way to do this right now is to create yet another Xen sub-driver. I don't expect this to take an extremely long time, as this tutorial from IBM makes it fairly straightforward to understand: http://www-128.ibm.com/developerworks/linux/library/l-inotify.html The experimental user mode linux driver has some iNotify code in it too if you want another point of reference. See the umlInotifyEvent() method umlStartup() where I register for the events http://www.redhat.com/archives/libvir-list/2008-October/msg00355.html Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] mark a few diagnostics for translation
FYI. This is trivial, so I'll push it soon unless someone objects. From d5d9bc7e5473ea3ce40c4af70a2085c316023723 Mon Sep 17 00:00:00 2001 From: Jim Meyering [EMAIL PROTECTED] Date: Thu, 6 Nov 2008 20:41:34 +0100 Subject: [PATCH] mark a few diagnostics for translation * src/lxc_conf.c (lxcLoadDriverConfig): Mark a diagnostic. * src/lxc_driver.c (lxcDomainStart): Likewise. * po/POTFILES.in: Add src/lxc_conf.c. * Makefile.maint (msg_gen_function): Add virReportErrorHelper and lxcError. --- Makefile.maint |3 ++- po/POTFILES.in |1 + src/lxc_conf.c |5 ++--- src/lxc_driver.c |2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile.maint b/Makefile.maint index d856469..28b1c3f 100644 --- a/Makefile.maint +++ b/Makefile.maint @@ -353,6 +353,8 @@ msg_gen_function += qemudReportError msg_gen_function += openvzLog msg_gen_function += openvzError msg_gen_function += virDomainReportError +msg_gen_function += virReportErrorHelper +msg_gen_function += lxcError # Uncomment the following and run make syntax-check to see diagnostics # that are not yet marked for translation, but that need to be rewritten @@ -360,7 +362,6 @@ msg_gen_function += virDomainReportError # msg_gen_function += error # msg_gen_function += virXenError # msg_gen_function += testError -# msg_gen_function += lxcError func_or := $(shell printf '$(msg_gen_function)'|tr -s '[[:space:]]' '|') func_re := ($(func_or)) diff --git a/po/POTFILES.in b/po/POTFILES.in index fdb34b5..3f8fdd2 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -7,6 +7,7 @@ src/datatypes.c src/domain_conf.c src/iptables.c src/libvirt.c +src/lxc_conf.c src/lxc_container.c src/lxc_controller.c src/lxc_driver.c diff --git a/src/lxc_conf.c b/src/lxc_conf.c index 76f4e9d..0db9bb5 100644 --- a/src/lxc_conf.c +++ b/src/lxc_conf.c @@ -83,8 +83,7 @@ int lxcLoadDriverConfig(lxc_driver_t *driver) return 0; no_memory: -lxcError(NULL, NULL, VIR_ERR_NO_MEMORY, configDir); +lxcError(NULL, NULL, VIR_ERR_NO_MEMORY, + %s, _(while loading LXC driver config)); return -1; } - - diff --git a/src/lxc_driver.c b/src/lxc_driver.c index 8bfd27d..583c4ff 100644 --- a/src/lxc_driver.c +++ b/src/lxc_driver.c @@ -857,7 +857,7 @@ static int lxcDomainStart(virDomainPtr dom) if (!vm) { lxcError(conn, dom, VIR_ERR_INVALID_DOMAIN, - no domain with uuid); + _(no domain named %s), dom-name); goto cleanup; } -- 1.6.0.3.756.gb776d -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] always compile iptables.c
On Fri, Nov 07, 2008 at 02:49:43PM +0100, Jim Meyering wrote: This is slightly different from the previous version. The new part is the addition of the virRun stub to prevent a mingw link failure when building with shared libraries. Now, configured like this, it builds without error: /usr/bin/mingw32-configure --without-sasl --without-avahi \ --without-polkit --without-python --without-xen --without-qemu \ --without-lxc --without-openvz --without-libvirtd \ --prefix=/tmp/libvirt-inst --enable-compile-warnings=maximum OK, looks good to me, +1. On an unrelated point, probably any usage of __MINGW32__ is suspect, eg: #else /* __MINGW32__ */ Our MinGW cross-compiler defines the symbol 'WIN32', and so do all compilers on Windows itself[1][2]. Therefore it's better to use #ifdef WIN32 ... #endif for any code that is specific to the Win32 API. The __MINGW32__ symbol has a place for code which is specific to the MinGW version of GCC, eg. if it had a bug that we needed to work around. The attached patch appears to work with some light testing. Rich. [1] Even for 64-bit code. [2] The exception is Cygwin, but you can argue that Cygwin is really a Unix API. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones Read my OCaml programming blog: http://camltastic.blogspot.com/ Fedora now supports 68 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora Index: src/console.c === RCS file: /data/cvs/libvirt/src/console.c,v retrieving revision 1.7 diff -u -r1.7 console.c --- src/console.c 10 Apr 2008 16:53:29 - 1.7 +++ src/console.c 7 Nov 2008 14:06:57 - @@ -22,7 +22,7 @@ #include config.h -#ifndef __MINGW32__ +#ifndef WIN32 #include stdio.h #include sys/types.h @@ -197,4 +197,4 @@ return ret; } -#endif /* !__MINGW32__ */ +#endif /* !WIN32 */ Index: src/console.h === RCS file: /data/cvs/libvirt/src/console.h,v retrieving revision 1.5 diff -u -r1.5 console.h --- src/console.h 20 Aug 2008 20:48:35 - 1.5 +++ src/console.h 7 Nov 2008 14:06:57 - @@ -23,10 +23,10 @@ #ifndef __VIR_CONSOLE_H__ #define __VIR_CONSOLE_H__ -#ifndef __MINGW32__ +#ifndef WIN32 int vshRunConsole(const char *tty); -#endif /* !__MINGW32__ */ +#endif /* !WIN32 */ #endif /* __VIR_CONSOLE_H__ */ Index: src/storage_backend.c === RCS file: /data/cvs/libvirt/src/storage_backend.c,v retrieving revision 1.26 diff -u -r1.26 storage_backend.c --- src/storage_backend.c 4 Nov 2008 22:30:34 - 1.26 +++ src/storage_backend.c 7 Nov 2008 14:06:57 - @@ -246,7 +246,7 @@ return -2; if (S_ISREG(sb.st_mode)) { -#ifndef __MINGW32__ +#ifndef WIN32 vol-allocation = (unsigned long long)sb.st_blocks * (unsigned long long)sb.st_blksize; #else @@ -421,7 +421,7 @@ } -#ifndef __MINGW32__ +#ifndef WIN32 /* * Run an external program. * Index: src/util.c === RCS file: /data/cvs/libvirt/src/util.c,v retrieving revision 1.66 diff -u -r1.66 util.c --- src/util.c 6 Nov 2008 16:36:07 - 1.66 +++ src/util.c 7 Nov 2008 14:06:58 - @@ -116,7 +116,7 @@ } -#ifndef __MINGW32__ +#ifndef WIN32 static int virSetCloseExec(int fd) { int flags; @@ -577,7 +577,7 @@ return ret; } -#else /* __MINGW32__ */ +#else /* WIN32 */ int virExec(virConnectPtr conn, @@ -594,7 +594,7 @@ return -1; } -#endif /* __MINGW32__ */ +#endif /* WIN32 */ /* Like gnulib's fread_file, but read no more than the specified maximum number of bytes. If the length of the input is = max_len, and Index: src/virsh.c === RCS file: /data/cvs/libvirt/src/virsh.c,v retrieving revision 1.170 diff -u -r1.170 virsh.c --- src/virsh.c 13 Oct 2008 16:46:29 - 1.170 +++ src/virsh.c 7 Nov 2008 14:07:02 - @@ -481,7 +481,7 @@ {NULL, 0, 0, NULL} }; -#ifndef __MINGW32__ +#ifndef WIN32 static int cmdConsole(vshControl *ctl, const vshCmd *cmd) @@ -531,7 +531,7 @@ return ret; } -#else /* __MINGW32__ */ +#else /* WIN32 */ static int cmdConsole(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) @@ -540,7 +540,7 @@ return FALSE; } -#endif /* __MINGW32__ */ +#endif /* WIN32 */ /* * list command -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] Re: _lstat link failure on mingw
On Fri, Nov 07, 2008 at 02:46:16PM +0100, Jim Meyering wrote: This fixes a problem spotted by Rich Jones yesterday: Dan actually, but +1 anyway. 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 -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] always compile iptables.c
Richard W.M. Jones [EMAIL PROTECTED] wrote: On Fri, Nov 07, 2008 at 02:49:43PM +0100, Jim Meyering wrote: This is slightly different from the previous version. The new part is the addition of the virRun stub to prevent a mingw link failure when building with shared libraries. Now, configured like this, it builds without error: /usr/bin/mingw32-configure --without-sasl --without-avahi \ --without-polkit --without-python --without-xen --without-qemu \ --without-lxc --without-openvz --without-libvirtd \ --prefix=/tmp/libvirt-inst --enable-compile-warnings=maximum OK, looks good to me, +1. Thanks. On an unrelated point, probably any usage of __MINGW32__ is suspect, eg: s/any/any *other*/ ? #else /* __MINGW32__ */ Our MinGW cross-compiler defines the symbol 'WIN32', and so do all compilers on Windows itself[1][2]. Therefore it's better to use #ifdef WIN32 ... #endif for any code that is specific to the Win32 API. The __MINGW32__ symbol has a place for code which is specific to the MinGW version of GCC, eg. if it had a bug that we needed to work around. In the case of lstat, that use of __MINGW32__ is deliberate, since the guarded code is needed only on mingw, and not on cygwin. So using WIN32 there would be wrong. -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] _lstat link failure on mingw
On Fri, Nov 07, 2008 at 02:46:16PM +0100, Jim Meyering wrote: This fixes a problem spotted by Rich Jones yesterday: From 5d5042ad904f8da693c1a5e392cd4d9b86a1 Mon Sep 17 00:00:00 2001 From: Jim Meyering [EMAIL PROTECTED] Date: Thu, 6 Nov 2008 20:46:46 +0100 Subject: [PATCH] tweak lstat.c to avoid mingw link failure * gnulib/lib/lstat.c: Include sys/stat.h *before* the use of stat in orig_stat. Otherwise, on mingw (which lacks lstat), any program using the lstat module would not get the redefinition- to-stat provided by gnulib's sys/stat.h. ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] 0/7 host (node) device enumeration - completed submission
P.S. Patch 7/7 (Java bindings for host dev enum) hasn't changed. On Thu, 2008-11-06 at 21:32 -0500, David Lively wrote: Daniel(s) - In the attached set of patches, I've merged in DanB's reworking of the headers, etc. and adjusted my code accordingly. I've also renamed NodeDriver to DeviceMonitor, as discussed with DanV, and added a --cap option to the virsh node-list-devices command. -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] PATCH: Misc fixes to events code
Daniel P. Berrange wrote on 11/04/2008 05:05 PM: Well lets just start with STARTED/STOPPED from xenstore, and possibly try ADDED/REMOVED using inotify on /etc/xen or /var/lib/xend/domains. These are what virt-manager cares about the most. The others are just a nice-to-have. Perhaps I just can't see it, but is there already mechanism where I can look up a domain (virDomainPtr) given a config filename? I'd rather not re-invent the wheel if this is already written... I think that there should be code to do this somewhere in the xm_internal file when listing defined (but not running) domains...but I'm just not seeing it Ben -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] always compile iptables.c
On Fri, Nov 07, 2008 at 03:34:59PM +0100, Jim Meyering wrote: Richard W.M. Jones [EMAIL PROTECTED] wrote: On an unrelated point, probably any usage of __MINGW32__ is suspect, eg: s/any/any *other*/ ? I'm pretty sure any, in this case too. #else /* __MINGW32__ */ Our MinGW cross-compiler defines the symbol 'WIN32', and so do all compilers on Windows itself[1][2]. Therefore it's better to use #ifdef WIN32 ... #endif for any code that is specific to the Win32 API. The __MINGW32__ symbol has a place for code which is specific to the MinGW version of GCC, eg. if it had a bug that we needed to work around. In the case of lstat, that use of __MINGW32__ is deliberate, since the guarded code is needed only on mingw, and not on cygwin. So using WIN32 there would be wrong. Cygwin isn't like other Windows compilers -- it exposes a Unix/POSIX API (not Win32 which is a completely different API, even though some of the calls happen to look superficially similar). Cygwin doesn't define WIN32 symbol[1], so using WIN32 here should be OK. Anyway, I don't think anyone is using Cygwin to compile libvirt. The licensing issues alone mean that it'd be unacceptable to most of our users. Rich. [1] Well, that's not entirely true: if you use Cygwin and then include windows.h, you do get WIN32 symbol defined, because by doing this you've got both POSIX _and_ Win32 APIs available. WIN32 tells you that the Win32 API is available, not that POSIX is unavailable. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] RFC: Domain events add DEFINED and UNDEFINED events
I suppose I could make some sort of configure option to only compile it in optionally... I don't have access to a solaris box though...so don't really know what the appropriate API would be in that situation Daniel Veillard wrote on 11/07/2008 07:39 AM: On Fri, Nov 07, 2008 at 12:26:23PM +, Daniel P. Berrange wrote: Yesterday, I began looking into creating a xen driver patch for emitting the DEFINED/UNDEFINED events via inotify. It looks like the easiest way to do this right now is to create yet another Xen sub-driver. I don't expect this to take an extremely long time, as this tutorial from IBM makes it fairly straightforward to understand: http://www-128.ibm.com/developerworks/linux/library/l-inotify.html The experimental user mode linux driver has some iNotify code in it too if you want another point of reference. See the umlInotifyEvent() method umlStartup() where I register for the events http://www.redhat.com/archives/libvir-list/2008-October/msg00355.html Hum, the only problem is that contrary to uml , the xen drivers should not be Linux specific, but inotify is linux specific. Making this subdriver Linux only should still be okay until someone using Solaris comes with an appropriate patch though, /me hopes to never get involved again into the mess of portable APIs for file changes notifications. Daniel -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] RFC: Domain events add DEFINED and UNDEFINED events
On Fri, Nov 07, 2008 at 12:26:23PM +, Daniel P. Berrange wrote: Yesterday, I began looking into creating a xen driver patch for emitting the DEFINED/UNDEFINED events via inotify. It looks like the easiest way to do this right now is to create yet another Xen sub-driver. I don't expect this to take an extremely long time, as this tutorial from IBM makes it fairly straightforward to understand: http://www-128.ibm.com/developerworks/linux/library/l-inotify.html The experimental user mode linux driver has some iNotify code in it too if you want another point of reference. See the umlInotifyEvent() method umlStartup() where I register for the events http://www.redhat.com/archives/libvir-list/2008-October/msg00355.html Hum, the only problem is that contrary to uml , the xen drivers should not be Linux specific, but inotify is linux specific. Making this subdriver Linux only should still be okay until someone using Solaris comes with an appropriate patch though, /me hopes to never get involved again into the mess of portable APIs for file changes notifications. Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ [EMAIL PROTECTED] | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
RE: [libvirt] RFC: Domain events add DEFINED and UNDEFINED events
I think this sounds reasonable. Let me see if I understand the state machine for a newly created persistent domain: DEFINED-ADDED-STARTED-STOPPED Starting, then stopping a previously defined persistent domain would just emit STARTED-STOPPED and a transient domain would be: ADDED-STARTED-STOPPED-REMOVED Will it be an issue for domains that only support a subset of these events (like xen) Yesterday, I began looking into creating a xen driver patch for emitting the DEFINED/UNDEFINED events via inotify. It looks like the easiest way to do this right now is to create yet another Xen sub-driver. I don't expect this to take an extremely long time, as this tutorial from IBM makes it fairly straightforward to understand: http://www-128.ibm.com/developerworks/linux/library/l-inotify.html -Original Message- From: [EMAIL PROTECTED] on behalf of Daniel P. Berrange Sent: Fri 11/7/2008 5:34 AM To: libvir-list@redhat.com Subject: [libvirt] RFC: Domain events add DEFINED and UNDEFINED events We currently have the following list of events for domains: VIR_DOMAIN_EVENT_ADDED, VIR_DOMAIN_EVENT_REMOVED, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_RESUMED, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_SAVED, VIR_DOMAIN_EVENT_RESTORED, The QEMU driver supports all of them, except for ADDED and REMOVED. I was looking at adding these and wondering how exactly we should define the semantics Originally I was just going to emit 'ADDED' from virDomainDefine() driver impl and 'REMOVED' from virDomainUndefine(). This does not, however, take into account that there are two sorts of domains, so called 'persistent' and 'transient' domains. With a transient domain, there is no config file, so the first time you know about the domain is when it is booted via virDomainCreateXML(), and all trace of it disappears when it shuts down, or migrates, or is saved. With a persistent domain though, it is visible before it is booted, and remains visible after shutdown/migrate/save etc. The current set of events does not allow applications to get this level of visibility. eg when receiving a VIR_DOMAIN_EVENT_STOPPED event, there is no way to know wether the domain was transient / persistent, and thus whether to remove it from your list of VMs, or simply mark it shutoff. So, I'd like to propose that we do the following: - Clarify the semantics for * VIR_DOMAIN_EVENT_ADDED Emitted when a domain comes into existance, by which I mean a previously known inactive domain is defined, or a transient domain is booted. This is emited before any other events for a domain with that UUID/name. * VIR_DOMAIN_EVENT_REMOVED Emitted when a domains goes out of existance, by which I mean a transient domain shuts down / migrates / is saved, or a persistent domain is undefined. This is the last event ever to be emitted for a domain with that UUID/name. - Create two more events * VIR_DOMAIN_EVENT_DEFINED Emitted whenenever a domain's config file is created. This can be when a peristent domain is first defined, when it is later re-defined, or when an transient domain gains a confi file, becoming persistent. * VIR_DOMAIN_EVENT_UNDEFINED Emitted when a domain's config file is removed. With this complete set of events, virt-manager is able to track domains without ever having to poll for the domain listing. I think we also need to provide some way for an application to determine what set of events a hypervisor backend supports. eg, if it only supports the STARTED/STOPPED events, virt-manager would still need to do polling to find out about defined/undefined domains. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] always compile iptables.c
This is slightly different from the previous version. The new part is the addition of the virRun stub to prevent a mingw link failure when building with shared libraries. Now, configured like this, it builds without error: /usr/bin/mingw32-configure --without-sasl --without-avahi \ --without-polkit --without-python --without-xen --without-qemu \ --without-lxc --without-openvz --without-libvirtd \ --prefix=/tmp/libvirt-inst --enable-compile-warnings=maximum From 0b35049f3cd10dbfd650aae692c553e940409805 Mon Sep 17 00:00:00 2001 From: Jim Meyering [EMAIL PROTECTED] Date: Thu, 6 Nov 2008 08:42:33 +0100 Subject: [PATCH 1/3] always compile iptables.c Avoid a build error when configuring --without-xen --without-qemu. * src/iptables.c [WITH_QEMU]: Don't #ifdef-out. * src/iptables.h [WITH_QEMU]: Don't #ifdef-out. * src/util.c (virRun) [__MINGW32__]: Define a stub that always fails. --- src/iptables.c |4 src/iptables.h |6 +- src/util.c | 12 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/iptables.c b/src/iptables.c index 53e0f41..ad7fddf 100644 --- a/src/iptables.c +++ b/src/iptables.c @@ -21,8 +21,6 @@ #include config.h -#if WITH_QEMU - #include stdio.h #include stdlib.h #include stdarg.h @@ -1120,5 +1118,3 @@ iptablesRemoveForwardMasquerade(iptablesContext *ctx, { return iptablesForwardMasquerade(ctx, network, physdev, REMOVE); } - -#endif /* WITH_QEMU */ diff --git a/src/iptables.h b/src/iptables.h index 95f07de..fbe9b5d 100644 --- a/src/iptables.h +++ b/src/iptables.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Red Hat, Inc. + * Copyright (C) 2007, 2008 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,8 +22,6 @@ #ifndef __QEMUD_IPTABLES_H__ #define __QEMUD_IPTABLES_H__ -#if WITH_QEMU - typedef struct _iptablesContext iptablesContext; iptablesContext *iptablesContextNew (void); @@ -95,6 +93,4 @@ int iptablesRemoveForwardMasquerade (iptablesContext *ctx, const char *network, const char *physdev); -#endif /* WITH_QEMU */ - #endif /* __QEMUD_IPTABLES_H__ */ diff --git a/src/util.c b/src/util.c index abc86d6..6141847 100644 --- a/src/util.c +++ b/src/util.c @@ -580,6 +580,18 @@ virRun(virConnectPtr conn, #else /* __MINGW32__ */ int +virRun(virConnectPtr conn, + const char *const *argv ATTRIBUTE_UNUSED, + int *status) +{ +if (status) +*status = ENOTSUP; +else +ReportError (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__); +return -1; +} + +int virExec(virConnectPtr conn, const char *const*argv ATTRIBUTE_UNUSED, const char *const*envp ATTRIBUTE_UNUSED, -- 1.6.0.3.756.gb776d -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] RFC: Domain events add DEFINED and UNDEFINED events
We currently have the following list of events for domains: VIR_DOMAIN_EVENT_ADDED, VIR_DOMAIN_EVENT_REMOVED, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_RESUMED, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_SAVED, VIR_DOMAIN_EVENT_RESTORED, The QEMU driver supports all of them, except for ADDED and REMOVED. I was looking at adding these and wondering how exactly we should define the semantics Originally I was just going to emit 'ADDED' from virDomainDefine() driver impl and 'REMOVED' from virDomainUndefine(). This does not, however, take into account that there are two sorts of domains, so called 'persistent' and 'transient' domains. With a transient domain, there is no config file, so the first time you know about the domain is when it is booted via virDomainCreateXML(), and all trace of it disappears when it shuts down, or migrates, or is saved. With a persistent domain though, it is visible before it is booted, and remains visible after shutdown/migrate/save etc. The current set of events does not allow applications to get this level of visibility. eg when receiving a VIR_DOMAIN_EVENT_STOPPED event, there is no way to know wether the domain was transient / persistent, and thus whether to remove it from your list of VMs, or simply mark it shutoff. So, I'd like to propose that we do the following: - Clarify the semantics for * VIR_DOMAIN_EVENT_ADDED Emitted when a domain comes into existance, by which I mean a previously known inactive domain is defined, or a transient domain is booted. This is emited before any other events for a domain with that UUID/name. * VIR_DOMAIN_EVENT_REMOVED Emitted when a domains goes out of existance, by which I mean a transient domain shuts down / migrates / is saved, or a persistent domain is undefined. This is the last event ever to be emitted for a domain with that UUID/name. - Create two more events * VIR_DOMAIN_EVENT_DEFINED Emitted whenenever a domain's config file is created. This can be when a peristent domain is first defined, when it is later re-defined, or when an transient domain gains a confi file, becoming persistent. * VIR_DOMAIN_EVENT_UNDEFINED Emitted when a domain's config file is removed. With this complete set of events, virt-manager is able to track domains without ever having to poll for the domain listing. I think we also need to provide some way for an application to determine what set of events a hypervisor backend supports. eg, if it only supports the STARTED/STOPPED events, virt-manager would still need to do polling to find out about defined/undefined domains. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] _lstat link failure on mingw
This fixes a problem spotted by Rich Jones yesterday: From 5d5042ad904f8da693c1a5e392cd4d9b86a1 Mon Sep 17 00:00:00 2001 From: Jim Meyering [EMAIL PROTECTED] Date: Thu, 6 Nov 2008 20:46:46 +0100 Subject: [PATCH] tweak lstat.c to avoid mingw link failure * gnulib/lib/lstat.c: Include sys/stat.h *before* the use of stat in orig_stat. Otherwise, on mingw (which lacks lstat), any program using the lstat module would not get the redefinition- to-stat provided by gnulib's sys/stat.h. --- gnulib/lib/lstat.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gnulib/lib/lstat.c b/gnulib/lib/lstat.c index 3d1bca8..aa5e8c4 100644 --- a/gnulib/lib/lstat.c +++ b/gnulib/lib/lstat.c @@ -25,15 +25,15 @@ #include sys/stat.h #undef __need_system_sys_stat_h +/* Specification. */ +#include sys/stat.h + static inline int orig_lstat (const char *filename, struct stat *buf) { return lstat (filename, buf); } -/* Specification. */ -#include sys/stat.h - #include string.h #include errno.h -- 1.6.0.3.756.gb776d -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Java bindings for domain events
The attached patch (against libvirt-java) contains Java bindings for the new domain event code. It works (see EventTest.java), but there's a certain amount of hokiness regarding the EventImpl stuff that I'd like to discuss. Unlike the C and Python interfaces, the Java interface does not currently allow the client to supply an EventImpl. The problem is that Java really has no way to interact with unix file descriptors so there's no reasonable way to implement a fd-watching EventImpl in pure Java (java.io.FileDescriptor doesn't do the trick since there's no way of constructing one from raw (int) unix fd)[**]. So for now, I've had the Java bindings register an EventImpl when the Connect class is loaded. This EventImpl is a Java class, with native methods implementing it. In fact, I've simply stolen (verbatim) the EventImpl from libvirt/qemud/events.c and made the native methods call it. [If we stick with this solution, it would obviously be better to somehow share this code with libvirtd rather than copy it.] The other tricky subject is multi-threading. For now, I've avoided it by exposing Connect.eventImpl.run_once() and forcing the client to call it from their event loop. But the normal Java way of doing things would simply run the EventImpl in a separate thread. In fact, this EventImpl does implement Runnable, which makes it trivial to run in a separate thread -- but I don't declare that it implements Runnable yet because it's not safe to run in a thread while another thread might be making libvirt calls. It shouldn't be hard to make this thread-safe using Java synchronized methods and statements, but I haven't done that yet. Should I?? ** java.nio.Channel and friends seem to be the right interface for exposing abstract selectable channels in Java. It's just complicated enough that I've avoided it for now. But I can look into going this way for allowing Java to provide an EventImpl in the future .. Cheers, Dave diff --git a/EventTest.java b/EventTest.java new file mode 100644 index 000..dc01f8b --- /dev/null +++ b/EventTest.java @@ -0,0 +1,35 @@ +import org.libvirt.*; + +class TestDomainEventListener implements DomainEventListener { + +String name; + +TestDomainEventListener(String name) { + this.name = name; +} + +public void handle(Domain dom, int event) { + try { + System.out.println(name + : dom + dom.getName() + got event + event); + } catch (LibvirtException e) { + System.out.println(e); + System.out.println(name + : unknown dom got event + event); + } +} +} + +class EventTest { + +public static void main(String args[]) throws LibvirtException { + String URI = qemu:///system; + if (args.length 0) + URI = args[0]; + Connect conn = new Connect(URI); + conn.domainEventRegister(new TestDomainEventListener(Test 1)); + conn.domainEventRegister(new TestDomainEventListener(Test 2)); + + while (true) { + conn.eventImpl.run_once(); + } +} +} diff --git a/src/Makefile.am b/src/Makefile.am index 5200c1d..a265de9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,9 +7,11 @@ java_libvirt_source_files = \ org/libvirt/ConnectAuthDefault.java \ org/libvirt/ConnectAuth.java \ org/libvirt/DomainBlockStats.java \ + org/libvirt/DomainEventListener.java \ org/libvirt/DomainInfo.java \ org/libvirt/DomainInterfaceStats.java \ org/libvirt/Domain.java \ + org/libvirt/EventImpl.java \ org/libvirt/ErrorException.java \ org/libvirt/Error.java \ org/libvirt/Network.java \ diff --git a/src/jni/Makefile.am b/src/jni/Makefile.am index c894024..829298a 100644 --- a/src/jni/Makefile.am +++ b/src/jni/Makefile.am @@ -5,6 +5,7 @@ GENERATED = \ org_libvirt_Domain_CreateFlags.h \ org_libvirt_Domain_MigrateFlags.h \ org_libvirt_Domain_XMLFlags.h \ + org_libvirt_EventImpl.h \ org_libvirt_StoragePool_BuildFlags.h \ org_libvirt_StoragePool_DeleteFlags.h \ org_libvirt_StoragePool.h \ @@ -25,6 +26,9 @@ org_libvirt_Network.h: $(JAVA_CLASS_ROOT)/org/libvirt/Network.class org_libvirt_Domain.h org_libvirt_Domain_CreateFlags.h org_libvirt_Domain_MigrateFlags.h org_libvirt_Domain_XMLFlags.h : $(JAVA_CLASS_ROOT)/org/libvirt/Domain.class $(JAVAH) -classpath $(JAVA_CLASS_ROOT) org.libvirt.Domain +org_libvirt_EventImpl.h : $(JAVA_CLASS_ROOT)/org/libvirt/EventImpl.class + $(JAVAH) -classpath $(JAVA_CLASS_ROOT) org.libvirt.EventImpl + org_libvirt_StoragePool.h org_libvirt_StoragePool_BuildFlags.h org_libvirt_StoragePool_DeleteFlags.h : $(JAVA_CLASS_ROOT)/org/libvirt/StoragePool.class $(JAVAH) -classpath $(JAVA_CLASS_ROOT) org.libvirt.StoragePool @@ -36,6 +40,7 @@ libvirt_jni_la_SOURCES = \ org_libvirt_Network.c \ org_libvirt_Connect.c \ org_libvirt_Domain.c \ + org_libvirt_EventImpl.c \ org_libvirt_StoragePool.c \ org_libvirt_StorageVol.c \ generic.h \ diff --git a/src/jni/org_libvirt_Connect.c b/src/jni/org_libvirt_Connect.c index cbf437c..3107159 100644 --- a/src/jni/org_libvirt_Connect.c +++