Re: [libvirt] [PATCH] util: Fix incorrect error in PCI functions.

2011-05-31 Thread Osier Yang

On 06/01/2011 04:35 AM, Matthias Bolte wrote:

2011/5/31 Osier Yang:

Substitute VIR_ERR_NO_SUPPORT with VIR_ERR_INTERNAL_ERROR. Error
like following is not what user want to see.

error : pciDeviceIsAssignable:1487 : this function is not supported
by the connection driver: Device :07:10.0 is behind a switch
lacking ACS and cannot be assigned

---
  src/util/pci.c |   20 ++--
  1 files changed, 10 insertions(+), 10 deletions(-)



ACK.

Matthias


Thanks, applied.

Regards
Osier

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


[libvirt] [PATCH] security: plug regression introduced in disk probe logic

2011-05-31 Thread Eric Blake
Regression introduced in commit d6623003 (v0.8.8) - using the
wrong sizeof operand meant that security manager private data
was overlaying the allowDiskFOrmatProbing member of struct
_virSecurityManager.  This reopens disk probing, which was
supposed to be prevented by the solution to CVE-2010-2238.

* src/security/security_manager.c
(virSecurityManagerGetPrivateData): Use correct offset.
---
 src/security/security_manager.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/security/security_manager.c b/src/security/security_manager.c
index 0246dd8..833c1a2 100644
--- a/src/security/security_manager.c
+++ b/src/security/security_manager.c
@@ -107,7 +107,7 @@ virSecurityManagerPtr virSecurityManagerNew(const char 
*name,

 void *virSecurityManagerGetPrivateData(virSecurityManagerPtr mgr)
 {
-return ((char*)mgr) + sizeof(mgr);
+return ((char*)mgr) + sizeof(*mgr);
 }


-- 
1.7.4.4

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


[libvirt] [PATCH] build: consistently use CFLAGS

2011-05-31 Thread Eric Blake
According to the automake manual, CPPFLAGS (aka INCLUDES, as spelled
in automake 1.9.6) should only include -I, -D, and -U directives; more
generic directives like -Wall belong in CFLAGS since they affect more
phases of the build process.  Therefore, we should be sticking CFLAGS
additions into a CFLAGS container, not a CPPFLAGS container.

* src/Makefile.am (INCLUDES): Move CFLAGS items...
(AM_CFLAGS): ...to their proper location.
* python/Makefile.am (INCLUDES, AM_CFLAGS): Likewise.
* tests/Makefile.am (INCLUDES, AM_CFLAGS): Likewise.
---
 python/Makefile.am |5 +++--
 src/Makefile.am|   15 +++
 tests/Makefile.am  |8 +---
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/python/Makefile.am b/python/Makefile.am
index 432ad70..0edb3e4 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -3,12 +3,13 @@
 SUBDIRS= . tests

 INCLUDES = \
-$(WARN_CFLAGS) \
-$(PYTHON_INCLUDES) \
+   $(PYTHON_INCLUDES) \
-I$(top_srcdir)/include \
-I$(top_builddir)/include \
-I$(top_builddir)/$(subdir)

+AM_CFLAGS = $(WARN_CFLAGS)
+
 DOCS_DIR = $(datadir)/doc/libvirt-python-$(LIBVIRT_VERSION)

 DOCS = ${srcdir}/TODO
diff --git a/src/Makefile.am b/src/Makefile.am
index 02d53ee..292fa30 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,20 +3,19 @@
 # No libraries with the exception of LIBXML should be listed
 # here. List them against the individual XXX_la_CFLAGS targets
 # that actually use them
-INCLUDES = \
-   -I$(top_srcdir)/gnulib/lib  \
+INCLUDES = -I$(top_srcdir)/gnulib/lib  \
-I../gnulib/lib \
-I../include\
-I@top_srcdir@/src/util \
-I@top_srcdir@/include  \
-   $(DRIVER_MODULE_CFLAGS) \
+   -DIN_LIBVIRT
+
+AM_CFLAGS =$(DRIVER_MODULE_CFLAGS) \
$(LIBXML_CFLAGS)\
$(WARN_CFLAGS)  \
-   $(LOCK_CHECKING_CFLAGS) \
-   -DIN_LIBVIRT\
-   $(WIN32_EXTRA_CFLAGS)
-
-AM_CFLAGS = $(COVERAGE_CFLAGS)
+   $(LOCK_CHECKING_CFLAGS) \
+   $(WIN32_EXTRA_CFLAGS)   \
+   $(COVERAGE_CFLAGS)
 AM_LDFLAGS = $(COVERAGE_LDFLAGS)

 EXTRA_DIST = $(conf_DATA)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7ae50a2..2b21d82 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -8,14 +8,16 @@ INCLUDES = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/util \
-   -I$(top_srcdir)/src/conf \
+   -I$(top_srcdir)/src/conf
+
+AM_CFLAGS = \
$(LIBXML_CFLAGS) \
$(GNUTLS_CFLAGS) \
$(SASL_CFLAGS) \
$(SELINUX_CFLAGS) \
$(APPARMOR_CFLAGS) \
- $(COVERAGE_CFLAGS) \
- $(WARN_CFLAGS)
+   $(COVERAGE_CFLAGS) \
+   $(WARN_CFLAGS)

 if WITH_DRIVER_MODULES
 INCLUDES += \
-- 
1.7.4.4

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


Re: [libvirt] [PATCH] graphics: add support for action_if_connected in qemu

2011-05-31 Thread Eric Blake
On 05/31/2011 03:09 PM, Eric Blake wrote:
>>  
>> +if (connected) {
>> +int action = 
>> virDomainGraphicsAuthConnectedTypeFromString(connected);
>> +if (action < 0) {
>> +virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
>> + _("unknown connected value %s"),
> 
> Do we want to allow parsing "default"?  If not, then change this to 'if
> (action <= 0)'.

Still applicable to v2.

> 
>> @@ -1755,7 +1760,7 @@ qemuDomainChangeGraphicsPasswords(struct qemud_driver 
>> *driver,
>>  ret = qemuMonitorSetPassword(priv->mon,
>>   type,
>>   auth->passwd ? auth->passwd : 
>> defaultPasswd,
>> - NULL);
>> + auth->connected ? 
>> virDomainGraphicsAuthConnectedTypeToString(auth->connected) : NULL);
> 
> Style - this results in a long line.  It might be nicer to do:
> 
> const char *connected = NULL;
> if (auth->connected)
> connected = virDomainGraphicsAuthConnectedTypeToString(auth->connected);
> ...
> qemuMonitorSetPassword(priv->mon, type,
>   auth->passwd ? auth->passwd : defaultPasswd,
>   connected);
> 
> This is a new XML feature, but has missed the rc1 freeze, so v2 should
> not be applied until after the 0.9.2 release, although you can post it
> for review before then.

Serves me right for reading my inbox in order - I see you already posted
v2: https://www.redhat.com/archives/libvir-list/2011-May/msg01871.html

And now I'm wavering on whether this is a completely new feature, or
enough of a bug-fix that we could get it into 0.9.2 anyways, since it is
certainly minimal impact; so opinions from others would be helpful here.

-- 
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] freebsd: Fix build problem due to picking up the wrong libvirt.h

2011-05-31 Thread Eric Blake
On 05/31/2011 02:51 PM, Matthias Bolte wrote:
> AM_GNU_GETTEXT calls AM_ICONV_LINK. AM_ICONV_LINK saves and alters
> CPPFLAGS, but doesn't restore it when it finds libiconv. This
> results in /usr/local/include ending up in the gcc command line
> before the include path for the local include directory. This makes
> gcc pick a previous installed libvirt.h instead of the correct one
> from the source tree.
> 
> Workaround this problem by saving and restoring CPPFLAGS around
> the AM_GNU_GETTEXT call.
> ---
>  configure.ac |8 
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index b2ba930..8f46dbd 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -2011,8 +2011,16 @@ dnl Enable building libvirtd?
>  AM_CONDITIONAL([WITH_LIBVIRTD],[test "x$with_libvirtd" = "xyes"])
>  
>  dnl Check for gettext - don't go any newer than what RHEL 5 supports
> +dnl
> +dnl save and restore CPPFLAGS around gettext check as the internal iconv
> +dnl check might leave -I/usr/local/include in CPPFLAGS on FreeBSD resulting
> +dnl in the build picking up previously installed libvirt/libvirt.h instead
> +dnl of the correct one from the soucre tree
> +
> +save_CPPFLAGS="$CPPFLAGS"
>  AM_GNU_GETTEXT_VERSION([0.17])
>  AM_GNU_GETTEXT([external])
> +CPPFLAGS="$save_CPPFLAGS"

Does this still pick up /usr/local/include later in the command line,
for the portion of the build that actually needs to include iconf
headers, but in a position after our internal headers have been found first?

I was actually thinking that we should instead work around this by
setting AM_CPPFLAGS somewhere in our Makefile.am files.  That is, when
AM_CPPFLAGS is set, then automake outputs $(AM_CPPFLAGS) $(CPPFLAGS)
when producing compilation rules, such that our internal CPPFLAGS
settings come first in the command line, prior to anything inherited
during configure (including the internal iconv settings).  That is, with
new enough automake, I think this alternative patch solve your BSD
compilation (although other directories need the same treatment),
without needing any configure.ac hacks.

On the other hand, it looks like RHEL 5 only supports automake 1.9.6,
and the automake NEWS doesn't mention AM_CPPFLAGS until 1.10 :(

So even if the approach in my patch solves your issue, I think it's a
non-starter, and something like your patch may be the best we can do.

But I'm still worried that we have to use -I/usr/local/include somewhere
in the command line, which means we would have to modify src/Makefile.am
(and friends) to have:

INCLUDES= ... $(GETTEXT_CPPFLAGS)

where GETTEXT_CPPFLAGS is substituted with the difference in
$save_CPPFLAGS and $CPPFLAGS prior to the point where we restore $CPPFLAGS.

diff --git i/src/Makefile.am w/src/Makefile.am
index 02d53ee..793fb9b 100644
--- i/src/Makefile.am
+++ w/src/Makefile.am
@@ -3,20 +3,20 @@
 # No libraries with the exception of LIBXML should be listed
 # here. List them against the individual XXX_la_CFLAGS targets
 # that actually use them
-INCLUDES = \
+AM_CPPFLAGS =  \
-I$(top_srcdir)/gnulib/lib  \
-I../gnulib/lib \
-I../include\
-I@top_srcdir@/src/util \
-I@top_srcdir@/include  \
-   $(DRIVER_MODULE_CFLAGS) \
+   -DIN_LIBVIRT
+
+AM_CFLAGS =$(DRIVER_MODULE_CFLAGS) \
$(LIBXML_CFLAGS)\
$(WARN_CFLAGS)  \
-   $(LOCK_CHECKING_CFLAGS) \
-   -DIN_LIBVIRT\
-   $(WIN32_EXTRA_CFLAGS)
-
-AM_CFLAGS = $(COVERAGE_CFLAGS)
+   $(LOCK_CHECKING_CFLAGS) \
+   $(WIN32_EXTRA_CFLAGS)   \
+   $(COVERAGE_CFLAGS)
 AM_LDFLAGS = $(COVERAGE_LDFLAGS)

 EXTRA_DIST = $(conf_DATA)


-- 
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] virsh version problem with remote connection

2011-05-31 Thread Matthias Bolte
virsh version does basically this

hvType = virConnectGetType(...)
virGetVersion(..., hvType, ...)
[...]

Assuming a remote connection virConnectGetType calls the remote driver
that returns the type of the underlying driver on the server side, for
example QEMU. Then virGetVersion compares hvType to a set of strings
that depend on configure options and returns LIBVIR_VERSION_NUMBER in
most cases. Now this fails in case libvirt on the client side is just
compiled with the remote driver enabled and the server side has the
actual driver such as the QEMU driver. It just happens to work when
the actual driver is compiled in on client and server side. But that's
not the case here.

freebsd# ./tools/virsh -c qemu+tcp://192.168.178.22/system version
Compiled against library: libvir 0.9.2
error: failed to get the library version
error: this function is not supported by the connection driver: virGetVersion

This is not FreeBSD specific, happens on Windows as well due to the
similar drivers configuration. The problem is that virConnectGetType
returns QEMU, but virGetVersion on the client side only accepts Remote
as hvType due to all other drivers being disabled on the client side.

I'm not sure how to fix this properly, does anyone have some idea?

Matthias

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


Re: [libvirt] [PATCH] openvz: Add simple test for openvzReadNetworkConf

2011-05-31 Thread Eric Blake
On 05/31/2011 07:11 AM, Matthias Bolte wrote:
> Convert openvzLocateConfFile to a replaceable callback to allow
> testing the config file parsing without rewriting the whole OpenVZ
> config parsing to a more testable structure.
> 
> Also ignore the openvzutilstest binary.

Serves me right for pushing that .gitignore fix before finishing reading
my inbox...

> ---
>  src/openvz/openvz_conf.c   |   28 +++
>  src/openvz/openvz_conf.h   |6 +++
>  tests/.gitignore   |1 +
>  tests/openvzutilstest.c|   78 
> 
>  tests/openvzutilstest.conf |1 +
>  5 files changed, 106 insertions(+), 8 deletions(-)
> 
> +++ b/tests/.gitignore
> @@ -16,6 +16,7 @@ object-locking
>  object-locking-files.txt
>  object-locking.cmi
>  object-locking.cmx
> +openvzutilstest

I'd rather move towards having more exceptions in the top-level
.gitignore, and fewer lines here in the directory-specific
tests/.gitignore (for that matter, since .gitignore is hierarchical, I
would eventually like to get rid of all the child .gitignore files and
put everything in the top level).  But that's a cleanup for another day.
 Meanwhile, this hunk is no longer necessary, thanks to commit ad962bc.

ACK to the rest of the patch; more testsuite exposure is always okay,
even after feature freeze.

-- 
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] remote generator: Handle some virTypedParameterPtr using functions

2011-05-31 Thread Eric Blake
On 05/30/2011 12:34 PM, Matthias Bolte wrote:
> This doesn't cover the getters that allow to query nparams yet.
> ---
> 
> This patch depends on
> 
> https://www.redhat.com/archives/libvir-list/2011-May/msg01856.html
> 
>  daemon/remote.c  |  182 ---
>  daemon/remote_generator.pl   |   58 +++-
>  src/remote/remote_driver.c   |  215 
> --
>  src/remote/remote_protocol.x |   20 ++--
>  4 files changed, 67 insertions(+), 408 deletions(-)

Nice reduction in maintained code size!

I got conflicts when trying this patch out, though, so you may have some
rebase issues, but I think I resolved it correctly, and was able to
verify that with this applied, the generated functions accurately
replace the manual versions.

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

Re: [libvirt] [PATCH] Use common parameter order for remote(De)SerializeTypedParameters

2011-05-31 Thread Eric Blake
On 05/30/2011 12:33 PM, Matthias Bolte wrote:
> We commonly use "value, length" order, let's stick to this.
> ---
>  daemon/remote.c|   40 
>  src/remote/remote_driver.c |   40 
>  2 files changed, 40 insertions(+), 40 deletions(-)

ACK.  (Does it show that I built up the factored function incrementally,
without realizing that the end result ended up going against convention?)

-- 
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] graphics: add support for action_if_connected in qemu

2011-05-31 Thread Eric Blake
On 05/30/2011 09:45 AM, Michal Privoznik wrote:
> This option accepts 3 values:
> -keep, to keep current client connected (Spice+VNC)
> -disconnect, to disconnect client (Spice)
> -fail, to fail setting password if there is a client connected (Spice)
> ---
>  docs/schemas/domain.rng  |   16 
>  src/conf/domain_conf.c   |   44 +---
>  src/conf/domain_conf.h   |   11 +++
>  src/libvirt_private.syms |2 ++
>  src/qemu/qemu_hotplug.c  |   11 ---
>  5 files changed, 78 insertions(+), 6 deletions(-)

In addition to Matthias' correct note that we need a patch to
docs/formatdomain.html.in,

> +virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
> + virDomainGraphicsAuthDefPtr def,
> + int type)
>  {
>  char *validTo = NULL;
> +char *connected = virXMLPropString(node, "connected");
>  
>  def->passwd = virXMLPropString(node, "passwd");
>  
> @@ -3846,6 +3856,28 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node, 
> virDomainGraphicsAuthDefPtr de
>  def->expires = 1;
>  }
>  
> +if (connected) {
> +int action = virDomainGraphicsAuthConnectedTypeFromString(connected);
> +if (action < 0) {
> +virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> + _("unknown connected value %s"),

Do we want to allow parsing "default"?  If not, then change this to 'if
(action <= 0)'.

> @@ -1755,7 +1760,7 @@ qemuDomainChangeGraphicsPasswords(struct qemud_driver 
> *driver,
>  ret = qemuMonitorSetPassword(priv->mon,
>   type,
>   auth->passwd ? auth->passwd : defaultPasswd,
> - NULL);
> + auth->connected ? 
> virDomainGraphicsAuthConnectedTypeToString(auth->connected) : NULL);

Style - this results in a long line.  It might be nicer to do:

const char *connected = NULL;
if (auth->connected)
connected = virDomainGraphicsAuthConnectedTypeToString(auth->connected);
...
qemuMonitorSetPassword(priv->mon, type,
  auth->passwd ? auth->passwd : defaultPasswd,
  connected);

This is a new XML feature, but has missed the rc1 freeze, so v2 should
not be applied until after the 0.9.2 release, although you can post it
for review before then.

-- 
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] freebsd: Fix build problem due to picking up the wrong libvirt.h

2011-05-31 Thread Matthias Bolte
AM_GNU_GETTEXT calls AM_ICONV_LINK. AM_ICONV_LINK saves and alters
CPPFLAGS, but doesn't restore it when it finds libiconv. This
results in /usr/local/include ending up in the gcc command line
before the include path for the local include directory. This makes
gcc pick a previous installed libvirt.h instead of the correct one
from the source tree.

Workaround this problem by saving and restoring CPPFLAGS around
the AM_GNU_GETTEXT call.
---
 configure.ac |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index b2ba930..8f46dbd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2011,8 +2011,16 @@ dnl Enable building libvirtd?
 AM_CONDITIONAL([WITH_LIBVIRTD],[test "x$with_libvirtd" = "xyes"])
 
 dnl Check for gettext - don't go any newer than what RHEL 5 supports
+dnl
+dnl save and restore CPPFLAGS around gettext check as the internal iconv
+dnl check might leave -I/usr/local/include in CPPFLAGS on FreeBSD resulting
+dnl in the build picking up previously installed libvirt/libvirt.h instead
+dnl of the correct one from the soucre tree
+
+save_CPPFLAGS="$CPPFLAGS"
 AM_GNU_GETTEXT_VERSION([0.17])
 AM_GNU_GETTEXT([external])
+CPPFLAGS="$save_CPPFLAGS"
 
 ALL_LINGUAS=`cd "$srcdir/po" > /dev/null && ls *.po | sed 's+\.po$++'`
 
-- 
1.7.0.4

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


Re: [libvirt] [PATCHv6 0/6] Add virNodeGetCPUStats() API

2011-05-31 Thread Eric Blake
On 05/29/2011 07:54 PM, Minoru Usui wrote:
>>> So I wonder if we should add a parameter for the CPU num
>>> to the API:
>>>
>>>  int virNodeGetCPUStats (virConnectPtr conn,
>>>  int cpuNum,
>>>  virCPUStatsPtr params,
>>>  int *nparams,
>>>  unsigned int flags);
>>>
>>> And have a constant for getting the host data as a whole:
>>>
>>>#define  VIR_NODE_CPU_STATS_ALL_CPUS -1

>>  That way the API and virsh command are ready for more precise use
>> and we won't need to make a second set of APIs.
>>
>>   thanks !
> 
> OK.
> I'll add cpu/cell argments for more generalization.

At this point, I'd feel more comfortable delaying this patch series (as
well the virNodeGetMemoryStats series) until after the 0.9.2 release.
Feel free to post v7 for review before them, but I think we've had
enough churn on the interface, and we've already hit the freeze with
release candidate 1, that I don't feel right pushing this upstream this
late in a release cycle, even though the principle idea has been ACK'd.

