]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
14 years agotests: Fix commandtest in VPATH build
Jiri Denemark [Mon, 6 Dec 2010 12:03:26 +0000 (13:03 +0100)]
tests: Fix commandtest in VPATH build

14 years agotests: fix leaks in commandtest
Eric Blake [Mon, 6 Dec 2010 21:48:11 +0000 (14:48 -0700)]
tests: fix leaks in commandtest

Most leaks could only occur on error cleanup paths.

14 years agocommand: improve allocation failure reporting
Eric Blake [Mon, 6 Dec 2010 20:58:52 +0000 (13:58 -0700)]
command: improve allocation failure reporting

* src/util/command.c (virCommandAddEnvString): Remove duplicate
code.
(virCommandToString, virCommandRun, virCommandRunAsync)
(virCommandWait): Report NULL command as ENOMEM, not invalid
usage.
Reported by Jiri Denemark.

14 years agotests: Fix detection of expected error
Jiri Denemark [Mon, 6 Dec 2010 11:58:56 +0000 (12:58 +0100)]
tests: Fix detection of expected error

14 years agotests: Fix code formating in commandtest
Jiri Denemark [Mon, 6 Dec 2010 10:51:41 +0000 (11:51 +0100)]
tests: Fix code formating in commandtest

14 years agouuid: require smbios uuid and domain uuid to match
Eric Blake [Fri, 3 Dec 2010 20:16:31 +0000 (13:16 -0700)]
uuid: require smbios uuid and domain uuid to match

* src/conf/domain_conf.c (virDomainDefParseXML): Prefer sysinfo
uuid over generating one, and if both uuids are present, require
them to be identical.
* src/qemu/qemu_conf.c (qemuBuildSmbiosSystemStr): Allow skipping
the uuid.
(qemudBuildCommandLine): Adjust caller; <smbios mode=host/> must
not use host uuid in place of guest uuid.

14 years agosmbios: allow () in smbios strings
Eric Blake [Thu, 2 Dec 2010 00:45:19 +0000 (17:45 -0700)]
smbios: allow () in smbios strings

* docs/schemas/domain.rng (sysinf-value): Expand pattern.
* tests/qemuxml2argvdata/qemuxml2argv-smbios.xml: Prefer '' over
"" for attribute values.  Copy real hardware values.
* tests/qemuxml2argvdata/qemuxml2argv-smbios.args: Likewise.

14 years agosmbios: support system family
Eric Blake [Thu, 2 Dec 2010 00:07:41 +0000 (17:07 -0700)]
smbios: support system family

* docs/schemas/domain.rng (sysinfo-system-name): Also allow
family.
* src/util/sysinfo.h (struct _virSysinfoDef): Add system_family.
* src/conf/domain_conf.c (virSysinfoParseXML)
(virDomainSysinfoDefFormat): Support it.
* src/util/sysinfo.c (virSysinfoDefFree, virSysinfoRead): Likewise.
* src/qemu/qemu_conf.c (qemuBuildSmbiosSystemStr): Likewise.
* tests/qemuxml2argvdata/qemuxml2argv-smbios.xml: Adjust test.
* tests/qemuxml2argvdata/qemuxml2argv-smbios.args: Likewise.

14 years agoqemu: avoid adding "" in smbios arguments
Eric Blake [Wed, 1 Dec 2010 23:50:59 +0000 (16:50 -0700)]
qemu: avoid adding "" in smbios arguments

The log lists things like -smbios type=1,vendor="Red Hat", which
is great for shell parsing, but not so great when you realize that
execve() then passes those literal "" on as part of the command
line argument, such that qemu sets SMBIOS with extra literal quotes.

The eventual addition of virCommand is needed before we have the API
to shell-quote a string representation of a command line, so that the
log can still be pasted into a shell, but without inserting extra
bytes into the execve() arguments.

* src/qemu/qemu_conf.c (qemuBuildSmbiosBiosStr)
(qemuBuildSmbiosSystemStr): Qemu doesn't like quotes around uuid
arguments, and the remaining quotes are passed literally to
smbios, making <smbios mode='host'/> inaccurate.  Removing the
quotes makes the log harder to parse, but that can be fixed later
with virCommand improvements.
* tests/qemuxml2argvdata/qemuxml2argv-smbios.args: 'Fix' test; it
will need fixing again once virCommand learns how to shell-quote a
potential command line.

14 years agovirsh: Remove redundant commands in group domain
Osier Yang [Tue, 7 Dec 2010 07:25:47 +0000 (15:25 +0800)]
virsh: Remove redundant commands in group domain

"echo" is already in group "virsh", "freecell" and "hostname" are
already in group "host", so remove them from group "domain"

* tools/virsh.c

14 years agoFix funny off-by-one error in clock-variable
Dan Kenigsberg [Mon, 6 Dec 2010 07:59:30 +0000 (09:59 +0200)]
Fix funny off-by-one error in clock-variable

Humans consider January as month #1, while gmtime_r(3) calls it month #0.

While fixing it, render qemu's rtc parameter with leading zeros, as is more
commonplace.

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

14 years agosyntax error "Bad fd number" when stopping libvirt-guests
Laurent Léonard [Sun, 5 Dec 2010 17:53:26 +0000 (18:53 +0100)]
syntax error "Bad fd number" when stopping libvirt-guests

When libvirt-guests is being stopped, I get the following message:
$Running guests on default URI: test-vm
$Suspending guests on default URI...
$Suspending test-vm: /etc/init.d/libvirt-guests: 340: Syntax error: Bad fd
number

14 years agothreads: add virThreadID for debugging use
Eric Blake [Sat, 4 Dec 2010 21:33:23 +0000 (14:33 -0700)]
threads: add virThreadID for debugging use

* src/util/threads.h (virThreadID): New prototype.
* src/util/threads-pthread.c (virThreadID): New function.
* src/util/threads-win32.c (virThreadID): Likewise.
* src/libvirt_private.syms (threads.h): Export it.
* daemon/event.c (virEventInterruptLocked): Use it to avoid
warning on BSD systems.

