]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
11 years agobuild: work around broken sasl header
Eric Blake [Wed, 29 May 2013 19:57:01 +0000 (13:57 -0600)]
build: work around broken sasl header

Compilation on cygwin failed due to a bug in the sasl headers
present on that platform (libsasl2-devel 2.1.26):

In file included from rpc/virnetserverclient.c:27:0:
/usr/include/sasl/sasl.h:230:38: error: expected declaration specifiers or '...' before 'size_t'

Upstream is aware of their bug:
https://bugzilla.cyrusimap.org/show_bug.cgi?id=3759

* src/rpc/virnetserverclient.c (includes): Ensure size_t is
defined before using sasl.h.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agobuild: fix typo in earlier commit
Eric Blake [Wed, 29 May 2013 17:06:39 +0000 (11:06 -0600)]
build: fix typo in earlier commit

Bummer, I committed, then fixed a typo, then tested, and forgot to
amend the commit before pushing 7d21d6b6.

* src/rpc/virnettlscontext.c (includes): Use correct spelling.

11 years agovirsh: migrate: Don't disallow --p2p and --migrateuri
Cole Robinson [Tue, 28 May 2013 19:37:53 +0000 (15:37 -0400)]
virsh: migrate: Don't disallow --p2p and --migrateuri

Because it's a valid combination. p2p still uses a separate channel
for qemu migration, so there's value in letting the user specify a manual
migrate URI for overriding auto-port, or libvirt's FQDN lookup.

What _isn't_ allowed is --migrateuri and TUNNELLED, since there is
no separate migration channel. Disallow that instead

11 years agoqemu: migration: error if tunnelled + storage specified
Cole Robinson [Tue, 28 May 2013 19:27:45 +0000 (15:27 -0400)]
qemu: migration: error if tunnelled + storage specified

Since as the code indicates it doesn't work yet, so let's be
explicit about it.

11 years agoqemu: migration: Improve p2p error if we can't open conn
Cole Robinson [Tue, 28 May 2013 19:12:01 +0000 (15:12 -0400)]
qemu: migration: Improve p2p error if we can't open conn

By actually showing the Open() error to the user

11 years agobuild: fix build without libvirtd
Eric Blake [Wed, 29 May 2013 15:05:33 +0000 (09:05 -0600)]
build: fix build without libvirtd

Building when configured --with-libvirtd=no fails with:

In file included from ../src/qemu/qemu_command.h:30:0,
                 from testutilsqemu.h:4,
                 from networkxml2xmltest.c:14:
../src/qemu/qemu_conf.h:175:5: error: expected specifier-qualifier-list before 'virStateInhibitCallback'

* src/libvirt_internal.h (virStateInhibitCallback): Move outside
of conditional.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agobuild: fix build with newer gnutls
Eric Blake [Wed, 29 May 2013 03:15:08 +0000 (21:15 -0600)]
build: fix build with newer gnutls

Building with gnutls 3.2.0 (such as shipped with current cygwin) fails
with:

rpc/virnettlscontext.c: In function 'virNetTLSSessionGetKeySize':
rpc/virnettlscontext.c:1358:5: error: implicit declaration of function 'gnutls_cipher_get_key_size' [-Wimplicit-function-declaration]

Yeah, it's stupid that gnutls broke API by moving their declaration
into a new header without including that header from the old one,
but it's easy enough to work around, all without breaking on gnutls
1.4.1 (hello RHEL 5) that lacked the new header.

* configure.ac (gnutls): Check for <gnutls/crypto.h>.
* src/rpc/virnettlscontext.c (includes): Include additional header.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agostorage_conf: Use uid_t/gid_t instead of int to cast the value
Osier Yang [Wed, 22 May 2013 12:05:22 +0000 (20:05 +0800)]
storage_conf: Use uid_t/gid_t instead of int to cast the value

And error out if the casted value is not same with the original
one, which prevents the bug on platform(s) where uid_t/gid_t
has different size with long.

11 years agostorage_conf: Improve error messages
Osier Yang [Wed, 22 May 2013 12:05:21 +0000 (20:05 +0800)]
storage_conf: Improve error messages

virStoragePoolDefParseSource:
  * Better error message

virStoragePoolObjLoad:
  * Break the line line

11 years agostorage_conf: Use NULLSTR instead
Osier Yang [Wed, 22 May 2013 12:05:19 +0000 (20:05 +0800)]
storage_conf: Use NULLSTR instead

11 years agostorage_conf: Improve the memory deallocation of virStorageVolDefParseXML
Osier Yang [Wed, 22 May 2013 12:05:18 +0000 (20:05 +0800)]
storage_conf: Improve the memory deallocation of virStorageVolDefParseXML