-- 
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] docs: document iface-* commands

2011-05-31 Thread Eric Blake
I intentionally set things up so 'virsh help interface' lists
commands in alphabetical order, but 'man virsh' lists them in
topical order; this matches our practice on some other commands.

* tools/virsh.pod: Document all iface commands.
* tools/virsh.c (ifaceCmds): Sort.
---

v2: fix points raised by Laine.

Interdiff from v1 before the actual patch:

 =head1 INTERFACE COMMANDS

-The following commands manipulate host interfaces to be used by
-virtual networks. A lot of the commands for host interfaces are
-similar to the ones used for domains, and the way to name an interface
-is either by its name or its MAC address.
+The following commands manipulate host interfaces.  Often, these host
+interfaces can then be used by name within domain  elements
+(such as a system-created bridge interface), but there is no
+requirement that host interfaces be tied to any particular guest
+configuration XML at all.
+
+A lot of the commands for host interfaces are similar to the ones used
+for domains, and the way to name an interface is either by its name or
+its MAC address.  However, using a MAC address for an I
+argument only works when that address is unique (if an interface and a
+bridge share the same MAC address, which is often the case, then using
+that MAC address results in an error due to ambiguity, and you must
+resort to a name instead).

 =over 4

@@ -985,7 +994,8 @@ I<--inactive> is specified only the inactive ones will be 
listed.

 =item B I

-Convert a host interface MAC to interface name.
+Convert a host interface MAC to interface name, if the I is
+unique among the host's interfaces.

 =item B I

@@ -993,7 +1003,7 @@ Convert a host interface name to MAC address.

 =item B I

-Start a (previously defined) host interface.
+Start a (previously defined) host interface, such as by running "if-up".

 =item B I

@@ -1011,17 +1021,16 @@ commit or rollback.

 =item B

-Confirm that all changes since the last I are working,
-and delete the rollback point.  If no interface snapshot has already
-been started, then this command will fail.
+Declare all changes since the last I as working, and
+delete the rollback point.  If no interface snapshot has already been
+started, then this command will fail.

 =item B

 Revert all host interface settings back to the state recorded in the
 last I.  If no interface snapshot has already been
-started, then this command will fail.  If appropriate netcf init
-scripts are also installed, then rebooting the host may serve as an
-implicit rollback point.
+started, then this command will fail.  Rebooting the host also serves
+as an implicit rollback point.

 =back






 tools/virsh.c   |   12 +++---
 tools/virsh.pod |   99 ++-
 2 files changed, 104 insertions(+), 7 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index dfd5bd2..b9f1101 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -11063,6 +11063,10 @@ static const vshCmdDef nodedevCmds[] = {
 };

 static const vshCmdDef ifaceCmds[] = {
+{"iface-begin", cmdInterfaceBegin, opts_interface_begin,
+ info_interface_begin, 0},
+{"iface-commit", cmdInterfaceCommit, opts_interface_commit,
+ info_interface_commit, 0},
 {"iface-define", cmdInterfaceDefine, opts_interface_define,
  info_interface_define, 0},
 {"iface-destroy", cmdInterfaceDestroy, opts_interface_destroy,
@@ -11077,16 +11081,12 @@ static const vshCmdDef ifaceCmds[] = {
  info_interface_mac, 0},
 {"iface-name", cmdInterfaceName, opts_interface_name,
  info_interface_name, 0},
+{"iface-rollback", cmdInterfaceRollback, opts_interface_rollback,
+ info_interface_rollback, 0},
 {"iface-start", cmdInterfaceStart, opts_interface_start,
  info_interface_start, 0},
 {"iface-undefine", cmdInterfaceUndefine, opts_interface_undefine,
  info_interface_undefine, 0},
-{"iface-begin", cmdInterfaceBegin, opts_interface_begin,
- info_interface_begin, 0},
-{"iface-commit", cmdInterfaceCommit, opts_interface_commit,
- info_interface_commit, 0},
-{"iface-rollback", cmdInterfaceRollback, opts_interface_rollback,
- info_interface_rollback, 0},
 {NULL, NULL, NULL, NULL, 0}
 };

diff --git a/tools/virsh.pod b/tools/virsh.pod
index 9251db6..ae0c887 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -865,7 +865,7 @@ The following commands manipulate networks. Libvirt has the 
capability to
 define virtual networks which can then be used by domains and linked to
 actual network devices. For more detailed information about this feature
 see the documentation at L . A lot
-of the command for virtual networks are similar to the one used for domains,
+of the commands for virtual networks are similar to the ones used for domains,
 but the way to name a virtual network is either by its name or UUID.

 =over 4
@@ -937,6 +937,103 @@ Convert a network name to network UUID.

 =back

+=head1 INTERFACE COMMANDS
+
+The fo

Re: [libvirt] [PATCH] util: Fix incorrect error in PCI functions.

2011-05-31 Thread Matthias Bolte
2011/5/31 Osier Yang :
> Substitute VIR_ERR_NO_SUPPORT with VIR_ERR_INTERNAL_ERROR. Error
> like following is not what user want to see.
>
> error : pciDeviceIsAssignable:1487 : this function is not supported
> by the connection driver: Device :07:10.0 is behind a switch
> lacking ACS and cannot be assigned
>
> ---
>  src/util/pci.c |   20 ++--
>  1 files changed, 10 insertions(+), 10 deletions(-)
>

ACK.

Matthias

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

Re: [libvirt] [PATCH] docs: document iface-* commands

2011-05-31 Thread Laine Stump

Thanks for taking care of this Eric. (Exactly how many do I owe you now? :-)

On 05/31/2011 03:51 PM, Eric Blake wrote:

I intentionally set things up so 'virsh help interface' lists
commands in alphabetical order, but 'man virsh' lists them in
topical order; this matches our practice on some other commands.

* tools/virsh.pod: Document all iface commands.
* tools/virsh.c (ifaceCmds): Sort.
---

Dan was partially right:


Though we will be wanting a followup patch for virsh.pod to add docs
for this

but missed the fact that _none_ of the iface-* commands were
documented, so Laine's initial patch wasn't making the situation
any worse.  At any rate, this patch was heavily copy-and-pasted
from existing net-* commands.

  tools/virsh.c   |   12 
  tools/virsh.pod |   90 ++-
  2 files changed, 95 insertions(+), 7 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index dfd5bd2..b9f1101 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -11063,6 +11063,10 @@ static const vshCmdDef nodedevCmds[] = {
  };

  static const vshCmdDef ifaceCmds[] = {
+{"iface-begin", cmdInterfaceBegin, opts_interface_begin,
+ info_interface_begin, 0},
+{"iface-commit", cmdInterfaceCommit, opts_interface_commit,
+ info_interface_commit, 0},
  {"iface-define", cmdInterfaceDefine, opts_interface_define,
   info_interface_define, 0},
  {"iface-destroy", cmdInterfaceDestroy, opts_interface_destroy,
@@ -11077,16 +11081,12 @@ static const vshCmdDef ifaceCmds[] = {
   info_interface_mac, 0},
  {"iface-name", cmdInterfaceName, opts_interface_name,
   info_interface_name, 0},
+{"iface-rollback", cmdInterfaceRollback, opts_interface_rollback,
+ info_interface_rollback, 0},
  {"iface-start", cmdInterfaceStart, opts_interface_start,
   info_interface_start, 0},
  {"iface-undefine", cmdInterfaceUndefine, opts_interface_undefine,
   info_interface_undefine, 0},
-{"iface-begin", cmdInterfaceBegin, opts_interface_begin,
- info_interface_begin, 0},
-{"iface-commit", cmdInterfaceCommit, opts_interface_commit,
- info_interface_commit, 0},
-{"iface-rollback", cmdInterfaceRollback, opts_interface_rollback,
- info_interface_rollback, 0},
  {NULL, NULL, NULL, NULL, 0}
  };

diff --git a/tools/virsh.pod b/tools/virsh.pod
index 9251db6..4ef518f 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -865,7 +865,7 @@ The following commands manipulate networks. Libvirt has the 
capability to
  define virtual networks which can then be used by domains and linked to
  actual network devices. For more detailed information about this feature
  see the documentation at L  . A lot
-of the command for virtual networks are similar to the one used for domains,
+of the commands for virtual networks are similar to the ones used for domains,
  but the way to name a virtual network is either by its name or UUID.

  =over 4
@@ -937,6 +937,94 @@ Convert a network name to network UUID.

  =back

+=head1 INTERFACE COMMANDS
+
+The following commands manipulate host interfaces to be used by
+virtual networks. A lot of the commands for host interfaces are


Not necessarily "to be used by virtual networks". They just manipulate 
host interfaces in general. Often those interfaces are not used by 
libvirt "virtual networks" at all, but referenced in a domain's 
 element (eg a system-created bridge interface), or possibly 
not referenced within any libvirt config XML at all.



+similar to the ones used for domains, and the way to name an interface
+is either by its name or its MAC address.


Note that MAC address is not necessarily unique - multiple interfaces 
can have the same MAC address (and often do, for example a bridge could 
have the same MAC address as the NIC it's attached to)



+
+=over 4
+
+=item B  I
+
+Define a host interface from an XML I, the interface is just defined but
+not started.
+
+=item B  I
+
+Destroy a given host interface, such as by running "if-down" to
+disable that interface from active use. This takes effect immediately.
+
+=item B  I  optional I<--inactive>
+
+Output the host interface information as an XML dump to stdout.  If
+I<--inactive>  is specified, then the output reflects the persistent
+state of the interface that will be used the next time it is started.
+
+=item B  I
+
+Edit the XML configuration file for a host interface.
+
+This is equivalent to:
+
+ virsh iface-dumpxml iface>  iface.xml
+ vi iface.xml (or make changes with your other text editor)
+ virsh iface-define iface.xml
+
+except that it does some error checking.
+
+The editor used can be supplied by the C<$VISUAL>  or C<$EDITOR>  environment
+variables, and defaults to C.
+
+=item B  optional I<--inactive>  or I<--all>
+
+Returns the list of active host interfaces.  If I<--all>  is specified
+this will also include defined but inactive interfaces.  If
+I<--inactive>  is specified only the

Re: [libvirt] [PATCH] maint: use consistent file name for threading notes

2011-05-31 Thread Eric Blake
On 05/31/2011 01:45 PM, Matthias Bolte wrote:
> 2011/5/31 Eric Blake :
>> * daemon/THREADING.txt: Rename...
>> * daemon/THREADS.txt: ...to match qemu thread notes.
>> * daemon/Makefile.am (EXTRA_DIST): Reflect rename.
>> ---
>>
>> First suggested here:
>> https://www.redhat.com/archives/libvir-list/2011-May/msg01730.html
>>
>>  daemon/Makefile.am|2 +-
>>  daemon/{THREADING.txt => THREADS.txt} |0
>>  2 files changed, 1 insertions(+), 1 deletions(-)
>>  rename daemon/{THREADING.txt => THREADS.txt} (100%)
>>
> 
> 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] [PATCHv3 0/8] add virGetSchedulerParametersFlags

2011-05-31 Thread Eric Blake
On 05/29/2011 05:05 AM, Daniel Veillard wrote:
>> For easier review, v3 of this series is now at:
>>
>> git fetch git://repo.or.cz/libvirt/ericb.git getsched
>>
>> or browse-able at
>> http://repo.or.cz/w/libvirt/ericb.git/shortlog/refs/heads/getsched
> 
>   ACK,
> 
>   Okay, thanks, I reviewed and pushed. As indicated previously
> 1/8 really had to make RC1 so I pushed this. I had to rebase
> 3 or 4 of the patches since new APIs had been commited since then,
> but I think that looks okay, a small double check might be worth
> the time though :-)

I didn't see any problem with your rebase.  Thanks for doing the work to
get this into rc1.

-- 
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] ssh from host to guest on default network

2011-05-31 Thread Kay Williams
Neil, thank you for the suggestion.

Actually, I was able to get this working using dnsmasq (rather than avahi).
The trick was to manually add the ipaddress for the virtual network (e.g.
192.168.122.1) as the first nameserver listed in /etc/resolv.conf on the
host machine. 

This solution has less overhead than using avahi since it doesn't require
additional software on the client.

Thanks again for the assistance.
Kay

-Original Message-
From: libvir-list-boun...@redhat.com [mailto:libvir-list-boun...@redhat.com]
On Behalf Of Neil Wilson
Sent: Tuesday, May 31, 2011 6:06 AM
To: libvir-list@redhat.com
Subject: Re: [libvirt] ssh from host to guest on default network


> Message: 1
> Date: Mon, 30 May 2011 20:28:42 -0700
> From: Kay Williams 
> To: "libvir-list@redhat.com" 
> Subject: [libvirt] ssh from host to guest on default network
> Message-ID:
>   <3527434A537F2F42A53BAA31DC03BB6A4A52040D70@SERVER1.family.local>
> Content-Type: text/plain; charset="us-ascii"
> 
> Hello,
> 

> The trouble I am having is with ssh'ing from the host to guest machine.

Probably more for the user list than this one. However...

I've used 'avahi' successfully to get resolution in the clients. It
implements the 'Bonjour' no configuration system. Obviously the client
image has to have the avahi daemons installed and correctly configured.

Once you have that working in the client and the correct settings in
your resolver on the host, then you can ssh into 'xyz.local' and it
resolves nicely.

Rgs

Neil



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

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


[libvirt] [PATCH] docs: document iface-* commands

2011-05-31 Thread Eric Blake
I intentionally set things up so 'virsh help interface' lists
commands in alphabetical order, but 'man virsh' lists them in
topical order; this matches our practice on some other commands.

* tools/virsh.pod: Document all iface commands.
* tools/virsh.c (ifaceCmds): Sort.
---

Dan was partially right:

> Though we will be wanting a followup patch for virsh.pod to add docs
> for this