14 years agoutil: Fix bug which will cause libvirtd crash
Osier Yang [Mon, 6 Dec 2010 09:41:10 +0000 (17:41 +0800)]
util: Fix bug which will cause libvirtd crash

"virCommandRun": if "cmd->outbuf" or "cmd->errbuf" is NULL,
libvirtd will be crashed when trying to start a qemu domain
(which invokes "virCommandRun"), it caused by we try to use
"*cmd->outbuf" and "*cmd->errbuf" regardless of cmd->outbuf
or cmd->errbuf is NULL.

* src/util/command.c (virCommandRun)

14 years agotests: Don't ignore return value of getcwd()
Jiri Denemark [Fri, 3 Dec 2010 16:10:31 +0000 (17:10 +0100)]
tests: Don't ignore return value of getcwd()

14 years agobuild: Fix internal docs generation in VPATH builds
Jiri Denemark [Fri, 3 Dec 2010 16:06:14 +0000 (17:06 +0100)]
build: Fix internal docs generation in VPATH builds

14 years agoqemu: Fix a possible deadlock in p2p migration
Jiri Denemark [Fri, 3 Dec 2010 09:48:31 +0000 (10:48 +0100)]
qemu: Fix a possible deadlock in p2p migration

Two more calls to remote libvirtd have to be surrounded by
qemuDomainObjEnterRemoteWithDriver() and
qemuDomainObjExitRemoteWithDriver() to prevent possible deadlock between
two communicating libvirt daemons.

See commit f0c8e1cb3774d6f09e2681ca1988bf235a343007 for further details.

14 years agoChange return value of VIR_DRV_SUPPORTS_FEATURE to bool
Jiri Denemark [Fri, 3 Dec 2010 08:31:48 +0000 (09:31 +0100)]
Change return value of VIR_DRV_SUPPORTS_FEATURE to bool

virDrvSupportsFeature API is allowed to return -1 on error while all but
one uses of VIR_DRV_SUPPORTS_FEATURE only check for (non)zero return
value. Let's make this macro return zero on error, which is what
everyone expects anyway.

14 years agoqemu: Don't try to set input FD to -1
Matthias Bolte [Sat, 4 Dec 2010 23:45:43 +0000 (00:45 +0100)]
qemu: Don't try to set input FD to -1

14 years agoImplement virVMOperationType{To|From}String independent from WITH_MACVTAP
Matthias Bolte [Fri, 3 Dec 2010 17:02:59 +0000 (18:02 +0100)]
Implement virVMOperationType{To|From}String independent from WITH_MACVTAP

As this symbols are exported independent from WITH_MACVTAP.

14 years agobuild: avoid shadowing devname() on BSD systems
Eric Blake [Fri, 3 Dec 2010 15:26:40 +0000 (08:26 -0700)]
build: avoid shadowing devname() on BSD systems

* tools/virsh.c (cmdRunConsole, cmdConsole): Rename problematic
symbol.
Reported by Justin Clift.

14 years agovirsh: Remove redundant optional option for cmdHelp
Osier Yang [Fri, 3 Dec 2010 07:34:23 +0000 (15:34 +0800)]
virsh: Remove redundant optional option for cmdHelp

Remove the optional option "group", as cmdHelp should accepts
only one option ("virsh help" supports both command and command
group now, and user rarely uses the options, so it doesn't matter
much for it being longer, :-)

* tools/virsh.c

14 years agoCreate file in virFileWriteStr() if it doesn't exist
Jean-Baptiste Rouault [Fri, 3 Dec 2010 09:47:08 +0000 (10:47 +0100)]
Create file in virFileWriteStr() if it doesn't exist

This patch adds a mode_t parameter to virFileWriteStr().
If mode is different from 0, virFileWriteStr() will try
to create the file if it doesn't exist.

* src/util/util.h (virFileWriteStr): Alter signature.
* src/util/util.c (virFileWriteStr): Allow file creation.
* src/network/bridge_driver.c (networkEnableIpForwarding)
(networkDisableIPV6): Adjust clients.
* src/node_device/node_device_driver.c
(nodeDeviceVportCreateDelete): Likewise.
* src/util/cgroup.c (virCgroupSetValueStr): Likewise.
* src/util/pci.c (pciBindDeviceToStub, pciUnBindDeviceFromStub):
Likewise.

14 years agoman pages: update the description for the virsh help command
Justin Clift [Thu, 2 Dec 2010 12:49:38 +0000 (23:49 +1100)]
man pages: update the description for the virsh help command

Now includes information on keyword usage, and provides examples.

14 years agovirsh: move two commands from domain group to storage pool group
Osier Yang [Thu, 2 Dec 2010 00:25:17 +0000 (08:25 +0800)]
virsh: move two commands from domain group to storage pool group