Changes:
  * Add a new goto label "error"
  * Free the strings at "cleanup"
  * Remove the unnecessary frees

11 years agostorage_conf: Improve the memory deallocation of pool def parsing
Osier Yang [Wed, 29 May 2013 10:04:33 +0000 (18:04 +0800)]
storage_conf: Improve the memory deallocation of pool def parsing

Changes:
    * Free all the strings at "cleanup", instead of freeing them
      in the middle
    * Remove xmlFree
    * s/tmppath/target_path/, to make it more sensible
    * Add new goto label "error"

11 years agoqemuOpenVhostNet: Decrease vhostfdSize on open failure
Michal Privoznik [Fri, 24 May 2013 12:45:06 +0000 (14:45 +0200)]
qemuOpenVhostNet: Decrease vhostfdSize on open failure

Currently, if there's an error opening /dev/vhost-net (e.g. because
it doesn't exist) but it's not required we proceed with vhostfd array
filled with -1 and vhostfdSize unchanged. Later, when constructing
the qemu command line only non-negative items within vhostfd array
are taken into account. This means, vhostfdSize may be greater than
the actual count of non-negative items in vhostfd array. This results
in improper command line arguments being generated, e.g.:

-netdev tap,fd=21,id=hostnet0,vhost=on,vhostfd=(null)

11 years agobuild: fix build with older gcc
Eric Blake [Tue, 28 May 2013 23:30:30 +0000 (17:30 -0600)]
build: fix build with older gcc

gcc 4.1.2 (hello, RHEL 5!) fails to build on 32-bit platforms with:

conf/domain_conf.c: In function 'virDomainDefParseXML':
conf/domain_conf.c:10581: warning: integer constant is too large for 'long' type

Problem introduced in commit f8e3221f9.

* src/conf/domain_conf.c (virDomainDefParseXML): Mark large constants.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agobuild: drop unused variable
Eric Blake [Tue, 28 May 2013 23:11:48 +0000 (17:11 -0600)]
build: drop unused variable

Compilation for mingw failed:

../../src/util/virutil.c: In function 'virGetWin32DirectoryRoot':
../../src/util/virutil.c:1094:9: error: unused variable 'ret' [-Werror=unused-variable]

* src/util/virutil.c (virGetWin32DirectoryRoot): Silence compiler
warning.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agosyntax: fix broken error message in previous patch
Eric Blake [Tue, 28 May 2013 15:49:53 +0000 (09:49 -0600)]
syntax: fix broken error message in previous patch

Osier Yang pointed out that I introduced a syntax error in my
syntax check (I really shouldn't make last-minute changes without
testing them....).