but missed the fact that _none_ of the iface-* commands were
documented, so Laine's initial patch wasn't making the situation
any worse.  At any rate, this patch was heavily copy-and-pasted
from existing net-* commands.

 tools/virsh.c   |   12 
 tools/virsh.pod |   90 ++-
 2 files changed, 95 insertions(+), 7 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index dfd5bd2..b9f1101 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -11063,6 +11063,10 @@ static const vshCmdDef nodedevCmds[] = {
 };

 static const vshCmdDef ifaceCmds[] = {
+{"iface-begin", cmdInterfaceBegin, opts_interface_begin,
+ info_interface_begin, 0},
+{"iface-commit", cmdInterfaceCommit, opts_interface_commit,
+ info_interface_commit, 0},
 {"iface-define", cmdInterfaceDefine, opts_interface_define,
  info_interface_define, 0},
 {"iface-destroy", cmdInterfaceDestroy, opts_interface_destroy,
@@ -11077,16 +11081,12 @@ static const vshCmdDef ifaceCmds[] = {
  info_interface_mac, 0},
 {"iface-name", cmdInterfaceName, opts_interface_name,
  info_interface_name, 0},
+{"iface-rollback", cmdInterfaceRollback, opts_interface_rollback,
+ info_interface_rollback, 0},
 {"iface-start", cmdInterfaceStart, opts_interface_start,
  info_interface_start, 0},
 {"iface-undefine", cmdInterfaceUndefine, opts_interface_undefine,
  info_interface_undefine, 0},
-{"iface-begin", cmdInterfaceBegin, opts_interface_begin,
- info_interface_begin, 0},
-{"iface-commit", cmdInterfaceCommit, opts_interface_commit,
- info_interface_commit, 0},
-{"iface-rollback", cmdInterfaceRollback, opts_interface_rollback,
- info_interface_rollback, 0},
 {NULL, NULL, NULL, NULL, 0}
 };

diff --git a/tools/virsh.pod b/tools/virsh.pod
index 9251db6..4ef518f 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -865,7 +865,7 @@ The following commands manipulate networks. Libvirt has the 
capability to
 define virtual networks which can then be used by domains and linked to
 actual network devices. For more detailed information about this feature
 see the documentation at L . A lot
-of the command for virtual networks are similar to the one used for domains,
+of the commands for virtual networks are similar to the ones used for domains,
 but the way to name a virtual network is either by its name or UUID.

 =over 4
@@ -937,6 +937,94 @@ Convert a network name to network UUID.

 =back

+=head1 INTERFACE COMMANDS
+
+The following commands manipulate host interfaces to be used by
+virtual networks. A lot of the commands for host interfaces are
+similar to the ones used for domains, and the way to name an interface
+is either by its name or its MAC address.
+
+=over 4
+
+=item B I
+
+Define a host interface from an XML I, the interface is just defined but
+not started.
+
+=item B I
+
+Destroy a given host interface, such as by running "if-down" to
+disable that interface from active use. This takes effect immediately.
+
+=item B I optional I<--inactive>
+
+Output the host interface information as an XML dump to stdout.  If
+I<--inactive> is specified, then the output reflects the persistent
+state of the interface that will be used the next time it is started.
+
+=item B I
+
+Edit the XML configuration file for a host interface.
+
+This is equivalent to:
+
+ virsh iface-dumpxml iface > iface.xml
+ vi iface.xml (or make changes with your other text editor)
+ virsh iface-define iface.xml
+
+except that it does some error checking.
+
+The editor used can be supplied by the C<$VISUAL> or C<$EDITOR> environment
+variables, and defaults to C.
+
+=item B optional I<--inactive> or I<--all>
+
+Returns the list of active host interfaces.  If I<--all> is specified
+this will also include defined but inactive interfaces.  If
+I<--inactive> is specified only the inactive ones will be listed.
+
+=item B I
+
+Convert a host interface MAC to interface name.
+
+=item B I
+
+Convert a host interface name to MAC address.
+
+=item B I
+
+Start a (previously defined) host interface.
+
+=item B I
+
+Undefine the configuration for an inactive host interface.
+
+=item B
+
+Create a snapshot of current host interface settings, which can later
+be committed (I) or restored (I).  If a
+snapshot already exists, then this command will fail until the
+previous snapshot has been committed or restored.  Undefined behavior
+results if any external changes are made to host interfaces outside of
+the libvirt API between the beginning of a snapshot and it

Re: [libvirt] [PATCH] maint: use consistent file name for threading notes

2011-05-31 Thread Matthias Bolte
2011/5/31 Eric Blake :
> * daemon/THREADING.txt: Rename...
> * daemon/THREADS.txt: ...to match qemu thread notes.
> * daemon/Makefile.am (EXTRA_DIST): Reflect rename.
> ---
>
> First suggested here:
> https://www.redhat.com/archives/libvir-list/2011-May/msg01730.html
>
>  daemon/Makefile.am                    |    2 +-
>  daemon/{THREADING.txt => THREADS.txt} |    0
>  2 files changed, 1 insertions(+), 1 deletions(-)
>  rename daemon/{THREADING.txt => THREADS.txt} (100%)
>

ACK.

Matthias

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

[libvirt] [PATCH] maint: use consistent file name for threading notes

2011-05-31 Thread Eric Blake
* daemon/THREADING.txt: Rename...
* daemon/THREADS.txt: ...to match qemu thread notes.
* daemon/Makefile.am (EXTRA_DIST): Reflect rename.
---

First suggested here:
https://www.redhat.com/archives/libvir-list/2011-May/msg01730.html

 daemon/Makefile.am|2 +-
 daemon/{THREADING.txt => THREADS.txt} |0
 2 files changed, 1 insertions(+), 1 deletions(-)
 rename daemon/{THREADING.txt => THREADS.txt} (100%)

diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 92d154f..c1b4a9f 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -44,7 +44,7 @@ EXTRA_DIST =  \
libvirtd.lxc.logrotate.in   \
libvirtd.uml.logrotate.in   \
test_libvirtd.aug   \
-   THREADING.txt   \
+   THREADS.txt \
libvirtd.pod.in \
libvirtd.8.in   \
libvirtd.stp\
diff --git a/daemon/THREADING.txt b/daemon/THREADS.txt
similarity index 100%
rename from daemon/THREADING.txt
rename to daemon/THREADS.txt
-- 
1.7.4.4

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


Re: [libvirt] [PATCH] openvz: Restore original EOF handling in openvzGetProcessInfo

2011-05-31 Thread Matthias Bolte
2011/5/31 Eric Blake :
> On 05/27/2011 09:47 AM, Matthias Bolte wrote:
>> This function is also affected by getline conversion. But this
>> didn't result in a regression in general, because the difference
>> whould only affect the behavior of the function when the line in
>> /proc/vz/vestat for the given vpsid wasn't found. Under normal
>> conditions this should not happen.
>> ---
>>  src/openvz/openvz_driver.c |    7 +--
>>  1 files changed, 5 insertions(+), 2 deletions(-)
>
> ACK.
>

Thanks, pushed.

Matthias

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

Re: [libvirt] [PATCH v2] tests: Add more complex domain scheme test data

2011-05-31 Thread Daniel P. Berrange
On Tue, May 31, 2011 at 11:28:39AM -0600, Eric Blake wrote:
> On 05/31/2011 08:59 AM, Michal Privoznik wrote:
> > ---
> > diff to v1:
> > -move from tests/domainschemadata/ to tests/qemuxml2argvdata/
> > -add .args
> > 
> > +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
> > @@ -0,0 +1,14 @@
> > +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test 
> > QEMU_AUDIO_DRV=spice \
> > +/usr/bin/qemu-kvm
> 
> > +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml
> > @@ -0,0 +1,86 @@
> > +
> 
> > +  
> > +/usr/bin/qemu-kvm
> 
> Phooey - this test is now failing on a RHEL 6.1 machine:
> 
> 54) QEMU XML-2-ARGV graphics-spice-timeout
> ... libvir: QEMU error : Cannot find QEMU binary /usr/bin/qemu-kvm: No
> such file or directory
> FAILED
> 
> This is the first test in qemuxml2argvdata that insists on
> /usr/bin/qemu-kvm instead of /usr/bin/qemu.
> 
> I was about to push the "obvious" fix of s/qemu-kvm/qemu/, but that just
> papers over the real bug, which is that our testsuite depends on what is
> installed on the test machine.  We need to figure out the root cause and
> make the test work even when the  tag requested by the tag
> does not exist on the machine running the test.

The existing tests don't depend on the host OS install. We setup
capabilities data in testutilsqemu.c for them. The problem is
that this test file used a binary that isn't in the capabilities
data we provide to tests, so we fallback to trying to extract
the data for it.

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] openvz: Restore original EOF handling in openvzGetProcessInfo

2011-05-31 Thread Eric Blake
On 05/27/2011 09:47 AM, Matthias Bolte wrote:
> This function is also affected by getline conversion. But this
> didn't result in a regression in general, because the difference
> whould only affect the behavior of the function when the line in
> /proc/vz/vestat for the given vpsid wasn't found. Under normal
> conditions this should not happen.
> ---
>  src/openvz/openvz_driver.c |7 +--
>  1 files changed, 5 insertions(+), 2 deletions(-)

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

Re: [libvirt] [PATCH] openvz: Handle getline failures in openvzReadConfigParam properly

2011-05-31 Thread Matthias Bolte
2011/5/31 Eric Blake :
> On 05/27/2011 04:37 AM, Matthias Bolte wrote:
>> The regression fix in 3aab7f2d6b068f0 altered the error handling.
>> getline returns -1 on failure to read a line (including EOF). The
>> original openvzReadConfigParam function using openvz_readline only
>> treated EOF as not-found. The current getline version treats all
>> getline failures as not-found.
>>
>> This patch fixes this and distinguished EOF from other getline
>> failures.
>> ---
>>  src/openvz/openvz_conf.c |    7 ++-
>>  1 files changed, 6 insertions(+), 1 deletions(-)
>
> ACK.
>

Thanks, pushed.

Matthias

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

[libvirt] [PATCH] * .gitignore: Exempt a new test binary.

2011-05-31 Thread Eric Blake
---

Pushing under the trivial rule.

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

diff --git a/.gitignore b/.gitignore
index a15100c..a4d3ea1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -57,6 +57,7 @@
 /tests/cputest
 /tests/hashtest
 /tests/nwfilterxml2xmltest
+/tests/openvzutilstest
 /update.log
 Makefile
 Makefile.in
-- 
1.7.4.4

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


Re: [libvirt] [PATCH v2] tests: Add more complex domain scheme test data

2011-05-31 Thread Eric Blake
On 05/31/2011 11:28 AM, Eric Blake wrote:
> This is the first test in qemuxml2argvdata that insists on
> /usr/bin/qemu-kvm instead of /usr/bin/qemu.
> 
> I was about to push the "obvious" fix of s/qemu-kvm/qemu/, but that just
> papers over the real bug, which is that our testsuite depends on what is
> installed on the test machine.  We need to figure out the root cause and
> make the test work even when the  tag requested by the tag
> does not exist on the machine running the test.

Perhaps using /./qemu.sh is the way to go for this
test (see qemuxml2argv-cpu-exact1.xml, for precedence).

On the other hand, it looks like qemuxml2argvtest is only run if qemu
was detected, which is why we have been getting away with calling the
/usr/bin/qemu binary in so many tests already, but it seems like a nicer
solution would be one where we don't have to use the external binary at all.

-- 
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 v2] tests: Add more complex domain scheme test data

2011-05-31 Thread Eric Blake
On 05/31/2011 08:59 AM, Michal Privoznik wrote:
> ---
> diff to v1:
> -move from tests/domainschemadata/ to tests/qemuxml2argvdata/
> -add .args
> 
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
> @@ -0,0 +1,14 @@
> +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test 
> QEMU_AUDIO_DRV=spice \
> +/usr/bin/qemu-kvm

> +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml
> @@ -0,0 +1,86 @@
> +

> +  
> +/usr/bin/qemu-kvm

Phooey - this test is now failing on a RHEL 6.1 machine:

54) QEMU XML-2-ARGV graphics-spice-timeout
... libvir: QEMU error : Cannot find QEMU binary /usr/bin/qemu-kvm: No
such file or directory
FAILED

This is the first test in qemuxml2argvdata that insists on
/usr/bin/qemu-kvm instead of /usr/bin/qemu.

I was about to push the "obvious" fix of s/qemu-kvm/qemu/, but that just
papers over the real bug, which is that our testsuite depends on what is
installed on the test machine.  We need to figure out the root cause and
make the test work even when the  tag requested by the tag
does not exist on the machine running the test.

-- 
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] openvz: Handle getline failures in openvzReadConfigParam properly

2011-05-31 Thread Eric Blake
On 05/27/2011 04:37 AM, Matthias Bolte wrote:
> The regression fix in 3aab7f2d6b068f0 altered the error handling.
> getline returns -1 on failure to read a line (including EOF). The
> original openvzReadConfigParam function using openvz_readline only
> treated EOF as not-found. The current getline version treats all
> getline failures as not-found.
> 
> This patch fixes this and distinguished EOF from other getline
> failures.
> ---
>  src/openvz/openvz_conf.c |7 ++-
>  1 files changed, 6 insertions(+), 1 deletions(-)

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

Re: [libvirt] remote generator: Legacy support for hyper to long mappings