* tools/virsh.c (find-storage-pool-sources-as and find-storage-pool-sources
should't be in command group "Domain Management", move them to group
"Storage Pool".

14 years agoRemove bogus includes
Daniel P. Berrange [Tue, 25 May 2010 11:17:56 +0000 (12:17 +0100)]
Remove bogus includes

14 years agouml: convert to virCommand
Daniel P. Berrange [Tue, 25 May 2010 13:17:48 +0000 (14:17 +0100)]
uml: convert to virCommand

* src/uml/uml_conf.c (umlBuildCommandLineChr)
(umlBuildCommandLine): Rewrite with virCommand.
* src/uml/uml_conf.h (umlBuildCommandLine): Update signature.
* src/uml/uml_driver.c (umlStartVMDaemon): Adjust caller.

14 years agoqemu: convert to virCommand
Eric Blake [Mon, 22 Nov 2010 23:09:13 +0000 (16:09 -0700)]
qemu: convert to virCommand

* src/qemu/qemu_conf.c (qemudExtractVersionInfo): Check for file
before executing it here, rather than in callers.
(qemudBuildCommandLine): Rewrite with virCommand.
* src/qemu/qemu_conf.h (qemudBuildCommandLine): Update signature.
* src/qemu/qemu_driver.c (qemuAssignPCIAddresses)
(qemudStartVMDaemon, qemuDomainXMLToNative): Adjust callers.

14 years agoPort hooks and iptables code to new command execution APIs
Daniel P. Berrange [Tue, 25 May 2010 11:18:53 +0000 (12:18 +0100)]
Port hooks and iptables code to new command execution APIs

This proof of concept shows how two existing uses of virExec
and virRun can be ported to the new virCommand APIs, and how
much simpler the code becomes

14 years agovirCommand: docs for usage of new command APIs
Daniel P. Berrange [Tue, 25 May 2010 13:14:46 +0000 (14:14 +0100)]
virCommand: docs for usage of new command APIs

* docs/internals/command.html.in: New file.
* docs/Makefile.am: Build new docs.
* docs/subsite.xsl: New glue file.
* docs/internals.html.in, docs/sitemap.html.in: Update glue.

14 years agoIntroduce new APIs for spawning processes
Daniel P. Berrange [Tue, 25 May 2010 11:14:06 +0000 (12:14 +0100)]
Introduce new APIs for spawning processes

This introduces a new set of APIs in src/util/command.h
to use for invoking commands. This is intended to replace
all current usage of virRun and virExec variants, with a
more flexible and less error prone API.

* src/util/command.c: New file.
* src/util/command.h: New header.
* src/Makefile.am (UTIL_SOURCES): Build it.
* src/libvirt_private.syms: Export symbols internally.
* tests/commandtest.c: New test.
* tests/Makefile.am (check_PROGRAMS): Run it.
* tests/commandhelper.c: Auxiliary program.
* tests/commanddata/test2.log - test15.log: New expected outputs.
* cfg.mk (useless_free_options): Add virCommandFree.
(msg_gen_function): Add virCommandError.
* po/POTFILES.in: New translation.
* .x-sc_avoid_write: Add exemption.
* tests/.gitignore: Ignore new built file.

14 years agoutil: add virVasprintf
Eric Blake [Mon, 22 Nov 2010 23:39:47 +0000 (16:39 -0700)]
util: add virVasprintf

* src/util/util.h (virVasprintf): New declaration.
* src/util/util.c (virVasprintf): New function.
(virAsprintf): Use it.
* src/util/virtaudit.c (virAuditSend): Likewise.
* src/libvirt_private.syms: Export it.
* cfg.mk (sc_prohibit_asprintf): Also prohibit vasprintf.
* .x-sc_prohibit_asprintf: Add exemption.

14 years agoutil: fix saferead type
Eric Blake [Mon, 22 Nov 2010 23:50:00 +0000 (16:50 -0700)]
util: fix saferead type

* src/util/util.c (saferead): Fix return type.
(safewrite): Fix indentation.

14 years agoTweak daemon event debug to include errno
Daniel P. Berrange [Wed, 1 Dec 2010 16:41:14 +0000 (16:41 +0000)]
Tweak daemon event debug to include errno

* daemon/event.c: Include errno in debug info upon poll() failure

14 years agoFix memory leak in logging setup
Daniel P. Berrange [Wed, 1 Dec 2010 16:42:17 +0000 (16:42 +0000)]
Fix memory leak in logging setup

The logging setup requires const char * strings, but the
virLogSetFromEnv() strdup's the env variables, thus causing
a memory leak

* src/util/logging.c: Avoid strdup'ing env variables

14 years agotests: Add tests for CPU selection in qemu driver
Jiri Denemark [Fri, 16 Apr 2010 06:21:23 +0000 (08:21 +0200)]
tests: Add tests for CPU selection in qemu driver

14 years agotests: Support for faking emulator in qemuxml2argv
Jiri Denemark [Fri, 16 Apr 2010 06:20:33 +0000 (08:20 +0200)]
tests: Support for faking emulator in qemuxml2argv

This patch allows for using custom scripts instead of /usr/bin/qemu
emulator in domain XML. To do so, one would specify relative path to the
custom script in <emulator/>. The path needs to be relative to
qemuxml2argvdata directory and it will be transparently made absolute in
runtime. The expected command line needs to contain the exact relative
path as was used in domain XML.

The problem is RelaxNG schema for domain XML only allows for absolute
path within <emulator/>. To workaround it, an extra '/' must be added at
the beginning of the path. That is, instead of "./qemu.sh" or
"../emulator/qemu.sh" one would use "/./qemu.sh" or
"/../emulator/qemu.sh". The extra slash is removed before further
processing. I don't like this workaround, it's very ugly but it's the
best option I was able to come up with. Relaxing domain XML schema is
not an option IMO.

14 years agoschemas: Fix cpu element schema
Jiri Denemark [Wed, 1 Dec 2010 14:25:48 +0000 (15:25 +0100)]
schemas: Fix cpu element schema

Both vendor and topology elements are optional.

14 years agovirsh: Remove using phy as default disk driver in cmdAttachDisk
Osier Yang [Thu, 2 Dec 2010 01:19:30 +0000 (09:19 +0800)]
virsh: Remove using phy as default disk driver in cmdAttachDisk

* tools/virsh.c (virsh shouldn't use 'phy' as the disk driver if
user doesn't specify "--driver", it causes bugs, as not all of
hypervisor driver supports 'phy', and actually hypervisor should
known the correct default disk driver and subdriver, so remove it)

14 years agomaint: update .gitignore
Eric Blake [Wed, 1 Dec 2010 23:48:19 +0000 (16:48 -0700)]
maint: update .gitignore

* .gitignore: Ignore recent built file, sort.

14 years agoOpenVZ: drop fd leackage
Guido Günther [Wed, 1 Dec 2010 16:43:46 +0000 (17:43 +0100)]
OpenVZ: drop fd leackage

Drop unused (and unclosed) errfd and close outfd on exit. Otherwise
polling the running domains with virt-manager let's us quickly run out
of fds.

14 years agoqemu: Use macro for max and min vnc port instead of number
Osier Yang [Wed, 1 Dec 2010 12:35:52 +0000 (20:35 +0800)]
qemu: Use macro for max and min vnc port instead of number

* src/qemu/qemu_driver.c (though MACROS QEMU_VNC_PORT_MAX, and
QEMU_VNC_PORT_MIN are defined at the beginning, numbers (65535, 5900)
are still used, replace them)

14 years agoqemu: Fix typo in qemuTeardownDiskPathDeny
Osier Yang [Wed, 1 Dec 2010 12:46:20 +0000 (20:46 +0800)]
qemu: Fix typo in qemuTeardownDiskPathDeny

typo in error message, it should be by copy-a-paste
from "qemuSetupDiskPathAllow".

* src/qemu/qemu_driver.c (qemuTeardownDiskPathDeny)

14 years agoqemu: plug memory leak
Eric Blake [Tue, 30 Nov 2010 16:00:30 +0000 (09:00 -0700)]
qemu: plug memory leak

* src/qemu/qemu_driver.c (qemudShutdown): Free all strings and the
ebtables structure.
* src/libvirt_private.syms (ebtablesContextFree): Export missing
symbol.
* src/util/ebtables.c (ebtablesContextFree): Allow early exit.

14 years agolibvirtd: avoid memory leak on shutdown
Eric Blake [Tue, 30 Nov 2010 15:35:22 +0000 (08:35 -0700)]
libvirtd: avoid memory leak on shutdown

* daemon/libvirtd.c (qemudRunLoop): Free any remaining client data.

14 years agoFix flaw in thread creation APIs
Daniel P. Berrange [Wed, 1 Dec 2010 11:23:07 +0000 (11:23 +0000)]
Fix flaw in thread creation APIs

The arguments passed to the thread function must be allocated on
the heap, rather than the stack, since it is possible for the
spawning thread to continue before the new thread runs at all.
In such a case, it is possible that the area of stack where the
thread args were stored is overwritten.

* src/util/threads-pthread.c, src/util/threads-win32.c: Allocate
  thread arguments on the heap

14 years agovirsh: update help for "virsh help help"
Osier Yang [Wed, 1 Dec 2010 12:24:58 +0000 (20:24 +0800)]
virsh: update help for "virsh help help"

As virsh help supports both command and command group now,
update "cmdHelp" to print consite help, (this patch is
increment of "7829052757953023b0826e0293ffe18ed4ab89e9").

And also remove redundant empty line in "vshUsage".

* tools/virsh.c

14 years agoFix undefined symbol errors when macvtap support is disabled
Matthias Bolte [Wed, 1 Dec 2010 14:43:40 +0000 (15:43 +0100)]
Fix undefined symbol errors when macvtap support is disabled

Use macvtap specific functions depending on WITH_MACVTAP.

Use #if instead of #ifdef to check for WITH_MACVTAP, because
WITH_MACVTAP is always defined with value 0 or 1.

Also export virVMOperationType{To|From}String unconditional,
because they are used unconditional in the domain config code.

14 years agoFix warning when macvtap support is disabled
Jean-Baptiste Rouault [Wed, 1 Dec 2010 11:00:32 +0000 (12:00 +0100)]
Fix warning when macvtap support is disabled

14 years agovirsh: remove a badly placed line break in virsh -h output
Justin Clift [Wed, 1 Dec 2010 13:25:09 +0000 (00:25 +1100)]
virsh: remove a badly placed line break in virsh -h output

The output was previously:

    -c | --connect <uri>    hypervisor connection URI
    -r | --readonly         connect readonly
    -d | --debug <num>      debug level [0-5]
    -h | --help             this help
    -q | --quiet            quiet mode
    -t | --timing           print timing information
    -l | --log <file>       output logging to file
    -v | --version[=short]  program version

    -V | --version=long     version and full options

(note the blank line between the --version types)

This patch removes the extra blank line.

14 years agotests: Add unit tests for internal CPU APIs
Jiri Denemark [Thu, 7 Oct 2010 14:35:17 +0000 (16:35 +0200)]
tests: Add unit tests for internal CPU APIs

14 years agocpu: Add support for overriding path to CPU map XML file
Jiri Denemark [Thu, 16 Sep 2010 14:56:07 +0000 (16:56 +0200)]
cpu: Add support for overriding path to CPU map XML file

14 years agoFall back to QEMUD_SAVE_FORMAT_RAW if compression method fails.
Hu Tao [Tue, 30 Nov 2010 07:12:54 +0000 (15:12 +0800)]
Fall back to QEMUD_SAVE_FORMAT_RAW if compression method fails.

When dumping a domain, it's reasonable to save dump-file in raw format
if dump format is misconfigured or the corresponding compress program
is not available rather then fail dumping.

14 years agovirsh: Categorize commands into groups for virsh help
Osier Yang [Tue, 30 Nov 2010 06:37:04 +0000 (14:37 +0800)]
virsh: Categorize commands into groups for virsh help

Change the virsh help out. The new output of "virsh help" and
"virsh --help" will be like:

 Secret (help keyword 'secret'):
    secret-define                  define or modify a secret from an XML file
    secret-dumpxml                 secret attributes in XML
    secret-set-value               set a secret value
    secret-get-value               Output a secret value
    secret-undefine                undefine a secret
    secret-list                    list secrets

 Snapshot (help keyword 'snapshot'):
    snapshot-create                Create a snapshot
    snapshot-current               Get the current snapshot
    snapshot-delete                Delete a domain snapshot
    snapshot-dumpxml               Dump XML for a domain snapshot
    snapshot-list                  List snapshots for a domain
    snapshot-revert                Revert a domain to a snapshot

Also support output help information of specified command group, e.g.

% ./tools/virsh help "Network Filter"
 Network Filter (help keyword 'filter'):
    nwfilter-define                define or update a network filter from an XML file
    nwfilter-undefine              undefine a network filter
    nwfilter-dumpxml               network filter information in XML
    nwfilter-list                  list network filters
    nwfilter-edit                  edit XML configuration for a network filter

Each group has a help keyword, e.g.

% ./tools/virsh help filter
 Network Filter (help keyword 'filter'):
    nwfilter-define                define or update a network filter from an XML file
    nwfilter-undefine              undefine a network filter
    nwfilter-dumpxml               network filter information in XML
    nwfilter-list                  list network filters
    nwfilter-edit                  edit XML configuration for a network filter

* tools/virsh.c:
  - introduce new struct "vshCmdGrp" and macros to define the groups.
  - split previous array "commands" into small arrays which are orgnized
    by group
  - changed some functions, e.g. "vshCmdDefSearch"
  - Added new functions, e.g. "vshCmdGrpSearch"
  - commands of each group are in "alphabetical order" now.
  - command groups are in "alphabetical order" now.
  - the commands are categorized with reference of
    http://wiki.libvirt.org/page/VirshHelpV2 (by Justin)
  - the modifications doesn't affect tests

* TODO:
  - doc

14 years agomaint: allow 'make syntax-check' to run again
Eric Blake [Tue, 30 Nov 2010 20:29:19 +0000 (13:29 -0700)]
maint: allow 'make syntax-check' to run again

* cfg.mk (VC_LIST_ALWAYS_EXCLUDE_REGEX): Permanently exempt
docs/news.html.in from all future syntax checks.

14 years agoRelease of libvirt 0.8.6
Daniel Veillard [Tue, 30 Nov 2010 18:52:25 +0000 (19:52 +0100)]
Release of libvirt 0.8.6

- configure.ac libvirt.spec.in: bump version, add a missing systemtap
  build requirement
- docs/news.html.in: add informations about the release
- po/*: updated Polish and Dutch localizations, and regenerated
- tests/qemuxml2argvtest.c: Fix build problem

14 years ago802.1Qbg: use pre-associate state at beginning of inc. migr
Stefan Berger [Tue, 30 Nov 2010 17:50:54 +0000 (12:50 -0500)]
802.1Qbg: use pre-associate state at beginning of inc. migr

This patch introduces the usage of the pre-associate state of the IEEE 802.1Qbg standard on incoming VM migration on the target host. It is in response to bugzilla entry 632750.

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

For being able to differentiate the exact reason as to why a macvtap device is being created, either due to a VM creation or an incoming VM migration, I needed to pass that reason as a parameter from wherever qemudStartVMDaemon is being called in order to determine whether to send an ASSOCIATE (VM creation) or a PRE-ASSOCIATE (incoming VM migration) towards lldpad.

I am also fixing a problem with the virsh domainxml-to-native call on the way.

Gerhard successfully tested the patch with a recent blade network 802.1Qbg-compliant switch.

The patch should not have any side-effects on the 802.1Qbh support in libvirt, but Roopa (cc'ed) may want to verify this.

14 years agoIgnore files generated by "make tags"
Guido Günther [Mon, 29 Nov 2010 12:43:00 +0000 (13:43 +0100)]
Ignore files generated by "make tags"

14 years agoOpenVZ: Fix some overwritten error codes
Guido Günther [Mon, 29 Nov 2010 09:23:15 +0000 (10:23 +0100)]
OpenVZ: Fix some overwritten error codes

Don't overwrite errors during domain creation/definition to ease
tracking down problems.

14 years agoOpenVZ: take veid from vmdef->name when defining new domains
Guido Günther [Sun, 28 Nov 2010 21:52:44 +0000 (22:52 +0100)]
OpenVZ: take veid from vmdef->name when defining new domains

We currently use the next free veid although there's one given in the
domain xml. This currently breaks defining new domains since vmdef->name
and veid don't match leading to the following error later on:

    error: Failed to define domain from 110.xml
    error: internal error Could not set UUID

Since silently ignoring vmdef->name is not nice respect it instead. We
avoid veid collisions in the upper levels already.

14 years agoLog client errors in libvirtd at debug priority
Matthias Bolte [Tue, 30 Nov 2010 13:10:42 +0000 (14:10 +0100)]
Log client errors in libvirtd at debug priority

This reverts commit

 Log all errors at level INFO to stop polluting syslog
 04bd0360f32ec628ecf7943b3fd1468d6eb2dde5.

and makes virRaiseErrorFull() log errors at debug priority
when called from inside libvirtd. This stops libvirtd from
polluting it's own log with client errors at error priority
that'll be reported and logged on the client side anyway.

14 years agocorrect the arguments of migrate_speed
Wen Congyang [Thu, 25 Nov 2010 08:38:32 +0000 (16:38 +0800)]
correct the arguments of migrate_speed

When we set migrate_speed by json, we receive the following
error message:
libvirtError: internal error unable to execute QEMU command
'migrate_set_speed': Invalid parameter type, expected: number

The reason is that: the arguments of migrate_set_speed
by json is json number, not json string.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
14 years agotests: Fix detection of expected errors
Jiri Denemark [Mon, 29 Nov 2010 13:11:53 +0000 (14:11 +0100)]
tests: Fix detection of expected errors

14 years agodocs: updated c# bindings with arnauds latest changes
Justin Clift [Mon, 29 Nov 2010 15:12:38 +0000 (02:12 +1100)]
docs: updated c# bindings with arnauds latest changes

14 years agoFix memory leaks in audit & VirtualBox code
Daniel P. Berrange [Wed, 24 Nov 2010 11:49:40 +0000 (11:49 +0000)]
Fix memory leaks in audit & VirtualBox code

* src/util/virtaudit.c: Free audit string
* src/vbox/vbox_XPCOMCGlue.c: Free library name

14 years agoRemove bogus check for Xen in example program
Daniel P. Berrange [Mon, 8 Nov 2010 14:21:49 +0000 (14:21 +0000)]
Remove bogus check for Xen in example program

The dominfo.py example script has a bogus check for /proc/xen
existing. The default connection cannot be assumed to be Xen
any more

* examples/python/dominfo.py: Remove check for Xen

14 years agodoc: Fix spelling of virBufferVSprintf
Jiri Denemark [Thu, 25 Nov 2010 13:48:08 +0000 (14:48 +0100)]
doc: Fix spelling of virBufferVSprintf

14 years agoFix host CPU counting on unusual NUMA topologies
Jiri Denemark [Wed, 24 Nov 2010 10:25:19 +0000 (11:25 +0100)]
Fix host CPU counting on unusual NUMA topologies

The nodeinfo structure includes

    nodes   : the number of NUMA cell, 1 for uniform mem access
    sockets : number of CPU socket per node
    cores   : number of core per socket
    threads : number of threads per core

which does not work well for NUMA topologies where each node does not
consist of integral number of CPU sockets.

We also have VIR_NODEINFO_MAXCPUS macro in public libvirt.h which
computes maximum number of CPUs as (nodes * sockets * cores * threads).

As a result, we can't just change sockets to report total number of
sockets instead of sockets per node. This would probably be the easiest
since I doubt anyone is using the field directly. But because of the
macro, some apps might be using sockets indirectly.

This patch leaves sockets to be the number of CPU sockets per node (and
fixes qemu driver to comply with this) on machines where sockets can be
divided by nodes. If we can't divide sockets by nodes, we behave as if
there was just one NUMA node containing all sockets. Apps interested in
NUMA should consult capabilities XML, which is what they probably do
anyway.

This way, the only case in which apps that care about NUMA may break is
on machines with funky NUMA topology. And there is a chance libvirt
wasn't able to start any guests on those machines anyway (although it
depends on the topology, total number of CPUs and kernel version).
Nothing changes at all for apps that don't care about NUMA.

14 years agoFix broken XML entity for '>'
Philipp Hahn [Thu, 25 Nov 2010 09:40:07 +0000 (10:40 +0100)]
Fix broken XML entity for '>'

Add missing 'g' to '&gt;' of '<product />' source-element.

Signed-off-by: Philipp Hahn <hahn@univention.de>
14 years agosecurity, storage: plug memory leaks for security_context_t
Eric Blake [Wed, 24 Nov 2010 21:09:58 +0000 (14:09 -0700)]
security, storage: plug memory leaks for security_context_t

security_context_t happens to be a typedef for char*, and happens to
begin with a string usable as a raw context string.  But in reality,
it is an opaque type that may or may not have additional information
after the first NUL byte, where that additional information can
include pointers that can only be freed via freecon().

Proof is from this valgrind run of daemon/libvirtd:

==6028== 839,169 (40 direct, 839,129 indirect) bytes in 1 blocks are definitely lost in loss record 274 of 274
==6028==    at 0x4A0515D: malloc (vg_replace_malloc.c:195)
==6028==    by 0x3022E0D48C: selabel_open (label.c:165)
==6028==    by 0x3022E11646: matchpathcon_init_prefix (matchpathcon.c:296)
==6028==    by 0x3022E1190D: matchpathcon (matchpathcon.c:317)
==6028==    by 0x4F9D842: SELinuxRestoreSecurityFileLabel (security_selinux.c:382)

800k is a lot of memory to be leaking.

* src/storage/storage_backend.c
(virStorageBackendUpdateVolTargetInfoFD): Avoid leak on error.
* src/security/security_selinux.c
(SELinuxReserveSecurityLabel, SELinuxGetSecurityProcessLabel)
(SELinuxRestoreSecurityFileLabel): Use correct function to free
security_context_t.

14 years agonetwork: plug memory leak
Eric Blake [Wed, 24 Nov 2010 20:29:38 +0000 (13:29 -0700)]
network: plug memory leak

* src/conf/network_conf.c (virNetworkDHCPRangeDefParseXML): Free
xml strings when no longer referenced.

14 years agomaint: prohibit most uses of xmlGetProp
Eric Blake [Wed, 24 Nov 2010 20:08:55 +0000 (13:08 -0700)]
maint: prohibit most uses of xmlGetProp

Making this change makes it easier to spot the memory leaks
that will be fixed in the next patch.

* cfg.mk (sc_prohibit_xmlGetProp): New rule.
* .x-sc_prohibit_xmlGetProp: New exception.
* Makefile.am (EXTRA_DIST): Ship exception file.
* tools/virsh.c (cmdDetachInterface, cmdDetachDisk): Adjust
offenders.
* src/conf/storage_conf.c (virStoragePoolDefParseSource):
Likewise.
* src/conf/network_conf.c (virNetworkDHCPRangeDefParseXML)
(virNetworkIPParseXML): Likewise.

14 years agoqemu: plug memory leak
Eric Blake [Wed, 24 Nov 2010 16:04:33 +0000 (09:04 -0700)]
qemu: plug memory leak

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

* src/qemu/qemu_monitor.c (qemuMonitorFree): Also free the buffer.

14 years agomaint: ensure syntax check exceptions are distributed
Eric Blake [Sat, 13 Nov 2010 22:18:55 +0000 (15:18 -0700)]
maint: ensure syntax check exceptions are distributed

* Makefile.am (EXTRA_DIST): Factor exceptions files...
(syntax_check_excpetions): into new list.  Include recently added
exceptions.
* cfg.mk (sc_x_sc_dist_check): New check, copied from coreutils.

14 years agobuild: enforce files.h usage
Eric Blake [Sat, 20 Nov 2010 00:25:23 +0000 (17:25 -0700)]
build: enforce files.h usage

* cfg.mk (sc_prohibit_close): New syntax-check rule.
* src/util/pci.c (pciWaitForDeviceCleanup): Fix violation.
* .x-sc_prohibit_close: New exceptions.
* Makefile.am (EXTRA_DIST): Distribute new file.

14 years agoAlways close drivers when a virConnectPtr is released
Matthias Bolte [Wed, 24 Nov 2010 17:10:14 +0000 (18:10 +0100)]
Always close drivers when a virConnectPtr is released

virConnectClose calls virUnrefConnect which in turn closes
all open drivers when the refcount of that connection dropped
to zero. This works fine when you free all other objects that
hold a ref to the connection before you close it, because in
this case virUnrefConnect is the one that removes the last
ref to the connection.

But it doesn't work when you close the connection first before
freeing the other objects. This is because the other virUnref*
functions call virReleaseConnect when they detect that the
connection's refcount dropped to zero. In this case another
virUnref* function (different from virUnrefConnect) removes the
last ref to the connection. This results in not closing the
open drivers and leaking things that should have been cleaned
up in the driver close functions.

To fix this move the driver close calls to virReleaseConnect.

14 years agoImplementations of virDomainIsUpdated for drivers except qemu
Osier Yang [Wed, 24 Nov 2010 07:43:15 +0000 (15:43 +0800)]
Implementations of virDomainIsUpdated for drivers except qemu

Except LXC and UML driver, implementations of all other drivers
simply return 0, because these drivers doesn't have config both
in memory and on disk, no need to track if the domain of these
drivers updated or not.

Rename "xenUnifiedDomainisPersistent" to "xenUnifiedDomainIsPersistent"

* esx/esx_driver.c
* lxc/lxc_driver.c
* opennebula/one_driver.c
* openvz/openvz_driver.c
* phyp/phyp_driver.c
* test/test_driver.c
* uml/uml_driver.c
* vbox/vbox_tmpl.c
* xen/xen_driver.c
* xenapi/xenapi_driver.c

14 years agoimplement callback function for qemu driver
Osier Yang [Mon, 15 Nov 2010 03:23:35 +0000 (11:23 +0800)]
implement callback function for qemu driver

* src/qemu/qemu_driver.c (add function qemuDomainIsUpdated)

14 years agoimplement the remote protocol
Osier Yang [Mon, 15 Nov 2010 03:23:34 +0000 (11:23 +0800)]
implement the remote protocol

* daemon/remote.c
* daemon/remote_dispatch_args.h
* daemon/remote_dispatch_prototypes.h
* daemon/remote_dispatch_ret.h
* daemon/remote_dispatch_table.h
* src/remote/remote_driver.c
* src/remote/remote_protocol.c
* src/remote/remote_protocol.h
* src/remote/remote_protocol.x
* src/remote_protocol-structs

14 years agoimplement public API virDomainIsUpdated
Osier Yang [Thu, 18 Nov 2010 11:12:06 +0000 (19:12 +0800)]
implement public API virDomainIsUpdated

* src/libvirt.c

14 years agodefine internal driver API
Osier Yang [Mon, 15 Nov 2010 03:23:33 +0000 (11:23 +0800)]
define internal driver API

* src/driver.h (new typedef, new callback member for "_virDriver")
* src/esx/esx_driver.c
* src/lxc/lxc_driver.c
* src/opennebula/one_driver.c
* src/openvz/openvz_driver.c
* src/phyp/phyp_driver.c
* src/qemu/qemu_driver.c
* src/remote/remote_driver.c
* src/test/test_driver.c
* src/uml/uml_driver.c
* src/vbox/vbox_tmpl.c
* src/xen/xen_driver.c
* src/xenapi/xenapi_driver.c

14 years agovirDomainIsUpdated: define the new public API
Osier Yang [Mon, 15 Nov 2010 03:23:32 +0000 (11:23 +0800)]
virDomainIsUpdated: define the new public API

introduce new public API "virDomainIsUpdated"

* src/conf/domain_conf.h (new member "updated" for "virDomainObj")
* src/libvirt_public.syms
* include/libvirt/libvirt.h.in

14 years agomaint: sort exports
Eric Blake [Mon, 22 Nov 2010 19:14:14 +0000 (12:14 -0700)]
maint: sort exports

* src/libvirt_private.syms (buf.h): Sort.

14 years agoremote: Fix TLS transport on Windows
Matthias Bolte [Sat, 20 Nov 2010 17:04:42 +0000 (18:04 +0100)]
remote: Fix TLS transport on Windows

gnulib wraps Windows' SOCKET handle based send() and recv() functions
into file descriptor based ones that are used in libvirt.

Even though GnuTLS is using gnulib too, it explicitly doesn't use
gnulib's replacement functions on Windows. By default GnuTLS uses the
SOCKET handle based send() and recv(). This makes gnutls_handshake()
fail internally with a WSAENOTSOCK error because libvirt passes a
file descriptor; GnuTLS needs the SOCKET handle.

To avoid this mismatch make sure that GnuTLS uses gnulib's replacment
functions, by setting custom pull() and push() functions for GnuTLS.

14 years agotests: Fix dispatching internal error reports
Cole Robinson [Tue, 23 Nov 2010 16:01:03 +0000 (11:01 -0500)]
tests: Fix dispatching internal error reports

Without this fix, the test suite doesn't print error messages when a libvirt
function fails. Additionally, only print error reports if DEBUG or VERBOSE
requested.

14 years agolibvirtd: fix bug when shrinking number of clients
Eric Blake [Mon, 22 Nov 2010 19:27:07 +0000 (12:27 -0700)]
libvirtd: fix bug when shrinking number of clients

* daemon/libvirtd.c (qemudRunLoop): Pass allocation size, not
current count, to VIR_SHRINK_N.
* docs/hacking.html.in: Update doc example.
* HACKING: Regenerate.

14 years agoRename 'remove' param to 'toremove' to avoid clash with stdio.h
Daniel P. Berrange [Tue, 23 Nov 2010 13:31:43 +0000 (13:31 +0000)]
Rename 'remove' param to 'toremove' to avoid clash with stdio.h

The stdio.h header has a function called 'remove' declared. This
clashes with the 'remove' parameter in virShrinkN

* src/util/memory.c: Rename 'remove' to 'toremove'

14 years agoFix 32-bit int truncation in QED header check
Daniel P. Berrange [Tue, 23 Nov 2010 13:32:31 +0000 (13:32 +0000)]
Fix 32-bit int truncation in QED header check

* src/util/memory.c: Avoid 32-bit truncation extracting a 64bit int

14 years agoFix error handling in virsh when listing storage volumes
Daniel P. Berrange [Fri, 12 Nov 2010 15:51:14 +0000 (15:51 +0000)]
Fix error handling in virsh when listing storage volumes

virsh was not checking for a error code when listing storage
volumes. So when listing volumes in a pool that was shutoff,
no output was displayed

* tools/virsh.c: Fix error handling when listing volumes

14 years agoImprove SCSI volume name generation
Daniel P. Berrange [Fri, 12 Nov 2010 15:49:40 +0000 (15:49 +0000)]
Improve SCSI volume name generation

The SCSI volumes currently get a name like '17:0:0:1' based
on $host:$bus:$target:$lun. The names are intended to be unique
per pool and stable across pool restarts. The inclusion of the
$host component breaks this, because the $host number for iSCSI
pools is dynamically allocated by the kernel at time of login.
This changes the name to be 'unit:0:0:1', ie removes the leading
host component. The 'unit:' prefix is just to ensure the volume
name doesn't start with a number and make it clearer when seen
out of context.

* src/storage/storage_backend_scsi.c: Improve volume name
  field value stability and uniqueness

14 years agoFix error codes returned when a storage pool is inactive
Daniel P. Berrange [Fri, 12 Nov 2010 15:47:37 +0000 (15:47 +0000)]
Fix error codes returned when a storage pool is inactive

Many operations are not valid on inactive storage pools. The
storage driver is currently returning VIR_ERR_INTERNAL_ERROR
in these cases, rather than the more suitable error code
VIR_ERR_OPERATION_INVALID

* src/storage/storage_driver.c: Fix error code when pool
  is not active

14 years agoCheck whether pools are already active upon libvirtd startup
Daniel P. Berrange [Thu, 11 Nov 2010 20:09:20 +0000 (20:09 +0000)]
Check whether pools are already active upon libvirtd startup

When libvirt starts up all storage pools default to the inactive
state, even if the underlying storage is already active on the
host. This introduces a new API into the internal storage backend
drivers that checks whether a storage pool is already active. If
the pool is active at libvirtd startup, the volume list will be
immediately populated.

* src/storage/storage_backend.h: New internal API for checking
  storage pool state
* src/storage/storage_driver.c: Check whether a pool is active
  upon driver startup
* src/storage/storage_backend_fs.c, src/storage/storage_backend_iscsi.c,
  src/storage/storage_backend_logical.c, src/storage/storage_backend_mpath.c,
  src/storage/storage_backend_scsi.c: Add checks for pool state

14 years agoRemove bogus port handling code in virsh
Daniel P. Berrange [Fri, 12 Nov 2010 13:30:32 +0000 (13:30 +0000)]
Remove bogus port handling code in virsh

The "find-storage-pool-sources-as" command takes two arguments,
a hostname and a port number. For some reason the code would
also then look for a port number appended to the hostname
string by searching for ':'. This totally breaks if the user
gives an IPv6 address, and is redundant, since you can already
provide a port as a separate argument

* tools/virsh.c: Remove bogus port number handling code

14 years agoAllow iSCSI IQN to be set with find-storage-pool-sources-as command
Daniel P. Berrange [Fri, 12 Nov 2010 13:27:51 +0000 (13:27 +0000)]
Allow iSCSI IQN to be set with find-storage-pool-sources-as command

Allow an iSCSI initiator IQN to be set with the XML for the
find-storage-pool-sources-as virsh command

* tools/virsh.c: Add iSCSI IQN support

14 years agoSwitch the virsh XML generation to use virBuffer instead of virAsprintf
Daniel P. Berrange [Fri, 12 Nov 2010 13:25:55 +0000 (13:25 +0000)]
Switch the virsh XML generation to use virBuffer instead of virAsprintf

The code generating XML for storage pool source discovery is
hardcoded to only allow a hostname and optional port number.
Refactor this code to make it easier to add support for extra
parameters.

* tools/virsh.c: Refactor XML generator

14 years agoAdd support for iSCSI target auto-discovery
Daniel P. Berrange [Fri, 12 Nov 2010 15:41:16 +0000 (15:41 +0000)]
Add support for iSCSI target auto-discovery

Since the previous patch added support for parsing the output of
the 'sendtargets' command, it is now trivial to support the
storage pool discovery API.

Given a hostname and optional portnumber and initiator IQN,
the code can return a full list of storage pool source docs,
each one representing a iSCSI target.

* src/storage/storage_backend_iscsi.c: Wire up target
  auto-discovery

14 years agoStop iSCSI targets automatically logging back in after logout
Daniel P. Berrange [Fri, 12 Nov 2010 15:21:48 +0000 (15:21 +0000)]
Stop iSCSI targets automatically logging back in after logout

The Linux iSCSI initiator toolchain has the dubious feature that
if you ever run the 'sendtargets' command to merely query what
targets are available from a server, the results will be recorded
in /var/lib/iscsi. Any time the '/etc/init.d/iscsi' script runs
in the future, it will then automatically login to all those
targets. /etc/init.d/iscsi is automatically run whenever a NIC
comes online.

So from the moment you ask a server what targets are available,
your client will forever more automatically try to login to all
targets without ever asking if you actually want it todo this.

To stop this stupid behaviour, we need to run

  iscsiadm --portal $PORTAL --target $TARGET
   --op update --name node.startup --value manual

For every target on the server.

* src/storage/storage_backend_iscsi.c: Disable automatic login
  for targets found as a result of a 'sendtargets' command

14 years agoRefactor iSCSI driver code to facilitate future changes
Daniel P. Berrange [Tue, 2 Nov 2010 11:40:46 +0000 (11:40 +0000)]
Refactor iSCSI driver code to facilitate future changes

The following series of patches are adding significant
extra functionality to the iSCSI driver. THe current
internal helper methods are not sufficiently flexible
to cope with these changes. This patch refactors the
code to avoid needing to have a virStoragePoolObjPtr
instance as a parameter, instead passing individual
target, portal and initiatoriqn parameters.

It also removes hardcoding of port 3260 in the portal
address, instead using the XML value if any.

* src/storage/storage_backend_iscsi.c: Refactor internal
  helper methods

14 years agoFix parsing of port attribute in storage XML configuration
Daniel P. Berrange [Fri, 12 Nov 2010 13:23:55 +0000 (13:23 +0000)]
Fix parsing of port attribute in storage XML configuration

The XML docs describe a 'port' attribute for the
storage source <host> element, but the parser never
handled it.

* docs/schemas/storagepool.rng: Define port attribute
* src/conf/storage_conf.c: Add missing parsing/formatting
  of host port number
* src/conf/storage_conf.h: Remove bogus/unused 'protocol' field

14 years agoDon't catch SIGCHLD in libvirtd
Daniel P. Berrange [Tue, 23 Nov 2010 10:59:51 +0000 (10:59 +0000)]
Don't catch SIGCHLD in libvirtd

libvirtd no longer deals with SIGCHLD in its signal handler
since the QEMU driver switched to always daemonize processes.
Thus remove the sigaction for it, to avoid warning log
messages

* daemon/libvirtd.c: Don't catch SIGCHLD