/bin/sh: -c: line 2: syntax error near unexpected token `;'
/bin/sh: -c: line 2: `  { echo 'maint.mk: incorrect whitespace, see HACKING for rules' 2>&; \'
make: *** [bracket-spacing-check] Error 1

* cfg.mk (bracket-spacing-check): Fix copy-and-paste error.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoqemu: Don't report error on successful media eject
Cole Robinson [Tue, 28 May 2013 14:23:00 +0000 (10:23 -0400)]
qemu: Don't report error on successful media eject

If we are just ejecting media, ret == -1 even after the retry loop
determines that the tray is open, as requested. This means media
disconnect always report's error.

Fix it, and fix some other mini issues:

- Don't overwrite the 'eject' error message if the retry loop fails
- Move the retries decrement inside the loop, otherwise the final loop
  might succeed, yet retries == 0 and we will raise error
- Setting ret = -1 in the disk->src check is unneeded
- Fix comment typos

cc: mprivozn@redhat.com

11 years agosyntax-check: mandate space after mid-line semicolon
Eric Blake [Fri, 24 May 2013 16:43:45 +0000 (10:43 -0600)]
syntax-check: mandate space after mid-line semicolon

Enforce the style cleanup in the previous patch.

* build-aux/bracket-spacing.pl: Enforce trailing spacing.
* cfg.mk (bracket-spacing-check): Tweak error wording.
* docs/hacking.html.in: Document the rule.
* HACKING: Regenerate.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agosyntax: prefer space after semicolon in for loop
Eric Blake [Fri, 24 May 2013 16:58:25 +0000 (10:58 -0600)]
syntax: prefer space after semicolon in for loop

I noticed several unusual spacings in for loops, and decided to
fix them up.  See the next commit for the syntax check that found
all of these.

* examples/domsuspend/suspend.c (main): Fix spacing.
* python/libvirt-override.c: Likewise.
* src/conf/interface_conf.c: Likewise.
* src/security/virt-aa-helper.c: Likewise.
* src/util/virconf.c: Likewise.
* src/util/virhook.c: Likewise.
* src/util/virlog.c: Likewise.
* src/util/virsocketaddr.c: Likewise.
* src/util/virsysinfo.c: Likewise.
* src/util/viruuid.c: Likewise.
* src/vbox/vbox_tmpl.c: Likewise.
* src/xen/xen_hypervisor.c: Likewise.
* tools/virsh-domain-monitor.c (vshDomainStateToString): Drop
default case, to let compiler check us.
* tools/virsh-domain.c (vshDomainVcpuStateToString): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoutil: fix the VIR_STRDUP when src is NULL
yangdongsheng [Tue, 28 May 2013 07:13:17 +0000 (15:13 +0800)]
util: fix the VIR_STRDUP when src is NULL

When src is NULL, VIR_STRDUP will return 0 directly.
This patch will set dest to NULL before VIR_STRDUP return.

Example:
[root@yds-pc libvirt]# virsh
Welcome to virsh, the virtualization interactive terminal.

Type: 'help' for help with commands
'quit' to quit

virsh # connect
error: Failed to connect to the hypervisor
error: internal error Unable to parse URI �N�*

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoqemu: Fix build without gnutls
Jiri Denemark [Mon, 27 May 2013 08:19:36 +0000 (10:19 +0200)]
qemu: Fix build without gnutls

"error" label in qemuMigrationCookieGraphicsAlloc is now used
unconditionally thanks to VIR_STRDUP.

11 years agoqemu: save domain state to XML after reboot
Sergey Fionov [Sat, 18 May 2013 11:47:51 +0000 (15:47 +0400)]
qemu: save domain state to XML after reboot

Currently qemuDomainReboot() does reboot in two phases:
qemuMonitorSystemPowerdown() and qemuProcessFakeReboot().

qemuMonitorSystemPowerdown() shutdowns the domain and saves domain
state/reason as VIR_DOMAIN_SHUTDOWN_UNKNOWN.

qemuProcessFakeReboot() sets domain state/reason to
VIR_DOMAIN_RESUMED_UNPAUSED but does not save domain state changes.

Subsequent restart of libvirtd leads to restoring domain state/reason to
saved that is VIR_DOMAIN_SHUTDOWN_UNKNOWN and to automatic shutdown of
the domain. This commit adds virDomainSaveStatus() into
qemuProcessFakeReboot() to avoid unexpected shutdowns.

11 years agoesx: Fix dynamic VI object type detection
Matthias Bolte [Sat, 18 May 2013 09:45:04 +0000 (11:45 +0200)]
esx: Fix dynamic VI object type detection

VI objects support inheritance with subtype polymorphism. For example the
FileInfo object type is extended by FloppyImageFileInfo, FolderFileInfo
etc. Then SearchDatastore_Task returns an array of FileInfo objects and
depending on the represented file the FileInfo is actually a FolderFileInfo
or FloppyImageFileInfo etc. The actual type information is stored as XML
attribute that allows clients such as libvirt to distinguish between the
actual types. esxVI_GetActualObjectType is used to extract the actual type.

I assumed that this mechanism would be used for all VI object types that
have subtypes. But this is not the case. It seems only to be used for types
that are actually used as generic base type such as FileInfo. But it is not
used for types that got extended later such as ElementDescription that was
extended by ExtendedElementDescription (added in vSphere API 4.0) or that
are not meant to be used with subtype polymorphism.

This breaks the deserialization of types that contain ElementDescription
properties such as PerfCounterInfo or ChoiceOption, because the code
expects an ElementDescription object to have an XML attribute named type
that is not present, since ExtendedElementDescription was added to the
esx_vi_generator.input in commit 60f0f55ee4686fecbffc5fb32f90863427d02a14.
This in turn break virtual machine question handling and auto answering.

Fix this by using the base type if no XML type attribute is present.

11 years agospec: Build vbox packages only for x86 architectures
Viktor Mihajlovski [Fri, 24 May 2013 13:44:19 +0000 (15:44 +0200)]
spec: Build vbox packages only for x86 architectures

Commit 6ab6bc19f03513fd87d29ecfd405bb7f4a7de114 has introduced separate
daemon/driver packages for vbox. These should only be built for x86
architectures which is done hereby.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
11 years agosecurity_dac: Fix the coding style
Osier Yang [Fri, 24 May 2013 15:31:28 +0000 (23:31 +0800)]
security_dac: Fix the coding style

Pushed under trivial rule.

11 years agoAdapt to new VIR_STRNDUP behavior
Michal Privoznik [Fri, 24 May 2013 09:21:36 +0000 (11:21 +0200)]
Adapt to new VIR_STRNDUP behavior

With previous patch, we accept negative value as length of string to
duplicate. So there is no need to pass strlen(src) in case we want to do
duplicate the whole string.

11 years agovirStrndup: Accept negative values as string length
Michal Privoznik [Fri, 24 May 2013 08:45:57 +0000 (10:45 +0200)]
virStrndup: Accept negative values as string length

It may shorten the code a bit as the following pattern:

  VIR_STRNDUP(dst, src, cond ? n : strlen(src))

is used on several places among our code. However, we can
move the strlen into virStrndup and thus write just:

  VIR_STRNDUP(dst, src, cond ? n : -1)

11 years agostorage_conf: Fix the error type
Osier Yang [Wed, 22 May 2013 12:05:16 +0000 (20:05 +0800)]
storage_conf: Fix the error type

s/VIR_ERR_INTERNAL_ERROR/VIR_ERR_XML_ERROR/.

11 years agostorage_conf: Put "%s" at the same line with error type
Osier Yang [Wed, 22 May 2013 12:05:15 +0000 (20:05 +0800)]
storage_conf: Put "%s" at the same line with error type

Trivial, but it allows the "error message" to have more spaces.

11 years agostorage_conf: Use xmlStrEqual instead of STREQ
Osier Yang [Wed, 22 May 2013 12:05:14 +0000 (20:05 +0800)]
storage_conf: Use xmlStrEqual instead of STREQ

And improve the error message

11 years agostorage_conf: Remove the useless casting
Osier Yang [Wed, 22 May 2013 12:05:13 +0000 (20:05 +0800)]
storage_conf: Remove the useless casting

11 years agostorage_conf: Don't leak "uuid" in virStoragePoolDefParseAuthCephx
Osier Yang [Wed, 22 May 2013 12:05:12 +0000 (20:05 +0800)]
storage_conf: Don't leak "uuid" in virStoragePoolDefParseAuthCephx

Any string returned from virXPathString should be freed.

11 years agostorage_conf: Fix the wrong error message
Osier Yang [Wed, 22 May 2013 12:05:11 +0000 (20:05 +0800)]
storage_conf: Fix the wrong error message

It's for parsing "login" attribute of "auth".

11 years agosyntax-check: ignore all quoted strings in bracket-spacing
Ján Tomko [Fri, 24 May 2013 08:50:42 +0000 (10:50 +0200)]
syntax-check: ignore all quoted strings in bracket-spacing

Ignore strings with an escaped double quote too.

This removes the need for special handling of quotes in the
semicolon check.

11 years agonwfilter: Remove error report in virNWFilterDHCPSnoopEnd
Stefan Berger [Fri, 24 May 2013 12:01:03 +0000 (08:01 -0400)]
nwfilter: Remove error report in virNWFilterDHCPSnoopEnd

Remove error reporting when calling the virNWFilterDHCPSnoopEnd
function with an interface for which no thread is snooping traffic.

Document the usage of this function.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
11 years agoFix blkdeviotune for shutoff domain
Martin Kletzander [Thu, 23 May 2013 11:07:34 +0000 (13:07 +0200)]
Fix blkdeviotune for shutoff domain

Function qemuDomainSetBlockIoTune() was checking QEMU capabilities
even when !(flags & VIR_DOMAIN_AFFECT_LIVE) and the domain was
shutoff, resulting in the following problem:

 virsh # domstate asdf; blkdeviotune asdf vda --write-bytes-sec 100
 shut off

 error: Unable to change block I/O throttle
 error: unsupported configuration: block I/O throttling not supported with this QEMU binary

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

11 years agocgroups: Do not enforce nonexistent controllers
Viktor Mihajlovski [Thu, 23 May 2013 13:26:31 +0000 (15:26 +0200)]
cgroups: Do not enforce nonexistent controllers

Currently, the controllers argument to virCgroupDetect acts both as
a result filter and a required controller specification, which is
a bit overloaded. If both functionalities are needed, it would be
better to have them seperated into a filter and a requirement mask.
The only situation where it is used today is to ensure that only
CPU related controllers are used for the VCPU directories. But here
we clearly do not want to enforce the existence of cpu, cpuacct and
specifically not cpuset at the same time.
This commit changes the semantics of controllers to "filter only".
Should a required mask ever be needed, more work will have to be done.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
11 years agovirsh: Fix regression of vol-resize
Osier Yang [Fri, 24 May 2013 03:59:14 +0000 (11:59 +0800)]
virsh: Fix regression of vol-resize

Introduced by commit 1daa4ba33acf. vshCommandOptStringReq returns
0 on *success* or the option is not required && not present, both
are right result. Error out when returning 0 is not correct.
the caller, it doesn't have to check wether it

11 years agoIntroduce syntax-check rule to prefer VIR_STRDUP over strdup
Michal Privoznik [Thu, 4 Apr 2013 18:16:43 +0000 (20:16 +0200)]
Introduce syntax-check rule to prefer VIR_STRDUP over strdup

11 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in tools/virsh.c
Michal Privoznik [Thu, 23 May 2013 07:51:59 +0000 (09:51 +0200)]
Adapt to VIR_STRDUP and VIR_STRNDUP in tools/virsh.c

11 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/util/*
Michal Privoznik [Fri, 24 May 2013 07:19:51 +0000 (09:19 +0200)]
Adapt to VIR_STRDUP and VIR_STRNDUP in src/util/*

11 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/util/vircgroup.c
Michal Privoznik [Fri, 24 May 2013 07:19:34 +0000 (09:19 +0200)]
Adapt to VIR_STRDUP and VIR_STRNDUP in src/util/vircgroup.c

This commit is separate due to unusual paradigm compared to the
most source files.

11 years agovirCgroupAddTaskStrController: s/-1/-ENOMEM/
Michal Privoznik [Fri, 24 May 2013 07:49:54 +0000 (09:49 +0200)]
virCgroupAddTaskStrController: s/-1/-ENOMEM/

Within whole vircgroup.c we 'return -errno', e.g. 'return -ENOMEM'.
However, in this specific function virCgroupAddTaskStrController
we weren't returning -ENOMEM but -1 despite fact that later in
the function we are returning one of errno values indeed.

11 years agoxen: Resolve Coverity FORWARD_NULL issue
John Ferlan [Thu, 23 May 2013 15:07:36 +0000 (11:07 -0400)]
xen: Resolve Coverity FORWARD_NULL issue

Commit '18b14012' refactored the Xen code resulting in a Coverity
warning about possible NULL reference if the path where the XM driver
takes puts the def on it's list.  Moved/duplicated the virGetDomain()
call to pacify the possible NULL deref.

11 years agodocs: domain: /dev/urandom isn't a valid rng patch
Cole Robinson [Thu, 23 May 2013 18:37:08 +0000 (14:37 -0400)]
docs: domain: /dev/urandom isn't a valid rng patch

Only /dev/random and /dev/hwrng are accepted, list them explicitly.

11 years agoconf: add missing OOM errors
Ján Tomko [Wed, 22 May 2013 10:56:37 +0000 (12:56 +0200)]
conf: add missing OOM errors

11 years agoqemu: fix NBD migration to hosts with IPv6 enabled
Ján Tomko [Thu, 23 May 2013 13:51:05 +0000 (15:51 +0200)]
qemu: fix NBD migration to hosts with IPv6 enabled

Since f03dcc5 we use [::] as the listening address both on qemu
command line in -incoming and in nbd-server-start QMP command.
However the latter requires just :: without the braces.

11 years agoconf: fix use after free in virChrdevOpen
Ján Tomko [Wed, 22 May 2013 10:56:23 +0000 (12:56 +0200)]
conf: fix use after free in virChrdevOpen

Don't free the stream on error if we've successfully added it
to the hash table, since it will be freed by virChrdevHashEntryFree
callback.

Preserve the error message before calling virStreamFree, since it
resets the error.

Introduced by 4716138, crashing since 6921892.

Reported by Sergey Fionov on libvir-list.

11 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/xenxs/*
Michal Privoznik [Fri, 3 May 2013 12:51:56 +0000 (14:51 +0200)]
Adapt to VIR_STRDUP and VIR_STRNDUP in src/xenxs/*

11 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/xenapi/*
Michal Privoznik [Fri, 3 May 2013 12:51:37 +0000 (14:51 +0200)]
Adapt to VIR_STRDUP and VIR_STRNDUP in src/xenapi/*

11 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/xen/*
Michal Privoznik [Fri, 3 May 2013 12:51:25 +0000 (14:51 +0200)]
Adapt to VIR_STRDUP and VIR_STRNDUP in src/xen/*

11 years agovirNetMessageSaveError: Fix copy and paste error
Michal Privoznik [Thu, 23 May 2013 13:47:47 +0000 (15:47 +0200)]
virNetMessageSaveError: Fix copy and paste error

Previously, we were freeing verr fields instead of rerr which we've
allocated just a line above.

11 years agovirNWFilterHashTablePut: Free the correct variable
Michal Privoznik [Thu, 23 May 2013 13:40:42 +0000 (15:40 +0200)]
virNWFilterHashTablePut: Free the correct variable

In bf1fe848 I've introduced 'newName' variable to substitute the old
'const char *name' as previously we had an ugly code there:

  name = strdup(name);

However, some parts of the function were not updated, so they were still
calling VIR_FREE(name) instead of VIR_FREE(newName).

11 years agoumlConnectTapDevice: initialize tapfd variable
Michal Privoznik [Thu, 23 May 2013 13:22:35 +0000 (15:22 +0200)]
umlConnectTapDevice: initialize tapfd variable

There is possibility to jump to 'cleanup' label without tapfd variable
being initialized. In the label, VIR_FORCE_CLOSE(tapfd) is called which
can have fatal consequences.

11 years agoremote: fix dom->id after virDomainCreateWithFlags
Marek Marczykowski [Thu, 23 May 2013 00:01:30 +0000 (02:01 +0200)]
remote: fix dom->id after virDomainCreateWithFlags

The same issue as (already fixed) in virDomainCreate -
REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS doesn't return new domain ID, only
-1 on error or 0 on success.

Besides this one fix it is more general problem - local domain object
ID can desynchronize with the real one, for example in case of another
client creates/destroys domain in the meantime. Perhaps virDomainGetID
should be called remotely (with all performance implications...)? Or
some event-based notification used?

Signed-off-by: Marek Marczykowski <marmarek@invisiblethingslab.com>
11 years agoFix the build failure
Osier Yang [Thu, 23 May 2013 11:58:28 +0000 (19:58 +0800)]
Fix the build failure

Commit 16251193afdc forgot to include "virstring.h". Pushed under
build-breaker rule.

11 years agovirsh: Fix virDomainFree for NULL domain in blkdeviotune
Martin Kletzander [Thu, 23 May 2013 10:24:08 +0000 (12:24 +0200)]
virsh: Fix virDomainFree for NULL domain in blkdeviotune

11 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/security/*
Michal Privoznik [Fri, 3 May 2013 12:48:43 +0000 (14:48 +0200)]
Adapt to VIR_STRDUP and VIR_STRNDUP in src/security/*

11 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/rpc/*
Michal Privoznik [Fri, 3 May 2013 12:47:53 +0000 (14:47 +0200)]
Adapt to VIR_STRDUP and VIR_STRNDUP in src/rpc/*

11 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/remote/*
Michal Privoznik [Fri, 3 May 2013 12:47:37 +0000 (14:47 +0200)]
Adapt to VIR_STRDUP and VIR_STRNDUP in src/remote/*

11 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/qemu/*
Michal Privoznik [Mon, 20 May 2013 09:23:13 +0000 (11:23 +0200)]
Adapt to VIR_STRDUP and VIR_STRNDUP in src/qemu/*

11 years agovirsh: omit OPTION section in 'virsh help' if no option exists
Zhang Xiaohe [Wed, 22 May 2013 03:15:45 +0000 (11:15 +0800)]
virsh: omit OPTION section in 'virsh help' if no option exists

Don't print 'OPTION' if there's no options. Just behaves as DESCRIPTION
does.
This mostly affects 'interface' command group.

Signed-off-by: Zhang Xiaohe <zhangxh@cn.fujitsu.com>
Reported-by: Li Yang <liyang.fnst@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoChange virConnectDomainEventGraphicsCallback signature
Michal Privoznik [Sun, 19 May 2013 10:48:11 +0000 (12:48 +0200)]
Change virConnectDomainEventGraphicsCallback signature

For future work we need _virDomainEventGraphicsAddress and
_virDomainEventGraphicsSubjectIdentity members to be char * not const
char *. We are strdup()-ing them anyway, so they should have been char *
anyway (from const correctness POV). However, we don't want users to
change passed values, so we need to make the callback's argument const.

Although this is an API change (not ABI though), real callers won't be
impacted. Why?
 1. these callback members are read-only, so it is less likely that
someone is trying to assign into the struct members.
 2. The only way to register a virConnectDomainEventGraphicsCallback is
to cast it through a call to virConnectDomainEventRegisterAny.  That is,
even if the user's callback function leaves out the const, we never use
the typedef as the direct type of any API parameter.  Since they are
already casting their function pointer into a munged type before
registering it, their code will continue to compile.

11 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/openvz/*
Michal Privoznik [Fri, 3 May 2013 12:45:31 +0000 (14:45 +0200)]
Adapt to VIR_STRDUP and VIR_STRNDUP in src/openvz/*

11 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/conf/*
Michal Privoznik [Fri, 3 May 2013 12:40:46 +0000 (14:40 +0200)]
Adapt to VIR_STRDUP and VIR_STRNDUP in src/conf/*

11 years agovirNetDevTapCreate: Fail on systems not supporting IFF_MULTI_QUEUE
Michal Privoznik [Wed, 22 May 2013 16:32:27 +0000 (18:32 +0200)]
virNetDevTapCreate: Fail on systems not supporting IFF_MULTI_QUEUE

In my previous patches I enabled the IFF_MULTI_QUEUE flag every
time the user requested multiqueue TAP device. However, this
works only at runtime. During build time the flag may be
undeclared.

11 years agoqemu: Enable multiqueue network
Michal Privoznik [Thu, 18 Apr 2013 08:47:01 +0000 (10:47 +0200)]
qemu: Enable multiqueue network

11 years agoqemu: Adapt qemuBuildInterfaceCommandLine to to multiqueue net
Michal Privoznik [Tue, 21 May 2013 13:50:09 +0000 (15:50 +0200)]
qemu: Adapt qemuBuildInterfaceCommandLine to to multiqueue net

In order to learn libvirt multiqueue several things must be done:

1) The '/dev/net/tun' device needs to be opened multiple times with
IFF_MULTI_QUEUE flag passed to ioctl(fd, TUNSETIFF, &ifr);

2) Similarly, '/dev/vhost-net' must be opened as many times as in 1)
in order to keep 1:1 ratio recommended by qemu and kernel folks.

3) The command line construction code needs to switch from 'fd=X' to
'fds=X:Y:...:Z' and from 'vhostfd=X' to 'vhostfds=X:Y:...:Z'.

4) The monitor handling code needs to learn to pass multiple FDs.

11 years agoqemu: Move interface cmd line construction into a separate function
Michal Privoznik [Mon, 13 May 2013 15:31:06 +0000 (17:31 +0200)]
qemu: Move interface cmd line construction into a separate function

Currently, we have one huge function to construct qemu command line.
This is very ineffective esp. if there's a fault somewhere.

11 years agoIntroduce /domain/devices/interface/driver/@queues attribute
Michal Privoznik [Wed, 10 Apr 2013 10:19:37 +0000 (12:19 +0200)]
Introduce /domain/devices/interface/driver/@queues attribute

This attribute is going to represent number of queues for
multique vhost network interface. This commit implements XML
extension part of the feature and add one test as well. For now,
we can only do xml2xml test as qemu command line generation code
is not adapted yet.

11 years agoqemu: add ', share=<policy>' to qemu commandline
Guannan Ren [Tue, 21 May 2013 14:31:49 +0000 (22:31 +0800)]
qemu: add ', share=<policy>' to qemu commandline

example: qemu ${otherargs} \
             -vnc 127.0.0.1:0,share=allow-exclusive

11 years agoconf: add 'sharePolicy' attribute to graphics element for vnc
Guannan Ren [Tue, 21 May 2013 14:31:48 +0000 (22:31 +0800)]
conf: add 'sharePolicy' attribute to graphics element for vnc

 -vnc :5900,share=allow-exclusive
allows clients to ask for exclusive access which is
implemented by dropping other connections Connecting
multiple clients in parallel requires all clients asking
for a shared session (vncviewer: -shared switch)

 -vnc :5900,share=force-shared
disables exclusive client access.  Useful for shared
desktop sessions, where you don't want someone forgetting
specify -shared disconnect everybody else.

 -vnc :5900,share=ignore
completely ignores the shared flag and allows everybody
connect unconditionally

11 years agoqemu: new vnc display sharing policy caps flag
Guannan Ren [Tue, 21 May 2013 14:31:47 +0000 (22:31 +0800)]
qemu: new vnc display sharing policy caps flag

QEMU_CAPS_VNC_SHARE_POLICY (qemu >= 1.1)

11 years agovbox: fix VIR_STRDUP value check
Ján Tomko [Mon, 20 May 2013 09:48:34 +0000 (11:48 +0200)]
vbox: fix VIR_STRDUP value check

In my review of 31532ca I missed the fact that VIR_STRDUP
now returns 1 on success, and 0 if the source was NULL.

(This still doesn't add proper OOM error handling.)

11 years agosyntax-check: Add the rule to forbid whitespace before ";"
Osier Yang [Tue, 21 May 2013 10:01:01 +0000 (18:01 +0800)]
syntax-check: Add the rule to forbid whitespace before ";"

Only a few cases are allowed:

1) The expression is empty for "for" loop, E.g.

  for (i = 0; ; i++)

2) An empty statement

  while (write(statuswrite, &status, 1) == -1 &&
         errno == EINTR)
      ; /* empty */

3) ";" is inside double-quote, I.e, as part of const string. E.g.

  vshPrint(ctl, "a ; b ; cd;\n");