2011-05-31 Thread Daniel P. Berrange
On Tue, May 31, 2011 at 11:00:04AM -0600, Eric Blake wrote:
> On 05/30/2011 07:03 AM, Matthias Bolte wrote:
> 
> > From 726dae7b4c21d4c17ac19808c06d7fc978b36778 Mon Sep 17 00:00:00 2001
> > From: Matthias Bolte 
> > Date: Mon, 30 May 2011 12:58:57 +0200
> > Subject: [PATCH] remote generator: Legacy support for hyper to long mappings
> > 
> > Remove some special case code that took care of mapping hyper to the
> > correct C types.
> 
> I like patch 1B better than 1A, so that's what I'm reviewing here.
> 
> > +++ b/configure.ac
> > @@ -117,6 +117,7 @@ if test "x$have_cpuid" = xyes; then
> >  fi
> >  AC_MSG_RESULT([$have_cpuid])
> >  
> > +AC_CHECK_SIZEOF(long)
> 
> AC_CHECK_SIZEOF([long])
> 
> so that we follow the autoconf recommended quoting rules.
> 
> > +++ b/daemon/remote_generator.pl
> > @@ -174,6 +174,58 @@ while () {
> >  
> >  close(PROTOCOL);
> >  
> > +# this dict contains the procedures that are allowed to map [unsigend] 
> > hyper
> 
> s/unsigend/unsigned/
> 
> > +# to [unsigend] long for legacy reasons in their signature and return type.
> > +# this list is fixed. new procedures and public APIs have to map [unsigend]
> > +# hyper to [unsigend] long long
> 
> 3 more instances.
> 
> > +my $long_legacy = {
> > +DomainGetMaxMemory  => { ret => { memory => 1 } },
> > +DomainGetInfo   => { ret => { maxMem => 1, memory => 1 } },
> > +DomainMigrate   => { arg => { flags => 1, resource => 1 } 
> > },
> > +DomainMigrate2  => { arg => { flags => 1, resource => 1 } 
> > },
> > +DomainMigrateBegin3 => { arg => { flags => 1, resource => 1 } 
> > },
> 
> Dan, DomainMigrate2 and DomainMigrateBegin3 are new APIs as of this
> release (similarly for other Migration v3 commands).  Should these use
> 'long long' rather than 'long' for resource, as well as 'unsigned int'
> for flags, as part of your edict that all new APIs should avoid 'long'?
>  Right _now_ is the time to make this change, before 0.9.2 goes gold.

The migration API situation is complex, because the public APIs
virDomainMigrate / MigrateToURI, call into different internal
methods based on migration protocol. Having the v3 migration
protocol use different size types to the v1 and v2 migration
protocols would be creating pain for ourselves IMHO.


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 2/2] remote generator: Legacy support for hyper to long mappings

2011-05-31 Thread Eric Blake
On 05/30/2011 07:03 AM, Matthias Bolte wrote:
> From 3bb05f7543f86e3b47772f0fabecbda4f167b3bc Mon Sep 17 00:00:00 2001
> From: Matthias Bolte 
> Date: Mon, 30 May 2011 14:36:41 +0200
> Subject: [PATCH] apibuild: Restrict long usage to existing functions and 
> struct
> 
> New APIs have to use long long instead of long.
> 
> Also make apibuild errors fatal.
> ---
>  docs/Makefile.am |2 +-
>  docs/apibuild.py |   74 
> ++
>  2 files changed, 75 insertions(+), 1 deletions(-)

Now reviewing patch 2, assuming that you go with 1B.

> 
> diff --git a/docs/Makefile.am b/docs/Makefile.am
> index 59ae685..a98f08d 100644
> --- a/docs/Makefile.am
> +++ b/docs/Makefile.am
> @@ -179,7 +179,7 @@ $(python_generated_files): $(srcdir)/apibuild.py \
>   $(srcdir)/../include/libvirt/*.h \
>   $(srcdir)/../src/libvirt.c \
>   $(srcdir)/../src/util/virterror.c
> - -srcdir=$(srcdir) $(srcdir)/apibuild.py
> + srcdir=$(srcdir) $(srcdir)/apibuild.py

While you're touching this line, how about we also modify it to use
$(AM_V_GEN)

> +++ b/docs/apibuild.py
> @@ -1480,6 +1480,77 @@ class CParser:
>  self.signature = signature
>  return token
>  
> +# this dict contains the functions that are allowed to use [unsigend]
> +# long for legacy reasons in their signature and return type. this list 
> is
> +# fixed. new procedures and public APIs have to use [unsigend] long long

s/unsigend/unsigned/ twice (copy and paste from the last patch? :)

> +long_legacy_functions = \
> +  { "virGetVersion"  : (False, ("libVer", "typeVer")),
> +"virConnectGetLibVersion": (False, ("libVer")),
> +"virConnectGetVersion"   : (False, ("hvVer")),
> +"virDomainGetMaxMemory"  : (True,  ()),
> +"virDomainMigrate"   : (False, ("flags", "bandwidth")),
> +"virDomainMigrate2"  : (False, ("flags", "bandwidth")),
> +"virDomainMigrateBegin3" : (False, ("flags", "bandwidth")),

Same query to danpb about whether new migration v3 APIs should avoid
'long', and same independent patch to fix that issue.

> +
> +# this dict contains the structs that are allowed to use [unsigend]
> +# long for legacy reasons. this list is fixed. new structs have to use
> +# [unsigend] long long

s/unsigend/unsigned/ twice

ACK with the spelling 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] remote generator: Legacy support for hyper to long mappings

2011-05-31 Thread Eric Blake
On 05/30/2011 07:03 AM, Matthias Bolte wrote:

> From 726dae7b4c21d4c17ac19808c06d7fc978b36778 Mon Sep 17 00:00:00 2001
> From: Matthias Bolte 
> Date: Mon, 30 May 2011 12:58:57 +0200
> Subject: [PATCH] remote generator: Legacy support for hyper to long mappings
> 
> Remove some special case code that took care of mapping hyper to the
> correct C types.

I like patch 1B better than 1A, so that's what I'm reviewing here.

> +++ b/configure.ac
> @@ -117,6 +117,7 @@ if test "x$have_cpuid" = xyes; then
>  fi
>  AC_MSG_RESULT([$have_cpuid])
>  
> +AC_CHECK_SIZEOF(long)

AC_CHECK_SIZEOF([long])

so that we follow the autoconf recommended quoting rules.

> +++ b/daemon/remote_generator.pl
> @@ -174,6 +174,58 @@ while () {
>  
>  close(PROTOCOL);
>  
> +# this dict contains the procedures that are allowed to map [unsigend] hyper

s/unsigend/unsigned/

> +# to [unsigend] long for legacy reasons in their signature and return type.
> +# this list is fixed. new procedures and public APIs have to map [unsigend]
> +# hyper to [unsigend] long long

3 more instances.

> +my $long_legacy = {
> +DomainGetMaxMemory  => { ret => { memory => 1 } },
> +DomainGetInfo   => { ret => { maxMem => 1, memory => 1 } },
> +DomainMigrate   => { arg => { flags => 1, resource => 1 } },
> +DomainMigrate2  => { arg => { flags => 1, resource => 1 } },
> +DomainMigrateBegin3 => { arg => { flags => 1, resource => 1 } },

Dan, DomainMigrate2 and DomainMigrateBegin3 are new APIs as of this
release (similarly for other Migration v3 commands).  Should these use
'long long' rather than 'long' for resource, as well as 'unsigned int'
for flags, as part of your edict that all new APIs should avoid 'long'?
 Right _now_ is the time to make this change, before 0.9.2 goes gold.

> +++ b/src/remote/remote_driver.c
> @@ -87,6 +87,24 @@
>  
>  #define VIR_FROM_THIS VIR_FROM_REMOTE
>  
> +#define HYPER_TO_TYPE(_type, _to, _from) 
>  \

I'm thinking we should move the definition of HYPER_TO_TYPE inside...

> +do { 
>  \
> +if ((_from) != (_type)(_from)) { 
>  \
> +remoteError(VIR_ERR_INTERNAL_ERROR,  
>  \
> +_("conversion from hyper to %s overflowed"), 
> #_type); \
> +goto done;   
>  \
> +}
>  \
> +(_to) = (_from); 
>  \
> +} while (0)
> +
> +#if SIZEOF_LONG < 8

...this #if conditional, so that gcc won't complain about the macro
HYPER_TO_TYPE being unused on 64 bit platforms.  That's a one-liner
change, but copied into two files.

> +# define HYPER_TO_LONG(_to, _from) HYPER_TO_TYPE(long, _to, _from)
> +# define HYPER_TO_ULONG(_to, _from) HYPER_TO_TYPE(unsigned long, _to, _from)
> +#else
> +# define HYPER_TO_LONG(_to, _from) (_to) = (_from)
> +# define HYPER_TO_ULONG(_to, _from) (_to) = (_from)
> +#endif
> +

ACK with the nits fixed.  I think we can push this in now whether or not
we have Dan's answer on whether migration v3 calls should avoid 'long',
because that would be an independent cleanup.

-- 
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 v4] storage: List directory volumes for dir/fs/netfs pools

2011-05-31 Thread Cole Robinson
On 05/31/2011 12:45 PM, Eric Blake wrote:
> On 05/31/2011 10:03 AM, Cole Robinson wrote:
>> Since directories can be used for  passthrough, they are
>> basically storage volumes.
>>
>> v2:
>> Skip ., .., lost+found dirs
>>
>> v3:
>> Use gnulib last_component
>>
>> v4:
>> Use gnulib "dirname.h", not system 
>> Don't skip lost+found
>>
>> Signed-off-by: Cole Robinson 
>> ---
>>  src/storage/storage_backend.c|   44 
>> +++--
>>  src/storage/storage_backend.h|7 +-
>>  src/storage/storage_backend_fs.c |   14 ---
>>  src/util/storage_file.c  |   30 +-
>>  4 files changed, 82 insertions(+), 13 deletions(-)
> 
> ACK.
> 

Thanks, pushed.

- Cole

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


Re: [libvirt] [PATCH v4] storage: List directory volumes for dir/fs/netfs pools

2011-05-31 Thread Eric Blake
On 05/31/2011 10:03 AM, Cole Robinson wrote:
> Since directories can be used for  passthrough, they are
> basically storage volumes.
> 
> v2:
> Skip ., .., lost+found dirs
> 
> v3:
> Use gnulib last_component
> 
> v4:
> Use gnulib "dirname.h", not system 
> Don't skip lost+found
> 
> Signed-off-by: Cole Robinson 
> ---
>  src/storage/storage_backend.c|   44 +++--
>  src/storage/storage_backend.h|7 +-
>  src/storage/storage_backend_fs.c |   14 ---
>  src/util/storage_file.c  |   30 +-
>  4 files changed, 82 insertions(+), 13 deletions(-)

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 v4] storage: List directory volumes for dir/fs/netfs pools

2011-05-31 Thread Cole Robinson
Since directories can be used for  passthrough, they are
basically storage volumes.

v2:
Skip ., .., lost+found dirs

v3:
Use gnulib last_component

v4:
Use gnulib "dirname.h", not system 
Don't skip lost+found

Signed-off-by: Cole Robinson 
---
 src/storage/storage_backend.c|   44 +++--
 src/storage/storage_backend.h|7 +-
 src/storage/storage_backend_fs.c |   14 ---
 src/util/storage_file.c  |   30 +-
 4 files changed, 82 insertions(+), 13 deletions(-)

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 02e455f..d269e4c 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include "dirname.h"
 #ifdef __linux__
 # include 
 # include 
@@ -994,6 +995,7 @@ virStorageBackendVolOpenCheckMode(const char *path, 
unsigned int flags)
 {
 int fd, mode = 0;
 struct stat sb;
+char *base = last_component(path);
 
 if ((fd = open(path, O_RDONLY|O_NONBLOCK|O_NOCTTY)) < 0) {
 if ((errno == ENOENT || errno == ELOOP) &&
@@ -1022,9 +1024,20 @@ virStorageBackendVolOpenCheckMode(const char *path, 
unsigned int flags)
 mode = VIR_STORAGE_VOL_OPEN_CHAR;
 else if (S_ISBLK(sb.st_mode))
 mode = VIR_STORAGE_VOL_OPEN_BLOCK;
+else if (S_ISDIR(sb.st_mode)) {
+mode = VIR_STORAGE_VOL_OPEN_DIR;
+
+if (STREQ(base, ".") ||
+STREQ(base, "..")) {
+VIR_FORCE_CLOSE(fd);
+VIR_INFO("Skipping special dir '%s'", base);
+return -2;
+}
+}
 
 if (!(mode & flags)) {
 VIR_FORCE_CLOSE(fd);
+VIR_INFO("Skipping volume '%s'", path);
 
 if (mode & VIR_STORAGE_VOL_OPEN_ERROR) {
 virStorageReportError(VIR_ERR_INTERNAL_ERROR,
@@ -1047,11 +1060,13 @@ int virStorageBackendVolOpen(const char *path)
 int
 virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target,
  unsigned long long *allocation,
- unsigned long long *capacity)
+ unsigned long long *capacity,
+ unsigned int openflags)
 {
 int ret, fd;
 
-if ((ret = virStorageBackendVolOpen(target->path)) < 0)
+if ((ret = virStorageBackendVolOpenCheckMode(target->path,
+ openflags)) < 0)
 return ret;
 
 fd = ret;
@@ -1066,24 +1081,34 @@ 
virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target,
 }
 
 int
-virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol,
-   int withCapacity)
+virStorageBackendUpdateVolInfoFlags(virStorageVolDefPtr vol,
+int withCapacity,
+unsigned int openflags)
 {
 int ret;
 
 if ((ret = virStorageBackendUpdateVolTargetInfo(&vol->target,
-&vol->allocation,
-withCapacity ? 
&vol->capacity : NULL)) < 0)
+&vol->allocation,
+withCapacity ? &vol->capacity : NULL,
+openflags)) < 0)
 return ret;
 
 if (vol->backingStore.path &&
 (ret = virStorageBackendUpdateVolTargetInfo(&vol->backingStore,
-NULL, NULL)) < 0)
+NULL, NULL,
+VIR_STORAGE_VOL_OPEN_DEFAULT)) < 0)
 return ret;
 
 return 0;
 }
 
+int virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol,
+   int withCapacity)
+{
+return virStorageBackendUpdateVolInfoFlags(vol, withCapacity,
+   VIR_STORAGE_VOL_OPEN_DEFAULT);
+}
+
 /*
  * virStorageBackendUpdateVolTargetInfoFD:
  * @conn: connection to report errors on
@@ -1125,6 +1150,11 @@ 
virStorageBackendUpdateVolTargetInfoFD(virStorageVolTargetPtr target,
  */
 if (capacity)
 *capacity = sb.st_size;
+} else if (S_ISDIR(sb.st_mode)) {
+*allocation = 0;
+if (capacity)
+*capacity = 0;
+
 } else {
 off_t end;
 /* XXX this is POSIX compliant, but doesn't work for CHAR files,
diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h
index fcfbed0..67ac32c 100644
--- a/src/storage/storage_backend.h
+++ b/src/storage/storage_backend.h
@@ -93,6 +93,7 @@ enum {
 VIR_STORAGE_VOL_OPEN_REG= 1 << 1, /* regular files okay */
 VIR_STORAGE_VOL_OPEN_BLOCK  = 1 << 2, /* block files okay */
 VIR_STORAGE_VOL_OPEN_CHAR   = 1 << 3, /* char files okay */
+VIR_STORAGE_VOL_OPEN_DIR= 1 << 4, /* directories

Re: [libvirt] [PATCH] storage: List directory volumes for dir/fs/netfs pools

2011-05-31 Thread Cole Robinson
On 05/27/2011 08:39 AM, Richard W.M. Jones wrote:
> On Thu, May 26, 2011 at 01:25:24PM -0600, Eric Blake wrote:
>> On 05/26/2011 12:58 PM, Daniel P. Berrange wrote:
>>> On Thu, May 26, 2011 at 02:10:24PM -0400, Cole Robinson wrote:
 Since directories can be used for  passthrough, they are
 basically storage volumes. Not sure if anyone has an opinion about
 not listing directories like ., .., or lost+found, but this patch
 doesn't do anything explicit with them.
>>>
>>> I think we should skip '.', '..', and 'lost+found' since they
>>> are special items, not things that can be used as volumes.
>>
>> Definitely skip '.' and '..'.
>>
>> 'lost+found' might be a legitimate real directory at non-mount points,
>> but skipping it is okay by me.
> 
> Also it's not called "lost+found" on all systems.  On Macs it's called
> "Lost and Found", and my Android phone has a directory called
> "LOST.DIR" although I'm not sure in the latter case if that's just an
> ordinary trash folder or acts as a true lost+found in the fsck sense.
> I think it's safer not to skip anything except "." and "..".
> 

Good point, I've sent a v4

Thanks,
Cole

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


Re: [libvirt] [PATCH 7/7] remote generator: Annotate hyper with the actual C type

2011-05-31 Thread Eric Blake
On 05/27/2011 04:12 AM, Daniel P. Berrange wrote:
>> But anything is better than nothing, so I won't give any further
>> complaints if we go with your idea of only annotating the exceptions to
>> the 'long long' default, rather than all uses of hyper.
> 
> My rationale for defaulting to 'long long' is that we should never
> add any more APIs which take a plain 'long' anywhere. It would be
> a nice idea if we could get apibuild.py or something to raise an
> error if it finds any more APIs using 'long', except for a whitelist
> of existing ones

Yes, I like that compromise.  Default to 'long long', enforce that
default in new code, and whitelist the old exceptions; then we only have
to annotate the exceptions, and don't have to worry about adding
annotations when adding new API.

-- 
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 v2] tests: Add more complex domain scheme test data

2011-05-31 Thread Michal Prívozník
On 31.05.2011 17:06, Eric Blake wrote:
> On 05/31/2011 08:59 AM, Michal Privoznik wrote:
>> ---
>> diff to v1:
>> -move from tests/domainschemadata/ to tests/qemuxml2argvdata/
>> -add .args
>>
>>  .../qemuxml2argv-graphics-spice-timeout.args   |   14 +++
>>  .../qemuxml2argv-graphics-spice-timeout.xml|   86 
>> 
>>  tests/qemuxml2argvtest.c   |5 +
>>  tests/qemuxml2xmltest.c|3 +-
>>  4 files changed, 107 insertions(+), 1 deletions(-)
>>  create mode 100644 
>> tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
>>  create mode 100644 
>> tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml
>>
>> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args 
>> b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
>> new file mode 100644
>> index 000..7c30e43
>> --- /dev/null
>> +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
>> @@ -0,0 +1,14 @@
>> +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test 
>> QEMU_AUDIO_DRV=spice \
>> +/usr/bin/qemu-kvm -S -M pc-0.13 -cpu 
>> core2duo,+lahf_lm,+xtpr,+cx16,+tm2,+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,+acpi,+ds
>>  \
> 
> You can additionally add backslash-newline pairs in the middle of this
> line, rather than only breaking lines after spaces, if it helps fit the
> file into 80 columns.  But that's stylistic, and not a showstopper to
> have a long line.  So
> 
> ACK.
> 

Fixed and pushed. Thanks

Michal

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


Re: [libvirt] [PATCH v2] tests: Add more complex domain scheme test data

2011-05-31 Thread Eric Blake
On 05/31/2011 08:59 AM, Michal Privoznik wrote:
> ---
> diff to v1:
> -move from tests/domainschemadata/ to tests/qemuxml2argvdata/
> -add .args
> 
>  .../qemuxml2argv-graphics-spice-timeout.args   |   14 +++
>  .../qemuxml2argv-graphics-spice-timeout.xml|   86 
> 
>  tests/qemuxml2argvtest.c   |5 +
>  tests/qemuxml2xmltest.c|3 +-
>  4 files changed, 107 insertions(+), 1 deletions(-)
>  create mode 100644 
> tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
>  create mode 100644 
> tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml
> 
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args 
> b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
> new file mode 100644
> index 000..7c30e43
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
> @@ -0,0 +1,14 @@
> +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test 
> QEMU_AUDIO_DRV=spice \
> +/usr/bin/qemu-kvm -S -M pc-0.13 -cpu 
> core2duo,+lahf_lm,+xtpr,+cx16,+tm2,+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,+acpi,+ds
>  \

You can additionally add backslash-newline pairs in the middle of this
line, rather than only breaking lines after spaces, if it helps fit the
file into 80 columns.  But that's stylistic, and not a showstopper to
have a long line.  So

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

Re: [libvirt] ruby libvirt restore is broken

2011-05-31 Thread Chris Lalancette
On 05/28/11 - 05:46:21PM, Ronen Narkis wrote:
> Hey dear libvirt users /dev
> 
> Im trying to use ruby's bindings to libvirt and Im unable to use the domain
> restore
> 
> 
> ruby-1.8.7-p334 :014 > dom.restore("/tmp/puppet-client.state")
> Libvirt::Error: Call to virDomainRestore failed
> from (irb):14:in `restore'
> from (irb):14

Unfortunately, dom.restore doesn't work.  I suspect it is an object lifetime
issue, since once you have done a dom.save, the underlying VM is killed and
I think libvirt will drop the object.

What you really want to use is:

Libvirt::Domain::Restore(conn, "/tmp/puppet-client.state")

Which should do the trick.

-- 
Chris Lalancette

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


[libvirt] [PATCH v2] tests: Add more complex domain scheme test data

2011-05-31 Thread Michal Privoznik
---
diff to v1:
-move from tests/domainschemadata/ to tests/qemuxml2argvdata/
-add .args

 .../qemuxml2argv-graphics-spice-timeout.args   |   14 +++
 .../qemuxml2argv-graphics-spice-timeout.xml|   86 
 tests/qemuxml2argvtest.c   |5 +
 tests/qemuxml2xmltest.c|3 +-
 4 files changed, 107 insertions(+), 1 deletions(-)
 create mode 100644 
tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
 create mode 100644 
tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args 
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
new file mode 100644
index 000..7c30e43
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
@@ -0,0 +1,14 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice 
\
+/usr/bin/qemu-kvm -S -M pc-0.13 -cpu 
core2duo,+lahf_lm,+xtpr,+cx16,+tm2,+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,+acpi,+ds 
\
+-m 1024 -smp 2 -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
+-boot dc -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 \
+-drive file=/var/lib/libvirt/images/f14.img,if=none,id=drive-virtio-disk0 \
+-device 
virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0 \
+-drive 
file=/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso,if=none,media=cdrom,id=drive-ide0-1-0
 \
+-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 \
+-device rtl8139,vlan=0,id=net0,mac=52:54:00:71:70:89,bus=pci.0,addr=0x7 \
+-net tap,script=/etc/qemu-ifup,vlan=0,name=hostnet0 -serial pty \
+-usb -device usb-tablet,id=input0 \
+-spice port=5900,tls-port=0,x509-dir=/etc/pki/libvirt-spice -vga std \
+-device AC97,id=sound0,bus=pci.0,addr=0x3 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml
new file mode 100644
index 000..aaa4469
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml
@@ -0,0 +1,86 @@
+
+  f14
+  553effab-b5e1-2d80-dfe3-da4344826c43
+  1048576
+  1048576
+  2
+  
+hvm
+
+
+
+  
+  
+
+
+
+  
+  
+core2duo
+Intel
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+  destroy
+  restart
+  restart
+  
+/usr/bin/qemu-kvm
+
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+  
+
+
+  
+
+
+  
+
+
+  
+  
+  
+
+
+  
+
+
+  
+
+
+
+
+
+  
+
+
+  
+  
+
+
+  
+
+  
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 33cc58f..c9076e1 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -357,6 +357,11 @@ mymain(void)
 DO_TEST("graphics-spice-compression", false,
 QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
 QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE);
+DO_TEST("graphics-spice-timeout", false,
+QEMU_CAPS_DRIVE,
+QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
+QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
+QEMU_CAPS_DEVICE_QXL_VGA);
 DO_TEST("graphics-spice-qxl-vga", false,
 QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
 QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 1574cae..64a833f 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -35,7 +35,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char 
*outxml)
   VIR_DOMAIN_XML_INACTIVE)))
 goto fail;
 
-if (!(actual = virDomainDefFormat(def, 0)))
+if (!(actual = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE)))
 goto fail;
 
 
@@ -144,6 +144,7 @@ mymain(void)
 DO_TEST("graphics-sdl-fullscreen");
 DO_TEST("graphics-spice");
 DO_TEST("graphics-spice-compression");
+DO_TEST("graphics-spice-timeout");
 DO_TEST("graphics-spice-qxl-vga");
 DO_TEST("input-usbmouse");
 DO_TEST("input-usbtablet");
-- 
1.7.5.rc3

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


Re: [libvirt] [RESEND PATCH 1/3] Add new flags for setting memory parameters

2011-05-31 Thread Eric Blake
On 05/25/2011 02:54 AM, Hu Tao wrote:
> This enables users to modify memory parameters for inactive domains
> ---
>  include/libvirt/libvirt.h.in |7 +++
>  tools/virsh.c|   26 +++---
>  tools/virsh.pod  |7 +++
>  3 files changed, 37 insertions(+), 3 deletions(-)

> +/* flags for setting memory parameters */
> +typedef enum {
> +VIR_DOMAIN_MEMORY_PARAM_CURRENT = 0,/* affect current domain 
> state */
> +VIR_DOMAIN_MEMORY_PARAM_LIVE= (1 << 0), /* affect active domain */
> +VIR_DOMAIN_MEMORY_PARAM_CONFIG  = (1 << 1)  /* affect next boot */
> +} virMemoryParamFlags;

This commit is already pushed, but our general style has been to include
the trailing comma in enum lists (this requires a C99 compiler, but we
require C99 for other reasons).  It makes maintenance easier, because
then adding a new value does not require modifying the former last line
to add the comma, for a smaller diff.

-- 
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] tests: Test for SPICE compression options

2011-05-31 Thread Michal Prívozník
On 31.05.2011 16:30, Matthias Bolte wrote:
> 2011/5/31 Michal Privoznik :
>> and check regression
>> ---
>>  .../qemuxml2argv-graphics-spice-compression.args   |9 +
>>  .../qemuxml2argv-graphics-spice-compression.xml|   39 
>> 
>>  tests/qemuxml2argvtest.c   |3 ++
>>  tests/qemuxml2xmltest.c|1 +
>>  4 files changed, 52 insertions(+), 0 deletions(-)
>>  create mode 100644 
>> tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args
>>  create mode 100644 
>> tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
>>
> 
> This test fails without your fix and passes with your fix, thanks.
> 
> ACK.
> 
> Matthias

Thanks, pushed.

Michal

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


Re: [libvirt] [PATCH] tests: Test for SPICE compression options

2011-05-31 Thread Matthias Bolte
2011/5/31 Michal Privoznik :
> and check regression
> ---
>  .../qemuxml2argv-graphics-spice-compression.args   |    9 +
>  .../qemuxml2argv-graphics-spice-compression.xml    |   39 
> 
>  tests/qemuxml2argvtest.c                           |    3 ++
>  tests/qemuxml2xmltest.c                            |    1 +
>  4 files changed, 52 insertions(+), 0 deletions(-)
>  create mode 100644 
> tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args
>  create mode 100644 
> tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
>

This test fails without your fix and passes with your fix, thanks.

ACK.

Matthias

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

Re: [libvirt] [PATCH] Workaround apibuild.py warnings

