[libvirt] [PATCH v2] xen: Prevent updating device when attaching a device

2011-02-09 Thread Osier Yang
When attaching a device that already exists, xend driver updates
the device with "device_configure", it causes problems (e.g. for
disk device, 'device_configure' only can be used to update device
like CDROM), on the other hand, we provide additional API
(virDomainUpdateDevice) to update device, this fix is to raise up
errors instead of updating the existed device which is not CDROM
device.

Changes from v1 to v2:
  - allow update CDROM

* src/xen/xend_internal.c
---
 src/xen/xend_internal.c |   42 +-
 1 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index cd30336..bc23595 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -3965,6 +3965,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const 
char *xml,
 virDomainDefPtr def = NULL;
 virBuffer buf = VIR_BUFFER_INITIALIZER;
 char class[8], ref[80];
+char *target = NULL;

 if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
 virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
@@ -4029,6 +4030,13 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const 
char *xml,
 STREQ(def->os.type, "hvm") ? 1 : 0,
 priv->xendConfigVersion, 1) < 0)
 goto cleanup;
+
+if (dev->data.disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
+if (!(target = strdup(dev->data.disk->dst))) {
+virReportOOMError();
+goto cleanup;
+}
+}
 break;

 case VIR_DOMAIN_DEVICE_NET:
@@ -4038,6 +4046,14 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const 
char *xml,
STREQ(def->os.type, "hvm") ? 1 : 0,
priv->xendConfigVersion, 1) < 0)
 goto cleanup;
+
+char macStr[VIR_MAC_STRING_BUFLEN];
+virFormatMacAddr(dev->data.net->mac, macStr);
+
+if (!(target = strdup(macStr))) {
+virReportOOMError();
+goto cleanup;
+}
 break;

 case VIR_DOMAIN_DEVICE_HOSTDEV:
@@ -4046,6 +4062,17 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const 
char *xml,
 if (xenDaemonFormatSxprOnePCI(dev->data.hostdev,
   &buf, 0) < 0)
 goto cleanup;
+
+virDomainDevicePCIAddress PCIAddr;
+
+PCIAddr = dev->data.hostdev->source.subsys.u.pci;
+virAsprintf(&target, "PCI device: %.4x:%.2x:%.2x", PCIAddr.domain,
+ PCIAddr.bus, PCIAddr.slot);
+
+if (target == NULL) {
+virReportOOMError();
+goto cleanup;
+}
 } else {
 virXendError(VIR_ERR_NO_SUPPORT, "%s",
  _("unsupported device type"));
@@ -4065,17 +4092,22 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const 
char *xml,
 /* device doesn't exist, define it */
 ret = xend_op(domain->conn, domain->name, "op", "device_create",
   "config", sexpr, NULL);
-}
-else {
-/* device exists, attempt to modify it */
-ret = xend_op(domain->conn, domain->name, "op", "device_configure",
-  "config", sexpr, "dev", ref, NULL);
+} else {
+if (dev->data.disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
+virXendError(VIR_ERR_OPERATION_INVALID,
+ _("target '%s' already exists"), target);
+} else {
+/* device exists, attempt to modify it */
+ret = xend_op(domain->conn, domain->name, "op", "device_configure",
+  "config", sexpr, "dev", ref, NULL);
+}
 }

 cleanup:
 VIR_FREE(sexpr);
 virDomainDefFree(def);
 virDomainDeviceDefFree(dev);
+VIR_FREE(target);
 return ret;
 }

--
1.7.3.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] docs: Clarify usage of vram and heads

2011-02-09 Thread Matthias Bolte
2011/2/9 Osier Yang :
> Though attributes "vram" and "heads" of "video" element are generic,
> they are only useful for vbox driver currently.
>

That's not true, the vram attribute is supported by the esx and vmware
driver too.

Matthias

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH v2] xen: Prevent updating device when attaching a device

2011-02-09 Thread Osier Yang

于 2011年02月09日 16:51, Osier Yang 写道:

When attaching a device that already exists, xend driver updates
the device with "device_configure", it causes problems (e.g. for
disk device, 'device_configure' only can be used to update device
like CDROM), on the other hand, we provide additional API
(virDomainUpdateDevice) to update device, this fix is to raise up
errors instead of updating the existed device which is not CDROM
device.

Changes from v1 to v2:
   - allow update CDROM



s/allow/allow to/ will change it when pushing. :-)

Regards
Osier

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] docs: Clarify usage of vram and heads

2011-02-09 Thread Osier Yang

于 2011年02月09日 17:37, Matthias Bolte 写道:

2011/2/9 Osier Yang:

Though attributes "vram" and "heads" of "video" element are generic,
they are only useful for vbox driver currently.



That's not true, the vram attribute is supported by the esx and vmware
driver too.


so only these 3 drivers support it, right?

Regards
Osier

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] docs: Clarify usage of vram and heads

2011-02-09 Thread Osier Yang

于 2011年02月09日 17:37, Matthias Bolte 写道:

2011/2/9 Osier Yang:

Though attributes "vram" and "heads" of "video" element are generic,
they are only useful for vbox driver currently.



That's not true, the vram attribute is supported by the esx and vmware
driver too.


ah, yeah, recall I have seen the codes last weekend, forgot about it.
 :-)

Matthias


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 2/2] Give each virtual network bridge its own fixed MAC address

2011-02-09 Thread Laine Stump
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=609463

The problem was that, since a bridge always acquires the MAC address
of the connected interface with the numerically lowest MAC, as guests
are started and stopped, it was possible for the MAC address to change
over time, and this change in the network was being detected by
Windows 7 (it sees the MAC of the default route change), so on each
reboot it would bring up a dialog box asking about this "new network".

The solution is to create a dummy tap interface with a MAC guaranteed
to be lower than any guest interface's MAC, and attach that tap to the
bridge as soon as it's created. Since all guest MAC addresses start
with 0xFE, we can just generate a MAC with the standard "0x52, 0x54,
0" prefix, and it's guaranteed to always win (physical interfaces are
never connected to these bridges, so we don't need to worry about
competing numerically with them).

Note that the dummy tap is never set to IFF_UP state - that's not
necessary in order for the bridge to take its MAC, and not setting it
to UP eliminates the clutter of having an (eg) "virbr0-mac" displayed
in the output of the ifconfig command.

Problem that needs a solution:
-

I chose to not auto-generate the MAC address in the network XML
parser, as there are likely to be consumers of that API that don't
need or want to have a MAC address associated with the
bridge.

Instead, in bridge_driver.c when the network is being brought
up, if there is no MAC, I generate one then. One down side of this is
that the MAC is written to the *statedir* xml file (in
/var/lib/libvirt/networks) but no to the *config* xml (in
/etc/libvirt/qemu/networks). That means that if libvirtd is restarted
while the network is down, the next time it's started it will have a
different MAC.

It looks like the only place the *config* xml is written is in
networkDefine or networkCreate, but that's inadequate for this case,
as anyone upgrading their libvirt will want this change to take effect
for all their already-defined networks.

DV suggested that we could add a flag to the parser telling it whether
or not to auto-generate a MAC when one wasn't specified. That would
require (at least) adding a new arg to:

   virNetworkDefParseFile
   virNetworkDefParse
   virNetworkDefParseNode
   virNetworkDefParseXML

and adding this arg would be embedding details of the XML attributes
into the C API arglist, which doesn't seem very clean - this could set
a very bad precedent that would lead to argument clutter (one of the
things that using XML helps to prevent). Also, it would be one more
arg to be potentially set incorrectly by some new user of the parser.

Any advice on the cleanest way to solve this problem?
---
 src/conf/network_conf.c |   21 ++-
 src/conf/network_conf.h |3 ++
 src/libvirt_private.syms|1 +
 src/network/bridge_driver.c |   47 +++
 4 files changed, 71 insertions(+), 1 deletions(-)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 28a3ee8..592e38c 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -628,6 +628,19 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
 if (virXPathULong("string(./bridge[1]/@delay)", ctxt, &def->delay) < 0)
 def->delay = 0;
 