The "for" loop in src/rpc/virnettlscontext.c is the special case,
1) applies for it, so change it together in this patch.

11 years agonwfilter: Change the comment style
Osier Yang [Tue, 21 May 2013 10:01:00 +0000 (18:01 +0800)]
nwfilter: Change the comment style

The more common habit is to add the comment after the statements.

11 years agoFix the syntax-check failure
Osier Yang [Wed, 22 May 2013 05:12:34 +0000 (13:12 +0800)]
Fix the syntax-check failure

Introduced by commit 7ac2c4fe624, pushed under build-breaker rule.

11 years agointerface: list all interfaces with flags == 0
Guannan Ren [Tue, 21 May 2013 13:29:38 +0000 (21:29 +0800)]
interface: list all interfaces with flags == 0

virConnectListAllInterfaces should support to list all of
interfaces when the value of flags is 0. The behaviour is
consistent with other virConnectListAll* APIs

11 years agocgroup: be robust against cgroup movement races
Eric Blake [Tue, 21 May 2013 02:30:30 +0000 (20:30 -0600)]
cgroup: be robust against cgroup movement races

https://bugzilla.redhat.com/show_bug.cgi?id=965169 documents a
problem starting domains when cgroups are enabled; I was able
to reliably reproduce the race about 5% of the time when I added
hooks to domain startup by 3 seconds (as that seemed to be about
the length of time that qemu created and then closed a temporary
thread, probably related to aio handling of initially opening
a disk image).  The problem has existed since we introduced
virCgroupMoveTask in commit 9102829 (v0.10.0).