2011-05-31 Thread Matthias Bolte
2011/5/31 Daniel Veillard :
> On Tue, May 31, 2011 at 10:43:16AM +0200, Matthias Bolte wrote:
>> 2011/5/31 Daniel Veillard :
>> > On Sun, May 29, 2011 at 05:14:46PM +0200, Matthias Bolte wrote:
>> >> Parsing ./../include/libvirt/libvirt.h
>> >> Misformatted macro comment for _virSchedParameter
>> >>   Expecting '* _virSchedParameter:' got '* virSchedParameter:'
>> >> Misformatted macro comment for _virBlkioParameter
>> >>   Expecting '* _virBlkioParameter:' got '* virBlkioParameter:'
>> >> Misformatted macro comment for _virMemoryParameter
>> >>   Expecting '* _virMemoryParameter:' got '* virMemoryParameter:'
>> >>
>> >> Replace '#define' with '# define' for the backward compatibility
>> >> defines to keep apibuild.py from parsing them and expecting
>> >> documentation comments for them.
>> >> ---
>> >>  include/libvirt/libvirt.h.in |    6 +++---
>> >>  1 files changed, 3 insertions(+), 3 deletions(-)
>> >>
>> >> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
>> >> index 8058229..424e49b 100644
>> >> --- a/include/libvirt/libvirt.h.in
>> >> +++ b/include/libvirt/libvirt.h.in
>> >> @@ -2569,7 +2569,7 @@ typedef enum {
>> >>   * Provided for backwards compatibility; virTypedParameter is the
>> >>   * preferred alias since 0.9.2.
>> >>   */
>> >> -#define _virSchedParameter _virTypedParameter
>> >> +# define _virSchedParameter _virTypedParameter
>> >>  typedef struct _virTypedParameter virSchedParameter;
>> >>
>> >>  /**
>> >> @@ -2613,7 +2613,7 @@ typedef enum {
>> >>   * Provided for backwards compatibility; virTypedParameter is the
>> >>   * preferred alias since 0.9.2.
>> >>   */
>> >> -#define _virBlkioParameter _virTypedParameter
>> >> +# define _virBlkioParameter _virTypedParameter
>> >>  typedef struct _virTypedParameter virBlkioParameter;
>> >>
>> >>  /**
>> >> @@ -2657,7 +2657,7 @@ typedef enum {
>> >>   * Provided for backwards compatibility; virTypedParameter is the
>> >>   * preferred alias since 0.9.2.
>> >>   */
>> >> -#define _virMemoryParameter _virTypedParameter
>> >> +# define _virMemoryParameter _virTypedParameter
>> >>  typedef struct _virTypedParameter virMemoryParameter;
>> >
>> >  That's a bit odd ... it should be possibe to avoid those complaints
>> > from the generator, I can't look right now though
>> >
>> > Daniel
>>
>> Well, yes this was more like a hackish approach. Here's a v2 that
>> allows apibuild.py to ignore macros like it can already ignore
>> functions.
>>
>> Matthias
>
>> From ac679b3a929c22ae6cd3bf8733f57dca408f4e3b Mon Sep 17 00:00:00 2001
>> From: Matthias Bolte 
>> Date: Tue, 31 May 2011 10:41:37 +0200
>> Subject: [PATCH] Ignore backward compatibility macros in apibuild.py
>>
>> This fixes this three warnings from the parser by allowing the parser
>> to ignore some macros in the same way as it can ignore functions.
>>
>> Parsing ./../include/libvirt/libvirt.h
>> Misformatted macro comment for _virSchedParameter
>>  Expecting '* _virSchedParameter:' got '* virSchedParameter:'
>> Misformatted macro comment for _virBlkioParameter
>>  Expecting '* _virBlkioParameter:' got '* virBlkioParameter:'
>> Misformatted macro comment for _virMemoryParameter
>>  Expecting '* _virMemoryParameter:' got '* virMemoryParameter:'
>> ---
>>  docs/apibuild.py |   10 ++
>>  1 files changed, 10 insertions(+), 0 deletions(-)
>>
>> diff --git a/docs/apibuild.py b/docs/apibuild.py
>> index 2ab0599..f160c47 100755
>> --- a/docs/apibuild.py
>> +++ b/docs/apibuild.py
>> @@ -58,6 +58,12 @@ ignored_functions = {
>>    "virEventRemoveTimeout": "internal function in event.c",
>>  }
>>
>> +ignored_macros = {
>> +  "_virSchedParameter": "backward compatibility macro for 
>> virTypedParameter",
>> +  "_virBlkioParameter": "backward compatibility macro for 
>> virTypedParameter",
>> +  "_virMemoryParameter": "backward compatibility macro for 
>> virTypedParameter",
>> +}
>> +
>>  def escape(raw):
>>      raw = string.replace(raw, '&', '&')
>>      raw = string.replace(raw, '<', '<')
>> @@ -716,8 +722,12 @@ class CParser:
>>      # Parse a comment block associate to a macro
>>      #
>>      def parseMacroComment(self, name, quiet = 0):
>> +        global ignored_macros
>> +
>>          if name[0:2] == '__':
>>              quiet = 1
>> +        if ignored_macros.has_key(name):
>> +            quiet = 1
>>
>>          args = []
>>          desc = ""
>
>  Excellent, thanks ! ACK :-)
>
> Daniel
>

Thanks, pushed.

Matthias

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

[libvirt] [PATCH] tests: Test for SPICE compression options

2011-05-31 Thread Michal Privoznik
and check regression
---
 .../qemuxml2argv-graphics-spice-compression.args   |9 +
 .../qemuxml2argv-graphics-spice-compression.xml|   39 
 tests/qemuxml2argvtest.c   |3 ++
 tests/qemuxml2xmltest.c|1 +
 4 files changed, 52 insertions(+), 0 deletions(-)
 create mode 100644 
tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args
 create mode 100644 
tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml

diff --git 
a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args 
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args
new file mode 100644
index 000..531c567
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args
@@ -0,0 +1,9 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice 
\
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefaults -monitor \
+unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda \
+/dev/HostVG/QEMUGuest1 -usb -spice port=5903,tls-port=5904,addr=127.0.0.1,\
+x509-dir=/etc/pki/libvirt-spice,\
+image-compression=auto_glz,jpeg-wan-compression=auto,zlib-glz-wan-compression=auto,\
+playback-compression=on,streaming-video=filter -vga \
+qxl -global qxl.vram_size=18874368 -device 
qxl,id=video1,vram_size=33554432,bus=pci.0,addr=0x4 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
new file mode 100644
index 000..64a6890
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
@@ -0,0 +1,39 @@
+
+  QEMUGuest1
+  c7a5fdbd-edaf-9455-926a-d65c16db1809
+  219136
+  219136
+  1
+  
+hvm
+
+  
+  
+  destroy
+  restart
+  destroy
+  
+/usr/bin/qemu
+
+  
+  
+  
+
+
+
+
+  
+  
+  
+  
+  
+
+
+  
+
+
+  
+
+
+  
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index a7e4cc0..33cc58f 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -354,6 +354,9 @@ mymain(void)
 DO_TEST("graphics-spice", false,
 QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
 QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE);
+DO_TEST("graphics-spice-compression", false,
+QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
+QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE);
 DO_TEST("graphics-spice-qxl-vga", false,
 QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
 QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 5bfbcab..1574cae 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -143,6 +143,7 @@ mymain(void)
 DO_TEST("graphics-sdl");
 DO_TEST("graphics-sdl-fullscreen");
 DO_TEST("graphics-spice");
+DO_TEST("graphics-spice-compression");
 DO_TEST("graphics-spice-qxl-vga");
 DO_TEST("input-usbmouse");
 DO_TEST("input-usbtablet");
-- 
1.7.5.rc3

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


Re: [libvirt] [PATCH] conf: Fix incorrect spice graphic XML format on compression options

2011-05-31 Thread Michal Prívozník
On 31.05.2011 14:24, Jiri Denemark wrote:
> On Tue, May 24, 2011 at 13:43:30 +0200, Michal Privoznik wrote:
>> If spice graphics has no  elements, the output graphics XML
>> is messed up. To prevent this, we need to end the  element
>> just before adding any compression selecting elements.
>> ---
>>  src/conf/domain_conf.c |6 ++
>>  1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>> index 3f2fb11..2800db5 100644
>> --- a/src/conf/domain_conf.c
>> +++ b/src/conf/domain_conf.c
>> @@ -8082,6 +8082,12 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
>>
>> virDomainGraphicsSpiceChannelNameTypeToString(i),
>>
>> virDomainGraphicsSpiceChannelModeTypeToString(mode));
>>  }
>> +if (!children && (def->data.spice.image || def->data.spice.jpeg ||
>> +  def->data.spice.zlib || def->data.spice.playback 
>> ||
>> +  def->data.spice.streaming)) {
>> +virBufferAddLit(buf, ">\n");
>> +children = 1;
>> +}
>>  if (def->data.spice.image)
>>  virBufferAsprintf(buf, "  \n",
>>
>> virDomainGraphicsSpiceImageCompressionTypeToString(def->data.spice.image));
> 
> I feel like it's about time to rework all XML formating to just create a tree
> of XML nodes and use one universal function to transform the tree into it's
> string representation (aka xmlSaveTree() from libxml). Am I the only one?
> 
> ACK
> 
> Jirka

Thanks, pushed. The test patch will follow.

Michal

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


Re: [libvirt] [PATCH] Workaround apibuild.py warnings

2011-05-31 Thread Daniel Veillard
On Tue, May 31, 2011 at 10:43:16AM +0200, Matthias Bolte wrote:
> 2011/5/31 Daniel Veillard :
> > On Sun, May 29, 2011 at 05:14:46PM +0200, Matthias Bolte wrote:
> >> Parsing ./../include/libvirt/libvirt.h
> >> Misformatted macro comment for _virSchedParameter
> >>   Expecting '* _virSchedParameter:' got '* virSchedParameter:'
> >> Misformatted macro comment for _virBlkioParameter
> >>   Expecting '* _virBlkioParameter:' got '* virBlkioParameter:'
> >> Misformatted macro comment for _virMemoryParameter
> >>   Expecting '* _virMemoryParameter:' got '* virMemoryParameter:'
> >>
> >> Replace '#define' with '# define' for the backward compatibility
> >> defines to keep apibuild.py from parsing them and expecting
> >> documentation comments for them.
> >> ---
> >>  include/libvirt/libvirt.h.in |    6 +++---
> >>  1 files changed, 3 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> >> index 8058229..424e49b 100644
> >> --- a/include/libvirt/libvirt.h.in
> >> +++ b/include/libvirt/libvirt.h.in
> >> @@ -2569,7 +2569,7 @@ typedef enum {
> >>   * Provided for backwards compatibility; virTypedParameter is the
> >>   * preferred alias since 0.9.2.
> >>   */
> >> -#define _virSchedParameter _virTypedParameter
> >> +# define _virSchedParameter _virTypedParameter
> >>  typedef struct _virTypedParameter virSchedParameter;
> >>
> >>  /**
> >> @@ -2613,7 +2613,7 @@ typedef enum {
> >>   * Provided for backwards compatibility; virTypedParameter is the
> >>   * preferred alias since 0.9.2.
> >>   */
> >> -#define _virBlkioParameter _virTypedParameter
> >> +# define _virBlkioParameter _virTypedParameter
> >>  typedef struct _virTypedParameter virBlkioParameter;
> >>
> >>  /**
> >> @@ -2657,7 +2657,7 @@ typedef enum {
> >>   * Provided for backwards compatibility; virTypedParameter is the
> >>   * preferred alias since 0.9.2.
> >>   */
> >> -#define _virMemoryParameter _virTypedParameter
> >> +# define _virMemoryParameter _virTypedParameter
> >>  typedef struct _virTypedParameter virMemoryParameter;
> >
> >  That's a bit odd ... it should be possibe to avoid those complaints
> > from the generator, I can't look right now though
> >
> > Daniel
> 
> Well, yes this was more like a hackish approach. Here's a v2 that
> allows apibuild.py to ignore macros like it can already ignore
> functions.
> 
> Matthias

> From ac679b3a929c22ae6cd3bf8733f57dca408f4e3b Mon Sep 17 00:00:00 2001
> From: Matthias Bolte 
> Date: Tue, 31 May 2011 10:41:37 +0200
> Subject: [PATCH] Ignore backward compatibility macros in apibuild.py
> 
> This fixes this three warnings from the parser by allowing the parser
> to ignore some macros in the same way as it can ignore functions.
> 
> Parsing ./../include/libvirt/libvirt.h
> Misformatted macro comment for _virSchedParameter
>  Expecting '* _virSchedParameter:' got '* virSchedParameter:'
> Misformatted macro comment for _virBlkioParameter
>  Expecting '* _virBlkioParameter:' got '* virBlkioParameter:'
> Misformatted macro comment for _virMemoryParameter
>  Expecting '* _virMemoryParameter:' got '* virMemoryParameter:'
> ---
>  docs/apibuild.py |   10 ++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/docs/apibuild.py b/docs/apibuild.py
> index 2ab0599..f160c47 100755
> --- a/docs/apibuild.py
> +++ b/docs/apibuild.py
> @@ -58,6 +58,12 @@ ignored_functions = {
>"virEventRemoveTimeout": "internal function in event.c",
>  }
>  
> +ignored_macros = {
> +  "_virSchedParameter": "backward compatibility macro for virTypedParameter",
> +  "_virBlkioParameter": "backward compatibility macro for virTypedParameter",
> +  "_virMemoryParameter": "backward compatibility macro for 
> virTypedParameter",
> +}
> +
>  def escape(raw):
>  raw = string.replace(raw, '&', '&')
>  raw = string.replace(raw, '<', '<')
> @@ -716,8 +722,12 @@ class CParser:
>  # Parse a comment block associate to a macro
>  #
>  def parseMacroComment(self, name, quiet = 0):
> +global ignored_macros
> +
>  if name[0:2] == '__':
>  quiet = 1
> +if ignored_macros.has_key(name):
> +quiet = 1
>  
>  args = []
>  desc = ""

  Excellent, thanks ! ACK :-)

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 0/4] Allow changing guest XML during QEMU migration

2011-05-31 Thread Daniel P. Berrange
On Fri, May 27, 2011 at 01:09:06PM +0100, Daniel P. Berrange wrote:
> This patch series updates the QEMU driver to allow it to take
> advantage of the migration v3 protocol support for changing
> guest XML during migration.
> 
> eg
> 
> virsh migrate --xml migtest.xml migtest qemu+ssh://somehost/system
> 
> NB the XML is strictly validated for guest ABI compatibility
> so only things like host NIC device names or host disk file
> paths can be changed

This series caused a build failure on Win32 due to some dodgy
#ifdef conditionals, so I pushed this followup

commit ef983dfe5ab9c8b126d435f3f3a46bdd6f8f21b6
Author: Daniel P. Berrange 
Date:   Tue May 31 14:12:33 2011 +0100

Fix sysinfo/virsh build problems on Win32

The virSysinfoIsEqual method was mistakenly inside a #ifndef WIN32
conditional.

The existing virSysinfoFormat is also stubbed out on Win32, even
though the code works without any trouble. This breaks XML output
on Win32, so the stub is removed.

virsh migrate mistakenly had some variables inside the conditional

* src/util/sysinfo.c: Build virSysinfoIsEqual on Win32 and remove
  Win32 stub for virSysinfoFormat
* tools/virsh.c: Fix variable declaration on Win32

diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
index ff07151..40ec2e3 100644
--- a/src/util/sysinfo.c
+++ b/src/util/sysinfo.c
@@ -94,15 +94,6 @@ virSysinfoRead(void) {
 return NULL;
 }
 
-char *
-virSysinfoFormat(virSysinfoDefPtr def ATTRIBUTE_UNUSED,
- const char *prefix ATTRIBUTE_UNUSED)
-{
-virReportSystemError(ENOSYS, "%s",
- _("Host sysinfo extraction not supported on this platform"));
-return NULL;
-}
-
 #else /* !WIN32 */
 
 virSysinfoDefPtr
@@ -220,6 +211,7 @@ no_memory:
 ret = NULL;
 goto cleanup;
 }
+#endif /* !WIN32 */
 
 /**
  * virSysinfoFormat:
@@ -350,7 +342,7 @@ bool virSysinfoIsEqual(virSysinfoDefPtr src,
 goto cleanup;
 }
 
-# define CHECK_FIELD(name, desc)\
+#define CHECK_FIELD(name, desc) \
 do {\
 if (STRNEQ_NULLABLE(src->name, dst->name)) {\
 virSmbiosReportError(VIR_ERR_CONFIG_UNSUPPORTED,\
@@ -372,12 +364,10 @@ bool virSysinfoIsEqual(virSysinfoDefPtr src,
 CHECK_FIELD(system_sku, "system sku");
 CHECK_FIELD(system_family, "system family");
 
-# undef CHECK_FIELD
+#undef CHECK_FIELD
 
 identical = true;
 
 cleanup:
 return identical;
 }
-
-#endif /* !WIN32 */
diff --git a/tools/virsh.c b/tools/virsh.c
index 520d16e..dfd5bd2 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -3850,10 +3850,10 @@ doMigrate (void *opaque)
 vshCtrlData *data = opaque;
 vshControl *ctl = data->ctl;
 const vshCmd *cmd = data->cmd;
-#if HAVE_PTHREAD_SIGMASK
-sigset_t sigmask, oldsigmask;
 const char *xmlfile = NULL;
 char *xml = NULL;
+#if HAVE_PTHREAD_SIGMASK
+sigset_t sigmask, oldsigmask;
 
 sigemptyset(&sigmask);
 sigaddset(&sigmask, SIGINT);


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] openvz: fix bridge devices parsing in openvzReadNetworkConf()

2011-05-31 Thread Jean-Baptiste Rouault
On Tuesday 31 May 2011 14:41:55 Matthias Bolte wrote:
> I also added a testcase and looked at the other config parsing code in
> the OpenVZ driver. I thing that openvzLoadDomains is missing this
> line:
> 
>   dom->def->virtType = VIR_DOMAIN_VIRT_OPENVZ;
> 
> Could you do a virsh dumpxml for an OpenVZ guest and check the first
> line of XML? I think it currently reads
> 
>   
> 
> but should actually read
> 
>   
> 
> and we need to fix this.
> 
> Matthias

It indeed outputs ""

Regards,
Jean-Baptiste

-- 
Jean-Baptiste ROUAULT
Ingénieur R&D - Diateam : Architectes de l'information
Phone : +33 (0)9 53 16 02 70 Fax : +33 (0)2 98 050 051

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

[libvirt] [PATCH] openvz: Add simple test for openvzReadNetworkConf