+tmp = virXPathString("string(./bridge[1]/@mac)", ctxt);
+if (tmp) {
+if (virParseMacAddr(tmp, def->mac) < 0) {
+virNetworkReportError(VIR_ERR_XML_ERROR,
+  _("Invalid bridge mac address '%s' in 
network '%s'"),
+  tmp, def->name);
+VIR_FREE(tmp);
+goto error;
+}
+VIR_FREE(tmp);
+def->mac_specified = true;
+}
+
 nIps = virXPathNodeSet("./ip", ctxt, &ipNodes);
 if (nIps > 0) {
 int ii;
@@ -853,9 +866,15 @@ char *virNetworkDefFormat(const virNetworkDefPtr def)
 virBufferAddLit(&buf, "  bridge)
 virBufferEscapeString(&buf, " name='%s'", def->bridge);
-virBufferVSprintf(&buf, " stp='%s' delay='%ld' />\n",
+virBufferVSprintf(&buf, " stp='%s' delay='%ld'",
   def->stp ? "on" : "off",
   def->delay);
+if (def->mac_specified) {
+char macaddr[VIR_MAC_STRING_BUFLEN];
+virFormatMacAddr(def->mac, macaddr);
+virBufferVSprintf(&buf, " mac='%s'", macaddr);
+}
+virBufferAddLit(&buf, " />\n");
 
 if (def->domain)
 virBufferVSprintf(&buf, "  \n", def->domain);
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index fd96c36..1bde4ac 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -31,6 +31,7 @@
 # include "internal.h"
 # include "threads.h"
 # include "network.h"
+# include "util.h"
 
 /* 2 possible types of forwarding */
 enum virNetworkForwardType {
@@ -92,6 +93,8 @@ struct _virNetworkDef {
 char *domain;
 unsigned long delay;   /* Br

[libvirt] [PATCH 0/2] Give each virtual network bridge its own fixed MAC address

2011-02-09 Thread Laine Stump

This fixes https://bugzilla.redhat.com/show_bug.cgi?id=609463

As usual for me, this series has a problem searching for a more
elegant solution. See PATCH 2/2 for details.

Is it too late to put this in 0.8.8? (assuming a solution to that
problem, of course).

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 1/2] Allow brAddTap to create a tap device that is down

2011-02-09 Thread Laine Stump
An upcoming patch has a use for a tap device to be created that
doesn't need to be actually put into the "up" state, and keeping it
"down" keeps the output of ifconfig from being unnecessarily cluttered
(ifconfig won't show down interfaces unless you add "-a").

bridge.[ch]: add "up" as an arg to brAddTap()
uml_conf.c, qemu_command.c: add "up" (set to "true") to brAddTap() call.
---
 src/qemu/qemu_command.c |1 +
 src/uml/uml_conf.c  |1 +
 src/util/bridge.c   |3 ++-
 src/util/bridge.h   |1 +
 4 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f78ce71..600830a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -252,6 +252,7 @@ qemuNetworkIfaceConnect(virConnectPtr conn,
 &net->ifname,
 tapmac,
 vnet_hdr,
+true,
 &tapfd))) {
 if (err == ENOTSUP) {
 /* In this particular case, give a better diagnostic. */
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index e5dbed9..7c8fb16 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -143,6 +143,7 @@ umlConnectTapDevice(virConnectPtr conn,
 &net->ifname,
 tapmac,
 0,
+true,
 NULL))) {
 if (err == ENOTSUP) {
 /* In this particular case, give a better diagnostic. */
diff --git a/src/util/bridge.c b/src/util/bridge.c
index e53fce5..3ed71be 100644
--- a/src/util/bridge.c
+++ b/src/util/bridge.c
@@ -484,6 +484,7 @@ brAddTap(brControl *ctl,
  char **ifname,
  const unsigned char *macaddr,
  int vnet_hdr,
+ bool up,
  int *tapfd)
 {
 int fd;
@@ -530,7 +531,7 @@ brAddTap(brControl *ctl,
 goto error;
 if ((errno = brAddInterface(ctl, bridge, ifr.ifr_name)))
 goto error;
-if ((errno = brSetInterfaceUp(ctl, ifr.ifr_name, 1)))
+if (up && ((errno = brSetInterfaceUp(ctl, ifr.ifr_name, 1
 goto error;
 if (!tapfd &&
 (errno = ioctl(fd, TUNSETPERSIST, 1)))
diff --git a/src/util/bridge.h b/src/util/bridge.h
index e8e7eca..93f0b33 100644
--- a/src/util/bridge.h
+++ b/src/util/bridge.h
@@ -71,6 +71,7 @@ int brAddTap(brControl *ctl,
  char **ifname,
  const unsigned char *macaddr,
  int vnet_hdr,
+ bool up,
  int *tapfd);
 
 int brDeleteTap (brControl *ctl,
-- 
1.7.3.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH libvirt-site] Add libvirt-php information page

2011-02-09 Thread Michal Novotny

On 02/09/2011 02:48 AM, Daniel Veillard wrote:

On Tue, Feb 08, 2011 at 01:33:44PM +0100, Michal Novotny wrote:

Hi,
this is the patch to add libvirt-php information page with some
basic information on libvirt-php project compilation, contribution
and other useful information.

Michal

Signed-off-by: Michal Novotny
---
  docs/bindings.html.in |   13 ---
  docs/php.html.in  |   85 +
  docs/sitemap.html.in  |4 ++
  3 files changed, 96 insertions(+), 6 deletions(-)
  create mode 100644 docs/php.html.in


   ACK, pushed !



Thanks for pushing this!


BTW on Fedora 14 I gat many warnings when compiling against
php-devel-5.3.5-1.fc14, mostly around add_assoc_string_ex()
e.g.:

libvirt.c: In function ‘zif_libvirt_node_get_info’:
libvirt.c:613:2: warning: passing argument 4 of ‘add_assoc_string_ex’ makes 
pointer from integer without a cast
/usr/include/php/Zend/zend_API.h:360:45: note: expected ‘char *’ but argument 
is of type ‘long int’
libvirt.c: In function ‘zif_libvirt_domain_get_name’:
libvirt.c:1081:6: warning: assignment discards qualifiers from pointer target 
type

   I wonder if some zend API interface didn't changed at some point
leading to this !

Daniel

Yeah, that's right and I'm using Fedora 14 as well but you can ignore 
the warnings since it's working fine. Of course we should clean them up 
but I didn't have time to solve this yet. I guess this is some internal 
error of Zend API interface since "add_assoc_string_ex" function is not 
used in the code but "add_assoc_string" is used instead. Therefore I 
guess Zend API is having some macro defined for add_assoc_string() which 
is buggy.


But like I say, it's warning that I was afraid of first as well but I've 
found out that it's working fine when you ignore those warnings.


Michal

--
Michal Novotny, RHCE
Virtualization Team (xen userspace), Red Hat

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH RFC] Don't use CLONE_NEWUSER for now

2011-02-09 Thread Daniel P. Berrange
On Tue, Feb 08, 2011 at 08:58:24PM -0600, Serge E. Hallyn wrote:
> Until now, user namespaces have not done much, but (for that
> reason) have been innocuous to glob in with other CLONE_
> flags.  Upcoming userns development, however, will make tasks
> cloned with CLONE_NEWUSER far more restricted.  In particular,
> for some time they will be unable to access files with anything
> other than the world access perms.
> 
> This patch assumes that noone really needs the user namespaces
> to be enabled.  If that is wrong, then we can try a more
> baroque patch where we create a file owned by a test userid with
> 700 perms and, if we can't access it after setuid'ing to that
> userid, then return 0.  Otherwise, assume we are using an
> older, 'harmless' user namespace implementation.
> 
> Comments appreciated.  Is it ok to do this?

Given what you describe on the UserNamespaces wiki page I believe
this is the right thing todo in libvirt. There's no compelling
reason why we were setting this flag in the first place, other
than the fact that it existed & was thought todo something.

> 
> Signed-off-by: Serge Hallyn 
> ---
>  src/lxc/lxc_container.c |7 +++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
> index 876bc62..a735eb7 100644
> --- a/src/lxc/lxc_container.c
> +++ b/src/lxc/lxc_container.c
> @@ -810,7 +810,14 @@ static int lxcContainerChild( void *data )
>  
>  static int userns_supported(void)
>  {
> +#if 1
> +/*
> + * put off using userns until uid mapping is implemented
> + */
> +return 0;
> +#else
>  return lxcContainerAvailable(LXC_CONTAINER_FEATURE_USER) == 0;
> +#endif
>  }

ACK

Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] docs: Clarify usage of vram and heads

2011-02-09 Thread Daniel P. Berrange
On Wed, Feb 09, 2011 at 05:39:46PM +0800, Osier Yang wrote:
> 于 2011年02月09日 17:37, Matthias Bolte 写道:
> >2011/2/9 Osier Yang:
> >>Though attributes "vram" and "heads" of "video" element are generic,
> >>they are only useful for vbox driver currently.
> >>
> >
> >That's not true, the vram attribute is supported by the esx and vmware
> >driver too.
> >
> so only these 3 drivers support it, right?

QEMU with the QXL driver honours vram too

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] Strange nodedev-dumpxml ??

2011-02-09 Thread arnaud.champion
?Hi,

I have maybe a strange thing on a nodedev-dumpxml virsh result :

virsh # nodedev-dumpxml block_sr0

  block_sr0
  scsi_0_0_1_0
  
/dev/sr0
scsi
cdrom
DVD RW DRU-190S
SONY

  0
  0

  


I think (note I'm not sure), the capabilty type removable should be in the 
device element, like this :

virsh # nodedev-dumpxml block_sr0

  block_sr0
  scsi_0_0_1_0
  
/dev/sr0
scsi
cdrom
DVD RW DRU-190S
SONY
  
  
  0
  0
  



Let me know if I'm wrong.--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] Reserve PCI addresses 3 and 4 on qemu-system-ppc

2011-02-09 Thread Niels de Vos
On Mon, Feb 7, 2011 at 5:12 PM, Eric Blake  wrote:
> On 02/07/2011 05:13 AM, Daniel P. Berrange wrote:
>> Oh fun, it is actually worse than this. On PPC slot 1 is occupied by the
>> VGA adapter, while slot 2 is the IDE controller, so we'll need to make
>> some more complex changes here.
>>
>> We're gonna need to change this for every other arch too, in fact it looks
>> like it probably differs for each '-M' arg value too :-(
>>
>> I'm wondering whether we should just have a separate method for each combo
>> rather than trying to make one method do everything.
>
> Definitely sounds like the sort of thing where we need an arch-specific
> callback function that can report the correct reservation information
> for that architecture (similar to how we already have arch-specific
> callbacks for computing cpu features).

Okay, makes sense to me. Would extending "struct qemu_arch_info" in
src/qemu/qemu_capabilities.c be suitable enough?
We could add a function pointer that reserves some PCI-slots where
needed. Currently the table already supports different archs and
machines (machines seems NULL everywhere though).

Any objections if I have a look into adding this functionality there?
(Note, I don't have any no timeframe, it's purely hobby for me.)

Thanks,
Niels

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [libvirt-php 1/2] Introduce set_error() function and fix error handling/formatting

2011-02-09 Thread Michal Novotny
Hi,
this is the patch to switch error reporting facility to set_error()
function which is having the original code. This is useful to set
error from every place we need instead of setting it just by libvirt
error handler. This was mainly done to bail with error in the case
you call libvirt function that's not supported by your version of
libvirt (using LIBVIR_VERSION_NUMBER constant).

Signed-off-by: Michal Novotny 
---
 libvirt.c |  279 
 php_libvirt.h |4 -
 2 files changed, 159 insertions(+), 124 deletions(-)

diff --git a/libvirt.c b/libvirt.c
index 2926813..ebd009a 100644
--- a/libvirt.c
+++ b/libvirt.c
@@ -12,7 +12,7 @@
 #define VIR_NETWORKS_ACTIVE1
 #define VIR_NETWORKS_INACTIVE  2
 
-//- ZEND thread safe per request globals definition 
+/* ZEND thread safe per request globals definition */
 int le_libvirt_connection;
 int le_libvirt_domain;
 int le_libvirt_storagepool;
@@ -22,7 +22,6 @@ int le_libvirt_nodedev;
 
 ZEND_DECLARE_MODULE_GLOBALS(libvirt)
 
-//static
 ZEND_BEGIN_ARG_INFO_EX(arginfo_libvirt_connect, 0, 0, 0)
ZEND_ARG_INFO(0, url)
ZEND_ARG_INFO(0, readonly)
@@ -60,18 +59,14 @@ static function_entry libvirt_functions[] = {
PHP_FE(libvirt_domain_define_xml, NULL)
PHP_FE(libvirt_domain_create_xml, NULL)
PHP_FE(libvirt_domain_memory_peek,NULL)
-#if LIBVIR_VERSION_NUMBER>=7005
PHP_FE(libvirt_domain_memory_stats,NULL)
-#endif
PHP_FE(libvirt_domain_block_stats,NULL)
PHP_FE(libvirt_domain_interface_stats,NULL)
PHP_FE(libvirt_version,NULL)
PHP_FE(libvirt_domain_get_connect, NULL)
PHP_FE(libvirt_domain_migrate, NULL)
PHP_FE(libvirt_domain_migrate_to_uri, NULL)
-#if LIBVIR_VERSION_NUMBER>=7007 
PHP_FE(libvirt_domain_get_job_info, NULL)
-#endif
PHP_FE(libvirt_domain_xml_xpath, NULL)
PHP_FE(libvirt_domain_get_block_info, NULL)
 PHP_FE(libvirt_domain_get_network_info, NULL)
@@ -121,32 +116,32 @@ zend_module_entry libvirt_module_entry = {
 ZEND_GET_MODULE(libvirt)
 #endif
 
-//- PHP init options
+/* PHP init options */
 PHP_INI_BEGIN()
-STD_PHP_INI_ENTRY("libvirt.longlong_to_string", "1", PHP_INI_ALL, 
OnUpdateBool, longlong_to_string_ini, zend_libvirt_globals, libvirt_globals)
+   STD_PHP_INI_ENTRY("libvirt.longlong_to_string", "1", PHP_INI_ALL, 
OnUpdateBool, longlong_to_string_ini, zend_libvirt_globals, libvirt_globals)
 PHP_INI_END()
 
-//PHP requires to have this function defined
+/* PHP requires to have this function defined */
 static void php_libvirt_init_globals(zend_libvirt_globals *libvirt_globals)
 {
libvirt_globals->longlong_to_string_ini = 1;
 }
 
-//PHP request initialization
+/* PHP request initialization */
 PHP_RINIT_FUNCTION(libvirt)
 {
LIBVIRT_G (last_error)=NULL;
return SUCCESS;
 }
 
-//PHP request destruction
+/* PHP request destruction */
 PHP_RSHUTDOWN_FUNCTION(libvirt)
 {
if (LIBVIRT_G (last_error)!=NULL) efree(LIBVIRT_G (last_error));
return SUCCESS;
 }
 
-//phpinfo()
+/* Information function for phpinfo() */
 PHP_MINFO_FUNCTION(libvirt)
 {
unsigned long libVer;
@@ -166,16 +161,22 @@ PHP_MINFO_FUNCTION(libvirt)
php_info_print_table_end();
 }
 
-//calback error for receiving errors from libvirt. Pass them to PHP and stores 
for last_error function
-catch_error(void *userData, virErrorPtr error)
+/* Function to set the error message and pass it to PHP */
+void set_error(char *msg)
 {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING,"%s",error->message);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING,"%s",msg);
if (LIBVIRT_G (last_error)!=NULL) efree(LIBVIRT_G (last_error));
-   LIBVIRT_G (last_error)=estrndup(error->message,strlen(error->message));
+   LIBVIRT_G (last_error)=estrndup(msg,strlen(msg));
+}
+
+/* Error handler for receiving libvirt errors */
+catch_error(void *userData, virErrorPtr error)
+{
+   set_error(error->message);
 }
 
 
-//Destructor for connection resource
+/* Destructor for connection resource */
 static void php_libvirt_connection_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
 {
php_libvirt_connection *conn = (php_libvirt_connection*)rsrc->ptr;
@@ -186,7 +187,7 @@ static void 
php_libvirt_connection_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
conn->conn=NULL;
 }
 
-//Destructor for domain resource
+/* Destructor for domain resource */
 static void php_libvirt_domain_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
 {
php_libvirt_domain *domain = (php_libvirt_domain*)rsrc->ptr;
@@ -196,7 +197,7 @@ static void php_libvirt_domain_dtor(zend_rsrc_list_entry 
*rsrc TSRMLS_DC)
domain->domain=NULL;
 }
 
-//Destructor for storagepool resource
+/* Destructor for storagepool resource */
 static void php_libvirt_storagepool_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
 {
php_libvirt_storagepool *pool = (php_libvirt_storagepool*)

[libvirt] [libvirt-php 0/2] Introduce set_error() function and fix compilation warnings

2011-02-09 Thread Michal Novotny
Hi,
this is the patch to introduce set_error() function to be able to set error from
everywhere we want (and not just using the libvirt error handler), e.g. when the
API function is not available in the libvirt version the user is using. Also, 
the
formatting and error handling has been fixed.

Second part of the patch is fixing the compilation warnings. Patch has been 
tested
on Fedora 14 box using php 5.3.4-1 version of Fedora 14 and it was working as
designed.

Michal

Signed-off-by: Michal Novotny 

Michal Novotny (2):
  Introduce set_error() function and fix error handling/formatting
  Fix compilation warnings

 libvirt.c |  382 -
 php_libvirt.h |4 -
 2 files changed, 212 insertions(+), 174 deletions(-)

-- 
1.7.3.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] Strange nodedev-dumpxml ??

2011-02-09 Thread Daniel P. Berrange
On Wed, Feb 09, 2011 at 01:39:33PM +0100, arnaud.champ...@devatom.fr wrote:
> ?Hi,
> 
> I have maybe a strange thing on a nodedev-dumpxml virsh result :
> 
> virsh # nodedev-dumpxml block_sr0
> 
>   block_sr0
>   scsi_0_0_1_0
>   
> /dev/sr0
> scsi
> cdrom
> DVD RW DRU-190S
> SONY
> 
>   0
>   0
> 
>   
> 
> 
> I think (note I'm not sure), the capabilty type removable should be in the 
> device element, like this :
> 
> virsh # nodedev-dumpxml block_sr0
> 
>   block_sr0
>   scsi_0_0_1_0
>   
> /dev/sr0
> scsi
> cdrom
> DVD RW DRU-190S
> SONY
>   
>   
>   0
>   0
>   
> 
> 

No, 'removable' is a sub-capability of 'storage', hence it is nested.

Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [libvirt-php 2/2] Fix compilation warnings

2011-02-09 Thread Michal Novotny
Hi,
this is the patch to fix the compilation warnings like:

libvirt.c: In function ‘zif_libvirt_node_get_info’:
libvirt.c:613:2: warning: passing argument 4 of ‘add_assoc_string_ex’ makes 
pointer from integer without a cast
/usr/include/php/Zend/zend_API.h:360:45: note: expected ‘char *’ but argument 
is of type ‘long int’
libvirt.c: In function ‘zif_libvirt_domain_get_name’:
libvirt.c:1081:6: warning: assignment discards qualifiers from pointer target 
type

With this patch applied I was unable to see any warning to the number warnings
dropped to zero on my Fedora-14 box.

Michal

Signed-off-by: Michal Novotny 
---
 libvirt.c |  105 +++-
 1 files changed, 54 insertions(+), 51 deletions(-)

diff --git a/libvirt.c b/libvirt.c
index ebd009a..693443c 100644
--- a/libvirt.c
+++ b/libvirt.c
@@ -170,7 +170,8 @@ void set_error(char *msg)
 }
 
 /* Error handler for receiving libvirt errors */
-catch_error(void *userData, virErrorPtr error)
+static void catch_error(void *userData ATTRIBUTE_UNUSED,
+   virErrorPtr error)
 {
set_error(error->message);
 }
@@ -442,7 +443,7 @@ str_out = estrndup(str_in, strlen(str_in)); \
 #define LONGLONG_ASSOC(out,key,in) \
if (LIBVIRT_G(longlong_to_string_ini)) { \
  snprintf(tmpnumber,63,"%llu",in); \
-  add_assoc_string(out,key,tmpnumber,1); \
+  add_assoc_string_ex(out,key,strlen(key)+1,tmpnumber,1); \
 } \
else \
{ \
@@ -637,7 +638,7 @@ PHP_FUNCTION(libvirt_node_get_info)
if (retval==-1) RETURN_FALSE;
 
array_init(return_value);
-   add_assoc_string(return_value, "model", (long)info.model,1);
+   add_assoc_string_ex(return_value, "model", 6, info.model, 1);
add_assoc_long(return_value, "memory", (long)info.memory);
add_assoc_long(return_value, "cpus", (long)info.cpus);
add_assoc_long(return_value, "nodes", (long)info.nodes);
@@ -1100,11 +1101,14 @@ PHP_FUNCTION(libvirt_domain_get_name)
 {
php_libvirt_domain *domain=NULL;
zval *zdomain;
-   char *name=NULL;
+   const char *name=NULL;
char *name_out;
 
GET_DOMAIN_FROM_ARGS("r",&zdomain);
 
+   if (domain->domain == NULL)
+   RETURN_FALSE;
+
name=virDomainGetName(domain->domain);
if (name==NULL) RETURN_FALSE;
 
@@ -1486,7 +1490,7 @@ char *get_string_from_xpath(char *xml, char *xpath, zval 
**val, int *retVal)
value = (char *)xmlNodeListGetString(doc, 
nodeset->nodeTab[i]->xmlChildrenNode, 1);
 
snprintf(key, sizeof(key), "%d", i);
-   add_assoc_string(*val, key, (long)value, 1);
+   add_assoc_string_ex(*val, key, strlen(key)+1, 
value, 1);
ret++;
}
}
@@ -1543,15 +1547,15 @@ PHP_FUNCTION(libvirt_domain_get_network_info) {
}
 
array_init(return_value);
-   add_assoc_string(return_value, "mac", (long)mac, 1);
-   add_assoc_string(return_value, "network", (long)tmp, 1);
+   add_assoc_string_ex(return_value, "mac", 4, mac, 1);
+   add_assoc_string_ex(return_value, "network", 8, tmp, 1);
 
snprintf(fnpath, sizeof(fnpath), 
"//domain/devices/interface[@type='network']/mac[@address='%s']/../model/@type",
 mac);
tmp = get_string_from_xpath(xml, fnpath, NULL, &retval);
if ((tmp != NULL) && (retval > 0))
-   add_assoc_string(return_value, "nic_type", (long)tmp, 1);
+   add_assoc_string_ex(return_value, "nic_type", 9, tmp, 1);
else
-   add_assoc_string(return_value, "nic_type", (long)"default", 1);
+   add_assoc_string_ex(return_value, "nic_type", 9, "default", 1);
 }
 
 PHP_FUNCTION(libvirt_list_networks)
@@ -1631,11 +1635,6 @@ PHP_FUNCTION(libvirt_list_nodedevs)
free(names[i]);
}
 
-/*
-   if (cap != NULL)
-   add_assoc_string(return_value, "capability", (long)cap, 1);
-*/
-
efree(names);
 }
 
@@ -1739,95 +1738,95 @@ PHP_FUNCTION(libvirt_nodedev_get_information)
RETURN_FALSE;
}
 
-   add_assoc_string(return_value, "name", (long)tmp, 1);
+   add_assoc_string_ex(return_value, "name", 5, tmp, 1);
 
/* Get parent name */
tmp = get_string_from_xpath(xml, "//device/parent", NULL, &retval);
if ((tmp != NULL) && (retval > 0))
-   add_assoc_string(return_value, "parent", (long)tmp, 1);
+   add_assoc_string_ex(return_value, "parent", 7, tmp, 1);
 
/* Get capability */
cap = get_string_from_xpath(xml, "//device/capability/@type", NULL, 
&retval);
if ((cap != NULL) && (retval > 0))
-   add_assoc_string(return_value, "capability", (long)cap, 1);
+   add_assoc_string_ex(return_value, "capability", 11, cap, 1);
 
/* S

Re: [libvirt] [PATCH 1/2] Allow brAddTap to create a tap device that is down

2011-02-09 Thread Daniel P. Berrange
On Wed, Feb 09, 2011 at 04:53:31AM -0500, Laine Stump wrote:
> An upcoming patch has a use for a tap device to be created that
> doesn't need to be actually put into the "up" state, and keeping it
> "down" keeps the output of ifconfig from being unnecessarily cluttered
> (ifconfig won't show down interfaces unless you add "-a").
> 
> bridge.[ch]: add "up" as an arg to brAddTap()
> uml_conf.c, qemu_command.c: add "up" (set to "true") to brAddTap() call.
> ---
>  src/qemu/qemu_command.c |1 +
>  src/uml/uml_conf.c  |1 +
>  src/util/bridge.c   |3 ++-
>  src/util/bridge.h   |1 +
>  4 files changed, 5 insertions(+), 1 deletions(-)

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 2/2] Give each virtual network bridge its own fixed MAC address

2011-02-09 Thread Daniel P. Berrange
On Wed, Feb 09, 2011 at 04:53:32AM -0500, Laine Stump wrote:
> This fixes https://bugzilla.redhat.com/show_bug.cgi?id=609463
> 
> The problem was that, since a bridge always acquires the MAC address
> of the connected interface with the numerically lowest MAC, as guests
> are started and stopped, it was possible for the MAC address to change
> over time, and this change in the network was being detected by
> Windows 7 (it sees the MAC of the default route change), so on each
> reboot it would bring up a dialog box asking about this "new network".
> 
> The solution is to create a dummy tap interface with a MAC guaranteed
> to be lower than any guest interface's MAC, and attach that tap to the
> bridge as soon as it's created. Since all guest MAC addresses start
> with 0xFE, we can just generate a MAC with the standard "0x52, 0x54,
> 0" prefix, and it's guaranteed to always win (physical interfaces are
> never connected to these bridges, so we don't need to worry about
> competing numerically with them).

> Note that the dummy tap is never set to IFF_UP state - that's not
> necessary in order for the bridge to take its MAC, and not setting it
> to UP eliminates the clutter of having an (eg) "virbr0-mac" displayed
> in the output of the ifconfig command.
> 
> Problem that needs a solution:
> -
> 
> I chose to not auto-generate the MAC address in the network XML
> parser, as there are likely to be consumers of that API that don't
> need or want to have a MAC address associated with the
> bridge.
> 
> Instead, in bridge_driver.c when the network is being brought
> up, if there is no MAC, I generate one then. One down side of this is
> that the MAC is written to the *statedir* xml file (in
> /var/lib/libvirt/networks) but no to the *config* xml (in
> /etc/libvirt/qemu/networks). That means that if libvirtd is restarted
> while the network is down, the next time it's started it will have a
> different MAC.
> 
> It looks like the only place the *config* xml is written is in
> networkDefine or networkCreate, but that's inadequate for this case,
> as anyone upgrading their libvirt will want this change to take effect
> for all their already-defined networks.
> 
> DV suggested that we could add a flag to the parser telling it whether
> or not to auto-generate a MAC when one wasn't specified. That would
> require (at least) adding a new arg to:
> 
>virNetworkDefParseFile
>virNetworkDefParse
>virNetworkDefParseNode
>virNetworkDefParseXML
> 
> and adding this arg would be embedding details of the XML attributes
> into the C API arglist, which doesn't seem very clean - this could set
> a very bad precedent that would lead to argument clutter (one of the
> things that using XML helps to prevent). Also, it would be one more
> arg to be potentially set incorrectly by some new user of the parser.
> 
> Any advice on the cleanest way to solve this problem?
> ---
>  src/conf/network_conf.c |   21 ++-
>  src/conf/network_conf.h |3 ++
>  src/libvirt_private.syms|1 +
>  src/network/bridge_driver.c |   47 
> +++
>  4 files changed, 71 insertions(+), 1 deletions(-)
> 
> diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
> index 28a3ee8..592e38c 100644
> --- a/src/conf/network_conf.c
> +++ b/src/conf/network_conf.c
> @@ -628,6 +628,19 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
>  if (virXPathULong("string(./bridge[1]/@delay)", ctxt, &def->delay) < 0)
>  def->delay = 0;
>  
> +tmp = virXPathString("string(./bridge[1]/@mac)", ctxt);
> +if (tmp) {
> +if (virParseMacAddr(tmp, def->mac) < 0) {
> +virNetworkReportError(VIR_ERR_XML_ERROR,
> +  _("Invalid bridge mac address '%s' in 
> network '%s'"),
> +  tmp, def->name);
> +VIR_FREE(tmp);
> +goto error;
> +}
> +VIR_FREE(tmp);
> +def->mac_specified = true;
> +}

I'd be inclined to say that the MAC address should be in the standard
XML format we use elsewhere, eg a subelement

  

> diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
> index 08aaa36..1952dfd 100644
> --- a/src/network/bridge_driver.c
> +++ b/src/network/bridge_driver.c
> @@ -1566,6 +1566,7 @@ networkStartNetworkDaemon(struct network_driver *driver,
>  bool v4present = false, v6present = false;
>  virErrorPtr save_err = NULL;
>  virNetworkIpDefPtr ipdef;
> +char *macTapIfName;
>  
>  if (virNetworkObjIsActive(network)) {
>  networkReportError(VIR_ERR_OPERATION_INVALID,
> @@ -1585,6 +1586,27 @@ networkStartNetworkDaemon(struct network_driver 
> *driver,
>  return -1;
>  }
>  
> +virAsprintf(&macTapIfName, "%s-mac", network->def->bridge);

Not sure about the name suffix here, how about  '-gw' or '-nic' ?

> +if (!macTapIfName) {
> +virReportOOMError();
> +  

[libvirt] [libvirt-snmp][PATCH] Created .gitignore to ignore generated/compiled files.

2011-02-09 Thread Michal Privoznik
I've forgotten to add .gitignore to let git ignore some garbage.

---
 .gitignore |   27 +++
 src/.gitignore |   10 ++
 2 files changed, 37 insertions(+), 0 deletions(-)
 create mode 100644 .gitignore
 create mode 100644 src/.gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000..f4821fb
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,27 @@
+#*#
+*.#*#
+*.a
+*.exe
+*.gcda
+*.gcno
+*.gcov
+*.o
+*.orig
+*.rej
+*~
+.git
+.git-module-status
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache/
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/install-sh
+/libvirt-snmp.spec
+/missing
+/stamp-h1
diff --git a/src/.gitignore b/src/.gitignore
new file mode 100644
index 000..2c8801e
--- /dev/null
+++ b/src/.gitignore
@@ -0,0 +1,10 @@
+Makefile
+Makefile.in
+.deps
+.libs
+*.lo
+*.loT
+*.la
+*.exe
+*.cov
+/libvirtMib_subagent
-- 
1.7.3.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-php 2/2] Fix compilation warnings

2011-02-09 Thread Daniel Veillard
On Wed, Feb 09, 2011 at 02:11:40PM +0100, Michal Novotny wrote:
> Hi,
> this is the patch to fix the compilation warnings like:
> 
> libvirt.c: In function ‘zif_libvirt_node_get_info’:
> libvirt.c:613:2: warning: passing argument 4 of ‘add_assoc_string_ex’ makes 
> pointer from integer without a cast
> /usr/include/php/Zend/zend_API.h:360:45: note: expected ‘char *’ but argument 
> is of type ‘long int’
> libvirt.c: In function ‘zif_libvirt_domain_get_name’:
> libvirt.c:1081:6: warning: assignment discards qualifiers from pointer target 
> type
> 
> With this patch applied I was unable to see any warning to the number warnings
> dropped to zero on my Fedora-14 box.

  Cool, thanks !
I'm not sure I should ACK I guess you don't have to be too formal :-)

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | 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] [PATCH v2] xen: Prevent updating device when attaching a device

2011-02-09 Thread Daniel P. Berrange
On Wed, Feb 09, 2011 at 04:51:27PM +0800, Osier Yang wrote:
> When attaching a device that already exists, xend driver updates
> the device with "device_configure", it causes problems (e.g. for
> disk device, 'device_configure' only can be used to update device
> like CDROM), on the other hand, we provide additional API
> (virDomainUpdateDevice) to update device, this fix is to raise up
> errors instead of updating the existed device which is not CDROM
> device.
> 
> Changes from v1 to v2:
>   - allow update CDROM
> 
> * src/xen/xend_internal.c
> ---
>  src/xen/xend_internal.c |   42 +-
>  1 files changed, 37 insertions(+), 5 deletions(-)



> 
> diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
> index cd30336..bc23595 100644
> --- a/src/xen/xend_internal.c
> +++ b/src/xen/xend_internal.c
> @@ -3965,6 +3965,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const 
> char *xml,
>  virDomainDefPtr def = NULL;
>  virBuffer buf = VIR_BUFFER_INITIALIZER;
>  char class[8], ref[80];
> +char *target = NULL;
> 
>  if ((domain == NULL) || (domain->conn == NULL) || (domain->name == 
> NULL)) {
>  virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
> @@ -4029,6 +4030,13 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const 
> char *xml,
>  STREQ(def->os.type, "hvm") ? 1 : 0,
>  priv->xendConfigVersion, 1) < 0)
>  goto cleanup;
> +
> +if (dev->data.disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {

I can't remember if Xen supports it or not, but do we need  DEVICE_FLOPPY
here too ?

The patch looks good aside from that question

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-php 2/2] Fix compilation warnings

2011-02-09 Thread Michal Novotny

On 02/09/2011 02:57 PM, Daniel Veillard wrote:

On Wed, Feb 09, 2011 at 02:11:40PM +0100, Michal Novotny wrote:

Hi,
this is the patch to fix the compilation warnings like:

libvirt.c: In function ‘zif_libvirt_node_get_info’:
libvirt.c:613:2: warning: passing argument 4 of ‘add_assoc_string_ex’ makes 
pointer from integer without a cast
/usr/include/php/Zend/zend_API.h:360:45: note: expected ‘char *’ but argument 
is of type ‘long int’
libvirt.c: In function ‘zif_libvirt_domain_get_name’:
libvirt.c:1081:6: warning: assignment discards qualifiers from pointer target 
type

With this patch applied I was unable to see any warning to the number warnings
dropped to zero on my Fedora-14 box.

   Cool, thanks !
I'm not sure I should ACK I guess you don't have to be too formal :-)

Daniel

Well, I think it's good to review it and ACK :) To leave just one ACK 
either explicitly or wait few days to auto-ACK it. The main reason for 
posting this to the list is to allow engineers to explicitly NACK it if 
it doesn't make any sense. However you ACKed it now so I'll commit it to 
the repository now ;)


Michal

--
Michal Novotny, RHCE
Virtualization Team (xen userspace), Red Hat

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v2] storage: Allow to delete device mapper disk partition

2011-02-09 Thread Eric Blake
On 02/08/2011 08:02 PM, Osier Yang wrote:
> 于 2011年02月09日 01:12, Eric Blake 写道:
>> On 02/08/2011 03:30 AM, Osier Yang wrote:
>>> +bool
>>> +virIsDevMapperDevice(const char *devname)
>>> +{
>>> +struct stat buf;
>>> +
>>> +if (devname&&
>>> +!stat(devname,&buf)&&
>>
>> One other thing - the check for devname being non-NULL is not
>> necessary...
>>
>>> +bool virIsDevMapperDevice(const char *devname);
>>
>> if you add ATTRIBUTE_NONNULL(1) to this declaration.  Given that the
>> only use of this new function to date doesn't pass a NULL pointer, we
>> might as well make that part of the API.
>>
> Yeah, it's more reasonable to add ATTRIBUTE_NONNULL to this internal
> function, but do we need to make change on the API? I'm not sure
> if it will introduce some problem.

Adding ATTRIBUTE_NONNULL _is_ the API change I was referring to - it
simplifies the implementation, and puts a contract on the caller to not
pass NULL.  We can always remove it later (and re-instate the explicit
null check in the implementation) if we find a reason to, since the
function is internal.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH RFC] Don't use CLONE_NEWUSER for now

2011-02-09 Thread Eric Blake
On 02/09/2011 04:02 AM, Daniel P. Berrange wrote:
>> This patch assumes that noone really needs the user namespaces
>> to be enabled.  If that is wrong, then we can try a more
>> baroque patch where we create a file owned by a test userid with
>> 700 perms and, if we can't access it after setuid'ing to that
>> userid, then return 0.  Otherwise, assume we are using an
>> older, 'harmless' user namespace implementation.
>>
>> Comments appreciated.  Is it ok to do this?
> 
> Given what you describe on the UserNamespaces wiki page I believe
> this is the right thing todo in libvirt. There's no compelling
> reason why we were setting this flag in the first place, other
> than the fact that it existed & was thought todo something.
> 

> ACK

Pushed.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] Reserve PCI addresses 3 and 4 on qemu-system-ppc

2011-02-09 Thread Eric Blake
On 02/09/2011 05:55 AM, Niels de Vos wrote:
>>> I'm wondering whether we should just have a separate method for each combo
>>> rather than trying to make one method do everything.
>>
>> Definitely sounds like the sort of thing where we need an arch-specific
>> callback function that can report the correct reservation information
>> for that architecture (similar to how we already have arch-specific
>> callbacks for computing cpu features).
> 
> Okay, makes sense to me. Would extending "struct qemu_arch_info" in
> src/qemu/qemu_capabilities.c be suitable enough?

Certainly sounds like the right place.

> We could add a function pointer that reserves some PCI-slots where
> needed. Currently the table already supports different archs and
> machines (machines seems NULL everywhere though).
> 
> Any objections if I have a look into adding this functionality there?
> (Note, I don't have any no timeframe, it's purely hobby for me.)

Feel free to submit a patch, and to take as long as you need - the
beauty of open source is that everyone scratches their own itches in the
timeframe that they need.  When you do post a patch, we'll be sure to
review it based on its merits, and either take it as is or give you
feedback for improving it further.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [libvirt-snmp][PATCH] New environment variable managing connection URI.

2011-02-09 Thread Michal Privoznik
Add environment variable LIBVIRT_MIB_CONNECT_URI to control URI
which snmp agent is connecting to. It is now possible to connect
to all hypervisors (including test:///) instead of hardcoded
qemu:///system, which is used now by default when variable is not
set.
---
 src/libvirtSnmp.c |5 -
 src/libvirtSnmp.h |3 +++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/libvirtSnmp.c b/src/libvirtSnmp.c
index ce21369..7652da0 100644
--- a/src/libvirtSnmp.c
+++ b/src/libvirtSnmp.c
@@ -180,7 +180,10 @@ int libvirtSnmpInit(void)
 /* virConnectOpenAuth is called here with all default parameters,
  * except, possibly, the URI of the hypervisor. */
 /* TODO: configure the URI */
-conn = virConnectOpenAuth("qemu:///system", virConnectAuthPtrDefault, 0);
+/* A simple workaround for testing - environment variable */
+char *connect_uri = getenv(CONNECT_URI_ENV);
+
+conn = virConnectOpenAuth((connect_uri ? connect_uri : "qemu:///system"), 
virConnectAuthPtrDefault, 0);
 
 if (NULL == conn) {
 printf("No connection to hypervisor\n");
diff --git a/src/libvirtSnmp.h b/src/libvirtSnmp.h
index 4ac6130..67b6125 100644
--- a/src/libvirtSnmp.h
+++ b/src/libvirtSnmp.h
@@ -10,6 +10,9 @@
 #include 
 #include 
 
+/* Environment variable to control connection URI */
+#define CONNECT_URI_ENV "LIBVIRT_MIB_CONNECT_URI"
+
 /*
  * Populate libvirtGuestTable into given container.
  */
-- 
1.7.3.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-snmp][PATCH] Created .gitignore to ignore generated/compiled files.

2011-02-09 Thread Eric Blake
On 02/09/2011 06:48 AM, Michal Privoznik wrote:
> I've forgotten to add .gitignore to let git ignore some garbage.
> 
> ---
>  .gitignore |   27 +++
>  src/.gitignore |   10 ++

.gitignore can be hierarchical.  I prefer to have a single ignore file
at the top level, rather than one per directory.

> +++ b/.gitignore
> @@ -0,0 +1,27 @@
> +.git

This one shouldn't be needed (git automatically ignores its own directory).

> +.git-module-status

This one should probably be anchored.

> +/Makefile
> +/Makefile.in

Un-anchor these, then they will apply recursively (which is what you
want, for ignoring it in src/ as well).

> +++ b/src/.gitignore
> @@ -0,0 +1,10 @@
> +Makefile
> +Makefile.in
> +.deps
> +.libs
> +*.lo
> +*.loT
> +*.la
> +*.exe
> +*.cov
> +/libvirtMib_subagent

Most of these should be unanchored patterns at the top level; the last
line should be /src/libvirtMib_subagent at the top level, then you don't
need this file.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [RFC PATCH 0/6] Switch over qemu command line capabilities to virBitmap

2011-02-09 Thread Jiri Denemark
There are two main reasons behind this patchset:
- we are getting very close to 64 flags which is the maximum we can use with
  unsigned long long
- by using LL constants in enum we already violates C99 constraint that enum
  values have to fit into int

This is a very conflict-prone patchset so I'd like to get some feedback on the
ideas and naming used so that this could possible be among the first patches
pushed after 0.8.8 release.

Patches 2/6 and 4/6 are fully and 3/6 mostly mechanical. 5/6 and 6/6 need to be
squashed into a single patch but are provided separately for easier review.

Jiri Denemark (6):
  util: Add API for converting virBitmap into printable string
  qemu: Rename QEMUD_CMD_FLAG_* to QEMU_CAPS_*
  qemu: Use helper functions for handling cmd line capabilities
  qemu: Rename qemud\?CmdFlags to qemuCaps
  qemu: Switch over command line capabilities to virBitmap
  tests: Use virBitmap for qemu command line caps

 src/libvirt_private.syms |1 +
 src/qemu/qemu_capabilities.c |  238 +-
 src/qemu/qemu_capabilities.h |  150 +
 src/qemu/qemu_command.c  |  384 +++---
 src/qemu/qemu_command.h  |   30 +-
 src/qemu/qemu_driver.c   |  106 ---
 src/qemu/qemu_hotplug.c  |  162 +-
 src/qemu/qemu_hotplug.h  |   32 +-
 src/util/bitmap.c|   32 ++-
 src/util/bitmap.h|3 +
 tests/qemuargv2xmltest.c |2 +-
 tests/qemuhelptest.c |  745 +-
 tests/qemuxml2argvtest.c |  470 +-
 13 files changed, 1249 insertions(+), 1106 deletions(-)

-- 
1.7.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [RFC PATCH 1/6] util: Add API for converting virBitmap into printable string

2011-02-09 Thread Jiri Denemark
---
 src/libvirt_private.syms |1 +
 src/util/bitmap.c|   32 +++-
 src/util/bitmap.h|3 +++
 3 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index b9e3efe..335d12f 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -16,6 +16,7 @@ virBitmapClearBit;
 virBitmapFree;
 virBitmapGetBit;
 virBitmapSetBit;
+virBitmapString;
 
 
 # buf.h
diff --git a/src/util/bitmap.c b/src/util/bitmap.c
index 9741668..61280b4 100644
--- a/src/util/bitmap.c
+++ b/src/util/bitmap.c
@@ -1,7 +1,7 @@
 /*
  * bitmap.h: Simple bitmap operations
  *
- * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright (C) 2010-2011 Red Hat, Inc.
  * Copyright (C) 2010 Novell, Inc.
  *
  * This library is free software; you can redistribute it and/or
@@ -32,6 +32,7 @@
 
 #include "bitmap.h"
 #include "memory.h"
+#include "buf.h"
 
 
 struct _virBitmap {
@@ -151,3 +152,32 @@ int virBitmapGetBit(virBitmapPtr bitmap, size_t b, bool 
*result)
 *result = bit != 0;
 return 0;
 }
+
+/**
+ * virBitmapString:
+ * @bitmap: Pointer to bitmap
+ *
+ * Convert @bitmap to printable string.
+ *
+ * Returns pointer to the string or NULL on error.
+ */
+char *virBitmapString(virBitmapPtr bitmap)
+{
+virBuffer buf = VIR_BUFFER_INITIALIZER;
+size_t sz;
+
+virBufferAddLit(&buf, "0x");
+
+sz = (bitmap->size + VIR_BITMAP_BITS_PER_UNIT - 1) /
+  VIR_BITMAP_BITS_PER_UNIT;
+
+for ( ; sz > 0; sz--)
+virBufferVSprintf(&buf, "%08x", bitmap->map[sz - 1]);
+
+if (virBufferError(&buf)) {
+virBufferFreeAndReset(&buf);
+return NULL;
+}
+
+return virBufferContentAndReset(&buf);
+}
diff --git a/src/util/bitmap.h b/src/util/bitmap.h
index 08515d1..db297b6 100644
--- a/src/util/bitmap.h
+++ b/src/util/bitmap.h
@@ -60,4 +60,7 @@ int virBitmapClearBit(virBitmapPtr bitmap, size_t b)
 int virBitmapGetBit(virBitmapPtr bitmap, size_t b, bool *result)
 ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;
 
+char *virBitmapString(virBitmapPtr bitmap)
+ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+
 #endif
-- 
1.7.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [RFC PATCH 6/6] tests: Use virBitmap for qemu command line caps

2011-02-09 Thread Jiri Denemark
This needs to be squashed into the previous patch but is provided
separately for easier review.
---
 src/qemu/qemu_capabilities.c |   14 +
 src/qemu/qemu_capabilities.h |2 +
 tests/qemuhelptest.c |  727 +-
 tests/qemuxml2argvtest.c |  468 ++--
 4 files changed, 617 insertions(+), 594 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 4f63823..3ef7962 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
 
@@ -1245,6 +1246,19 @@ qemuCapsSet(virBitmapPtr caps,
 
 
 void
+qemuCapsSetList(virBitmapPtr caps, ...)
+{
+va_list list;
+int flag;
+
+va_start(list, caps);
+while ((flag = va_arg(list, int)) < QEMU_CAPS_LAST)
+ignore_value(virBitmapSetBit(caps, flag));
+va_end(list);
+}
+
+
+void
 qemuCapsClear(virBitmapPtr caps,
   enum qemuCapsFlags flag)
 {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 193f23d..3dded1b 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -104,6 +104,8 @@ virBitmapPtr qemuCapsNew(void);
 void qemuCapsSet(virBitmapPtr caps,
  enum qemuCapsFlags flag) ATTRIBUTE_NONNULL(1);
 
+void qemuCapsSetList(virBitmapPtr caps, ...) ATTRIBUTE_NONNULL(1);
+
 void qemuCapsClear(virBitmapPtr caps,
enum qemuCapsFlags flag) ATTRIBUTE_NONNULL(1);
 
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index e334bce..37ec331 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -13,7 +13,7 @@
 
 struct testInfo {
 const char *name;
-unsigned long long flags;
+virBitmapPtr flags;
 unsigned int version;
 unsigned int is_kvm;
 unsigned int kvm_version;
@@ -22,14 +22,14 @@ struct testInfo {
 static char *progname;
 static char *abs_srcdir;
 
-static void printMismatchedFlags(unsigned long long got,
- unsigned long long expect)
+static void printMismatchedFlags(virBitmapPtr got,
+ virBitmapPtr expect)
 {
 int i;
 
-for (i = 0 ; i < (sizeof(got)*CHAR_BIT) ; i++) {
-unsigned long long gotFlag = (got & (1LL << i));
-unsigned long long expectFlag = (expect & (1LL << i));
+for (i = 0 ; i < QEMU_CAPS_LAST ; i++) {
+bool gotFlag = qemuCapsGet(got, i);
+bool expectFlag = qemuCapsGet(expect, i);
 if (gotFlag && !expectFlag)
 fprintf(stderr, "Extra flag %i\n", i);
 if (!gotFlag && expectFlag)
@@ -44,8 +44,10 @@ static int testHelpStrParsing(const void *data)
 char helpStr[MAX_HELP_OUTPUT_SIZE];
 char *help = &(helpStr[0]);
 unsigned int version, is_kvm, kvm_version;
-unsigned long long flags;
+virBitmapPtr flags = NULL;
 int ret = -1;
+char *got = NULL;
+char *expected = NULL;
 
 if (virAsprintf(&path, "%s/qemuhelpdata/%s", abs_srcdir, info->name) < 0)
 return -1;
@@ -53,7 +55,10 @@ static int testHelpStrParsing(const void *data)
 if (virtTestLoadFile(path, &help, MAX_HELP_OUTPUT_SIZE) < 0)
 goto cleanup;
 
-if (qemuCapsParseHelpStr("QEMU", help, &flags,
+if (!(flags = qemuCapsNew()))
+goto cleanup;
+
+if (qemuCapsParseHelpStr("QEMU", help, flags,
  &version, &is_kvm, &kvm_version) == -1)
 goto cleanup;
 
@@ -66,14 +71,19 @@ static int testHelpStrParsing(const void *data)
 if (virtTestLoadFile(path, &help, MAX_HELP_OUTPUT_SIZE) < 0)
 goto cleanup;
 
-if (qemuCapsParseDeviceStr(help, &flags) < 0)
+if (qemuCapsParseDeviceStr(help, flags) < 0)
 goto cleanup;
 }
 
-if (flags != info->flags) {
+got = virBitmapString(flags);
+expected = virBitmapString(info->flags);
+if (!got || !expected)
+goto cleanup;
+
+if (STRNEQ(got, expected)) {
 fprintf(stderr,
-"Computed flags do not match: got 0x%llx, expected 0x%llx\n",
-flags, info->flags);
+"Computed flags do not match: got %s, expected %s\n",
+got, expected);
 
 if (getenv("VIR_TEST_DEBUG"))
 printMismatchedFlags(flags, info->flags);
@@ -104,6 +114,9 @@ static int testHelpStrParsing(const void *data)
 ret = 0;
 cleanup:
 VIR_FREE(path);
+qemuCapsFree(flags);
+VIR_FREE(got);
+VIR_FREE(expected);
 return ret;
 }
 
@@ -124,364 +137,358 @@ mymain(int argc, char **argv)
 if (!abs_srcdir)
 abs_srcdir = getcwd(cwd, sizeof(cwd));
 
-# define DO_TEST(name, flags, version, is_kvm, kvm_version)
  \
-do {   
 \
-const struct testInfo info = { name, flags, version, is_kvm, 
kvm_version }; \
-if (virtTestRun("QEMU Help S

Re: [libvirt] [RFC PATCH 2/6] qemu: Rename QEMUD_CMD_FLAG_* to QEMU_CAPS_*

2011-02-09 Thread Eric Blake
On 02/09/2011 09:01 AM, Jiri Denemark wrote:
> The new names comply more with the fact that they are all members of
> enum qemuCapsFlags.
> ---
>  src/qemu/qemu_capabilities.c |  128 
>  src/qemu/qemu_capabilities.h |  120 
>  src/qemu/qemu_command.c  |  246 
>  src/qemu/qemu_driver.c   |   24 +-
>  src/qemu/qemu_hotplug.c  |   86 +++---
>  tests/qemuargv2xmltest.c |2 +-
>  tests/qemuhelptest.c |  654 
> +-
>  tests/qemuxml2argvtest.c |  302 ++--
>  8 files changed, 781 insertions(+), 781 deletions(-)

ACK; and agree with the plan of delaying this until just after the 0.8.8
release.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [RFC PATCH 1/6] util: Add API for converting virBitmap into printable string

2011-02-09 Thread Eric Blake
On 02/09/2011 09:01 AM, Jiri Denemark wrote:
> ---
>  src/libvirt_private.syms |1 +
>  src/util/bitmap.c|   32 +++-
>  src/util/bitmap.h|3 +++
>  3 files changed, 35 insertions(+), 1 deletions(-)

> +char *virBitmapString(virBitmapPtr bitmap)
> +{
> +virBuffer buf = VIR_BUFFER_INITIALIZER;
> +size_t sz;
> +
> +virBufferAddLit(&buf, "0x");
> +
> +sz = (bitmap->size + VIR_BITMAP_BITS_PER_UNIT - 1) /
> +  VIR_BITMAP_BITS_PER_UNIT;
> +
> +for ( ; sz > 0; sz--)
> +virBufferVSprintf(&buf, "%08x", bitmap->map[sz - 1]);

I probably would have written:

while (sz--)
virBufferVSprintf(&buf, "%08x", bitmap->map[sz]);

since sz is guaranteed to be non-zero to start with.  But your way
works, and the compiler (hopefully) generates the same code (when
optimizing).

Problem - "%08x" is not portable.  bitmap->map[x] is a uint32_t, which
means we need to use "%08"PRIx32 (since some platforms declare uint32_t
as long rather than int) to avoid a gcc warning.

For that matter, why did we make the bitset use uint32_t as the
underlying type, instead of just using long?  We already have macros
VIR_BITMAP_BITS_PER_UNIT that make the rest of the code immune to size
changes, if we resize the bitmap to 64-bits on LP64 (like x86_64) while
keeping it at 32-bits on ILP32 (like i686).  Of course, making that
change would mean that this new code would need to use
"%0*lx",VIR_BITMAP_BITS_PER_UNIT/4,bitmap->map[x].

I like the patch, but think it needs a v2.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] Adjust some log levels in udev driver

2011-02-09 Thread Daniel P. Berrange
Most of te VIR_INFO calls in the udev driver are only relevant
to developers so can switch to VIR_DEBUG. Failure to initialize
libpciaccess though is a fatal error

* src/node_device/node_device_udev.c: Adjust log levels
---
 src/node_device/node_device_udev.c |   44 ++--
 1 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/src/node_device/node_device_udev.c 
b/src/node_device/node_device_udev.c
index 93390af..475cbb5 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -116,8 +116,8 @@ static int udevGetDeviceProperty(struct udev_device 
*udev_device,
 
 udev_value = udev_device_get_property_value(udev_device, property_key);
 if (udev_value == NULL) {
-VIR_INFO(_("udev reports device '%s' does not have property '%s'"),
- udev_device_get_sysname(udev_device), property_key);
+VIR_DEBUG("udev reports device '%s' does not have property '%s'",
+  udev_device_get_sysname(udev_device), property_key);
 ret = PROPERTY_MISSING;
 goto out;
 }
@@ -205,8 +205,8 @@ static int udevGetDeviceSysfsAttr(struct udev_device 
*udev_device,
 
 udev_value = udev_device_get_sysattr_value(udev_device, attr_name);
 if (udev_value == NULL) {
-VIR_INFO(_("udev reports device '%s' does not have sysfs attr '%s'"),
- udev_device_get_sysname(udev_device), attr_name);
+VIR_DEBUG("udev reports device '%s' does not have sysfs attr '%s'",
+  udev_device_get_sysname(udev_device), attr_name);
 ret = PROPERTY_MISSING;
 goto out;
 }
@@ -950,9 +950,9 @@ static int udevKludgeStorageType(virNodeDeviceDefPtr def)
 {
 int ret = -1;
 
-VIR_INFO("Could not find definitive storage type for device "
- "with sysfs path '%s', trying to guess it",
- def->sysfs_path);
+VIR_DEBUG("Could not find definitive storage type for device "
+  "with sysfs path '%s', trying to guess it",
+  def->sysfs_path);
 
 if (STRPREFIX(def->caps->data.storage.block, "/dev/vd")) {
 /* virtio disk */
@@ -963,8 +963,8 @@ static int udevKludgeStorageType(virNodeDeviceDefPtr def)
 }
 
 if (ret != 0) {
-VIR_INFO("Could not determine storage type for device "
- "with sysfs path '%s'", def->sysfs_path);
+VIR_DEBUG("Could not determine storage type for device "
+  "with sysfs path '%s'", def->sysfs_path);
 } else {
 VIR_DEBUG("Found storage type '%s' for device "
   "with sysfs path '%s'",
@@ -1062,8 +1062,8 @@ static int udevProcessStorage(struct udev_device *device,
 } else if (STREQ(def->caps->data.storage.drive_type, "floppy")) {
 ret = udevProcessFloppy(device, def);
 } else {
-VIR_INFO("Unsupported storage type '%s'",
- def->caps->data.storage.drive_type);
+VIR_DEBUG("Unsupported storage type '%s'",
+  def->caps->data.storage.drive_type);
 goto out;
 }
 
@@ -1141,9 +1141,9 @@ static int udevGetDeviceType(struct udev_device *device,
 goto out;
 }
 
-VIR_INFO("Could not determine device type for device "
- "with sysfs path '%s'",
- udev_device_get_sysname(device));
+VIR_DEBUG("Could not determine device type for device "
+  "with sysfs path '%s'",
+  udev_device_get_sysname(device));
 ret = -1;
 
 out:
@@ -1209,8 +1209,8 @@ static int udevRemoveOneDevice(struct udev_device *device)
   dev->def->name, name);
 virNodeDeviceObjRemove(&driverState->devs, dev);
 } else {
-VIR_INFO("Failed to find device to remove that has udev name '%s'",
- name);
+VIR_DEBUG("Failed to find device to remove that has udev name '%s'",
+  name);
 ret = -1;
 }
 nodeDeviceUnlock(driverState);
@@ -1237,8 +1237,8 @@ static int udevSetParent(struct udev_device *device,
 
 parent_sysfs_path = udev_device_get_syspath(parent_device);
 if (parent_sysfs_path == NULL) {
-VIR_INFO("Could not get syspath for parent of '%s'",
- udev_device_get_syspath(parent_device));
+VIR_DEBUG("Could not get syspath for parent of '%s'",
+  udev_device_get_syspath(parent_device));
 }
 
 dev = virNodeDeviceFindBySysfsPath(&driverState->devs,
@@ -1350,8 +1350,8 @@ static int udevProcessDeviceListEntry(struct udev *udev,
 
 if (device != NULL) {
 if (udevAddOneDevice(device) != 0) {
-VIR_INFO("Failed to create node device for udev device '%s'",
- name);
+VIR_DEBUG("Failed to create node device for udev device '%s'",
+  name);
 }
 ret = 0;
 }
@@ -1598,8 +1598,8 @@ static int udevDeviceMonitorStartup(int privileged 
ATTRIBUTE_UNUSED)
 

Re: [libvirt] [PATCH] Adjust some log levels in udev driver

2011-02-09 Thread Dave Allan
On Wed, Feb 09, 2011 at 04:42:31PM +, Daniel P. Berrange wrote:
> Most of te VIR_INFO calls in the udev driver are only relevant
> to developers so can switch to VIR_DEBUG. Failure to initialize
> libpciaccess though is a fatal error
> 
> * src/node_device/node_device_udev.c: Adjust log levels
> ---
>  src/node_device/node_device_udev.c |   44 
> ++--
>  1 files changed, 22 insertions(+), 22 deletions(-)
> 
> diff --git a/src/node_device/node_device_udev.c 
> b/src/node_device/node_device_udev.c
> index 93390af..475cbb5 100644
> --- a/src/node_device/node_device_udev.c
> +++ b/src/node_device/node_device_udev.c
> @@ -116,8 +116,8 @@ static int udevGetDeviceProperty(struct udev_device 
> *udev_device,
>  
>  udev_value = udev_device_get_property_value(udev_device, property_key);
>  if (udev_value == NULL) {
> -VIR_INFO(_("udev reports device '%s' does not have property '%s'"),
> - udev_device_get_sysname(udev_device), property_key);
> +VIR_DEBUG("udev reports device '%s' does not have property '%s'",
> +  udev_device_get_sysname(udev_device), property_key);
>  ret = PROPERTY_MISSING;
>  goto out;
>  }
> @@ -205,8 +205,8 @@ static int udevGetDeviceSysfsAttr(struct udev_device 
> *udev_device,
>  
>  udev_value = udev_device_get_sysattr_value(udev_device, attr_name);
>  if (udev_value == NULL) {
> -VIR_INFO(_("udev reports device '%s' does not have sysfs attr '%s'"),
> - udev_device_get_sysname(udev_device), attr_name);
> +VIR_DEBUG("udev reports device '%s' does not have sysfs attr '%s'",
> +  udev_device_get_sysname(udev_device), attr_name);
>  ret = PROPERTY_MISSING;
>  goto out;
>  }
> @@ -950,9 +950,9 @@ static int udevKludgeStorageType(virNodeDeviceDefPtr def)
>  {
>  int ret = -1;
>  
> -VIR_INFO("Could not find definitive storage type for device "
> - "with sysfs path '%s', trying to guess it",
> - def->sysfs_path);
> +VIR_DEBUG("Could not find definitive storage type for device "
> +  "with sysfs path '%s', trying to guess it",
> +  def->sysfs_path);
>  
>  if (STRPREFIX(def->caps->data.storage.block, "/dev/vd")) {
>  /* virtio disk */
> @@ -963,8 +963,8 @@ static int udevKludgeStorageType(virNodeDeviceDefPtr def)
>  }
>  
>  if (ret != 0) {
> -VIR_INFO("Could not determine storage type for device "
> - "with sysfs path '%s'", def->sysfs_path);
> +VIR_DEBUG("Could not determine storage type for device "
> +  "with sysfs path '%s'", def->sysfs_path);
>  } else {
>  VIR_DEBUG("Found storage type '%s' for device "
>"with sysfs path '%s'",
> @@ -1062,8 +1062,8 @@ static int udevProcessStorage(struct udev_device 
> *device,
>  } else if (STREQ(def->caps->data.storage.drive_type, "floppy")) {
>  ret = udevProcessFloppy(device, def);
>  } else {
> -VIR_INFO("Unsupported storage type '%s'",
> - def->caps->data.storage.drive_type);
> +VIR_DEBUG("Unsupported storage type '%s'",
> +  def->caps->data.storage.drive_type);
>  goto out;
>  }
>  
> @@ -1141,9 +1141,9 @@ static int udevGetDeviceType(struct udev_device *device,
>  goto out;
>  }
>  
> -VIR_INFO("Could not determine device type for device "
> - "with sysfs path '%s'",
> - udev_device_get_sysname(device));
> +VIR_DEBUG("Could not determine device type for device "
> +  "with sysfs path '%s'",
> +  udev_device_get_sysname(device));
>  ret = -1;
>  
>  out:
> @@ -1209,8 +1209,8 @@ static int udevRemoveOneDevice(struct udev_device 
> *device)
>dev->def->name, name);
>  virNodeDeviceObjRemove(&driverState->devs, dev);
>  } else {
> -VIR_INFO("Failed to find device to remove that has udev name '%s'",
> - name);
> +VIR_DEBUG("Failed to find device to remove that has udev name '%s'",
> +  name);
>  ret = -1;
>  }
>  nodeDeviceUnlock(driverState);
> @@ -1237,8 +1237,8 @@ static int udevSetParent(struct udev_device *device,
>  
>  parent_sysfs_path = udev_device_get_syspath(parent_device);
>  if (parent_sysfs_path == NULL) {
> -VIR_INFO("Could not get syspath for parent of '%s'",
> - udev_device_get_syspath(parent_device));
> +VIR_DEBUG("Could not get syspath for parent of '%s'",
> +  udev_device_get_syspath(parent_device));
>  }
>  
>  dev = virNodeDeviceFindBySysfsPath(&driverState->devs,
> @@ -1350,8 +1350,8 @@ static int udevProcessDeviceListEntry(struct udev *udev,
>  
>  if (device != NULL) {
>  if (udevAddOneDevice(device) != 0) {
> -VIR_INFO("Failed to cre

Re: [libvirt] [PATCH] Adjust some log levels in udev driver

2011-02-09 Thread Eric Blake
On 02/09/2011 09:42 AM, Daniel P. Berrange wrote:
> Most of te VIR_INFO calls in the udev driver are only relevant

s/te/the/

> to developers so can switch to VIR_DEBUG. Failure to initialize
> libpciaccess though is a fatal error
> 
> * src/node_device/node_device_udev.c: Adjust log levels
> ---
>  src/node_device/node_device_udev.c |   44 
> ++--
>  1 files changed, 22 insertions(+), 22 deletions(-)
> 
> @@ -1598,8 +1598,8 @@ static int udevDeviceMonitorStartup(int privileged 
> ATTRIBUTE_UNUSED)
>  
>  if ((pciret = pci_system_init()) != 0) {
>  char ebuf[256];
> -VIR_INFO("Failed to initialize libpciaccess: %s",
> - virStrerror(pciret, ebuf, sizeof ebuf));
> +VIR_ERROR("Failed to initialize libpciaccess: %s",
> +  virStrerror(pciret, ebuf, sizeof ebuf));

This won't pass 'make syntax-check'; you need _() for VIR_ERROR.  ACK
with that nit fixed.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 0/6] Introduce a new migration protocol to QEMU driver

2011-02-09 Thread Daniel P. Berrange
The current migration protocol has several flaws

 - No initial hook on the source host to do work before
   the dst VM is launched
 - No ability to restart src VM if dst fails to recv all
   migration data, but src successfully sent it all

This introduces a new 5 step migration process to address
this limitation. To support features such as seemless
migration of SPICE clients, and lock driver state passing
this now makes use of the migration cookie feature too

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 4/6] Remote driver implementation of new migration API

2011-02-09 Thread Daniel P. Berrange
* src/remote/remote_protocol.x: Define wire protocol for migration
  protocol v3
* daemon/remote.c: Server side dispatch
* src/remote/remote_driver.c: Client side serialization
* src/remote/remote_protocol.c, src/remote/remote_protocol.h,
  daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h,
  daemon/remote_dispatch_ret.h, daemon/remote_dispatch_table.h:
  Re-generate files
---
 daemon/remote.c |  282 ++
 daemon/remote_dispatch_args.h   |6 +
 daemon/remote_dispatch_prototypes.h |   48 +
 daemon/remote_dispatch_ret.h|5 +
 daemon/remote_dispatch_table.h  |   30 +++
 src/remote/remote_driver.c  |  371 ++-
 src/remote/remote_protocol.c|  163 +++
 src/remote/remote_protocol.h|  140 +
 src/remote/remote_protocol.x|   79 -
 9 files changed, 1117 insertions(+), 7 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index d53b466..6592c85 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -72,6 +72,7 @@ static virStorageVolPtr get_nonnull_storage_vol 
(virConnectPtr conn, remote_nonn
 static virSecretPtr get_nonnull_secret (virConnectPtr conn, 
remote_nonnull_secret secret);
 static virNWFilterPtr get_nonnull_nwfilter (virConnectPtr conn, 
remote_nonnull_nwfilter nwfilter);
 static virDomainSnapshotPtr get_nonnull_domain_snapshot (virDomainPtr domain, 
remote_nonnull_domain_snapshot snapshot);
+static int make_domain (remote_domain *dom_dst, virDomainPtr dom_src);
 static void make_nonnull_domain (remote_nonnull_domain *dom_dst, virDomainPtr 
dom_src);
 static void make_nonnull_network (remote_nonnull_network *net_dst, 
virNetworkPtr net_src);
 static void make_nonnull_interface (remote_nonnull_interface *interface_dst, 
virInterfacePtr interface_src);
@@ -7012,6 +7013,272 @@ remoteDispatchDomainOpenConsole(struct qemud_server 
*server ATTRIBUTE_UNUSED,
 }
 
 
+static int
+remoteDispatchDomainMigrateBegin3(struct qemud_server *server ATTRIBUTE_UNUSED,
+  struct qemud_client *client ATTRIBUTE_UNUSED,
+  virConnectPtr conn,
+  remote_message_header *hdr ATTRIBUTE_UNUSED,
+  remote_error *rerr,
+  remote_domain_migrate_begin3_args *args,
+  remote_domain_migrate_begin3_ret *ret)
+{
+char *xml = NULL;
+virDomainPtr dom;
+char *dname;
+char *cookieout = NULL;
+int cookieoutlen = 0;
+
+dom = get_nonnull_domain (conn, args->dom);
+if (dom == NULL) {
+remoteDispatchConnError(rerr, conn);
+return -1;
+}
+
+dname = args->dname == NULL ? NULL : *args->dname;
+
+xml = virDomainMigrateBegin3(dom,
+ &cookieout, &cookieoutlen,
+ args->flags, dname, args->resource);
+virDomainFree(dom);
+if (xml == NULL) {
+remoteDispatchConnError(rerr, conn);
+return -1;
+}
+
+/* remoteDispatchClientRequest will free cookie and
+ * the xml string if there is one.
+ */
+ret->cookie_out.cookie_out_len = cookieoutlen;
+ret->cookie_out.cookie_out_val = cookieout;
+ret->xml = xml;
+
+return 0;
+}
+
+
+static int
+remoteDispatchDomainMigratePrepare3(struct qemud_server *server 
ATTRIBUTE_UNUSED,
+struct qemud_client *client 
ATTRIBUTE_UNUSED,
+virConnectPtr conn,
+remote_message_header *hdr 
ATTRIBUTE_UNUSED,
+remote_error *rerr,
+remote_domain_migrate_prepare3_args *args,
+remote_domain_migrate_prepare3_ret *ret)
+{
+int r;
+char *cookieout = NULL;
+int cookieoutlen = 0;
+char *uri_in;
+char **uri_out;
+char *dname;
+CHECK_CONN (client);
+
+uri_in = args->uri_in == NULL ? NULL : *args->uri_in;
+dname = args->dname == NULL ? NULL : *args->dname;
+
+/* Wacky world of XDR ... */
+if (VIR_ALLOC(uri_out) < 0) {
+remoteDispatchOOMError(rerr);
+return -1;
+}
+
+r = virDomainMigratePrepare3(conn,
+ args->cookie_in.cookie_in_val,
+ args->cookie_in.cookie_in_len,
+ &cookieout, &cookieoutlen,
+ uri_in, uri_out,
+ args->flags, dname, args->resource,
+ args->dom_xml);
+if (r == -1) {
+remoteDispatchConnError(rerr, conn);
+return -1;
+}
+
+/* remoteDispatchClientRequest will free cookie, uri_out and
+ * the string if there is one.
+ */
+ret->cookie_out.cookie_out_len = cookieoutlen;
+ret->cookie_out.coo

[libvirt] [PATCH 5/6] Introduce migration cookies to QEMU driver

2011-02-09 Thread Daniel P. Berrange
The migration protocol has support for a 'cookie' parameter which
is an opaque array of bytes as far as libvirt is concerned. Drivers
may use this for passing around arbitrary extra data they might
need during migration. The QEMU driver needs todo a few things:

 - Pass hostname/uuid to allow strict protection against localhost
   migration attempts
 - Pass SPICE/VNC server port from the target back to the source to
   allow seemless relocation of client sessions
 - Pass lock driver state from source to destination

* src/libvirt_private.syms: Export virXMLParseStrHelper
* src/qemu/qemu_migration.c, src/qemu/qemu_migration.h: Parsing
  and formatting of migration cookies
* src/qemu/qemu_driver.c: Pass in cookie parameters where possible
* src/remote/remote_protocol.h, src/remote/remote_protocol.x: Change
  cookie max length to 16384 bytes
---
 src/libvirt_private.syms |1 +
 src/qemu/qemu_driver.c   |   20 +-
 src/qemu/qemu_migration.c|  600 +-
 src/qemu/qemu_migration.h|   16 ++
 src/remote/remote_protocol.h |2 +-
 src/remote/remote_protocol.x |2 +-
 6 files changed, 626 insertions(+), 15 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index d1e2f4c..38912dc 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -946,6 +946,7 @@ virStrerror;
 
 
 # xml.h
+virXMLParseStrHelper;
 virXMLPropString;
 virXPathBoolean;
 virXPathInt;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 82f735a..4f72c07 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5378,8 +5378,9 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn,
 }
 
 qemuDriverLock(driver);
-ret = qemuMigrationPrepareTunnel(driver, dconn, st,
- dname, dom_xml);
+ret = qemuMigrationPrepareTunnel(driver, dconn,
+ NULL, 0, NULL, NULL, /* No cookies in v2 
*/
+ st, dname, dom_xml);
 qemuDriverUnlock(driver);
 
 cleanup:
@@ -5392,8 +5393,8 @@ cleanup:
  */
 static int ATTRIBUTE_NONNULL (5)
 qemudDomainMigratePrepare2 (virConnectPtr dconn,
-char **cookie ATTRIBUTE_UNUSED,
-int *cookielen ATTRIBUTE_UNUSED,
+char **cookie,
+int *cookielen,
 const char *uri_in,
 char **uri_out,
 unsigned long flags,
@@ -5432,6 +5433,8 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
 }
 
 ret = qemuMigrationPrepareDirect(driver, dconn,
+ NULL, 0, /* No input cookies in v2 */
+ cookie, cookielen,
  uri_in, uri_out,
  dname, dom_xml);
 
@@ -5475,8 +5478,9 @@ qemudDomainMigratePerform (virDomainPtr dom,
 }
 
 ret = qemuMigrationPerform(driver, dom->conn, vm,
-   uri, flags,
-   dname, resource);
+   uri, cookie, cookielen,
+   NULL, NULL, /* No output cookies in v2 */
+   flags, dname, resource);
 
 cleanup:
 qemuDriverUnlock(driver);
@@ -5519,7 +5523,9 @@ qemudDomainMigrateFinish2 (virConnectPtr dconn,
 goto cleanup;
 }
 
-dom = qemuMigrationFinish(driver, dconn, vm, flags, retcode);
+dom = qemuMigrationFinish(driver, dconn, vm,
+  NULL, 0, NULL, NULL, /* No cookies in v2 */
+  flags, retcode);
 
 cleanup:
 if (orig_err) {
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 8d23cc5..097acaf 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -22,6 +22,8 @@
 #include 
 
 #include 
+#include 
+#include 
 
 #include "qemu_migration.h"
 #include "qemu_monitor.h"
@@ -37,11 +39,515 @@
 #include "files.h"
 #include "datatypes.h"
 #include "fdstream.h"
+#include "uuid.h"
+
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
 
 #define timeval_to_ms(tv)   (((tv).tv_sec * 1000ull) + ((tv).tv_usec / 
1000))
 
+enum qemuMigrationCookieFlags {
+QEMU_MIGRATION_COOKIE_GRAPHICS = (1 << 0),
+};
+
+typedef struct _qemuMigrationCookieGraphics qemuMigrationCookieGraphics;
+typedef qemuMigrationCookieGraphics *qemuMigrationCookieGraphicsPtr;
+struct _qemuMigrationCookieGraphics {
+int type;
+int port;
+int tlsPort;
+char *listen;
+char *tlsSubject;
+};
+
+typedef struct _qemuMigrationCookie qemuMigrationCookie;
+typedef qemuMigrationCookie *qemuMigrationCookiePtr;
+struct _qemuMigrationCookie {
+int flags;
+
+/* Host properties */
+unsigned char hostuuid[VIR_UUID_BUFLEN];
+char *hostname;
+
+/* Guest properties */
+unsigned char uuid[VIR_UUID_BUFLEN];
+char *name;
+
+/*

[libvirt] [PATCH 3/6] Introduce yet another migration version in API.

2011-02-09 Thread Daniel P. Berrange
Migration just seems togo from bad to worse. We already had to
introduce a second migration protocol when adding the QEMU driver,
since the one from Xen was insufficiently flexible to cope with
passing the data the QEMU driver required.

It turns out that this protocol still has some flaws that we
need to address. The current sequence is

 *  Src: DumpXML
  - Generate XML to pass to dst

 *  Dst: Prepare
  - Get ready to accept incoming VM
  - Generate optional cookie to pass to src

 *  Src: Perform
  - Start migration and wait for send completion
  - Kill off VM if successful, resume if failed

 *  Dst: Finish
  - Wait for recv completion and check status
  - Kill off VM if unsuccessful

The problems with this are:

 - Since the first step is a generic 'DumpXML' call, we can't
   add in other migration specific data. eg, we can't include
   any VM lease data from lock manager plugins
 - Since the first step is a generic 'DumpXML' call, we can't
   emit any 'migration begin' event on the source, or have
   any hook that runs right at the start of the process
 - Since there is no final step on the source, if the Finish
   method fails to receive all migration data & has to kill
   the VM, then there's no way to resume the original VM
   on the source

This patch attempts to introduce a version 3 that uses the
improved 5 step sequence

 *  Src: Begin
  - Generate XML to pass to dst
  - Generate optional cookie to pass to dst

 *  Dst: Prepare
  - Get ready to accept incoming VM
  - Generate optional cookie to pass to src

 *  Src: Perform
  - Start migration and wait for send completion
  - Generate optional cookie to pass to dst

 *  Dst: Finish
  - Wait for recv completion and check status
  - Kill off VM if failed, resume if success
  - Generate optional cookie to pass to src

 *  Src: Confirm
  - Kill off VM if success, resume if failed

The API is designed to allow both input and output cookies
in all methods where applicable. This lets us pass around
arbitrary extra driver specific data between src & dst during
migration. Combined with the extra 'Begin' method this lets
us pass lease information from source to dst at the start of
migration

Moving the killing of the source VM out of Perform and
into Confirm, means we can now recover if the dst host
can't successfully Finish receiving migration data.
---
 src/driver.h|   77 ++-
 src/esx/esx_driver.c|6 +
 src/libvirt.c   |  555 ++-
 src/libvirt_internal.h  |   66 +
 src/libvirt_private.syms|6 +
 src/lxc/lxc_driver.c|6 +
 src/opennebula/one_driver.c |6 +
 src/openvz/openvz_driver.c  |6 +
 src/phyp/phyp_driver.c  |6 +
 src/qemu/qemu_driver.c  |6 +
 src/remote/remote_driver.c  |6 +
 src/test/test_driver.c  |6 +
 src/uml/uml_driver.c|6 +
 src/vbox/vbox_tmpl.c|6 +
 src/vmware/vmware_driver.c  |6 +
 src/xen/xen_driver.c|6 +
 src/xenapi/xenapi_driver.c  |6 +
 17 files changed, 773 insertions(+), 9 deletions(-)

diff --git a/src/driver.h b/src/driver.h
index 7451004..27df9d0 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -387,7 +387,7 @@ typedef int
 
 typedef int
 (*virDrvDomainMigratePrepareTunnel)
-(virConnectPtr conn,
+(virConnectPtr dconn,
  virStreamPtr st,
  unsigned long flags,
  const char *dname,
@@ -495,6 +495,75 @@ typedef int
virStreamPtr st,
unsigned int flags);
 
+typedef char *
+(*virDrvDomainMigrateBegin3)
+(virDomainPtr domain,
+ char **cookieout,
+ int *cookieoutlen,
+ unsigned long flags,
+ const char *dname,
+ unsigned long resource);
+
+typedef int
+(*virDrvDomainMigratePrepare3)
+(virConnectPtr dconn,
+ const char *cookiein,
+ int cookieinlen,
+ char **cookieout,
+ int *cookieoutlen,
+ const char *uri_in,
+ char **uri_out,
+ unsigned long flags,
+ const char *dname,
+ unsigned long resource,
+ const char *dom_xml);
+
+typedef int
+(*virDrvDomainMigratePrepareTunnel3)
+(virConnectPtr dconn,
+ virStreamPtr st,
+ const char *cookiein,
+ int cookieinlen,
+ char **cookieout,
+ int *cookieoutlen,
+ unsigned long flags,
+ const char *dname,
+  

[libvirt] [PATCH 6/6] Implement migration v3 protocol in QEMU driver

2011-02-09 Thread Daniel P. Berrange
Implement the v3 migration protocol, which has two extra
steps, 'begin' on the source host and 'confirm' on the
source host. All other methods also gain both input and
output cookies to allow bi-directional data passing at
all stages

* src/qemu/qemu_driver.c: Wire up migrate v3 APIs
* src/qemu/qemu_migration.c, src/qemu/qemu_migration.h: Add
  begin & confirm methods
---
 src/qemu/qemu_driver.c|  318 +++-
 src/qemu/qemu_migration.c |  141 ++--
 src/qemu/qemu_migration.h |   16 ++-
 3 files changed, 454 insertions(+), 21 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4f72c07..91caeea 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -866,6 +866,7 @@ qemudSupportsFeature (virConnectPtr conn ATTRIBUTE_UNUSED, 
int feature)
 {
 switch (feature) {
 case VIR_DRV_FEATURE_MIGRATION_V2:
+case VIR_DRV_FEATURE_MIGRATION_V3:
 case VIR_DRV_FEATURE_MIGRATION_P2P:
 return 1;
 default:
@@ -5343,7 +5344,9 @@ qemuDomainEventDeregisterAny(virConnectPtr conn,
 }
 
 
-/* Migration support. */
+/***
+ * Migration Protocol Version 2
+ ***/
 
 /* Prepare is the first step, and it runs on the destination host.
  *
@@ -5361,6 +5364,15 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn,
 struct qemud_driver *driver = dconn->privateData;
 int ret = -1;
 
+virCheckFlags(VIR_MIGRATE_LIVE |
+  VIR_MIGRATE_PEER2PEER |
+  VIR_MIGRATE_TUNNELLED |
+  VIR_MIGRATE_PERSIST_DEST |
+  VIR_MIGRATE_UNDEFINE_SOURCE |
+  VIR_MIGRATE_PAUSED |
+  VIR_MIGRATE_NON_SHARED_DISK |
+  VIR_MIGRATE_NON_SHARED_INC, -1);
+
 if (!dom_xml) {
 qemuReportError(VIR_ERR_INTERNAL_ERROR,
 "%s", _("no domain XML passed"));
@@ -5480,7 +5492,7 @@ qemudDomainMigratePerform (virDomainPtr dom,
 ret = qemuMigrationPerform(driver, dom->conn, vm,
uri, cookie, cookielen,
NULL, NULL, /* No output cookies in v2 */
-   flags, dname, resource);
+   flags, dname, resource, true);
 
 cleanup:
 qemuDriverUnlock(driver);
@@ -5537,6 +5549,296 @@ cleanup:
 }
 
 
+/***
+ * Migration Protocol Version 3
+ ***/
+
+static char *
+qemuDomainMigrateBegin3(virDomainPtr domain,
+char **cookieout,
+int *cookieoutlen,
+unsigned long flags,
+const char *dname ATTRIBUTE_UNUSED,
+unsigned long resource ATTRIBUTE_UNUSED)
+{
+struct qemud_driver *driver = domain->conn->privateData;
+virDomainObjPtr vm;
+char *xml = NULL;
+
+virCheckFlags(VIR_MIGRATE_LIVE |
+  VIR_MIGRATE_PEER2PEER |
+  VIR_MIGRATE_TUNNELLED |
+  VIR_MIGRATE_PERSIST_DEST |
+  VIR_MIGRATE_UNDEFINE_SOURCE |
+  VIR_MIGRATE_PAUSED |
+  VIR_MIGRATE_NON_SHARED_DISK |
+  VIR_MIGRATE_NON_SHARED_INC, NULL);
+
+qemuDriverLock(driver);
+vm = virDomainFindByUUID(&driver->domains, domain->uuid);
+if (!vm) {
+char uuidstr[VIR_UUID_STRING_BUFLEN];
+virUUIDFormat(domain->uuid, uuidstr);
+qemuReportError(VIR_ERR_NO_DOMAIN,
+_("no domain with matching uuid '%s'"), uuidstr);
+goto cleanup;
+}
+
+xml = qemuMigrationBegin(driver, vm,
+ cookieout, cookieoutlen);
+
+cleanup:
+qemuDriverUnlock(driver);
+return xml;
+}
+
+static int
+qemuDomainMigratePrepare3(virConnectPtr dconn,
+  const char *cookiein,
+  int cookieinlen,
+  char **cookieout,
+  int *cookieoutlen,
+  const char *uri_in,
+  char **uri_out,
+  unsigned long flags,
+  const char *dname,
+  unsigned long resource ATTRIBUTE_UNUSED,
+  const char *dom_xml)
+{
+struct qemud_driver *driver = dconn->privateData;
+int ret = -1;
+
+virCheckFlags(VIR_MIGRATE_LIVE |
+  VIR_MIGRATE_PEER2PEER |
+  VIR_MIGRATE_TUNNELLED |
+  VIR_MIGRATE_PERSIST_DEST |
+  VIR_MIGRATE_UNDEFINE_SOURCE |
+  VIR_MIGRATE_PAUSED |
+  VIR_MIGRATE_NON_SHARED_DISK |
+  VIR_MIGRATE_NON_SHARED_INC, -1);
+
+*uri_out = NULL;
+
+qemuDriverLock(driv

Re: [libvirt] [RFC PATCH 3/6] qemu: Use helper functions for handling cmd line capabilities

2011-02-09 Thread Eric Blake
On 02/09/2011 09:02 AM, Jiri Denemark wrote:
> ---

No comment in the commit message about the name of the new helper methods?

>  src/qemu/qemu_capabilities.c |  152 ++--
>  src/qemu/qemu_capabilities.h |9 ++
>  src/qemu/qemu_command.c  |  260 +
>  src/qemu/qemu_driver.c   |   24 ++--
>  src/qemu/qemu_hotplug.c  |   86 +++---
>  tests/qemuhelptest.c |2 +-
>  tests/qemuxml2argvtest.c |4 +-
>  7 files changed, 288 insertions(+), 249 deletions(-)
> 

>  cmd = virCommandNewArgList(qemu, "-cpu", "?", NULL);
> -if (qemuCmdFlags & QEMU_CAPS_NODEFCONFIG)
> +if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NODEFCONFIG))

Looks like a pretty trivial conversion.  To prove that I really reviewed
this, let's see if I can find the few non-mechanical conversions :)

>  /* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */
> -if (!(*flags & QEMU_CAPS_CHARDEV_SPICEVMC) &&
> +if (!qemuCapsGet(*flags, QEMU_CAPS_CHARDEV_SPICEVMC) &&

This was probably one that needed attention; looks correct.

> +void
> +qemuCapsSet(unsigned long long *caps,
> +enum qemuCapsFlags flag)
> +{
> +*caps |= flag;
> +}
> +
> +
> +void
> +qemuCapsClear(unsigned long long *caps,
> +  enum qemuCapsFlags flag)
> +{
> +*caps &= ~flag;
> +}
> +
> +
> +bool
> +qemuCapsGet(unsigned long long caps,
> +enum qemuCapsFlags flag)
> +{
> +return !!(caps & flag);
> +}

Nice and simple.

> -if ((qemuCmdFlags & QEMU_CAPS_KVM) &&
> -(def->virtType == VIR_DOMAIN_VIRT_QEMU) &&
> -(qemuCmdFlags & QEMU_CAPS_DRIVE_BOOT))
> -qemuCmdFlags -= QEMU_CAPS_DRIVE_BOOT;
> +if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_KVM) &&
> +(def->virtType == VIR_DOMAIN_VIRT_QEMU))
> +qemuCapsClear(&qemuCmdFlags, QEMU_CAPS_DRIVE_BOOT);

There's another non-mechanical change.  The new logic is one line
shorter, and still correct.

> @@ -3141,12 +3140,13 @@ qemuBuildCommandLine(virConnectPtr conn,
>  int bootable = 0;
>  virDomainDiskDefPtr disk = def->disks[i];
>  int withDeviceArg = 0;
> +bool deviceFlagMasked = false;
>  int j;
>  
>  /* Unless we have -device, then USB disks need special
> handling */
>  if ((disk->bus == VIR_DOMAIN_DISK_BUS_USB) &&
> -!(qemuCmdFlags & QEMU_CAPS_DEVICE)) {
> +!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
>  if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
>  virCommandAddArg(cmd, "-usbdevice");
>  virCommandAddArgFormat(cmd, "disk:%s", disk->src);
> @@ -3181,12 +3181,18 @@ qemuBuildCommandLine(virConnectPtr conn,
> devices. Fortunately, those don't need
> static PCI addresses, so we don't really
> care that we can't use -device */
> -if ((qemuCmdFlags & QEMU_CAPS_DEVICE) &&
> -(disk->bus != VIR_DOMAIN_DISK_BUS_XEN))
> -withDeviceArg = 1;
> -if (!(optstr = qemuBuildDriveStr(disk, bootable,
> - (withDeviceArg ? qemuCmdFlags :
> -  (qemuCmdFlags & 
> ~QEMU_CAPS_DEVICE)
> +if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
> +if (disk->bus != VIR_DOMAIN_DISK_BUS_XEN) {
> +withDeviceArg = 1;
> +} else {
> +qemuCapsClear(&qemuCmdFlags, QEMU_CAPS_DEVICE);
> +deviceFlagMasked = true;
> +}
> +}
> +optstr = qemuBuildDriveStr(disk, bootable, qemuCmdFlags);
> +if (deviceFlagMasked)
> +qemuCapsSet(&qemuCmdFlags, QEMU_CAPS_DEVICE);
> +if (!optstr)

Certainly a tougher prospect.  On the surface, it looks correct;
however, I'm worried that there might be some potential for a data race
bug - that is, if we ever have any command that can build a command line
string while holding a read-only connection, is it right to be
temporarily modifying the domain def?  (That is, it seems like
domxml-to-native should work on a read-only connection without trying to
modify the guest definition.)

Should we instead be cloning the bitset, and passing the clone to
qemuBuildDriveStr, rather than changing and restoring the original?
Would it be any easier to just change the signature of qemuBuildDriveStr
to take an additional bool parameter on whether to ignore the
QEMU_CAPS_DEVICE flag?

> @@ -3444,8 +3450,8 @@ qemuBuildCommandLine(virConnectPtr conn,
>   *
>   * NB, no support for -netdev without use of -device
>   */
> -if ((qemuCmdFlags & QEMU_CAPS_NETDEV) &&
> -(qemuCmdFlags & QEMU_CAPS_DEVICE)) {
> +if (qemuCapsGet(qemuCmdFlags

Re: [libvirt] [RFC PATCH 4/6] qemu: Rename qemud\?CmdFlags to qemuCaps

2011-02-09 Thread Eric Blake
On 02/09/2011 09:02 AM, Jiri Denemark wrote:
> The new name comply more with the fact that it contains a set of
> qemuCapsFlags.
> ---
>  src/qemu/qemu_capabilities.c |   10 +-
>  src/qemu/qemu_capabilities.h |8 +-
>  src/qemu/qemu_command.c  |  368 
> +-
>  src/qemu/qemu_command.h  |   30 ++--
>  src/qemu/qemu_driver.c   |   94 ++--
>  src/qemu/qemu_hotplug.c  |  162 +-
>  src/qemu/qemu_hotplug.h  |   32 ++--
>  7 files changed, 352 insertions(+), 352 deletions(-)

Purely mechanical.  ACK.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCHv2 2/2] Add txmode attribute to interface XML for virtio backend

2011-02-09 Thread Laine Stump
This is in response to:

   https://bugzilla.redhat.com/show_bug.cgi?id=629662

Explanation

qemu's virtio-net-pci driver allows setting the algorithm used for tx
packets to either "bh" or "timer". This is done by adding ",tx=bh" or
",tx=timer" to the "-device virtio-net-pci" commandline option.

'bh' stands for 'bottom half'; when this is set, packet tx is all done
in an iothread in the bottom half of the driver. (In libvirt, this
option is called the more descriptive "iothread".)

'timer' means that tx work is done in qemu, and if there is more tx
data than can be sent at the present time, a timer is set before qemu
moves on to do other things; when the timer fires, another attempt is
made to send more data. (libvirt retains the name "timer" for this
option.)

The resulting difference, according to the qemu developer who added
the option is:

bh makes tx more asynchronous and reduces latency, but potentially
causes more processor bandwidth contention since the cpu doing the
tx isn't necessarily the cpu where the guest generated the
packets.

Solution

This patch provides a libvirt domain xml knob to change the option on
the qemu commandline, by adding a new attribute "txmode" to the
 element that can be placed inside any  element in
a domain definition. It's use would be something like this:


  ...
  
  
  ...


I chose to put this setting as an attribute to  rather than as
a sub-element to  because it is specific to the virtio-net
driver, not something that is generally usable by all network drivers.
(note that this is the same placement as the "driver name=..."
attribute used to choose kernel vs. userland backend for the
virtio-net driver.)

Actually adding the tx=xxx option to the qemu commandline is only done
if the version of qemu being used advertises it in the output of

qemu -device virtio-net-pci,?

If a particular txmode is requested in the XML, and the option isn't
listed in that help output, an UNSUPPORTED_CONFIG error is logged, and
the domain fails to start.
---

Changes from v1:

1) add error log / abort domain startup if option isn't supported by qemu

2) change attribute name from tx_alg to txmode

3) change attribute values from bh|timer to iothread|timer

(The difference in length between full patch and delta diff was small
enough that I decided to just resend the full patch.)


 src/conf/domain_conf.c   |   26 +-
 src/conf/domain_conf.h   |   11 +++
 src/qemu/qemu_capabilities.c |3 +++
 src/qemu/qemu_capabilities.h |1 +
 src/qemu/qemu_command.c  |   27 +++
 5 files changed, 67 insertions(+), 1 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 84b866b..dee05c4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -198,6 +198,11 @@ VIR_ENUM_IMPL(virDomainNetBackend, 
VIR_DOMAIN_NET_BACKEND_TYPE_LAST,
   "qemu",
   "vhost")
 
+VIR_ENUM_IMPL(virDomainNetVirtioTxMode, VIR_DOMAIN_NET_VIRTIO_TX_MODE_LAST,
+  "default",
+  "iothread",
+  "timer")
+
 VIR_ENUM_IMPL(virDomainChrChannelTarget,
   VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST,
   "guestfwd",
@@ -2477,6 +2482,7 @@ virDomainNetDefParseXML(virCapsPtr caps,
 char *port = NULL;
 char *model = NULL;
 char *backend = NULL;
+char *txmode = NULL;
 char *filter = NULL;
 char *internal = NULL;
 char *devaddr = NULL;
@@ -2565,6 +2571,7 @@ virDomainNetDefParseXML(virCapsPtr caps,
 model = virXMLPropString(cur, "type");
 } else if (xmlStrEqual (cur->name, BAD_CAST "driver")) {
 backend = virXMLPropString(cur, "name");
+txmode = virXMLPropString(cur, "txmode");
 } else if (xmlStrEqual (cur->name, BAD_CAST "filterref")) {
 filter = virXMLPropString(cur, "filter");
 VIR_FREE(filterparams);
@@ -2769,6 +2776,18 @@ virDomainNetDefParseXML(virCapsPtr caps,
 }
 def->driver.virtio.name = name;
 }
+if (txmode != NULL) {
+int m;
+if (((m = virDomainNetVirtioTxModeTypeFromString(txmode)) < 0) ||
+(m == VIR_DOMAIN_NET_VIRTIO_TX_MODE_DEFAULT)) {
+virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unknown interface  
"
+   "has been specified"),
+ txmode);
+goto error;
+}
+def->driver.virtio.txmode = m;
+}
 }
 
 if (filter != NULL) {
@@ -2808,6 +2827,7 @@ cleanup:
 VIR_FREE(bridge);
 VIR_FREE(model);
 VIR_FREE(backend);
+VIR_FREE(txmode);
 VIR_FREE(filter);
 VIR_FREE(type);
 VIR_FREE(internal);
@@ -6808,12 +6828,16 @@ virDomainNetDefFormat(virBufferPtr buf,
 virBufferEscapeString(buf, "  \n",

Re: [libvirt] [virt-tools-list] difference between blkid of a system and uuid of virtual machine by virt-manager

2011-02-09 Thread Cole Robinson
On 02/08/2011 02:06 PM, Tapas Mishra wrote:
> I want to know what is the difference between the output blkid command
> shows and the uuid which is set by virt-manager
> while creating a guest.
> Suppose in case of a re installation sort of situation I want to do a
> fresh install and restore things from a backup then
> where does this UUID thing comes into picture and what is its role
> with respect to Virtual Machines.
> 
> 

AFAIU it's just a unique identifier for use with libvirt, though nowadays it
might be passed down to the guest for other purposes. cc-ing libvirt-list

- Cole

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [RFC PATCH 5/6] qemu: Switch over command line capabilities to virBitmap

2011-02-09 Thread Eric Blake
On 02/09/2011 09:02 AM, Jiri Denemark wrote:
> This is done for two reasons:
> - we are getting very close to 64 flags which is the maximum we can use
>   with unsigned long long
> - by using LL constants in enum we already violates C99 constraint that
>   enum values have to fit into int

Does gcc warn about that (possible via some -W flag that we aren't
currently using)?  Or are we silently relying on a (common) extension
that might bite us elsewhere?

> -*flags = qemuCapsComputeCmdFlags(help, *version, *is_kvm, *kvm_version);
> +qemuCapsComputeCmdFlags(help, *version, *is_kvm, *kvm_version, flags);
> +
> +if (!(strflags = virBitmapString(flags))) {
> +virReportOOMError();
> +return -1;
> +}
> +
> +VIR_DEBUG("Version %u.%u.%u, cooked version %u, flags %s",
> +  major, minor, micro, *version, strflags);
> +VIR_FREE(strflags);

Using virReportOOMError() is harsh, when the only thing that we lack is
a VIR_DEBUG().  Would it be any better to do:

if ((strflags = virBitmapString(flags))) {
VIR_DEBUG(...);
VIR_FREE(strflags);
}

and just lose the debug message if we're tight on memory?  Then again,
if we're that close to running out of memory, it won't be much longer
before something else pushes us over the boundary, so giving up now
might not be too bad.

>  void
> -qemuCapsClear(unsigned long long *caps,
> +qemuCapsClear(virBitmapPtr caps,
>enum qemuCapsFlags flag)
>  {
> -*caps &= ~flag;
> +ignore_value(virBitmapClearBit(caps, flag));

So why does this require caps to exist...

>  }
>  
>  
>  bool
> -qemuCapsGet(unsigned long long caps,
> +qemuCapsGet(virBitmapPtr caps,
>  enum qemuCapsFlags flag)
>  {
> -return !!(caps & flag);
> +bool b;
> +
> +if (!caps || virBitmapGetBit(caps, flag, &b) < 0)

while this does not?  Shouldn't qemuCapsGet be marked ATTRIBUTE_NONNULL(1)?

>  
> -void qemuCapsSet(unsigned long long *caps,
> - enum qemuCapsFlags flag);
> +virBitmapPtr qemuCapsNew(void);
> +
> +# define qemuCapsFree(caps)  virBitmapFree(caps)

Add this to cfg.mk's list of free-like functions.

> -bool qemuCapsGet(unsigned long long caps,
> +bool qemuCapsGet(virBitmapPtr caps,
>   enum qemuCapsFlags flag);

I guess you really did intend for qemuCapsGet to work even if
qemuCapsFree failed.

I like the idea of this series, and agree that it's too late to make it
into 0.8.8.  It's probably worth posting a v2 to address comments I
raised, although an incremental diff might be easier to review at that
point.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [RFC PATCH 6/6] tests: Use virBitmap for qemu command line caps

2011-02-09 Thread Eric Blake
On 02/09/2011 09:02 AM, Jiri Denemark wrote:
> This needs to be squashed into the previous patch but is provided
> separately for easier review.
> ---
>  src/qemu/qemu_capabilities.c |   14 +
>  src/qemu/qemu_capabilities.h |2 +
>  tests/qemuhelptest.c |  727 
> +-
>  tests/qemuxml2argvtest.c |  468 ++--
>  4 files changed, 617 insertions(+), 594 deletions(-)
> 
>  void
> +qemuCapsSetList(virBitmapPtr caps, ...)
> +{
> +va_list list;
> +int flag;
> +
> +va_start(list, caps);
> +while ((flag = va_arg(list, int)) < QEMU_CAPS_LAST)
> +ignore_value(virBitmapSetBit(caps, flag));
> +va_end(list);

QEMU_CAPS_LAST as a terminal seems a bit awkward.  Would it be any
better to require 0 to be the terminal?  Then again, since it would be 0
and not NULL, we can't use ATTRIBUTE_SENTINEL as a compile-time aid that
we remembered to use the sentinel.

> @@ -124,364 +137,358 @@ mymain(int argc, char **argv)
>  if (!abs_srcdir)
>  abs_srcdir = getcwd(cwd, sizeof(cwd));
>  
> -# define DO_TEST(name, flags, version, is_kvm, kvm_version)  
> \
> -do { 
>\
> -const struct testInfo info = { name, flags, version, is_kvm, 
> kvm_version }; \
> -if (virtTestRun("QEMU Help String Parsing " name,
>\
> -1, testHelpStrParsing, &info) < 0)   
>\
> -ret = -1;
>\
> +# define DO_TEST(name, version, is_kvm, kvm_version, ...)   \
> +do {\
> +struct testInfo info = {\
> +name, NULL, version, is_kvm, kvm_version\
> +};  \
> +if (!(info.flags = qemuCapsNew()))  \
> +return EXIT_FAILURE;\
> +qemuCapsSetList(info.flags, __VA_ARGS__, QEMU_CAPS_LAST);   \

And this is a nice trick for encapsulating the sentinel in only one place.

> -DO_TEST("qemu-0.9.1",
> -QEMU_CAPS_KQEMU |
> -QEMU_CAPS_VNC_COLON |
> -QEMU_CAPS_NO_REBOOT |
> -QEMU_CAPS_DRIVE |
> +DO_TEST("qemu-0.9.1", 9001, 0, 0,
> +QEMU_CAPS_KQEMU,
> +QEMU_CAPS_VNC_COLON,
> +QEMU_CAPS_NO_REBOOT,
> +QEMU_CAPS_DRIVE,
> +QEMU_CAPS_NAME);
> +DO_TEST("kvm-74", 9001, 1, 74,
> +QEMU_CAPS_VNC_COLON,
> +QEMU_CAPS_NO_REBOOT,
> +QEMU_CAPS_DRIVE,
> +QEMU_CAPS_DRIVE_BOOT,
>  QEMU_CAPS_NAME,

How nice of git to mess up the context.  But the change you made looks
obvious.

ACK.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH libvirt site] Change PHP binding link to new one hosted on libvirt.org

2011-02-09 Thread Michal Novotny
Signed-off-by: Michal Novotny 
---
 docs/bindings.html.in |8 
 docs/sitemap.html.in  |4 
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/docs/bindings.html.in b/docs/bindings.html.in
index 87d894d..2d936a0 100644
--- a/docs/bindings.html.in
+++ b/docs/bindings.html.in
@@ -28,16 +28,16 @@
   
 
   PHP: Radek Hladik started developing
-  http://phplibvirt.cybersales.cz/";>PHP bindings in 2010.
+  http://libvirt.org/php";>PHP bindings in 2010.
 
 
-  In February 2011 the binding development has been moved to the
-  http://libvirt.org/git/?p=libvirt-php.git;a=summary";>libvirt.org as 
libvirt-php project.
+  In February 2011 the binding development has been moved to the 
libvirt.org website as
+  libvirt-php project.
 
 
   The project is now maintained by Michal Novotny and it's heavily 
based
   on Radek's version. For more information including the information 
on posting
-  the patches you to libvirt-php please refer to PHP binding page.
+  the patches you to libvirt-php please refer to http://libvirt.org/php";>PHP binding.
 
   
   
diff --git a/docs/sitemap.html.in b/docs/sitemap.html.in
index ac0af71..c987c49 100644
--- a/docs/sitemap.html.in
+++ b/docs/sitemap.html.in
@@ -266,10 +266,6 @@
 C#
 overview of the C# API bindings
   
-  
-PHP
-overview of the PHP API bindings
-  
 
   
   
-- 
1.7.3.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] maint: whitespace cleanup

2011-02-09 Thread Eric Blake
On 02/04/2011 11:25 AM, Eric Blake wrote:
> * cfg.mk (sc_TAB_in_indentation): Check more files.
> * .dir-locals.el (html-mode): Let emacs help out.
> * docs/internals/command.html.in: Fix offenders.
> * docs/formatdomain.html.in: Likewise.
> * docs/internals.html.in: Likewise.
> Reported by Jiri Denemark.
> ---
> 
> Here's the git diff -b output; actual patch below the diffstat.

PING - this one's probably worth including in 0.8.8.

> 
> diff --git c/.dir-locals.el w/.dir-locals.el
> index 7c483d2..f24ec61 100644
> --- c/.dir-locals.el
> +++ w/.dir-locals.el
> @@ -5,4 +5,7 @@
>  (c-indent-level . 4)
>  (c-basic-offset . 4)
>  ))
> + (html-mode . (
> +(indent-tabs-mode . nil)
> + ))
>   )
> diff --git c/cfg.mk w/cfg.mk
> index 7664bdf..120f452 100644
> --- c/cfg.mk
> +++ w/cfg.mk
> @@ -322,13 +322,13 @@ sc_prohibit_ctype_h:
>halt="don't use ctype.h; instead, use c-ctype.h"   \
>  $(_sc_search_regexp)
> 
> -# Ensure that no C source file or rng schema uses TABs for
> +# Ensure that no C source file, docs, or rng schema uses TABs for
>  # indentation.  Also match *.h.in files, to get libvirt.h.in.  Exclude
>  # files in gnulib, since they're imported.
>  sc_TAB_in_indentation:
>   @prohibit='^ *  '   \
> - in_vc_files='(\.(rng|[ch](\.in)?)|(daemon|tools)/.*\.in)$$' \
> - halt='use spaces, not TAB, for indentation in C, sh, and RNG schemas' \
> + in_vc_files='(\.(rng|[ch](\.in)?|html.in)|(daemon|tools)/.*\.in)$$' \
> + halt='use leading spaces, not TAB, in C, sh, html, and RNG schemas' \
> $(_sc_search_regexp)
> 
>  ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
> 
> 
> 
>  .dir-locals.el |3 +
>  cfg.mk |6 +-
>  docs/formatdomain.html.in  |  224 
> 
>  docs/internals.html.in |4 +-
>  docs/internals/command.html.in |   32 +++---
>  5 files changed, 136 insertions(+), 133 deletions(-)

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH libvirt site] Change PHP binding link to new one hosted on libvirt.org

2011-02-09 Thread Eric Blake
On 02/09/2011 10:52 AM, Michal Novotny wrote:
> Signed-off-by: Michal Novotny 
> ---
>  docs/bindings.html.in |8 
>  docs/sitemap.html.in  |4 
>  2 files changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/docs/bindings.html.in b/docs/bindings.html.in
> index 87d894d..2d936a0 100644
> --- a/docs/bindings.html.in
> +++ b/docs/bindings.html.in
> @@ -28,16 +28,16 @@
>
>  
>PHP: Radek Hladik started developing
> -  http://phplibvirt.cybersales.cz/";>PHP bindings in 
> 2010.
> +  http://libvirt.org/php";>PHP bindings in 2010.
>  
>  
> -  In February 2011 the binding development has been moved to the
> -   href="http://libvirt.org/git/?p=libvirt-php.git;a=summary";>libvirt.org as 
> libvirt-php project.
> +  In February 2011 the binding development has been moved to the 
> libvirt.org website as
> +  libvirt-php project.
>  
>  
>The project is now maintained by Michal Novotny and it's heavily 
> based
>on Radek's version. For more information including the information 
> on posting
> -  the patches you to libvirt-php please refer to  href="php.html">PHP binding page.
> +  the patches you to libvirt-php please refer to  href="http://libvirt.org/php";>PHP binding.

This part is fine.

>  
>
>
> diff --git a/docs/sitemap.html.in b/docs/sitemap.html.in
> index ac0af71..c987c49 100644
> --- a/docs/sitemap.html.in
> +++ b/docs/sitemap.html.in
> @@ -266,10 +266,6 @@
>  C#
>  overview of the C# API bindings
>
> -  
> -PHP
> -overview of the PHP API bindings
> -  

But this removes the reference without also removing docs/php.html.in;
would it be better to keep the reference, and make sure that libvirt's
php page is still useful?  In particular, remember that libvirt's pages
get installed locally even for users that don't install libvirt-php, so
they should have local documentation that alerts them to the existence
of bindings if they need it.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCHv2 2/2] Add txmode attribute to interface XML for virtio backend

2011-02-09 Thread Eric Blake
On 02/09/2011 10:14 AM, Laine Stump wrote:
> The resulting difference, according to the qemu developer who added
> the option is:
> 
> bh makes tx more asynchronous and reduces latency, but potentially
> causes more processor bandwidth contention since the cpu doing the
> tx isn't necessarily the cpu where the guest generated the
> packets.

This sentence (or something derived from it, using our names of
iothread|timer) should be in docs/formatdomain.html.in.

> 
> Changes from v1:
> 
> 1) add error log / abort domain startup if option isn't supported by qemu
> 
> 2) change attribute name from tx_alg to txmode
> 
> 3) change attribute values from bh|timer to iothread|timer

All seem reasonable.

> 
> (The difference in length between full patch and delta diff was small
> enough that I decided to just resend the full patch.)
> 
> 
>  src/conf/domain_conf.c   |   26 +-
>  src/conf/domain_conf.h   |   11 +++
>  src/qemu/qemu_capabilities.c |3 +++
>  src/qemu/qemu_capabilities.h |1 +
>  src/qemu/qemu_command.c  |   27 +++
>  5 files changed, 67 insertions(+), 1 deletions(-)

Incomplete - need a v3 (or at least a follow-up patch) that touches
docs/schemas/domain.rng, adds at least one test of the new attribute in
tests/qemuxml2argvdata/, and documents the issue.

> @@ -1367,6 +1377,7 @@ VIR_ENUM_DECL(virDomainFS)
>  VIR_ENUM_DECL(virDomainFSAccessMode)
>  VIR_ENUM_DECL(virDomainNet)
>  VIR_ENUM_DECL(virDomainNetBackend)
> +VIR_ENUM_DECL(virDomainNetVirtioTxMode)

Also missing two new entries in src/libvirt_private.syms.

> @@ -1104,6 +1105,8 @@ qemuCapsParseDeviceStr(const char *str, unsigned long 
> long *flags)
>  if (strstr(str, "pci-assign.bootindex"))
>  *flags |= QEMUD_CMD_FLAG_PCI_BOOTINDEX;
>  }
> +if (strstr(str, "virtio-net-pci.tx="))
> +*flags |= QEMUD_CMD_FLAG_VIRTIO_TX_ALG;

It's a race between your patch and Jirka's bitmap cleanup :)

Is this something that needs to go in 0.8.8, or should we wait until
post-release?

Looks better, but I don't feel comfortable giving this ack without a
completion of the patch series.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] build: distribute 'make syntax-check' tweaks

2011-02-09 Thread Eric Blake
On 02/01/2011 03:36 PM, Eric Blake wrote:
> * Makefile.am (EXTRA_DIST): Distribute cfg.mk.
> ---
> 
> I noticed that the 0.8.7 tarball lacks cfg.mk, so running 'make
> syntax-check' on that tarball is bound to have problems (without that
> file, you don't exempt tests in gnulib's maint.mk that libvirt is not
> interested in, and you miss out on lots of other tests that are
> libvirt-specific).
> 
> Tested with 'make distcheck', then inspecting the resulting tarball.
> I almost pushed this under a trivial rule, but restrained myself to
> wait for a proper review. :)
> 
>  Makefile.am |1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index 597ec61..882e676 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -51,6 +51,7 @@ EXTRA_DIST = \
>autobuild.sh \
>Makefile.nonreentrant \
>autogen.sh \
> +  cfg.mk \
>examples/domain-events/events-python \
>$(syntax_check_exceptions) \
>$(XML_EXAMPLES)

PING - this one's definitely worth including in 0.8.8.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH libvirt site] Change PHP binding link to new one hosted on libvirt.org

2011-02-09 Thread Michal Novotny

On 02/09/2011 07:32 PM, Eric Blake wrote:

On 02/09/2011 10:52 AM, Michal Novotny wrote:

Signed-off-by: Michal Novotny
---
  docs/bindings.html.in |8 
  docs/sitemap.html.in  |4 
  2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/docs/bindings.html.in b/docs/bindings.html.in
index 87d894d..2d936a0 100644
--- a/docs/bindings.html.in
+++ b/docs/bindings.html.in
@@ -28,16 +28,16 @@

  
PHP: Radek Hladik started developing
-http://phplibvirt.cybersales.cz/";>PHP bindings  in 2010.
+http://libvirt.org/php";>PHP bindings  in 2010.
  
  
-  In February 2011 the binding development has been moved to the
-http://libvirt.org/git/?p=libvirt-php.git;a=summary";>libvirt.org as 
libvirt-php project.
+  In February 2011 the binding development has been moved to the 
libvirt.org website as
+  libvirt-php project.
  
  
The project is now maintained by Michal Novotny and it's heavily 
based
on Radek's version. For more information including the information 
on posting
-  the patches you to libvirt-php please refer toPHP 
binding page.
+  the patches you to libvirt-php please refer tohttp://libvirt.org/php";>PHP binding.

This part is fine.


  


diff --git a/docs/sitemap.html.in b/docs/sitemap.html.in
index ac0af71..c987c49 100644
--- a/docs/sitemap.html.in
+++ b/docs/sitemap.html.in
@@ -266,10 +266,6 @@
  C#
  overview of the C# API bindings

-
-PHP
-overview of the PHP API bindings
-

But this removes the reference without also removing docs/php.html.in;
would it be better to keep the reference, and make sure that libvirt's
php page is still useful?  In particular, remember that libvirt's pages
get installed locally even for users that don't install libvirt-php, so
they should have local documentation that alerts them to the existence
of bindings if they need it.

Well, what about leaving all those information there as they are and 
just to expand the php.html that this project now has it's own website 
for more information ?


Michal

--
Michal Novotny, RHCE
Virtualization Team (xen userspace), Red Hat

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH libvirt site] Change PHP binding link to new one hosted on libvirt.org

2011-02-09 Thread Eric Blake
On 02/09/2011 11:34 AM, Michal Novotny wrote:
>>> -
>>> -PHP
>>> -overview of the PHP API bindings
>>> -
>> But this removes the reference without also removing docs/php.html.in;
>> would it be better to keep the reference, and make sure that libvirt's
>> php page is still useful?  In particular, remember that libvirt's pages
>> get installed locally even for users that don't install libvirt-php, so
>> they should have local documentation that alerts them to the existence
>> of bindings if they need it.
>>
> Well, what about leaving all those information there as they are and
> just to expand the php.html that this project now has it's own website
> for more information ?

Yeah, keeping php.html.in around is a good idea, especially when it is
enhanced with a link to the real libvirt-php website.  Maybe you can
trim some of the existing content from that page, but the page itself
should still exist and be listed in the sitemap.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] consistency of virsh help output

2011-02-09 Thread Eric Blake
On 02/06/2011 02:29 AM, Zdenek Styblik wrote:
> I didn't say we should take one way or another; neither I've said I'm
> going to. I merely wanted to point out at differences, which I think,
> create a bit of confusion.
> 
> As suggested in my hasty reply, perhaps we should have a vote or poll.
> It doesn't seem to be easy decision to me.

Well, I'll start by casting my vote :)

> 
> 
>> attach-disk [--domain]  [--source]  [--target] 
>> [--driver ]
> 
> 
> This is domain of man pages and might be (the best) understood. But it's
> damn-o-damn long. And although we are way past 80 char terminals, I
> still tend to keep within this limit etc. :)
> 
> 
>> attach-disk[]
> 
> 
> When understood, it's ok. And the majority of virsh commands have this
> format; except 19; I would stick with it.

I also like the shorter form.

> 0001-Unify-virsh-help-synopsis-output.patch>From 
> 2ce39caeb82a9a0b2dccc409ac986648c4017191 Mon Sep 17 00:00:00 2001
> From: Zdenek Styblik 
> Date: Sun, 6 Feb 2011 08:50:43 +0100
> Subject: [PATCH] Unify virsh help synopsis output
>  Signed-off-by: Zdenek Styblik 
> 
> ---
>  tools/virsh.c |4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/virsh.c b/tools/virsh.c
> index 1f820e8..cc8efcf 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -10596,11 +10596,11 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname)
>  case VSH_OT_INT:
>  /* xgettext:c-format */
>  fmt = ((opt->flag & VSH_OFLAG_REQ) ? "<%s>"
> -   : _("[--%s ]"));
> +   : _("[%s]"));
>  break;
>  case VSH_OT_STRING:
>  /* xgettext:c-format */
> -fmt = _("[--%s ]");
> +fmt = _("[%s]");
>  break;

Actually, I think these would be _("[<%s>]") (note the <> to signify the
meta-syntactic term).  But I like the idea; this shortens the synopsis
form, while still leaving the usage form to explain the meta-syntactic term.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH libvirt-site v2] Add information about libvirt-php new location [was Change PHP binding link to new one hosted on libvirt.org]

2011-02-09 Thread Michal Novotny
Signed-off-by: Michal Novotny 
---
 docs/bindings.html.in |8 +++---
 docs/php.html.in  |   57 ++--
 2 files changed, 7 insertions(+), 58 deletions(-)

diff --git a/docs/bindings.html.in b/docs/bindings.html.in
index 87d894d..2d936a0 100644
--- a/docs/bindings.html.in
+++ b/docs/bindings.html.in
@@ -28,16 +28,16 @@
   
 
   PHP: Radek Hladik started developing
-  http://phplibvirt.cybersales.cz/";>PHP bindings in 2010.
+  http://libvirt.org/php";>PHP bindings in 2010.
 
 
-  In February 2011 the binding development has been moved to the
-  http://libvirt.org/git/?p=libvirt-php.git;a=summary";>libvirt.org as 
libvirt-php project.
+  In February 2011 the binding development has been moved to the 
libvirt.org website as
+  libvirt-php project.
 
 
   The project is now maintained by Michal Novotny and it's heavily 
based
   on Radek's version. For more information including the information 
on posting
-  the patches you to libvirt-php please refer to PHP binding page.
+  the patches you to libvirt-php please refer to http://libvirt.org/php";>PHP binding.
 
   
   
diff --git a/docs/php.html.in b/docs/php.html.in
index ea4f76a..5283e67 100644
--- a/docs/php.html.in
+++ b/docs/php.html.in
@@ -24,60 +24,9 @@ It can also be browsed at
 
 
 
-Building
-The code is using autotools to generate the files necessary for 
compilation. The preferred way of building is
-   to run autogen.sh to generate configure script and then go on with the 
standard linux make commands, i.e.
-
-
-$ cd libvirt-php
-$ ./autogen.sh
-$ make
-
-
-
-Enabling the module in PHP
-Before you start using the module you have to install the module first. The 
module
-php_libvirt.so is being generated when you compile it. This is necessary to be 
loaded
-in the extensions sections of php.ini file for PHP version older than 
PHP-5.
-
-Starting with PHP-5 you can create a file called libvirt.ini in /etc/php.d 
having just
-one line extension=php_libvirt.so to enable the extension. Of 
course, you
-need to have this module copied in the directory with the rest of your PHP 
modules to
-make PHP find the module for you.
-
-If you're using PHP as a module (mod_php5.so) in the Apache webserver you need 
to
-restart your Apache to trigger configuration reload for PHP.
-
-
-If you're not sure that you have everything set up right and you don't want to 
restart
-your Apache webserver before you're sure everything will be working fine you 
could try
-running the test using cli-based PHP interpreter. There are some example 
scripts coming
-along the source codes in the example subdirectory so you can try 
to run
-php on the index.php script to check whether it's working fine to establish 
connection or not.
-
-
-When you're having some issues with the connection make sure the apache user 
is having
-access to libvirt. For more information please see Libvirt 
access control page.
-
-Contribution
-
-If you would like to contribute to the libvirt-php project you could write 
patches for it but please
-make sure you're following the procedure below:
-
-
- Sign up to libvirt list if you're not on it yet 
(libvir-list@redhat.com)
- Clone the repository from libvirt.org site using:
- git clone git://libvirt.org/libvirt-php
- 
- Set your git username and e-mail and also set the subject prefix in the 
project's repository using:
- git config --local format.subjectprefix "libvirt-php"
- 
- Create the patch in the form of the commits and include also information 
about usage (example source codes maybe) and testing
- Format it using git format-patch -X where X is the number of 
patch parts to be posted, for multipart patch (X is greater than 1) please use 
also numbering (-n) option and include the cover-letter (--cover-letter).
- Send to libvir-list@redhat.com using the git send-email 
 --to libvir-list@redhat.com command where  
can be 000* to send all the patches formatted by git format-patch since 
git format-patch names the files starting with the 4 digit numbers.
-
-
-When you send the patch you're patch will be reviewed and later committed to 
the libvirt-php repository. You'll be contacted in case some flaws are found 
during the review.
+Project pages
+Since February 2011 the project have it's own pages hosted at libvirt.org. 
For more information on the project
+   please refer to http://libvirt.org/php";>http://libvirt.org/php.
 
 
 
-- 
1.7.3.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH libvirt site] Change PHP binding link to new one hosted on libvirt.org

2011-02-09 Thread Michal Novotny

On 02/09/2011 07:37 PM, Eric Blake wrote:

On 02/09/2011 11:34 AM, Michal Novotny wrote:

-
-PHP
-overview of the PHP API bindings
-

But this removes the reference without also removing docs/php.html.in;
would it be better to keep the reference, and make sure that libvirt's
php page is still useful?  In particular, remember that libvirt's pages
get installed locally even for users that don't install libvirt-php, so
they should have local documentation that alerts them to the existence
of bindings if they need it.


Well, what about leaving all those information there as they are and
just to expand the php.html that this project now has it's own website
for more information ?

Yeah, keeping php.html.in around is a good idea, especially when it is
enhanced with a link to the real libvirt-php website.  Maybe you can
trim some of the existing content from that page, but the page itself
should still exist and be listed in the sitemap.
Good, I sent new patch about this right now. The original contents has 
been trimmed and information about new site has been added there.


Michal

--
Michal Novotny, RHCE
Virtualization Team (xen userspace), Red Hat

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] build: distribute 'make syntax-check' tweaks

2011-02-09 Thread Laine Stump

On 02/01/2011 05:36 PM, Eric Blake wrote:

* Makefile.am (EXTRA_DIST): Distribute cfg.mk.
---

I noticed that the 0.8.7 tarball lacks cfg.mk, so running 'make
syntax-check' on that tarball is bound to have problems (without that
file, you don't exempt tests in gnulib's maint.mk that libvirt is not
interested in, and you miss out on lots of other tests that are
libvirt-specific).

Tested with 'make distcheck', then inspecting the resulting tarball.
I almost pushed this under a trivial rule, but restrained myself to
wait for a proper review. :)


I tried this out by removing cfg.mk and trying to run make syntax-check. 
It definitely doesn't like that, so it makes sense to include the file.


ACK.


  Makefile.am |1 +
  1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 597ec61..882e676 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,6 +51,7 @@ EXTRA_DIST = \
autobuild.sh \
Makefile.nonreentrant \
autogen.sh \
+  cfg.mk \
examples/domain-events/events-python \
$(syntax_check_exceptions) \
$(XML_EXAMPLES)


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] maint: whitespace cleanup

2011-02-09 Thread Laine Stump

On 02/04/2011 01:25 PM, Eric Blake wrote:

* cfg.mk (sc_TAB_in_indentation): Check more files.
* .dir-locals.el (html-mode): Let emacs help out.
* docs/internals/command.html.in: Fix offenders.
* docs/formatdomain.html.in: Likewise.
* docs/internals.html.in: Likewise.
Reported by Jiri Denemark.
---

Here's the git diff -b output; actual patch below the diffstat.


ACK. The diff -b verifies no functional changes beyond the ones that 
will help to take detect / prevent future whitespace problems.



diff --git c/.dir-locals.el w/.dir-locals.el
index 7c483d2..f24ec61 100644
--- c/.dir-locals.el
+++ w/.dir-locals.el
@@ -5,4 +5,7 @@
  (c-indent-level . 4)
  (c-basic-offset . 4)
  ))
+ (html-mode . (
+(indent-tabs-mode . nil)
+   ))
   )
diff --git c/cfg.mk w/cfg.mk
index 7664bdf..120f452 100644
--- c/cfg.mk
+++ w/cfg.mk
@@ -322,13 +322,13 @@ sc_prohibit_ctype_h:
halt="don't use ctype.h; instead, use c-ctype.h"  \
  $(_sc_search_regexp)

-# Ensure that no C source file or rng schema uses TABs for
+# Ensure that no C source file, docs, or rng schema uses TABs for
  # indentation.  Also match *.h.in files, to get libvirt.h.in.  Exclude
  # files in gnulib, since they're imported.
  sc_TAB_in_indentation:
@prohibit='^ *  '   \
-   in_vc_files='(\.(rng|[ch](\.in)?)|(daemon|tools)/.*\.in)$$' \
-   halt='use spaces, not TAB, for indentation in C, sh, and RNG schemas' \
+   in_vc_files='(\.(rng|[ch](\.in)?|html.in)|(daemon|tools)/.*\.in)$$' \
+   halt='use leading spaces, not TAB, in C, sh, html, and RNG schemas' \
  $(_sc_search_regexp)

  ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\



  .dir-locals.el |3 +
  cfg.mk |6 +-
  docs/formatdomain.html.in  |  224 
  docs/internals.html.in |4 +-
  docs/internals/command.html.in |   32 +++---
  5 files changed, 136 insertions(+), 133 deletions(-)

diff --git a/.dir-locals.el b/.dir-locals.el
index 7c483d2..f24ec61 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -5,4 +5,7 @@
  (c-indent-level . 4)
  (c-basic-offset . 4)
  ))
+ (html-mode . (
+  (indent-tabs-mode . nil)
+  ))
   )
diff --git a/cfg.mk b/cfg.mk
index 7664bdf..120f452 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -322,13 +322,13 @@ sc_prohibit_ctype_h:
halt="don't use ctype.h; instead, use c-ctype.h"  \
  $(_sc_search_regexp)

-# Ensure that no C source file or rng schema uses TABs for
+# Ensure that no C source file, docs, or rng schema uses TABs for
  # indentation.  Also match *.h.in files, to get libvirt.h.in.  Exclude
  # files in gnulib, since they're imported.
  sc_TAB_in_indentation:
@prohibit='^ *  '   \
-   in_vc_files='(\.(rng|[ch](\.in)?)|(daemon|tools)/.*\.in)$$' \
-   halt='use spaces, not TAB, for indentation in C, sh, and RNG schemas' \
+   in_vc_files='(\.(rng|[ch](\.in)?|html.in)|(daemon|tools)/.*\.in)$$' \
+   halt='use leading spaces, not TAB, in C, sh, html, and RNG schemas' \
  $(_sc_search_regexp)

  ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 43c78fc..b048bb5 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -304,20 +304,20 @@
omitted, it defaults to the OS provided defaults.
hard_limit
  The optionalhard_limit  element is the maximum memory
-   the guest can use. The units for this value are kilobytes (i.e. blocks
-   of 1024 bytes)
+the guest can use. The units for this value are kilobytes (i.e. blocks
+of 1024 bytes)
soft_limit
  The optionalsoft_limit  element is the memory limit 
to
-   enforce during memory contention. The units for this value are
-   kilobytes (i.e. blocks of 1024 bytes)
+enforce during memory contention. The units for this value are
+kilobytes (i.e. blocks of 1024 bytes)
swap_hard_limit
  The optionalswap_hard_limit  element is the maximum
-   swap the guest can use. The units for this value are kilobytes
-   (i.e. blocks of 1024 bytes)
+swap the guest can use. The units for this value are kilobytes
+(i.e. blocks of 1024 bytes)
min_guarantee
  The optionalmin_guarantee  element is the guaranteed
-   minimum memory allocation for the guest. The units for this value are
-   kilobytes (i.e. blocks of 1024 bytes)
+minimum memory allocation for the guest. The units for this value are
+kilobytes (i.e. blocks of 1024 bytes)
vcpu
The content of this element defines the maximum number of virtual
  CPUs allocated for t

[libvirt] [PATCH libvirt-site v2] Add information about libvirt-php new location [was Change PHP binding link to new one hosted on libvirt.org]

2011-02-09 Thread Michal Novotny
Signed-off-by: Michal Novotny 
---
 docs/bindings.html.in |8 +++---
 docs/php.html.in  |   57 ++--
 2 files changed, 7 insertions(+), 58 deletions(-)

diff --git a/docs/bindings.html.in b/docs/bindings.html.in
index 87d894d..2d936a0 100644
--- a/docs/bindings.html.in
+++ b/docs/bindings.html.in
@@ -28,16 +28,16 @@
   
 
   PHP: Radek Hladik started developing
-  http://phplibvirt.cybersales.cz/";>PHP bindings in 2010.
+  http://libvirt.org/php";>PHP bindings in 2010.
 
 
-  In February 2011 the binding development has been moved to the
-  http://libvirt.org/git/?p=libvirt-php.git;a=summary";>libvirt.org as 
libvirt-php project.
+  In February 2011 the binding development has been moved to the 
libvirt.org website as
+  libvirt-php project.
 
 
   The project is now maintained by Michal Novotny and it's heavily 
based
   on Radek's version. For more information including the information 
on posting
-  the patches you to libvirt-php please refer to PHP binding page.
+  the patches you to libvirt-php please refer to http://libvirt.org/php";>PHP binding.
 
   
   
diff --git a/docs/php.html.in b/docs/php.html.in
index ea4f76a..5283e67 100644
--- a/docs/php.html.in
+++ b/docs/php.html.in
@@ -24,60 +24,9 @@ It can also be browsed at
 
 
 
-Building
-The code is using autotools to generate the files necessary for 
compilation. The preferred way of building is
-   to run autogen.sh to generate configure script and then go on with the 
standard linux make commands, i.e.
-
-
-$ cd libvirt-php
-$ ./autogen.sh
-$ make
-
-
-
-Enabling the module in PHP
-Before you start using the module you have to install the module first. The 
module
-php_libvirt.so is being generated when you compile it. This is necessary to be 
loaded
-in the extensions sections of php.ini file for PHP version older than 
PHP-5.
-
-Starting with PHP-5 you can create a file called libvirt.ini in /etc/php.d 
having just
-one line extension=php_libvirt.so to enable the extension. Of 
course, you
-need to have this module copied in the directory with the rest of your PHP 
modules to
-make PHP find the module for you.
-
-If you're using PHP as a module (mod_php5.so) in the Apache webserver you need 
to
-restart your Apache to trigger configuration reload for PHP.
-
-
-If you're not sure that you have everything set up right and you don't want to 
restart
-your Apache webserver before you're sure everything will be working fine you 
could try
-running the test using cli-based PHP interpreter. There are some example 
scripts coming
-along the source codes in the example subdirectory so you can try 
to run
-php on the index.php script to check whether it's working fine to establish 
connection or not.
-
-
-When you're having some issues with the connection make sure the apache user 
is having
-access to libvirt. For more information please see Libvirt 
access control page.
-
-Contribution
-
-If you would like to contribute to the libvirt-php project you could write 
patches for it but please
-make sure you're following the procedure below:
-
-
- Sign up to libvirt list if you're not on it yet 
(libvir-list@redhat.com)
- Clone the repository from libvirt.org site using:
- git clone git://libvirt.org/libvirt-php
- 
- Set your git username and e-mail and also set the subject prefix in the 
project's repository using:
- git config --local format.subjectprefix "libvirt-php"
- 
- Create the patch in the form of the commits and include also information 
about usage (example source codes maybe) and testing
- Format it using git format-patch -X where X is the number of 
patch parts to be posted, for multipart patch (X is greater than 1) please use 
also numbering (-n) option and include the cover-letter (--cover-letter).
- Send to libvir-list@redhat.com using the git send-email 
 --to libvir-list@redhat.com command where  
can be 000* to send all the patches formatted by git format-patch since 
git format-patch names the files starting with the 4 digit numbers.
-
-
-When you send the patch you're patch will be reviewed and later committed to 
the libvirt-php repository. You'll be contacted in case some flaws are found 
during the review.
+Project pages
+Since February 2011 the project have it's own pages hosted at libvirt.org. 
For more information on the project
+   please refer to http://libvirt.org/php";>http://libvirt.org/php.
 
 
 
-- 
1.7.3.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH libvirt-site v2] Add information about libvirt-php new location [was Change PHP binding link to new one hosted on libvirt.org]

2011-02-09 Thread Eric Blake
On 02/09/2011 11:44 AM, Michal Novotny wrote:
> Signed-off-by: Michal Novotny 

That created a rather long commit subject for 'git am', so I pruned it.

>  
>The project is now maintained by Michal Novotny and it's heavily 
> based
>on Radek's version. For more information including the information 
> on posting
> -  the patches you to libvirt-php please refer to  href="php.html">PHP binding page.
> +  the patches you to libvirt-php please refer to  href="http://libvirt.org/php";>PHP binding.

The grammar was already awful here; we might as well fix it while editing:

For more information, including information on posting patches to
libvirt-php, please refer to the PHP bindings site.

> +Project pages
> +Since February 2011 the project have it's own pages hosted at 
> libvirt.org. For more information on the project
> +   please refer to  href="http://libvirt.org/php";>http://libvirt.org/php.

ACK with that nit fixed, so I pushed it.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] maint: whitespace cleanup

2011-02-09 Thread Eric Blake
On 02/09/2011 11:52 AM, Laine Stump wrote:
> On 02/04/2011 01:25 PM, Eric Blake wrote:
>> * cfg.mk (sc_TAB_in_indentation): Check more files.
>> * .dir-locals.el (html-mode): Let emacs help out.
>> * docs/internals/command.html.in: Fix offenders.
>> * docs/formatdomain.html.in: Likewise.
>> * docs/internals.html.in: Likewise.
>> Reported by Jiri Denemark.
>> ---
>>
>> Here's the git diff -b output; actual patch below the diffstat.
> 
> ACK. The diff -b verifies no functional changes beyond the ones that
> will help to take detect / prevent future whitespace problems.

Thanks; pushed.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] build: distribute 'make syntax-check' tweaks

2011-02-09 Thread Eric Blake
On 02/09/2011 11:49 AM, Laine Stump wrote:
> On 02/01/2011 05:36 PM, Eric Blake wrote:
>> * Makefile.am (EXTRA_DIST): Distribute cfg.mk.
>> ---
>>
>> I noticed that the 0.8.7 tarball lacks cfg.mk, so running 'make
>> syntax-check' on that tarball is bound to have problems (without that
>> file, you don't exempt tests in gnulib's maint.mk that libvirt is not
>> interested in, and you miss out on lots of other tests that are
>> libvirt-specific).
>>
>> Tested with 'make distcheck', then inspecting the resulting tarball.
>> I almost pushed this under a trivial rule, but restrained myself to
>> wait for a proper review. :)
> 
> I tried this out by removing cfg.mk and trying to run make syntax-check.
> It definitely doesn't like that, so it makes sense to include the file.
> 
> ACK.

Thanks; pushed.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 1/6] Split all QEMU process mangement code into separate file

2011-02-09 Thread Eric Blake
On 02/09/2011 09:58 AM, Daniel P. Berrange wrote:
> Move the qemudStartVMDaemon and qemudShutdownVMDaemon
> methods into a separate file, renaming them to
> qemuProcessStart, qemuProcessStop. All helper methods
> called by these are also moved & renamed to match
> 
> * src/Makefile.am: Add qemu_process.c/.h
> * src/qemu/qemu_command.c: Add emuDomainAssignPCIAddresses

s/ emu/ qemu/

> * src/qemu/qemu_command.h: Add VNC port min/max
> * src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Add
>   domain event queue helpers
> * src/qemu/qemu_driver.c, src/qemu/qemu_driver.h: Remove
>   all QEMU process startup/shutdown functions
> * src/qemu/qemu_process.c, src/qemu/qemu_process.h: Add
>   all QEMU process startup/shutdown functions
> ---
>  po/POTFILES.in  |1 +
>  src/Makefile.am |1 +
>  src/qemu/qemu_command.c |   29 +
>  src/qemu/qemu_command.h |5 +
>  src/qemu/qemu_domain.c  |   56 +
>  src/qemu/qemu_domain.h  |   11 +
>  src/qemu/qemu_driver.c  | 3535 
> ---
>  src/qemu/qemu_driver.h  |   31 +-
>  src/qemu/qemu_process.c | 2417 
>  src/qemu/qemu_process.h |   52 +
>  10 files changed, 3121 insertions(+), 3017 deletions(-)
>  create mode 100644 src/qemu/qemu_process.c
>  create mode 100644 src/qemu/qemu_process.h

ACK; I reviewed an interdiff between this and your v1 [1], and you have
correctly picked up all the changes that went in to qemu_driver.c since
that posting, as well as resolved all my concerns from that post, except
for the spelling nit in the commit message.

[1] https://www.redhat.com/archives/libvir-list/2011-January/msg01255.html

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 2/6] Move all the QEMU migration code to a new file

2011-02-09 Thread Eric Blake
On 02/09/2011 09:58 AM, Daniel P. Berrange wrote:
> The introduction of the v3 migration protocol, along with
> support for migration cookies, will significantly expand
> the size of the migration code. Move it all to a separate
> file to make it more manageable
> 
> The functions are not moved 100%. The API entry points
> remain in the main QEMU driver, but once the public
> virDomainPtr is resolved to the internal virDomainObjPtr,
> all following code is moved.
> 
> This will allow the new v3 API entry points to call into the
> same shared internal migration functions
> 
> * src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Add
>   qemuDomainFormatXML helper method
> * src/qemu/qemu_driver.c: Remove all migration code
> * src/qemu/qemu_migration.c, src/qemu/qemu_migration.h: Add
>   all migration code.
> ---
>  po/POTFILES.in|1 +
>  src/Makefile.am   |3 +-
>  src/qemu/qemu_domain.c|   39 ++
>  src/qemu/qemu_domain.h|4 +
>  src/qemu/qemu_driver.c| 1297 
> ++---
>  src/qemu/qemu_migration.c | 1295 
>  src/qemu/qemu_migration.h |   63 +++
>  7 files changed, 1445 insertions(+), 1257 deletions(-)
>  create mode 100644 src/qemu/qemu_migration.c
>  create mode 100644 src/qemu/qemu_migration.h

You fixed my concerns from v1; however, you missed that commit ee3b030
in the meantime has changed what needed migration.

> + * This version starts an empty VM listening on a localhost TCP port, and
> + * sets up the corresponding virStream to handle the incoming data.
> + */
> +int
> +qemuMigrationPrepareTunnel(struct qemud_driver *driver,
> +   virConnectPtr dconn,
> +   virStreamPtr st,
> +   const char *dname,
> +   const char *dom_xml)
> +{

> +/* Parse the domain XML. */
> +if (!(def = virDomainDefParseString(driver->caps, dom_xml,
> +VIR_DOMAIN_XML_INACTIVE))) {
> +qemuReportError(VIR_ERR_OPERATION_FAILED,
> +"%s", _("failed to parse XML"));
> +goto cleanup;

This needs to be:

 qemuReportError(VIR_ERR_OPERATION_FAILED,
-"%s", _("failed to parse XML"));
+"%s", _("failed to parse XML, libvirt version
may be "
+"different between source and
destination host"));

ACK with that nit fixed.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] Basic support for VDE networking

2011-02-09 Thread LiuCougar
On 12/01/2011, at 11:29 PM, Daniel P. Berrange wrote:
> On Tue, Jan 11, 2011 at 04:12:57PM +0100, Renzo Davoli wrote:
>> I have seen several messages asking for VDE networking support.
>> There is an item also in your todo web page.
>> http://libvirt.org/todo.html
>> I have developed a patch to provide a basic support for VDE.
>> It defines and manages the syntax:
>>
>> 
>> 
>>  
>>   ...
>>   
>>  
>> 
>> 
>>
>> the switch tag can be omitted: vde uses the default switch.
>> I have tested the qemu/kvm support.
>> user-mode linux support is included but not tested yet.
>> libvirt vde support for virtualbox has not been coded yet (virtualbox
>> itself supports vde).
...
> eg, so you'd be able to create/delete/manage VDE daemon instances
> using the 'virsh net-XXX' command set. The guest domains would be
> connected to VDE using the existing  
> syntax, and not expose any 'vde' syntax in the guest XML directly.
> I think letting apps manage VDE daemon instances via the libvirt
> APi would make this functionality much more friendly & useful
The patch as it's submitted in this thread is very useful for all
users of qemu/kvm with VDE: it makes it possible for these users to
directly migrated to libvirt to manage VMs without too much hassle.

If it can be managed automatically by libvirt, that would be a plus,
but even then, I think it would be good to still support exposing VDE
directly in the XML so users can manually handle VDE configuration if
they choose to do so.

Is it possible to merge this patch into libvirt so VDE users can
benefit from libvirt?

thanks,
liucougar

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 3/6] Introduce yet another migration version in API.

2011-02-09 Thread Eric Blake
On 02/09/2011 09:58 AM, Daniel P. Berrange wrote:
> This patch attempts to introduce a version 3 that uses the
> improved 5 step sequence
> 
>  *  Src: Begin
>   - Generate XML to pass to dst
>   - Generate optional cookie to pass to dst
> 
>  *  Dst: Prepare
>   - Get ready to accept incoming VM
>   - Generate optional cookie to pass to src
> 
>  *  Src: Perform
>   - Start migration and wait for send completion
>   - Generate optional cookie to pass to dst
> 
>  *  Dst: Finish
>   - Wait for recv completion and check status
>   - Kill off VM if failed, resume if success
>   - Generate optional cookie to pass to src
> 
>  *  Src: Confirm
>   - Kill off VM if success, resume if failed
> 
> The API is designed to allow both input and output cookies
> in all methods where applicable. This lets us pass around
> arbitrary extra driver specific data between src & dst during
> migration. Combined with the extra 'Begin' method this lets
> us pass lease information from source to dst at the start of
> migration

This sounds like a post-0.8.8 change, but a good one.

> +static virDomainPtr
> +virDomainMigrateVersion3(virDomainPtr domain,
> + virConnectPtr dconn,
> + unsigned long flags,
> + const char *dname,
> + const char *uri,
> + unsigned long bandwidth)
> +{
> +
> +if (uri == NULL && uri_out == NULL) {
> +virLibConnError(VIR_ERR_INTERNAL_ERROR,
> +_("domainMigratePrepare2 did not set uri"));

s/2/3/

> +virDispatchError(domain->conn);
> +goto done;
> +}
> +if (uri_out)
> +uri = uri_out; /* Did domainMigratePrepare2 change URI? */

s/2/3/

> +/*
> + * The status code from the source is passed to the destination.
> + * The dest can cleanup in the source indicated it failed to

s/in/if/


> +if (conn->driver->domainMigrateBegin3) {
> +char *xml;
> +xml = conn->driver->domainMigrateBegin3(domain,
> +cookieout, cookieoutlen,
> +flags, dname, bandwidth);
> +VIR_DEBUG("xml %s", xml);

s/ xml/ NULLSTR(xml)/

> +int virDomainMigrateFinish3(virConnectPtr dconn,
> +const char *dname,
> +const char *cookiein,
> +int cookieinlen,
> +char **cookieout,
> +int *cookieoutlen,
> +const char *uri,
> +unsigned long flags,
> +int cancelled, /* Kill the dst VM */
> +virDomainPtr *newdom);
> +
> +int virDomainMigrateConfirm3(virDomainPtr domain,
> + const char *cookiein,
> + int cookieinlen,
> + unsigned long flags,
> + int restart); /* Restart the src VM */

Since cancelled and restart are basically bool, should they be
incorporated into flags rather than an extra argument?  But I'm fine
with leaving them separate, especially since that leaves flags for just
those bits requested by the user.

ACK with those nits fixed.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 1/2] Get cpuMhz of virNodeGetInfo() from cpufreq/cpuinfo_max_freq, if exist

2011-02-09 Thread Minoru Usui
Hi, Eric

On Tue, 1 Feb 2011 10:26:36 +0900
Minoru Usui  wrote:

> Hi, Eric
> 
> On Mon, 31 Jan 2011 15:46:39 -0700
> Eric Blake  wrote:
> 
> > On 01/27/2011 02:51 AM, Minoru Usui wrote:
> > > virNodeGetInfo() gets from
> > > /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq, first.
> > > 
> > > Signed-off-by: Minoru Usui 
> > 
> > I haven't looked closely at this series yet...
> > 
> > > +/*
> > > + * nodeinfo->mhz should return maximum frequency,
> > > + * but "cpu MHz" of /proc/cpuinfo is scaled by power saving feature.
> > > + * So it gets cpufreq/cpuinfo_max_freq, if possible.
> > > + */
> > > +ret = get_cpu_value(0, "cpufreq/cpuinfo_max_freq", true);
> > > +if (ret < 0)
> > > + return -1;
> > > +else if (ret != 1) {
> > > + /* convert unit */
> > > + cpu_mhz = ret / 1000;
> > 
> > But which units is this converting between, and should it truncate or
> > round up?
> 
> I think it divide by 1000 is collect, because my machine returns below values.
> 
> -
> # cat /sys/devices/system/cpu/cpu?/cpufreq/cpuinfo_max_freq 
> 231
> 231
> 231
> 231
> 231
> 231
> 231
> 231
>  
> # grep 'cpu MHz' /proc/cpuinfo
> cpu MHz : 2333.331
> cpu MHz : 2333.331
> cpu MHz : 2333.331
> cpu MHz : 2333.331
> cpu MHz : 2333.331
> cpu MHz : 2333.331
> cpu MHz : 2333.331
> cpu MHz : 2333.331
> -
> 
> On the other hand, I don't have clear opinion about truncate or round up. 
> Present implementation of linuxNodeInfoCPUPopulate() selects truncate,
> so I implement to truncate logic.

Are my explanations enough?
If not or I'm misunderstanding something, please let me know.

-- 
Minoru Usui 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 0/2] set QEMUD_CMD_FLAG_PCI_MULTIBUS for x86_64 and i686 architectures

2011-02-09 Thread Wen Congyang
When we attach a interface to a guest machine, we receive the
following error messages:

[root@wency ~]# virsh attach-interface RHEL6RC network default
error: Failed to attach interface
error: internal error unable to execute QEMU command 'device_add': Bus 'pci' 
not found

This bug was caused by 0b864eb1.

Wen Congyang (2):
  QEMUD_CMD_FLAG_PCI_MULTIBUS should be set in the function
qemuCapsExtractVersionInfo()
  tests: set QEMUD_CMD_FLAG_PCI_MULTIBUS in testCompareXMLToArgvFiles()

 src/qemu/qemu_capabilities.c |   12 +---
 src/qemu/qemu_capabilities.h |2 +-
 src/qemu/qemu_command.c  |6 --
 src/qemu/qemu_driver.c   |   20 +++-
 tests/qemuxml2argvtest.c |9 +
 5 files changed, 30 insertions(+), 19 deletions(-)

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 1/2] QEMUD_CMD_FLAG_PCI_MULTIBUS should be set in the function qemuCapsExtractVersionInfo()

2011-02-09 Thread Wen Congyang
The flag QEMUD_CMD_FLAG_PCI_MULTIBUS is used in the function
qemuBuildDeviceAddressStr(). All callers get qemuCmdFlags
by the function qemuCapsExtractVersionInfo() except that
testCompareXMLToArgvFiles() in qemuxml2argvtest.c.

So we should set QEMUD_CMD_FLAG_PCI_MULTIBUS in the function
qemuCapsExtractVersionInfo() instead of qemuBuildCommandLine()
because the function qemuBuildCommandLine() does not be called
when we attach a pci device.

Signed-off-by: Wen Congyang 

---
 src/qemu/qemu_capabilities.c |   12 +---
 src/qemu/qemu_capabilities.h |2 +-
 src/qemu/qemu_command.c  |6 --
 src/qemu/qemu_driver.c   |   20 +++-
 4 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 2787ffb..808ead0 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -547,7 +547,7 @@ qemuCapsInitGuest(virCapsPtr caps,
 !virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0))
 goto error;
 
-if (qemuCapsExtractVersionInfo(binary, NULL, &qemuCmdFlags) < 0 ||
+if (qemuCapsExtractVersionInfo(binary, info->arch, NULL, &qemuCmdFlags) < 
0 ||
 ((qemuCmdFlags & QEMUD_CMD_FLAG_BOOTINDEX) &&
  !virCapabilitiesAddGuestFeature(guest, "deviceboot", 1, 0)))
 goto error;
@@ -1108,7 +1108,7 @@ qemuCapsParseDeviceStr(const char *str, unsigned long 
long *flags)
 return 0;
 }
 
-int qemuCapsExtractVersionInfo(const char *qemu,
+int qemuCapsExtractVersionInfo(const char *qemu, const char *arch,
unsigned int *retversion,
unsigned long long *retflags)
 {
@@ -1144,6 +1144,12 @@ int qemuCapsExtractVersionInfo(const char *qemu,
  &version, &is_kvm, &kvm_version) == -1)
 goto cleanup;
 
+/* Currently only x86_64 and i686 support PCI-multibus. */
+if (STREQLEN(arch, "x86_64", 6) ||
+STREQLEN(arch, "i686", 4)) {
+flags |= QEMUD_CMD_FLAG_PCI_MULTIBUS;
+}
+
 /* qemuCapsExtractDeviceStr will only set additional flags if qemu
  * understands the 0.13.0+ notion of "-device driver,".  */
 if ((flags & QEMUD_CMD_FLAG_DEVICE) &&
@@ -1205,7 +1211,7 @@ int qemuCapsExtractVersion(virCapsPtr caps,
 return -1;
 }
 
-if (qemuCapsExtractVersionInfo(binary, version, NULL) < 0) {
+if (qemuCapsExtractVersionInfo(binary, ut.machine, version, NULL) < 0) {
 return -1;
 }
 
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index dd39b3b..a130a4f 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -108,7 +108,7 @@ int qemuCapsProbeCPUModels(const char *qemu,
 
 int qemuCapsExtractVersion(virCapsPtr caps,
unsigned int *version);
-int qemuCapsExtractVersionInfo(const char *qemu,
+int qemuCapsExtractVersionInfo(const char *qemu, const char *arch,
unsigned int *version,
unsigned long long *qemuCmdFlags);
 
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f78ce71..3ba0950 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2685,12 +2685,6 @@ qemuBuildCommandLine(virConnectPtr conn,
 break;
 }
 
-/* Currently only x86_64 and i686 support PCI-multibus. */
-if (STREQLEN(def->os.arch, "x86_64", 6) ||
-STREQLEN(def->os.arch, "i686", 4)) {
-qemuCmdFlags |= QEMUD_CMD_FLAG_PCI_MULTIBUS;
-}
-
 cmd = virCommandNewArgList(emulator, "-S", NULL);
 
 virCommandAddEnvPassCommon(cmd);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b936735..ff396ff 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -943,7 +943,7 @@ qemuReconnectDomain(void *payload, const char *name 
ATTRIBUTE_UNUSED, void *opaq
 /* XXX we should be persisting the original flags in the XML
  * not re-detecting them, since the binary may have changed
  * since launch time */
-if (qemuCapsExtractVersionInfo(obj->def->emulator,
+if (qemuCapsExtractVersionInfo(obj->def->emulator, obj->def->os.arch,
NULL,
&qemuCmdFlags) >= 0 &&
 (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE)) {
@@ -2516,7 +2516,7 @@ qemuAssignPCIAddresses(virDomainDefPtr def)
 unsigned long long qemuCmdFlags = 0;
 qemuDomainPCIAddressSetPtr addrs = NULL;
 
-if (qemuCapsExtractVersionInfo(def->emulator,
+if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch,
NULL,
&qemuCmdFlags) < 0)
 goto cleanup;
@@ -2749,7 +2749,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
 goto cleanup;
 
 DEBUG0("Determining emulator version");
-if (qemuCapsExtractVersionInfo(vm->def->emulator,
+if (qemuCapsExtractVersionInfo(vm->def->emulator, vm->def-

[libvirt] [PATCH 2/2] tests: set QEMUD_CMD_FLAG_PCI_MULTIBUS in testCompareXMLToArgvFiles()

2011-02-09 Thread Wen Congyang
set QEMUD_CMD_FLAG_PCI_MULTIBUS before calling qemuBuildCommandLine()
as the flags is not set by qemuCapsExtractVersionInfo().

Signed-off-by: Wen Congyang 

---
 tests/qemuxml2argvtest.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 52808b5..96260c0 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -111,6 +111,15 @@ static int testCompareXMLToArgvFiles(const char *xml,
 free(virtTestLogContentAndReset());
 virResetLastError();
 
+/* We do not call qemuCapsExtractVersionInfo() before calling
+ * qemuBuildCommandLine(), so we should set QEMUD_CMD_FLAG_PCI_MULTIBUS for
+ * x86_64 and i686 architectures here.
+ */
+if (STREQLEN(vmdef->os.arch, "x86_64", 6) ||
+STREQLEN(vmdef->os.arch, "i686", 4)) {
+flags |= QEMUD_CMD_FLAG_PCI_MULTIBUS;
+}
+
 if (!(cmd = qemuBuildCommandLine(conn, &driver,
  vmdef, &monitor_chr, false, flags,
  migrateFrom, migrateFd, NULL,
-- 
1.7.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [RFC PATCH 0/6] Switch over qemu command line capabilities to virBitmap

2011-02-09 Thread Daniel Veillard
On Wed, Feb 09, 2011 at 05:01:57PM +0100, Jiri Denemark wrote:
> There are two main reasons behind this patchset:
> - we are getting very close to 64 flags which is the maximum we can use with
>   unsigned long long
> - by using LL constants in enum we already violates C99 constraint that enum
>   values have to fit into int
> 
> This is a very conflict-prone patchset so I'd like to get some feedback on the
> ideas and naming used so that this could possible be among the first patches
> pushed after 0.8.8 release.

  ACK on the principle and timing !

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | 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] [libvirt-snmp][PATCH] New environment variable managing connection URI.

2011-02-09 Thread Daniel Veillard
On Wed, Feb 09, 2011 at 04:43:25PM +0100, Michal Privoznik wrote:
> Add environment variable LIBVIRT_MIB_CONNECT_URI to control URI
> which snmp agent is connecting to. It is now possible to connect
> to all hypervisors (including test:///) instead of hardcoded
> qemu:///system, which is used now by default when variable is not
> set.

  Should this use the existing LIBVIRT_DEFAULT_URI if set instead ?
That's the current way to define the default URI for the stack, so
why would you want a different one for SNMP ?

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | 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


[libvirt] Entering freeze for libvirt-0.8.8

2011-02-09 Thread Daniel Veillard
  We're entering the week freeze for 0.8.8, so let's delay new feature
until the end of next week and let's focuse on bug fixes. I have put an
initial release candidate at:

  ftp://libvirt.org/libvirt/libvirt-0.8.8-rc1.tar.gz

it seems to compile and work fine for me. there is however a small
problem at configure time:

-
thinkpad:~/tmp/libvirt-0.8.8 -> ./autogen.sh --system ; make
Running ./configure with --prefix=/usr --sysconfdir=/etc --localstatedir=/var 
--libdir=/usr/lib 
fatal: Not a git repository (or any of the parent directories): .git
fatal: Cannot open 'bootstrap.conf': No such file or directory
usage: git diff [--no-index]  
/home/veillard/tmp/libvirt-0.8.8/tmpwrk2661/archive
/home/veillard/tmp/libvirt-0.8.8/tmpwrk2661/archive
/home/veillard/tmp/libvirt-0.8.8/tmpwrk2661/archive
Copying file m4/codeset.m4
-

 Seems some git command is launched but errors out, that's normal
but it should not pollute the output (there is also the extra paths
output but that's due to the fact that I use CDPATH env variable
and as a result "cd dir" is not silent when successful but output
the target dir).

Daniel


-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | 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] [PATCH v2] xen: Prevent updating device when attaching a device

2011-02-09 Thread Daniel Veillard
On Wed, Feb 09, 2011 at 02:01:25PM +, Daniel P. Berrange wrote:
> On Wed, Feb 09, 2011 at 04:51:27PM +0800, Osier Yang wrote:
> > When attaching a device that already exists, xend driver updates
> > the device with "device_configure", it causes problems (e.g. for
> > disk device, 'device_configure' only can be used to update device
> > like CDROM), on the other hand, we provide additional API
> > (virDomainUpdateDevice) to update device, this fix is to raise up
> > errors instead of updating the existed device which is not CDROM
> > device.
> > 
> > Changes from v1 to v2:
> >   - allow update CDROM
> > 
> > * src/xen/xend_internal.c
> > ---
> >  src/xen/xend_internal.c |   42 +-
> >  1 files changed, 37 insertions(+), 5 deletions(-)
> 
> 
> 
> > 
> > diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
> > index cd30336..bc23595 100644
> > --- a/src/xen/xend_internal.c
> > +++ b/src/xen/xend_internal.c
> > @@ -3965,6 +3965,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const 
> > char *xml,
> >  virDomainDefPtr def = NULL;
> >  virBuffer buf = VIR_BUFFER_INITIALIZER;
> >  char class[8], ref[80];
> > +char *target = NULL;
> > 
> >  if ((domain == NULL) || (domain->conn == NULL) || (domain->name == 
> > NULL)) {
> >  virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
> > @@ -4029,6 +4030,13 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, 
> > const char *xml,
> >  STREQ(def->os.type, "hvm") ? 1 : 0,
> >  priv->xendConfigVersion, 1) < 0)
> >  goto cleanup;
> > +
> > +if (dev->data.disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
> 
> I can't remember if Xen supports it or not, but do we need  DEVICE_FLOPPY
> here too ?

  I would guess that yes, we use it in the xend driver 

> The patch looks good aside from that question

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | 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] Entering freeze for libvirt-0.8.8

2011-02-09 Thread Osier Yang

Works fine (simple checking with domain cycle operations)on my
F14, also no problem of compiling, (make, make check, make rpm,
make dist, etc).

Regards
Osier
于 2011年02月10日 11:43, Daniel Veillard 写道:

   We're entering the week freeze for 0.8.8, so let's delay new feature
until the end of next week and let's focuse on bug fixes. I have put an
initial release candidate at:

   ftp://libvirt.org/libvirt/libvirt-0.8.8-rc1.tar.gz

it seems to compile and work fine for me. there is however a small
problem at configure time:

-
thinkpad:~/tmp/libvirt-0.8.8 ->  ./autogen.sh --system ; make
Running ./configure with --prefix=/usr --sysconfdir=/etc --localstatedir=/var 
--libdir=/usr/lib
fatal: Not a git repository (or any of the parent directories): .git
fatal: Cannot open 'bootstrap.conf': No such file or directory
usage: git diff [--no-index]  
/home/veillard/tmp/libvirt-0.8.8/tmpwrk2661/archive
/home/veillard/tmp/libvirt-0.8.8/tmpwrk2661/archive
/home/veillard/tmp/libvirt-0.8.8/tmpwrk2661/archive
Copying file m4/codeset.m4
-

  Seems some git command is launched but errors out, that's normal
but it should not pollute the output (there is also the extra paths
output but that's due to the fact that I use CDPATH env variable
and as a result "cd dir" is not silent when successful but output
the target dir).

Daniel




--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] consistency of virsh help output

2011-02-09 Thread Zdenek Styblik

On 02/09/2011 07:26 PM, Eric Blake wrote:
[...]

attach-disk  []



When understood, it's ok. And the majority of virsh commands have this
format; except 19; I would stick with it.


I also like the shorter form.



Fine :o) I don't mind either of those.


0001-Unify-virsh-help-synopsis-output.patch> From 
2ce39caeb82a9a0b2dccc409ac986648c4017191 Mon Sep 17 00:00:00 2001
From: Zdenek Styblik
Date: Sun, 6 Feb 2011 08:50:43 +0100
Subject: [PATCH] Unify virsh help synopsis output
  Signed-off-by: Zdenek Styblik

---
  tools/virsh.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 1f820e8..cc8efcf 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -10596,11 +10596,11 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname)
  case VSH_OT_INT:
  /* xgettext:c-format */
  fmt = ((opt->flag&  VSH_OFLAG_REQ) ? "<%s>"
-   : _("[--%s]"));
+   : _("[%s]"));
  break;
  case VSH_OT_STRING:
  /* xgettext:c-format */
-fmt = _("[--%s]");
+fmt = _("[%s]");
  break;


Actually, I think these would be _("[<%s>]") (note the<>  to signify the
meta-syntactic term).  But I like the idea; this shortens the synopsis
form, while still leaving the usage form to explain the meta-syntactic term.



Right, because '--%s' is mandatory. Should I re-post the patch, or...?

Thanks,
Z.

--
Zdenek Styblik
Net/Linux admin
OS TurnovFree.net
email: sty...@turnovfree.net
jabber: sty...@jabber.turnovfree.net

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list