There are some inherent TOCTTOU races when moving tasks between
kernel cgroups, precisely because threads can be created or
completed in the window between when we read a thread id from the
source and when we write to the destination.  As the goal of
virCgroupMoveTask is merely to move ALL tasks into the new
cgroup, it is sufficient to iterate until no more threads are
being created in the old group, and ignoring any threads that
die before we can move them.

It would be nicer to start the threads in the right cgroup to
begin with, but by default, all child threads are created in
the same cgroup as their parent, and we don't want vcpu child
threads in the emulator cgroup, so I don't see any good way
of avoiding the move.  It would also be nice if the kernel were
to implement something like rename() as a way to atomically move
a group of threads from one cgroup to another, instead of forcing
a window where we have to read and parse the source, then format
and write back into the destination.

* src/util/vircgroup.c (virCgroupAddTaskStrController): Ignore
ESRCH, because a thread ended between read and write attempts.
(virCgroupMoveTask): Loop until all threads have moved.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agosrc/*.[ch]: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 08:08:42 +0000 (16:08 +0800)]
src/*.[ch]: Remove the whitespace before ";"

11 years agosrc/locking: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 08:06:00 +0000 (16:06 +0800)]
src/locking: Remove the whitespace before ";"

11 years agopython: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 08:05:06 +0000 (16:05 +0800)]
python: Remove the whitespace before ";"

11 years agoexamples: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 08:04:26 +0000 (16:04 +0800)]
examples: Remove the whitespace before ';'

11 years agosrc/lxc: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 08:03:33 +0000 (16:03 +0800)]
src/lxc: Remove the whitespace before ";"

11 years agosrc/remote: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 08:01:50 +0000 (16:01 +0800)]
src/remote: Remove the whitespace before ";"

11 years agosrc/rpc: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 07:59:54 +0000 (15:59 +0800)]
src/rpc: Remove the whitespace before ";"

11 years agosrc/utils: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 07:58:16 +0000 (15:58 +0800)]
src/utils: Remove the whitespace before ";"

11 years agotests/: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 07:53:48 +0000 (15:53 +0800)]
tests/: Remove the whitespace before ";"

11 years agodaemon: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 07:45:26 +0000 (15:45 +0800)]
daemon: Remove the whitespace before ";"

11 years agotools: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 07:44:53 +0000 (15:44 +0800)]
tools: Remove the whitespace before ";"

11 years agosrc/storage: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:21 +0000 (15:21 +0800)]
src/storage: Remove the whitespace before ';'

11 years agosrc/security: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:21 +0000 (15:21 +0800)]
src/security: Remove the whitespace before ';'

11 years agosrc/xen: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:21 +0000 (15:21 +0800)]
src/xen: Remove the whitespace before ';'

11 years agosrc/vmware: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:21 +0000 (15:21 +0800)]
src/vmware: Remove the whitespace before ';'

11 years agosrc/qemu: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:20 +0000 (15:21 +0800)]
src/qemu: Remove the whitespace before ';'

11 years agosrc/interface: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:20 +0000 (15:21 +0800)]
src/interface: Remove the whitespace before ';'

11 years agosrc/parallels: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:20 +0000 (15:21 +0800)]
src/parallels: Remove the whitespace before ';'

11 years agosrc/uml: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:19 +0000 (15:21 +0800)]
src/uml: Remove the whitespace before ';'

11 years agosrc/openvz: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:19 +0000 (15:21 +0800)]
src/openvz: Remove the whitespace before ';'

11 years agosrc/node_device: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:19 +0000 (15:21 +0800)]
src/node_device: Remove the whitespace before ';'