2011-05-31 Thread Matthias Bolte
Convert openvzLocateConfFile to a replaceable callback to allow
testing the config file parsing without rewriting the whole OpenVZ
config parsing to a more testable structure.

Also ignore the openvzutilstest binary.
---
 src/openvz/openvz_conf.c   |   28 +++
 src/openvz/openvz_conf.h   |6 +++
 tests/.gitignore   |1 +
 tests/openvzutilstest.c|   78 
 tests/openvzutilstest.conf |1 +
 5 files changed, 106 insertions(+), 8 deletions(-)

diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 6e32242..bba4e6f 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -60,6 +60,9 @@ static char *openvzLocateConfDir(void);
 static int openvzGetVPSUUID(int vpsid, char *uuidstr, size_t len);
 static int openvzLocateConfFile(int vpsid, char **conffile, const char *ext);
 static int openvzAssignUUIDs(void);
+static int openvzLocateConfFileDefault(int vpsid, char **conffile, const char 
*ext);
+
+openvzLocateConfFileFunc openvzLocateConfFileCallback = 
openvzLocateConfFileDefault;
 
 int
 strtoI(const char *str)
@@ -171,7 +174,7 @@ no_memory:
 }
 
 
-static int
+int
 openvzReadNetworkConf(virDomainDefPtr def,
   int veid) {
 int ret;
@@ -473,6 +476,8 @@ int openvzLoadDomains(struct openvz_driver *driver) {
 if (VIR_ALLOC(dom->def) < 0)
 goto no_memory;
 
+dom->def->virtType = VIR_DOMAIN_VIRT_OPENVZ;
+
 if (STREQ(status, "stopped")) {
 virDomainObjSetState(dom, VIR_DOMAIN_SHUTOFF,
  VIR_DOMAIN_SHUTOFF_UNKNOWN);
@@ -793,12 +798,9 @@ cleanup:
 return ret;
 }
 
-/* Locate config file of container
-* return -1 - error
-* 0 - OK
-*/
+
 static int
-openvzLocateConfFile(int vpsid, char **conffile, const char *ext)
+openvzLocateConfFileDefault(int vpsid, char **conffile, const char *ext)
 {
 char * confdir;
 int ret = 0;
@@ -817,8 +819,18 @@ openvzLocateConfFile(int vpsid, char **conffile, const 
char *ext)
 return ret;
 }
 
-static char
-*openvzLocateConfDir(void)
+/* Locate config file of container
+ * return -1 - error
+ * 0 - OK
+ */
+static int
+openvzLocateConfFile(int vpsid, char **conffile, const char *ext)
+{
+return openvzLocateConfFileCallback(vpsid, conffile, ext);
+}
+
+static char *
+openvzLocateConfDir(void)
 {
 const char *conf_dir_list[] = {"/etc/vz/conf", "/usr/local/etc/conf", 
NULL};
 int i=0;
diff --git a/src/openvz/openvz_conf.h b/src/openvz/openvz_conf.h
index d5a57a6..182ebae 100644
--- a/src/openvz/openvz_conf.h
+++ b/src/openvz/openvz_conf.h
@@ -53,6 +53,11 @@ struct openvz_driver {
 int version;
 };
 
+typedef int (*openvzLocateConfFileFunc)(int vpsid, char **conffile, const char 
*ext);
+
+/* this allows the testsuite to replace the conf file locator function */
+extern openvzLocateConfFileFunc openvzLocateConfFileCallback;
+
 int openvz_readline(int fd, char *ptr, int maxlen);
 int openvzExtractVersion(struct openvz_driver *driver);
 int openvzReadVPSConfigParam(int vpsid, const char *param, char **value);
@@ -66,5 +71,6 @@ int strtoI(const char *str);
 int openvzSetDefinedUUID(int vpsid, unsigned char *uuid);
 unsigned int openvzGetNodeCPUs(void);
 int openvzGetVEID(const char *name);
+int openvzReadNetworkConf(virDomainDefPtr def, int veid);
 
 #endif /* OPENVZ_CONF_H */
diff --git a/tests/.gitignore b/tests/.gitignore
index e3906f0..749b5b9 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -16,6 +16,7 @@ object-locking
 object-locking-files.txt
 object-locking.cmi
 object-locking.cmx
+openvzutilstest
 qemuargv2xmltest
 qemuhelptest
 qemuxml2argvtest
diff --git a/tests/openvzutilstest.c b/tests/openvzutilstest.c
index fe6a2ea..567131a 100644
--- a/tests/openvzutilstest.c
+++ b/tests/openvzutilstest.c
@@ -12,6 +12,13 @@
 # include "util.h"
 # include "openvz/openvz_conf.h"
 
+static int
+testLocateConfFile(int vpsid ATTRIBUTE_UNUSED, char **conffile,
+   const char *ext ATTRIBUTE_UNUSED)
+{
+return virAsprintf(conffile, "%s/openvzutilstest.conf", abs_srcdir);
+}
+
 struct testConfigParam {
 const char *param;
 const char *value;
@@ -62,10 +69,80 @@ cleanup:
 }
 
 static int
+testReadNetworkConf(const void *data ATTRIBUTE_UNUSED)
+{
+int result = -1;
+virDomainDefPtr def = NULL;
+char *actual = NULL;
+virErrorPtr err = NULL;
+const char *expected =
+"\n"
+"  ----\n"
+"  0\n"
+"  0\n"
+"  0\n"
+"  \n"
+"exe\n"
+"/sbin/init\n"
+"  \n"
+"  \n"
+"  destroy\n"
+"  destroy\n"
+"  destroy\n"
+"  \n"
+"\n"
+"  \n"
+"  \n"
+"\n"
+"\n"
+"  \n"
+"  \n"
+"\n"
+"  \n"
+"\n";
+
+if (VIR_ALLOC(def) < 0 ||
+!(def->os.type = strdup("ex

Re: [libvirt] ssh from host to guest on default network

2011-05-31 Thread Neil Wilson

> Message: 1
> Date: Mon, 30 May 2011 20:28:42 -0700
> From: Kay Williams 
> To: "libvir-list@redhat.com" 
> Subject: [libvirt] ssh from host to guest on default network
> Message-ID:
>   <3527434A537F2F42A53BAA31DC03BB6A4A52040D70@SERVER1.family.local>
> Content-Type: text/plain; charset="us-ascii"
> 
> Hello,
> 

> The trouble I am having is with ssh'ing from the host to guest machine.

Probably more for the user list than this one. However...

I've used 'avahi' successfully to get resolution in the clients. It
implements the 'Bonjour' no configuration system. Obviously the client
image has to have the avahi daemons installed and correctly configured.

Once you have that working in the client and the correct settings in
your resolver on the host, then you can ssh into 'xyz.local' and it
resolves nicely.

Rgs

Neil



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


Re: [libvirt] [PATCH] openvz: fix bridge devices parsing in openvzReadNetworkConf()

2011-05-31 Thread Matthias Bolte
2011/5/31 Jean-Baptiste Rouault :
> strchrnul() was called on the wrong string so it returned
> the same result for each iteration.
> ---
>  src/openvz/openvz_conf.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
> index 5f33f75..6e32242 100644
> --- a/src/openvz/openvz_conf.c
> +++ b/src/openvz/openvz_conf.c
> @@ -237,7 +237,7 @@ openvzReadNetworkConf(virDomainDefPtr def,
>
>             /*parse string*/
>             do {
> -                char *next = strchrnul (token, ',');
> +                char *next = strchrnul (p, ',');
>                 if (STRPREFIX(p, "ifname=")) {
>                     /* skip in libvirt */
>                 } else if (STRPREFIX(p, "host_ifname=")) {
> --
> 1.7.1

ACK and applied, thanks.

I also added a testcase and looked at the other config parsing code in
the OpenVZ driver. I thing that openvzLoadDomains is missing this
line:

  dom->def->virtType = VIR_DOMAIN_VIRT_OPENVZ;

Could you do a virsh dumpxml for an OpenVZ guest and check the first
line of XML? I think it currently reads

  

but should actually read

  

and we need to fix this.

Matthias

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

Re: [libvirt] [PATCH] conf: Fix incorrect spice graphic XML format on compression options

2011-05-31 Thread Jiri Denemark
On Tue, May 24, 2011 at 13:43:30 +0200, Michal Privoznik wrote:
> If spice graphics has no  elements, the output graphics XML
> is messed up. To prevent this, we need to end the  element
> just before adding any compression selecting elements.
> ---
>  src/conf/domain_conf.c |6 ++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 3f2fb11..2800db5 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -8082,6 +8082,12 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
>
> virDomainGraphicsSpiceChannelNameTypeToString(i),
>
> virDomainGraphicsSpiceChannelModeTypeToString(mode));
>  }
> +if (!children && (def->data.spice.image || def->data.spice.jpeg ||
> +  def->data.spice.zlib || def->data.spice.playback ||
> +  def->data.spice.streaming)) {
> +virBufferAddLit(buf, ">\n");
> +children = 1;
> +}
>  if (def->data.spice.image)
>  virBufferAsprintf(buf, "  \n",
>
> virDomainGraphicsSpiceImageCompressionTypeToString(def->data.spice.image));

I feel like it's about time to rework all XML formating to just create a tree
of XML nodes and use one universal function to transform the tree into it's
string representation (aka xmlSaveTree() from libxml). Am I the only one?

ACK

Jirka

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


Re: [libvirt] [PATCH] conf: Fix incorrect spice graphic XML format on compression options

2011-05-31 Thread Matthias Bolte
2011/5/24 Michal Prívozník :
> On 24.05.2011 13:43, Michal Privoznik wrote:
>> If spice graphics has no  elements, the output graphics XML
>> is messed up. To prevent this, we need to end the  element
> By messing up I mean something like this:
> ..
>     compression='auto_glz'/>
>      
>      
>      
> />
> ..
>> just before adding any compression selecting elements.
>> ---
>>  src/conf/domain_conf.c |    6 ++
>>  1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>> index 3f2fb11..2800db5 100644
>> --- a/src/conf/domain_conf.c
>> +++ b/src/conf/domain_conf.c
>> @@ -8082,6 +8082,12 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
>>                                
>> virDomainGraphicsSpiceChannelNameTypeToString(i),
>>                                
>> virDomainGraphicsSpiceChannelModeTypeToString(mode));
>>          }
>> +        if (!children && (def->data.spice.image || def->data.spice.jpeg ||
>> +                          def->data.spice.zlib || def->data.spice.playback 
>> ||
>> +                          def->data.spice.streaming)) {
>> +            virBufferAddLit(buf, ">\n");
>> +            children = 1;
>> +        }
>>          if (def->data.spice.image)
>>              virBufferAsprintf(buf, "      \n",
>>                                
>> virDomainGraphicsSpiceImageCompressionTypeToString(def->data.spice.image));
>

Could you add test file to the qemu tests that shows the broken
formatting and passes cleanly after your patch is applied? This way we
can avoid future regressions in XML formatting in this area, because
will complain.

Matthias

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

Re: [libvirt] fix spice graphic format issue in function virDomainGraphicsDefFormat

2011-05-31 Thread Michal Prívozník
On 31.05.2011 10:53, Chen Coolper wrote:
> hi,
> all sub item of spice graphics need to processed like spice channels,
> that is adding the following lines:
>  if (!children) {
> virBufferAddLit(buf, ">\n");
> children = 1;
> }
> 
> the following patch is generated base on git master.
> -
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index b30acc8..e42db06 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -8127,21 +8127,46 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
>  
>  virDomainGraphicsSpiceChannelNameTypeToString(i),
>  
>  virDomainGraphicsSpiceChannelModeTypeToString(mode));
>  }
> -if (def->data.spice.image)
> +if (def->data.spice.image) {
>  virBufferAsprintf(buf, "  \n",
>  
>  virDomainGraphicsSpiceImageCompressionTypeToString(def->data.spice.image));
> -if (def->data.spice.jpeg)
> +if (!children) {
> +virBufferAddLit(buf, ">\n");
> +children = 1;
> +}
> +}
> +if (def->data.spice.jpeg) {
>  virBufferAsprintf(buf, "  \n",
>  
>  virDomainGraphicsSpiceJpegCompressionTypeToString(def->data.spice.jpeg));
> -if (def->data.spice.zlib)
> +if (!children) {
> +virBufferAddLit(buf, ">\n");
> +children = 1;
> +}
> +}
> +if (def->data.spice.zlib) {
>  virBufferAsprintf(buf, "  \n",
>  
>  virDomainGraphicsSpiceZlibCompressionTypeToString(def->data.spice.zlib));
> -if (def->data.spice.playback)
> +if (!children) {
> +virBufferAddLit(buf, ">\n");
> +children = 1;
> +}
> +}
> +if (def->data.spice.playback) {
>  virBufferAsprintf(buf, "  \n",
>  
>  
> virDomainGraphicsSpicePlaybackCompressionTypeToString(def->data.spice.playback));
> -if (def->data.spice.streaming)
> +if (!children) {
> +virBufferAddLit(buf, ">\n");
> +children = 1;
> +}
> +}
> +if (def->data.spice.streaming) {
>  virBufferAsprintf(buf, "  \n",
>  
>  virDomainGraphicsSpiceStreamingModeTypeToString(def->data.spice.streaming));
> +if (!children) {
> +virBufferAddLit(buf, ">\n");
> +children = 1;
> +}
> +}
>  }
>  
>  if (children) {
> 
> 
> -- 
> Coolper Chen
> 
> 
> 
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

Or there is another approach:

https://www.redhat.com/archives/libvir-list/2011-May/msg01491.html

Michal

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


[libvirt] ssh from host to guest on default network

2011-05-31 Thread Kay Williams
Hello,

I am looking for an reliable, scriptable method to 1) install a kvm guest using 
the default network and 2) ssh from the host to the guest to perform machine 
maintenance (e.g. yum update).

Ideally, this would be done by providing a host name for the guest during 
install (e.g. virt-install  --name  ...), and then by ssh'ing to the 
machine using the provided hostname (e.g. ssh ) and a username/password 
or preconfigured certificate.

The trouble I am having is with ssh'ing from the host to guest machine.


1.   I can't (easily) use the guest hostname, as the host isn't 
automatically configured to resolve guest names.

2.   I can't (easily) use the guest IP address (e.g. read from 
/var/lib/libvirt/dnsmasq/default.leases), as the IP addresses are dynamic and 
can change when the guest is reinstalled (which I am doing a fair amount, at 
least in testing).

3.   I can't (easily) assign the guest a static IP address, as the default 
network configuration assumes all IP addresses in the range can be dynamically 
allocated, and thus a  statically assigned IP might conflict.

I can work around these issues in a variety of unfortunate ways.  But I wonder 
if there is something elegant I am missing.

If not, this would be a very nice feature for the future

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

[libvirt] fix spice graphic format issue in function virDomainGraphicsDefFormat

2011-05-31 Thread Chen Coolper
hi,
all sub item of spice graphics need to processed like spice channels, that
is adding the following lines:
 if (!children) {
virBufferAddLit(buf, ">\n");
children = 1;
}

the following patch is generated base on git master.
-
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b30acc8..e42db06 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8127,21 +8127,46 @@ virDomainGraphicsDefFormat(virBufferPtr buf,

 virDomainGraphicsSpiceChannelNameTypeToString(i),

 virDomainGraphicsSpiceChannelModeTypeToString(mode));
 }
-if (def->data.spice.image)
+if (def->data.spice.image) {
 virBufferAsprintf(buf, "  \n",

 virDomainGraphicsSpiceImageCompressionTypeToString(def->data.spice.image));
-if (def->data.spice.jpeg)
+if (!children) {
+virBufferAddLit(buf, ">\n");
+children = 1;
+}
+}
+if (def->data.spice.jpeg) {
 virBufferAsprintf(buf, "  \n",

 virDomainGraphicsSpiceJpegCompressionTypeToString(def->data.spice.jpeg));
-if (def->data.spice.zlib)
+if (!children) {
+virBufferAddLit(buf, ">\n");
+children = 1;
+}
+}
+if (def->data.spice.zlib) {
 virBufferAsprintf(buf, "  \n",

 virDomainGraphicsSpiceZlibCompressionTypeToString(def->data.spice.zlib));
-if (def->data.spice.playback)
+if (!children) {
+virBufferAddLit(buf, ">\n");
+children = 1;
+}
+}
+if (def->data.spice.playback) {
 virBufferAsprintf(buf, "  \n",

 
virDomainGraphicsSpicePlaybackCompressionTypeToString(def->data.spice.playback));
-if (def->data.spice.streaming)
+if (!children) {
+virBufferAddLit(buf, ">\n");
+children = 1;
+}
+}
+if (def->data.spice.streaming) {
 virBufferAsprintf(buf, "  \n",

 virDomainGraphicsSpiceStreamingModeTypeToString(def->data.spice.streaming));
+if (!children) {
+virBufferAddLit(buf, ">\n");
+children = 1;
+}
+}
 }

 if (children) {


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

Re: [libvirt] [PATCH 1/4] Add an API for comparing the ABI of two guest configurations

2011-05-31 Thread Daniel P. Berrange
On Tue, May 31, 2011 at 11:52:20AM +0200, Matthias Bolte wrote:
> 2011/5/27 Daniel P. Berrange :
> > To allow a client app to pass in custom XML during migration
> > of a guest it is neccessary to ensure the guest ABI remains
> > unchanged. The virDomainDefCheckABIStablity method accepts
> > two virDomainDefPtr structs and compares everything in them
> > that could impact the guest machine ABI
> >
> > * src/conf/domain_conf.c, src/conf/domain_conf.h,
> >  src/libvirt_private.syms: Add virDomainDefCheckABIStablity
> > * src/conf/cpu_conf.c, src/conf/cpu_conf.h: Add virCPUDefIsEqual
> > * src/util/sysinfo.c, src/util/sysinfo.h: Add virSysinfoIsEqual
> > ---
> >  src/conf/cpu_conf.c  |   91 +
> >  src/conf/cpu_conf.h  |9 +-
> >  src/conf/domain_conf.c   |  881 
> > +-
> >  src/conf/domain_conf.h   |   11 +-
> >  src/libvirt_private.syms |1 +
> >  src/util/sysinfo.c   |   60 +++-
> >  src/util/sysinfo.h   |   11 +-
> >  7 files changed, 1051 insertions(+), 13 deletions(-)
> >
> > diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
> > index 98d598a..77d0976 100644
> > --- a/src/conf/cpu_conf.c
> > +++ b/src/conf/cpu_conf.c
> 
> > @@ -446,3 +449,91 @@ no_memory:
> > virReportOOMError();
> > return -1;
> >  }
> > +
> > +bool
> > +virCPUDefIsEqual(virCPUDefPtr src,
> > + virCPUDefPtr dst)
> > +{
> > +bool identical = false;
> > +int i;
> 
> > +for (i = 0 ; i < src->nfeatures ; i++) {
> > +if (STRNEQ(src->features[i].name, dst->features[i].name)) {
> > +virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> > +  _("Target CPU feature %s does not match 
> > source %s"),
> > +  dst->features[i].name, 
> > src->features[i].name);
> > +goto cleanup;
> > +}
> 
> I think you need to compare features[i].policy here too.
> 
> > +}
> > +
> > +identical = true;
> > +
> > +cleanup:
> > +return identical;
> > +}
> 
> > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> > index 8ff155b..a9a4655 100644
> > --- a/src/conf/domain_conf.c
> > +++ b/src/conf/domain_conf.c
> 
> > +static bool virDomainNetDefCheckABIStability(virDomainNetDefPtr src,
> > + virDomainNetDefPtr dst)
> > +{
> > +bool identical = false;
> > +
> > +if (memcmp(src->mac, dst->mac, VIR_MAC_BUFLEN) != 0) {
> > +virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> > + _("Target network card mac 
> > %02x:%02x:%02x:%02x:%02x:%02x"
> > +   "does not match source 
> > %02x:%02x:%02x:%02x:%02x:%02x"),
> > + dst->mac[0], dst->mac[2], dst->mac[2],
> 
> Shouldn't this be dst->mac[0], dst->mac[1], dst->mac[2]?
> 
> > + dst->mac[3], dst->mac[4], dst->mac[5],
> > + src->mac[0], src->mac[2], src->mac[2],
> 
> Copy-n-paste error here.
> 
> > diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
> > index d929073..70da532 100644
> > --- a/src/util/sysinfo.c
> > +++ b/src/util/sysinfo.c
> 
> > @@ -326,4 +328,56 @@ virSysinfoFormat(virSysinfoDefPtr def, const char 
> > *prefix)
> > return virBufferContentAndReset(&buf);
> >  }
> >
> > +bool virSysinfoIsEqual(virSysinfoDefPtr src,
> > +   virSysinfoDefPtr dst)
> > +{
> > +bool identical = false;
> > +
> > +if (!src && !dst)
> > +return true;
> > +
> > +if ((src && !dst) || (!src && dst)) {
> > +virSmbiosReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> > + _("Target sysinfo does not match source"));
> > +goto cleanup;
> > +}
> > +
> > +if (src->type != dst->type) {
> > +virSmbiosReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> > + _("Target sysinfo %s does not match source 
> > %s"),
> > + virSysinfoTypeToString(dst->type),
> > + virSysinfoTypeToString(src->type));
> > +goto cleanup;
> > +}
> > +
> > +#define CHECK_FIELD(name, desc) \
> 
> This needs to be '# define CHECK_FIELD(name, desc)' to please syntax-check.
> 
> > +do {\
> > +if (STRNEQ_NULLABLE(src->name, dst->name)) {\
> > +virSmbiosReportError(VIR_ERR_CONFIG_UNSUPPORTED,\
> > + _("Target sysinfo " desc " %s does not 
> > match source %s"), \
> 
> Are you sure that this insertion of dest into the string in this way
> will work properly with gettext? I think
> 
>   _("Target sysinfo %s %s does not match source %s"), desc
> 
> will work better.
> 
> > + src->name, dst->name); \
> 
> You used STRNEQ_NULLABLE as src->name, dst->name could

Re: [libvirt] [PATCH RESEND] lxc: Seperate domain config loading

2011-05-31 Thread Osier Yang

于 2011年05月31日 17:38, Daniel P. Berrange 写道:

On Mon, May 30, 2011 at 05:54:20PM +0800, Osier Yang wrote:

This patch seperate the domain config loading just as qemu driver
does, first loading config of running or trasient domains, then
of persistent inactive domains. And only try to reconnect the
monitor of running domains, so that it won't always throws errors
saying can't connect to domain monitor.

And as "virDomainLoadConfig->virDomainAssignDef->virDomainObjAssignDef",
already do things like "vm->newDef = def", removed the codes
in "lxcReconnectVM" that does the same work.
---
  src/lxc/lxc_driver.c |   31 +++
  1 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 6ee13da..8eb87a2 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1522,6 +1522,10 @@ static int lxcVmStart(virConnectPtr conn,
  if (virDomainObjSetDefTransient(driver->caps, vm, false)<  0)
  goto cleanup;

+/* Write domain status to disk. */
+if (virDomainSaveStatus(driver->caps, driver->stateDir, vm)<  0)
+goto cleanup;
+
  rc = 0;

  cleanup:
@@ -1909,8 +1913,6 @@ lxcReconnectVM(void *payload, const void *name 
ATTRIBUTE_UNUSED, void *opaque)
  {
  virDomainObjPtr vm = payload;
  lxc_driver_t *driver = opaque;
-char *config = NULL;
-virDomainDefPtr tmp;
  lxcDomainObjPrivatePtr priv;

  virDomainObjLock(vm);
@@ -1926,18 +1928,6 @@ lxcReconnectVM(void *payload, const void *name 
ATTRIBUTE_UNUSED, void *opaque)
  goto cleanup;
  }

-if ((config = virDomainConfigFile(driver->stateDir,
-  vm->def->name)) == NULL)
-goto cleanup;
-
-/* Try and load the live config */
-tmp = virDomainDefParseFile(driver->caps, config, 0);
-VIR_FREE(config);
-if (tmp) {
-vm->newDef = vm->def;
-vm->def = tmp;
-}
-
  if (vm->pid != 0) {
  vm->def->id = vm->pid;
  virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
@@ -2030,6 +2020,17 @@ static int lxcStartup(int privileged)
  lxc_driver->caps->privateDataAllocFunc = lxcDomainObjPrivateAlloc;
  lxc_driver->caps->privateDataFreeFunc = lxcDomainObjPrivateFree;

+/* Get all the running persistent or transient configs first */
+if (virDomainLoadAllConfigs(lxc_driver->caps,
+&lxc_driver->domains,
+lxc_driver->stateDir,
+NULL,
+1, NULL, NULL)<  0)
+goto cleanup;
+
+virHashForEach(lxc_driver->domains.objs, lxcReconnectVM, lxc_driver);
+
+/* Then inactive persistent configs */
  if (virDomainLoadAllConfigs(lxc_driver->caps,
  &lxc_driver->domains,
  lxc_driver->configDir,
@@ -2037,8 +2038,6 @@ static int lxcStartup(int privileged)
  0, NULL, NULL)<  0)
  goto cleanup;

-virHashForEach(lxc_driver->domains.objs, lxcReconnectVM, lxc_driver);
-
  lxcDriverUnlock(lxc_driver);

  lxcAutostartConfigs(lxc_driver);


ACK

Daniel


Thanks, applied.

Regards
Osier

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

[libvirt] [PATCH] openvz: fix bridge devices parsing in openvzReadNetworkConf()

2011-05-31 Thread Jean-Baptiste Rouault
strchrnul() was called on the wrong string so it returned
the same result for each iteration.
---
 src/openvz/openvz_conf.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 5f33f75..6e32242 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -237,7 +237,7 @@ openvzReadNetworkConf(virDomainDefPtr def,
 
 /*parse string*/
 do {
-char *next = strchrnul (token, ',');
+char *next = strchrnul (p, ',');
 if (STRPREFIX(p, "ifname=")) {
 /* skip in libvirt */
 } else if (STRPREFIX(p, "host_ifname=")) {
-- 
1.7.1

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


Re: [libvirt] [PATCH 2/4] Allow virsh to pass in a custom XML document for migration

2011-05-31 Thread Matthias Bolte
2011/5/27 Daniel P. Berrange :
> Switch virsh migrate over to use virDomainMigrate2 and
> virDomainMigrateToURI2. This is still compatible with
> older libvirts, because these methods dynamically choose
> whether to perform v1, v2 or v3 migration based on declared
> RPC support from the libvirtd instances
>
> Add a --xml arg which allows the user to pass in a custom
> XML document. This XML document must be ABI compatible
> with the current *live* XML document for the running guest
> on the source host. ABI compatibility will be enforced by
> any driver supporting this function
>
> * tools/virsh.c: Add '--xml' arg to migrate command
> ---
>  tools/virsh.c |   19 +--
>  1 files changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/tools/virsh.c b/tools/virsh.c
> index b43c167..fd32309 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c

> @@ -3850,6 +3858,12 @@ doMigrate (void *opaque)
>     if (vshCommandOptBool (cmd, "copy-storage-inc"))
>         flags |= VIR_MIGRATE_NON_SHARED_INC;
>
> +
> +    if (xmlfile &&
> +        virFileReadAll(xmlfile, 8192, &xml) < 0)
> +        goto out;
> +
> +

Additional empty lines, could be removed here.

ACK.

Matthias

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

Re: [libvirt] [PATCH 1/4] Add an API for comparing the ABI of two guest configurations

2011-05-31 Thread Matthias Bolte
2011/5/27 Daniel P. Berrange :
> To allow a client app to pass in custom XML during migration
> of a guest it is neccessary to ensure the guest ABI remains
> unchanged. The virDomainDefCheckABIStablity method accepts
> two virDomainDefPtr structs and compares everything in them
> that could impact the guest machine ABI
>
> * src/conf/domain_conf.c, src/conf/domain_conf.h,
>  src/libvirt_private.syms: Add virDomainDefCheckABIStablity
> * src/conf/cpu_conf.c, src/conf/cpu_conf.h: Add virCPUDefIsEqual
> * src/util/sysinfo.c, src/util/sysinfo.h: Add virSysinfoIsEqual
> ---
>  src/conf/cpu_conf.c  |   91 +
>  src/conf/cpu_conf.h  |9 +-
>  src/conf/domain_conf.c   |  881 
> +-
>  src/conf/domain_conf.h   |   11 +-
>  src/libvirt_private.syms |1 +
>  src/util/sysinfo.c   |   60 +++-
>  src/util/sysinfo.h   |   11 +-
>  7 files changed, 1051 insertions(+), 13 deletions(-)
>
> diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
> index 98d598a..77d0976 100644
> --- a/src/conf/cpu_conf.c
> +++ b/src/conf/cpu_conf.c

> @@ -446,3 +449,91 @@ no_memory:
> virReportOOMError();
> return -1;
>  }
> +
> +bool
> +virCPUDefIsEqual(virCPUDefPtr src,
> + virCPUDefPtr dst)
> +{
> +bool identical = false;
> +int i;

> +for (i = 0 ; i < src->nfeatures ; i++) {
> +if (STRNEQ(src->features[i].name, dst->features[i].name)) {
> +virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +  _("Target CPU feature %s does not match source 
> %s"),
> +  dst->features[i].name, src->features[i].name);
> +goto cleanup;
> +}

I think you need to compare features[i].policy here too.

> +}
> +
> +identical = true;
> +
> +cleanup:
> +return identical;
> +}

> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 8ff155b..a9a4655 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c

> +static bool virDomainNetDefCheckABIStability(virDomainNetDefPtr src,
> + virDomainNetDefPtr dst)
> +{
> +bool identical = false;
> +
> +if (memcmp(src->mac, dst->mac, VIR_MAC_BUFLEN) != 0) {
> +virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> + _("Target network card mac 
> %02x:%02x:%02x:%02x:%02x:%02x"
> +   "does not match source 
> %02x:%02x:%02x:%02x:%02x:%02x"),
> + dst->mac[0], dst->mac[2], dst->mac[2],

Shouldn't this be dst->mac[0], dst->mac[1], dst->mac[2]?

> + dst->mac[3], dst->mac[4], dst->mac[5],
> + src->mac[0], src->mac[2], src->mac[2],

Copy-n-paste error here.

> diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
> index d929073..70da532 100644
> --- a/src/util/sysinfo.c
> +++ b/src/util/sysinfo.c

> @@ -326,4 +328,56 @@ virSysinfoFormat(virSysinfoDefPtr def, const char 
> *prefix)
> return virBufferContentAndReset(&buf);
>  }
>
> +bool virSysinfoIsEqual(virSysinfoDefPtr src,
> +   virSysinfoDefPtr dst)
> +{
> +bool identical = false;
> +
> +if (!src && !dst)
> +return true;
> +
> +if ((src && !dst) || (!src && dst)) {
> +virSmbiosReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> + _("Target sysinfo does not match source"));
> +goto cleanup;
> +}
> +
> +if (src->type != dst->type) {
> +virSmbiosReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> + _("Target sysinfo %s does not match source %s"),
> + virSysinfoTypeToString(dst->type),
> + virSysinfoTypeToString(src->type));
> +goto cleanup;
> +}
> +
> +#define CHECK_FIELD(name, desc) \

This needs to be '# define CHECK_FIELD(name, desc)' to please syntax-check.

> +do {\
> +if (STRNEQ_NULLABLE(src->name, dst->name)) {\
> +virSmbiosReportError(VIR_ERR_CONFIG_UNSUPPORTED,\
> + _("Target sysinfo " desc " %s does not 
> match source %s"), \

Are you sure that this insertion of dest into the string in this way
will work properly with gettext? I think

  _("Target sysinfo %s %s does not match source %s"), desc

will work better.

> + src->name, dst->name); \

You used STRNEQ_NULLABLE as src->name, dst->name could be NULL, so you
need to use

  NULLSTR(src->name), NULLSTR(dst->name)

here too.

> +}   \
> +} while (0)
> +
> +CHECK_FIELD(bios_vendor, "BIOS vendor");
> +CHECK_FIELD(bios_version, "BIOS version");
> +CHECK_FIELD(bios_date, "BIOS date");
> +CHECK_FIELD(

Re: [libvirt] [PATCH 3/4] Allow custom XML to be passed in during migration

2011-05-31 Thread Matthias Bolte
2011/5/27 Daniel P. Berrange :
> Update the qemuDomainMigrateBegin method so that it accepts
> an optional incoming XML document. This will be validated
> for ABI compatibility against the current domain config,
> and if this check passes, will be passed back out for use
> by the qemuDomainMigratePrepare method on the target
>
> * src/qemu/qemu_domain.c, src/qemu/qemu_domain.h,
>  src/qemu/qemu_migration.c: Allow custom XML to be passed
> ---
>  src/qemu/qemu_domain.c    |   26 ++
>  src/qemu/qemu_domain.h    |    4 
>  src/qemu/qemu_migration.c |   27 ++-
>  3 files changed, 40 insertions(+), 17 deletions(-)
>

ACK.

Matthias

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

Re: [libvirt] [PATCH RESEND] lxc: Seperate domain config loading

2011-05-31 Thread Daniel P. Berrange
On Mon, May 30, 2011 at 05:54:20PM +0800, Osier Yang wrote:
> This patch seperate the domain config loading just as qemu driver
> does, first loading config of running or trasient domains, then
> of persistent inactive domains. And only try to reconnect the
> monitor of running domains, so that it won't always throws errors
> saying can't connect to domain monitor.
> 
> And as "virDomainLoadConfig->virDomainAssignDef->virDomainObjAssignDef",
> already do things like "vm->newDef = def", removed the codes
> in "lxcReconnectVM" that does the same work.
> ---
>  src/lxc/lxc_driver.c |   31 +++
>  1 files changed, 15 insertions(+), 16 deletions(-)
> 
> diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
> index 6ee13da..8eb87a2 100644
> --- a/src/lxc/lxc_driver.c
> +++ b/src/lxc/lxc_driver.c
> @@ -1522,6 +1522,10 @@ static int lxcVmStart(virConnectPtr conn,
>  if (virDomainObjSetDefTransient(driver->caps, vm, false) < 0)
>  goto cleanup;
>  
> +/* Write domain status to disk. */
> +if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
> +goto cleanup;
> +
>  rc = 0;
>  
>  cleanup:
> @@ -1909,8 +1913,6 @@ lxcReconnectVM(void *payload, const void *name 
> ATTRIBUTE_UNUSED, void *opaque)
>  {
>  virDomainObjPtr vm = payload;
>  lxc_driver_t *driver = opaque;
> -char *config = NULL;
> -virDomainDefPtr tmp;
>  lxcDomainObjPrivatePtr priv;
>  
>  virDomainObjLock(vm);
> @@ -1926,18 +1928,6 @@ lxcReconnectVM(void *payload, const void *name 
> ATTRIBUTE_UNUSED, void *opaque)
>  goto cleanup;
>  }
>  
> -if ((config = virDomainConfigFile(driver->stateDir,
> -  vm->def->name)) == NULL)
> -goto cleanup;
> -
> -/* Try and load the live config */
> -tmp = virDomainDefParseFile(driver->caps, config, 0);
> -VIR_FREE(config);
> -if (tmp) {
> -vm->newDef = vm->def;
> -vm->def = tmp;
> -}
> -
>  if (vm->pid != 0) {
>  vm->def->id = vm->pid;
>  virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
> @@ -2030,6 +2020,17 @@ static int lxcStartup(int privileged)
>  lxc_driver->caps->privateDataAllocFunc = lxcDomainObjPrivateAlloc;
>  lxc_driver->caps->privateDataFreeFunc = lxcDomainObjPrivateFree;
>  
> +/* Get all the running persistent or transient configs first */
> +if (virDomainLoadAllConfigs(lxc_driver->caps,
> +&lxc_driver->domains,
> +lxc_driver->stateDir,
> +NULL,
> +1, NULL, NULL) < 0)
> +goto cleanup;
> +
> +virHashForEach(lxc_driver->domains.objs, lxcReconnectVM, lxc_driver);
> +
> +/* Then inactive persistent configs */
>  if (virDomainLoadAllConfigs(lxc_driver->caps,
>  &lxc_driver->domains,
>  lxc_driver->configDir,
> @@ -2037,8 +2038,6 @@ static int lxcStartup(int privileged)
>  0, NULL, NULL) < 0)
>  goto cleanup;
>  
> -virHashForEach(lxc_driver->domains.objs, lxcReconnectVM, lxc_driver);
> -
>  lxcDriverUnlock(lxc_driver);
>  
>  lxcAutostartConfigs(lxc_driver);

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


[libvirt] [PATCH v2] graphics: add support for action_if_connected in qemu

2011-05-31 Thread Michal Privoznik
This option accepts 3 values:
-keep, to keep current client connected (Spice+VNC)
-disconnect, to disconnect client (Spice)
-fail, to fail setting password if there is a client connected (Spice)
---
diff to v1:
-doc added

 docs/formatdomain.html.in |   13 +++--
 docs/schemas/domain.rng   |   16 
 src/conf/domain_conf.c|   44 +---
 src/conf/domain_conf.h|   11 +++
 src/libvirt_private.syms  |2 ++
 src/qemu/qemu_hotplug.c   |   11 ---
 6 files changed, 89 insertions(+), 8 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index f8baffd..25e97a5 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1762,7 +1762,11 @@ qemu-kvm -net nic,model=? /dev/null
   in clear text. The keymap attribute specifies the keymap
   to use. It is possible to set a limit on the validity of the password
   be giving an timestamp passwdValidTo='2010-04-09T15:51:00'
-  assumed to be in UTC. NB, this may not be supported by all hypervisors.
+  assumed to be in UTC. Since 0.8.6
+  The connected attribute allows control of connected client
+  during password changes. VNC accepts keep value only.
+  since 0.9.2
+  NB, this may not be supported by all hypervisors.
   
   Rather than using listen/port, QEMU supports a socket
   attribute for listening on a unix domain socket path.
@@ -1781,7 +1785,12 @@ qemu-kvm -net nic,model=? /dev/null
   in clear text. The keymap attribute specifies the keymap
   to use. It is possible to set a limit on the validity of the password
   be giving an timestamp passwdValidTo='2010-04-09T15:51:00'
-  assumed to be in UTC. NB, this may not be supported by all hypervisors.
+  assumed to be in UTC.Since 0.8.6
+  The connected attribute allows control of connected client
+  during password changes. SPICE accepts keep to keep client
+  connected, disconnect to disconnect client and
+  fail to fail changing password. Since 
0.9.2
+  NB, this may not be supported by all hypervisors.
   "spice" since 0.8.6.
 
 
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index c270815..f0efe60 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -1227,6 +1227,13 @@
   
 
   
+  
+
+  
+keep
+  
+
+  
 
 
   
@@ -1270,6 +1277,15 @@
   
 
   
+  
+
+  
+fail
+disconnect
+keep
+  
+
+  
   
 
   
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fbef61e..571fcf4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -313,6 +313,13 @@ VIR_ENUM_IMPL(virDomainGraphics, 
VIR_DOMAIN_GRAPHICS_TYPE_LAST,
   "desktop",
   "spice")
 
+VIR_ENUM_IMPL(virDomainGraphicsAuthConnected,
+  VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_LAST,
+  "default",
+  "fail",
+  "disconnect",
+  "keep")
+
 VIR_ENUM_IMPL(virDomainGraphicsSpiceChannelName,
   VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST,
   "main",
@@ -3803,9 +3810,12 @@ error:
 
 
 static int
-virDomainGraphicsAuthDefParseXML(xmlNodePtr node, virDomainGraphicsAuthDefPtr 
def)
+virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
+ virDomainGraphicsAuthDefPtr def,
+ int type)
 {
 char *validTo = NULL;
+char *connected = virXMLPropString(node, "connected");
 
 def->passwd = virXMLPropString(node, "passwd");
 
@@ -3846,6 +3856,28 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node, 
virDomainGraphicsAuthDefPtr de
 def->expires = 1;
 }
 
+if (connected) {
+int action = virDomainGraphicsAuthConnectedTypeFromString(connected);
+if (action < 0) {
+virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown connected value %s"),
+ connected);
+VIR_FREE(connected);
+return -1;
+}
+VIR_FREE(connected);
+
+/* VNC supports connected='keep' only */
+if (type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
+action != VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_KEEP) {
+virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("VNC supports connected='keep' only"));
+return -1;
+}
+
+def->connected = action;
+}
+
 return 0;
 }
 
@@ -3915,7 +3947,8 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) {
 !def->data.vnc.listenAddr[0])
 VIR_FREE(def->data.vnc.listenAddr);
 
-if (virDomainGraphicsAuthDefParseXML(node, &def->data.vnc.auth) < 0)
+ 

Re: [libvirt] [PATCH] Workaround apibuild.py warnings

2011-05-31 Thread Matthias Bolte
2011/5/31 Daniel Veillard :
> On Sun, May 29, 2011 at 05:14:46PM +0200, Matthias Bolte wrote:
>> Parsing ./../include/libvirt/libvirt.h
>> Misformatted macro comment for _virSchedParameter
>>   Expecting '* _virSchedParameter:' got '* virSchedParameter:'
>> Misformatted macro comment for _virBlkioParameter
>>   Expecting '* _virBlkioParameter:' got '* virBlkioParameter:'
>> Misformatted macro comment for _virMemoryParameter
>>   Expecting '* _virMemoryParameter:' got '* virMemoryParameter:'
>>
>> Replace '#define' with '# define' for the backward compatibility
>> defines to keep apibuild.py from parsing them and expecting
>> documentation comments for them.
>> ---
>>  include/libvirt/libvirt.h.in |    6 +++---
>>  1 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
>> index 8058229..424e49b 100644
>> --- a/include/libvirt/libvirt.h.in
>> +++ b/include/libvirt/libvirt.h.in
>> @@ -2569,7 +2569,7 @@ typedef enum {
>>   * Provided for backwards compatibility; virTypedParameter is the
>>   * preferred alias since 0.9.2.
>>   */
>> -#define _virSchedParameter _virTypedParameter
>> +# define _virSchedParameter _virTypedParameter
>>  typedef struct _virTypedParameter virSchedParameter;
>>
>>  /**
>> @@ -2613,7 +2613,7 @@ typedef enum {
>>   * Provided for backwards compatibility; virTypedParameter is the
>>   * preferred alias since 0.9.2.
>>   */
>> -#define _virBlkioParameter _virTypedParameter
>> +# define _virBlkioParameter _virTypedParameter
>>  typedef struct _virTypedParameter virBlkioParameter;
>>
>>  /**
>> @@ -2657,7 +2657,7 @@ typedef enum {
>>   * Provided for backwards compatibility; virTypedParameter is the
>>   * preferred alias since 0.9.2.
>>   */
>> -#define _virMemoryParameter _virTypedParameter
>> +# define _virMemoryParameter _virTypedParameter
>>  typedef struct _virTypedParameter virMemoryParameter;
>
>  That's a bit odd ... it should be possibe to avoid those complaints
> from the generator, I can't look right now though
>
> Daniel

Well, yes this was more like a hackish approach. Here's a v2 that
allows apibuild.py to ignore macros like it can already ignore
functions.

Matthias
From ac679b3a929c22ae6cd3bf8733f57dca408f4e3b Mon Sep 17 00:00:00 2001
From: Matthias Bolte 
Date: Tue, 31 May 2011 10:41:37 +0200
Subject: [PATCH] Ignore backward compatibility macros in apibuild.py

This fixes this three warnings from the parser by allowing the parser
to ignore some macros in the same way as it can ignore functions.

Parsing ./../include/libvirt/libvirt.h
Misformatted macro comment for _virSchedParameter
 Expecting '* _virSchedParameter:' got '* virSchedParameter:'
Misformatted macro comment for _virBlkioParameter
 Expecting '* _virBlkioParameter:' got '* virBlkioParameter:'
Misformatted macro comment for _virMemoryParameter
 Expecting '* _virMemoryParameter:' got '* virMemoryParameter:'
---
 docs/apibuild.py |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/docs/apibuild.py b/docs/apibuild.py
index 2ab0599..f160c47 100755
--- a/docs/apibuild.py
+++ b/docs/apibuild.py
@@ -58,6 +58,12 @@ ignored_functions = {
   "virEventRemoveTimeout": "internal function in event.c",
 }
 
+ignored_macros = {
+  "_virSchedParameter": "backward compatibility macro for virTypedParameter",
+  "_virBlkioParameter": "backward compatibility macro for virTypedParameter",
+  "_virMemoryParameter": "backward compatibility macro for virTypedParameter",
+}
+
 def escape(raw):
 raw = string.replace(raw, '&', '&')
 raw = string.replace(raw, '<', '<')
@@ -716,8 +722,12 @@ class CParser:
 # Parse a comment block associate to a macro
 #
 def parseMacroComment(self, name, quiet = 0):
+global ignored_macros
+
 if name[0:2] == '__':
 quiet = 1
+if ignored_macros.has_key(name):
+quiet = 1
 
 args = []
 desc = ""
-- 
1.7.0.4

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

Re: [libvirt] [PATCH] Fix virTypedParameter alias comments

2011-05-31 Thread Matthias Bolte
2011/5/31 Daniel Veillard :
> On Sun, May 29, 2011 at 05:14:25PM +0200, Matthias Bolte wrote:
>> Remove the Domain prefix from the comments.
>> ---
>>  include/libvirt/libvirt.h.in |   18 +-
>>  1 files changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
>> index cbd8dbb..8058229 100644
>> --- a/include/libvirt/libvirt.h.in
>> +++ b/include/libvirt/libvirt.h.in
>> @@ -2538,7 +2538,7 @@ int virDomainInjectNMI(virDomainPtr domain, unsigned 
>> int flags);
>>
>>
>>  /**
>> - * virDomainSchedParameterType:
>> + * virSchedParameterType:
>>   *
>>   * A scheduler parameter field type.  Provided for backwards
>>   * compatibility; virTypedParameterType is the preferred enum since
>> @@ -2563,9 +2563,9 @@ typedef enum {
>>  #define VIR_DOMAIN_SCHED_FIELD_LENGTH VIR_TYPED_PARAM_FIELD_LENGTH
>>
>>  /**
>> - * virDomainSchedParameter:
>> + * virSchedParameter:
>>   *
>> - * a virDomainSchedParameter is the set of scheduler parameters.
>> + * a virSchedParameter is the set of scheduler parameters.
>>   * Provided for backwards compatibility; virTypedParameter is the
>>   * preferred alias since 0.9.2.
>>   */
>> @@ -2582,7 +2582,7 @@ typedef struct _virTypedParameter virSchedParameter;
>>  typedef virSchedParameter *virSchedParameterPtr;
>>
>>  /**
>> - * virDomainBlkioParameterType:
>> + * virBlkioParameterType:
>>   *
>>   * A blkio parameter field type.  Provided for backwards
>>   * compatibility; virTypedParameterType is the preferred enum since
>> @@ -2607,9 +2607,9 @@ typedef enum {
>>  #define VIR_DOMAIN_BLKIO_FIELD_LENGTH VIR_TYPED_PARAM_FIELD_LENGTH
>>
>>  /**
>> - * virDomainBlkioParameter:
>> + * virBlkioParameter:
>>   *
>> - * a virDomainBlkioParameter is the set of blkio parameters.
>> + * a virBlkioParameter is the set of blkio parameters.
>>   * Provided for backwards compatibility; virTypedParameter is the
>>   * preferred alias since 0.9.2.
>>   */
>> @@ -2626,7 +2626,7 @@ typedef struct _virTypedParameter virBlkioParameter;
>>  typedef virBlkioParameter *virBlkioParameterPtr;
>>
>>  /**
>> - * virDomainMemoryParameterType:
>> + * virMemoryParameterType:
>>   *
>>   * A memory parameter field type.  Provided for backwards
>>   * compatibility; virTypedParameterType is the preferred enum since
>> @@ -2651,9 +2651,9 @@ typedef enum {
>>  #define VIR_DOMAIN_MEMORY_FIELD_LENGTH VIR_TYPED_PARAM_FIELD_LENGTH
>>
>>  /**
>> - * virDomainMemoryParameter:
>> + * virMemoryParameter:
>>   *
>> - * a virDomainMemoryParameter is the set of scheduler parameters.
>> + * a virMemoryParameter is the set of scheduler parameters.
>>   * Provided for backwards compatibility; virTypedParameter is the
>>   * preferred alias since 0.9.2.
>>   */
>
>  Right I remember seeing 3-4 comment warnng from generator.py when
>  doing "make dist" I think that's those ones,
>
>  ACK,
>
> Daniel

Thanks, pushed.

Matthias

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

Re: [libvirt] [PATCH] openvz: Automatically disable on non-Linux systems

2011-05-31 Thread Matthias Bolte
2011/5/31 Daniel Veillard :
> On Sun, May 29, 2011 at 05:12:57PM +0200, Matthias Bolte wrote:
>> As OpenVZ is Linux specific.
>> ---
>>  configure.ac |   20 +++-
>>  1 files changed, 19 insertions(+), 1 deletions(-)
>>
>> diff --git a/configure.ac b/configure.ac
>> index 55ae791..b2ba930 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -255,7 +255,7 @@ AC_ARG_WITH([qemu],
>>  AC_ARG_WITH([uml],
>>    AC_HELP_STRING([--with-uml], [add UML support 
>> @<:@default=check@:>@]),[],[with_uml=check])
>>  AC_ARG_WITH([openvz],
>> -  AC_HELP_STRING([--with-openvz], [add OpenVZ support 
>> @<:@default=yes@:>@]),[],[with_openvz=yes])
>> +  AC_HELP_STRING([--with-openvz], [add OpenVZ support 
>> @<:@default=check@:>@]),[],[with_openvz=check])
>>  AC_ARG_WITH([vmware],
>>    AC_HELP_STRING([--with-vmware], [add VMware support 
>> @<:@default=yes@:>@]),[],[with_vmware=yes])
>>  AC_ARG_WITH([libssh2],
>> @@ -348,16 +348,34 @@ AC_PATH_PROG([EBTABLES_PATH], [ebtables], 
>> /sbin/ebtables, [/usr/sbin:$PATH])
>>  AC_DEFINE_UNQUOTED([EBTABLES_PATH], "$EBTABLES_PATH", [path to ebtables 
>> binary])
>>
>>
>> +dnl
>> +dnl Checks for the OpenVZ driver
>> +dnl
>> +
>> +if test "$with_openvz" = "check"; then
>> +    with_openvz=$with_linux
>> +fi
>> +
>> +if test "$with_openvz" = "yes" && test "$with_linux" = "no"; then
>> +    AC_MSG_ERROR([The OpenVZ driver can be enabled on Linux only.])
>> +fi
>> +
>>  if test "$with_openvz" = "yes"; then
>>      AC_DEFINE_UNQUOTED([WITH_OPENVZ], 1, [whether OpenVZ driver is enabled])
>>  fi
>>  AM_CONDITIONAL([WITH_OPENVZ], [test "$with_openvz" = "yes"])
>>
>> +
>> +dnl
>> +dnl Checks for the VMware Workstation/Player driver
>> +dnl
>> +
>>  if test "$with_vmware" = "yes"; then
>>      AC_DEFINE_UNQUOTED([WITH_VMWARE], 1, [whether VMware driver is enabled])
>>  fi
>>  AM_CONDITIONAL([WITH_VMWARE], [test "$with_vmware" = "yes"])
>>
>> +
>>  dnl
>>  dnl check for XDR
>>  dnl
>
>  ACK,
>
> Daniel

Thanks, pushed.

Matthias

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

[libvirt] [PATCH] util: Fix incorrect error in PCI functions.

2011-05-31 Thread Osier Yang
Substitute VIR_ERR_NO_SUPPORT with VIR_ERR_INTERNAL_ERROR. Error
like following is not what user want to see.

error : pciDeviceIsAssignable:1487 : this function is not supported
by the connection driver: Device :07:10.0 is behind a switch
lacking ACS and cannot be assigned

---
 src/util/pci.c |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/util/pci.c b/src/util/pci.c
index 9cc7b20..8baa3d8 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -614,7 +614,7 @@ pciTrySecondaryBusReset(pciDevice *dev,
  * are not in use by the host or other guests.
  */
 if ((conflict = pciBusContainsActiveDevices(dev, inactiveDevs))) {
-pciReportError(VIR_ERR_NO_SUPPORT,
+pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Active %s devices on bus with %s, not doing bus 
reset"),
conflict->name, dev->name);
 return -1;
@@ -624,7 +624,7 @@ pciTrySecondaryBusReset(pciDevice *dev,
 if (pciGetParentDevice(dev, &parent) < 0)
 return -1;
 if (!parent) {
-pciReportError(VIR_ERR_NO_SUPPORT,
+pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to find parent device for %s"),
dev->name);
 return -1;
@@ -637,7 +637,7 @@ pciTrySecondaryBusReset(pciDevice *dev,
  * are multiple devices/functions
  */
 if (pciRead(dev, 0, config_space, PCI_CONF_LEN) < 0) {
-pciReportError(VIR_ERR_NO_SUPPORT,
+pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to read PCI config space for %s"),
dev->name);
 goto out;
@@ -657,7 +657,7 @@ pciTrySecondaryBusReset(pciDevice *dev,
 usleep(200 * 1000); /* sleep 200ms */
 
 if (pciWrite(dev, 0, config_space, PCI_CONF_LEN) < 0) {
-pciReportError(VIR_ERR_NO_SUPPORT,
+pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to restore PCI config space for %s"),
dev->name);
 goto out;
@@ -683,7 +683,7 @@ pciTryPowerManagementReset(pciDevice *dev)
 
 /* Save and restore the device's config space. */
 if (pciRead(dev, 0, &config_space[0], PCI_CONF_LEN) < 0) {
-pciReportError(VIR_ERR_NO_SUPPORT,
+pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to read PCI config space for %s"),
dev->name);
 return -1;
@@ -703,7 +703,7 @@ pciTryPowerManagementReset(pciDevice *dev)
 usleep(10 * 1000); /* sleep 10ms */
 
 if (pciWrite(dev, 0, &config_space[0], PCI_CONF_LEN) < 0) {
-pciReportError(VIR_ERR_NO_SUPPORT,
+pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to restore PCI config space for %s"),
dev->name);
 return -1;
@@ -770,7 +770,7 @@ pciResetDevice(pciDevice *dev,
 
 if (ret < 0) {
 virErrorPtr err = virGetLastError();
-pciReportError(VIR_ERR_NO_SUPPORT,
+pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Unable to reset PCI device %s: %s"),
dev->name,
err ? err->message : _("no FLR, PM reset or bus reset 
available"));
@@ -1324,7 +1324,7 @@ pciGetDevice(unsigned domain,
 product = pciReadDeviceID(dev, "device");
 
 if (!vendor || !product) {
-pciReportError(VIR_ERR_NO_SUPPORT,
+pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to read product/vendor ID for %s"),
dev->name);
 VIR_FREE(product);
@@ -1588,7 +1588,7 @@ pciDeviceIsBehindSwitchLackingACS(pciDevice *dev)
 if (dev->bus == 0)
 return 0;
 else {
-pciReportError(VIR_ERR_NO_SUPPORT,
+pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to find parent device for %s"),
dev->name);
 return -1;
@@ -1643,7 +1643,7 @@ int pciDeviceIsAssignable(pciDevice *dev,
 VIR_DEBUG("%s %s: strict ACS check disabled; device assignment 
allowed",
   dev->id, dev->name);
 } else {
-pciReportError(VIR_ERR_NO_SUPPORT,
+pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Device %s is behind a switch lacking ACS and "
  "cannot be assigned"),
dev->name);
-- 
1.7.4

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