]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
15 years agoFix up a misspelled comment.
Chris Lalancette [Wed, 10 Feb 2010 21:11:42 +0000 (16:11 -0500)]
Fix up a misspelled comment.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix disk stats retrieval with QEMU >= 0.12
Daniel P. Berrange [Wed, 10 Feb 2010 17:46:44 +0000 (17:46 +0000)]
Fix disk stats retrieval with QEMU >= 0.12

With QEMU >= 0.12 the host and guest side of disks no longer have
the same naming convention. Specifically the host side will now
get a 'drive-' prefix added to its name. The 'info blockstats'
monitor command returns the host side name, so it is neccessary
to strip this off when looking up stats since libvirt stores the
guest side name !

* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Move 'drive-' prefix
  string to a defined constant
* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_text.c: Strip
  off 'drive-' prefix (if found) when looking up disk stats

15 years agoqemu: Increase guest startup timeout to 30 seconds
Cole Robinson [Tue, 9 Feb 2010 20:10:41 +0000 (15:10 -0500)]
qemu: Increase guest startup timeout to 30 seconds

Currently the timeout for reading startup output is 3 seconds. If the
host is under any sort of load, we can easily trigger this. Lets bump
it to 30 seconds.

Since the polling loop checks to see if the process has died, we shouldn't
erroneously hit this timeout if qemu bombs (only if it is stuck in some
infinite loop).

15 years agoqemu: Properly report a startup timeout error
Cole Robinson [Tue, 9 Feb 2010 19:45:35 +0000 (14:45 -0500)]
qemu: Properly report a startup timeout error

The timeout errors were unconditionally being overwritten by the less
helpful 'unable to start guest' error.

15 years agotest: Fake security driver support in capabilities
Cole Robinson [Tue, 9 Feb 2010 17:16:00 +0000 (12:16 -0500)]
test: Fake security driver support in capabilities

Having some value in capabilities helps testing this stuff in
virt-manager.

15 years agoAnnotate some virConnectPtr as mandatory non-null
Daniel P. Berrange [Wed, 10 Feb 2010 13:19:17 +0000 (13:19 +0000)]
Annotate some virConnectPtr as mandatory non-null

Use the ATTRIBUTE_NONNULL annotation to mark some virConnectPtr
args as mandatory non-null so the compiler can warn of mistakes

* src/conf/domain_event.h: All virConnectPtr args must be non-null
* src/qemu/qemu_conf.h: qemudBuildCommandLine and
  qemudNetworkIfaceConnect() must be given non-null connection
* tests/qemuxml2argvtest.c: Provide a non-null (dummy) connection to
  qemudBuildCommandLine()

15 years agoRemove virConnectPtr from secret XML APIs
Daniel P. Berrange [Wed, 10 Feb 2010 12:33:34 +0000 (12:33 +0000)]
Remove virConnectPtr from secret XML APIs

The virConnectPtr is no longer required for error reporting since
that is recorded in a thread local. Remove use of virConnectPtr
from all APIs in secret_conf.{h,c} and update all callers to
match

15 years agoRemove virConnectPtr from interface XML APIs
Daniel P. Berrange [Wed, 10 Feb 2010 12:28:05 +0000 (12:28 +0000)]
Remove virConnectPtr from interface XML APIs

The virConnectPtr is no longer required for error reporting since
that is recorded in a thread local. Remove use of virConnectPtr
from all APIs in interface_conf.{h,c} and update all callers to
match

15 years agoRemove virConnectPtr from CPU XML APIs
Daniel P. Berrange [Wed, 10 Feb 2010 12:22:36 +0000 (12:22 +0000)]
Remove virConnectPtr from CPU XML APIs

The virConnectPtr is no longer required for error reporting since
that is recorded in a thread local. Remove use of virConnectPtr
from all APIs in cpu_conf.{h,c} and update all callers to
match

15 years agoRemove virConnectPtr from storage APIs & driver
Daniel P. Berrange [Wed, 10 Feb 2010 11:42:56 +0000 (11:42 +0000)]
Remove virConnectPtr from storage APIs & driver

The virConnectPtr is no longer required for error reporting since
that is recorded in a thread local. Remove use of virConnectPtr
from all APIs in storage_conf.{h,c} and storage_encryption_conf.{h,c}
and update all callers to match

15 years agoRemove virConnectPtr from all node device XML APIs
Daniel P. Berrange [Wed, 10 Feb 2010 10:40:18 +0000 (10:40 +0000)]
Remove virConnectPtr from all node device XML APIs

The virConnectPtr is no longer required for error reporting since
that is recorded in a thread local. Remove use of virConnectPtr
from all APIs in node_device_conf.{h,c} and update all callers to
match

15 years agoRemove virConnectPtr from network XML APis
Daniel P. Berrange [Wed, 10 Feb 2010 10:22:52 +0000 (10:22 +0000)]
Remove virConnectPtr from network XML APis

The virConnectPtr is no longer required for error reporting since
that is recorded in a thread local. Remove use of virConnectPtr
from all APIs in network_conf.{h,c} and update all callers to
match

15 years agoRemove virConnectPtr from USB/PCI device iterators
Daniel P. Berrange [Wed, 10 Feb 2010 09:55:39 +0000 (09:55 +0000)]
Remove virConnectPtr from USB/PCI device iterators

All callers now pass a NULL virConnectPtr into the USB/PCi device
iterator functions. Therefore the virConnectPtr arg can now be
removed from these functions

* src/util/hostusb.h, src/util/hostusb.c: Remove virConnectPtr
  from usbDeviceFileIterate
* src/util/pci.c, src/util/pci.h: Remove virConnectPtr arg from
  pciDeviceFileIterate
* src/qemu/qemu_security_dac.c, src/security/security_selinux.c: Update
  to drop redundant virConnectPtr arg

15 years agoFix generation of floppy disk arg for QEMU's -global arg
Daniel P. Berrange [Wed, 10 Feb 2010 09:22:42 +0000 (09:22 +0000)]
Fix generation of floppy disk arg for QEMU's -global arg

* src/qemu/qemu_conf.c: Fix ',' vs '.' typo in floppy disk arg

15 years agoFix compile error in Xen proxy from virConnectPtr changes
Daniel P. Berrange [Wed, 10 Feb 2010 12:51:08 +0000 (12:51 +0000)]
Fix compile error in Xen proxy from virConnectPtr changes

* proxy/libvirt_proxy.c: Remove 'conn' arg to virDomainDefFormat

15 years agoConvert qemu command line flags to 64-bit int
Daniel P. Berrange [Tue, 9 Feb 2010 13:06:56 +0000 (13:06 +0000)]
Convert qemu command line flags to 64-bit int

The QEMU flags are commonly stored as a signed or unsigned int,
allowing only 31 flags. This limit is rather close, so to aid
future patches, change it to a 64-bit int

* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h, src/qemu/qemu_driver.c,
  tests/qemuargv2xmltest.c, tests/qemuhelptest.c, tests/qemuxml2argvtest.c:
  Use 'unsigned long long' for QEMU flags

15 years agoRemove use of virConnectPtr from security driver APIs
Daniel P. Berrange [Tue, 9 Feb 2010 19:18:21 +0000 (19:18 +0000)]
Remove use of virConnectPtr from security driver APIs

The virConnectPtr is no longer required for error reporting since
that is recorded in a thread local. Remove use of virConnectPtr
from all APIs in security_driver.{h,c} and update all callers to
match

15 years agoRemove virConnectPtr from all domain XML parsing/formatting APIs
Daniel P. Berrange [Tue, 9 Feb 2010 18:58:01 +0000 (18:58 +0000)]
Remove virConnectPtr from all domain XML parsing/formatting APIs

15 years agoRemove virConnectPtr from LXC driver
Daniel P. Berrange [Tue, 9 Feb 2010 18:22:56 +0000 (18:22 +0000)]
Remove virConnectPtr from LXC driver

15 years agoRemove passing of virConnectPtr throughout QEMU driver
Daniel P. Berrange [Tue, 9 Feb 2010 18:15:41 +0000 (18:15 +0000)]
Remove passing of virConnectPtr throughout QEMU driver

15 years agoFix security driver configuration
Daniel P. Berrange [Tue, 9 Feb 2010 13:17:39 +0000 (13:17 +0000)]
Fix security driver configuration

The security driver was mistakenly initialized before the QEMU
config file was loaded. This prevents it being turned off again.
The capabilities XML was also getting the wrong security driver
name, due to the stacked driver arrangement.

* src/qemu/qemu_driver.c: Fix initialization order and capabilities
  model name

15 years agovirAsprintf: remove its warn_unused_result attribute
Jim Meyering [Wed, 10 Feb 2010 11:00:38 +0000 (12:00 +0100)]
virAsprintf: remove its warn_unused_result attribute

* src/util/util.h (virAsprintf): Remove ATTRIBUTE_RETURN_CHECK, since
it is perfectly fine to ignore the return value, now that the pointer
is guaranteed to be set to NULL upon failure.
* src/util/storage_file.c (absolutePathFromBaseFile): Remove now-
unnecessary use of ignore_value.

15 years agoabsolutePathFromBaseFile: avoid an unnecessary use of assert
Jim Meyering [Wed, 10 Feb 2010 10:54:24 +0000 (11:54 +0100)]
absolutePathFromBaseFile: avoid an unnecessary use of assert

* src/util/storage_file.c (absolutePathFromBaseFile): While this use
of virAsprintf is slightly cleaner than using stpncpy(stpcpy(...,
it does impose an artificial limitation on the length of the base_file
name.  Rather than asserting that it does not exceed INT_MAX, return
NULL when it does.

15 years agoEscape strings serialized in XML
Daniel Veillard [Mon, 8 Feb 2010 17:03:43 +0000 (18:03 +0100)]
Escape strings serialized in XML

* src/conf/node_device_conf.c: string saved into XML should be escaped
  with the use of virBufferEscapeString()

15 years agoCreate raw storage files with O_DSYNC
Jiri Denemark [Mon, 8 Feb 2010 15:10:02 +0000 (16:10 +0100)]
Create raw storage files with O_DSYNC

When creating preallocated large raw files opening them with O_DSYNC
prevents long delays in reading because cache pages can be immediately
reused without writing them on a disk first.

15 years agoRe-generate remote protocol files for new APIs
Daniel P. Berrange [Tue, 9 Feb 2010 12:09:05 +0000 (12:09 +0000)]
Re-generate remote protocol files for new APIs

Re-generate remote protocol files for changes in commit
daeb6f6b40432f74150c96fa99ef12df31344fbb

* daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h,
  daemon/remote_dispatch_table.h, src/remote/remote_protocol.c,
  src/remote/remote_protocol.h: Re-generate files

15 years agoRemove conn parameter from USB functions
Matthias Bolte [Thu, 4 Feb 2010 23:25:16 +0000 (00:25 +0100)]
Remove conn parameter from USB functions

It was used for error reporting only.

15 years agoRemove conn parameter from JSON error macro
Matthias Bolte [Thu, 4 Feb 2010 23:20:56 +0000 (00:20 +0100)]
Remove conn parameter from JSON error macro

15 years agoRemove conn parameter from PCI functions
Matthias Bolte [Thu, 4 Feb 2010 23:16:34 +0000 (00:16 +0100)]
Remove conn parameter from PCI functions

It was used for error reporting only.

15 years agoRemove conn parameter from Linux stats functions
Matthias Bolte [Thu, 4 Feb 2010 23:02:10 +0000 (00:02 +0100)]
Remove conn parameter from Linux stats functions

It was used for error reporting only.

15 years agoRemove conn parameter from storage file functions
Matthias Bolte [Thu, 4 Feb 2010 22:46:55 +0000 (23:46 +0100)]
Remove conn parameter from storage file functions

It was used for error reporting only.

15 years agoRemove conn parameter from util functions
Matthias Bolte [Thu, 4 Feb 2010 22:41:52 +0000 (23:41 +0100)]
Remove conn parameter from util functions

It was used for error reporting only.

15 years agoRemove conn parameter from virXPath* functions
Matthias Bolte [Thu, 4 Feb 2010 21:52:34 +0000 (22:52 +0100)]
Remove conn parameter from virXPath* functions

It was used for error reporting only.

15 years agoRemove conn parameter from virReportSystemError
Matthias Bolte [Thu, 4 Feb 2010 20:02:58 +0000 (21:02 +0100)]
Remove conn parameter from virReportSystemError

15 years agoRemove conn parameter from virReportOOMError
Matthias Bolte [Thu, 4 Feb 2010 18:19:08 +0000 (19:19 +0100)]
Remove conn parameter from virReportOOMError

15 years agoModify virsh commands
Jim Fehlig [Thu, 14 Jan 2010 01:54:58 +0000 (18:54 -0700)]
Modify virsh commands

Change all virsh commands that invoke virDomain{Attach,Detach}Device()
to use virDomain{Attach,Detach}DeviceFlags() instead.

Add a "--persistent" flag to these virsh commands, allowing user to
specify that the domain persisted config be modified as well.

V2: Only invoke virDomain{Attach,Detach}DeviceFlags() if
"--persistent" flag is specified.  Otherwise invoke
virDomain{Attach,Detach}Device() to retain current behavior.

15 years agodomain{Attach,Detach}DeviceFlags handler for drivers
Jim Fehlig [Thu, 14 Jan 2010 01:44:26 +0000 (18:44 -0700)]
domain{Attach,Detach}DeviceFlags handler for drivers

Implementation of domain{Attach,Detach}DeviceFlags handlers
in the drivers.

15 years agoServer side dispatcher
Jim Fehlig [Thu, 14 Jan 2010 01:42:28 +0000 (18:42 -0700)]
Server side dispatcher

Server side dispatcher for Domain{Attach,Detach}DeviceFlags.

15 years agoRemote driver
Jim Fehlig [Thu, 14 Jan 2010 01:41:13 +0000 (18:41 -0700)]
Remote driver

Implementation of Domain{Attach,Detach}DeviceFlags in remote driver.

15 years agoWire protocol format
Jim Fehlig [Thu, 14 Jan 2010 01:39:35 +0000 (18:39 -0700)]
Wire protocol format

Definition of wire protocol format for
virDomain{Attach,Detach}DeviceFlags.

15 years agoPublic API Implementation
Jim Fehlig [Thu, 14 Jan 2010 01:34:23 +0000 (18:34 -0700)]
Public API Implementation

Implementation of public API for virDomain{Attach,Detach}DeviceFlags.

V2: Don't break remote compatibility with older libvirtd

15 years agoInternal API
Jim Fehlig [Thu, 14 Jan 2010 01:31:14 +0000 (18:31 -0700)]
Internal API

Definition of internal API for virDomain{Attach,Detach}DeviceFlags.

15 years agoPublic API
Jim Fehlig [Thu, 14 Jan 2010 01:29:16 +0000 (18:29 -0700)]
Public API

Definition of public API for virDomain{Attach,Detach}DeviceFlags.

V2: Adjust libvrt_public.syms to anticipated 0.7.7 release.

15 years agodoc: restrict virDomain{Attach,Detach}Device to active domains
Jim Fehlig [Thu, 14 Jan 2010 01:24:51 +0000 (18:24 -0700)]
doc: restrict virDomain{Attach,Detach}Device to active domains

virDomain{Attach,Detach}Device is now only permitted on active
domains.  Explicitly state this restriction in the API
documentation.

V2: Only change doc, dropping the hunk that forced the restriction
    in libvirt frontend.

15 years agobuild: update gnulib submodule to latest
Jim Meyering [Fri, 5 Feb 2010 16:57:39 +0000 (17:57 +0100)]
build: update gnulib submodule to latest

* .gnulib: This fixes a warning in test-gettimeofday.c,
seen via "make check".  Reported by Daniel Veillard.

15 years ago(absolutePathFromBaseFile): fix up preceding commit
Jim Meyering [Fri, 5 Feb 2010 13:57:35 +0000 (14:57 +0100)]
(absolutePathFromBaseFile): fix up preceding commit

When configured with --enable-gcc-warnings, it didn't even compile.
* src/util/storage_file.c: Include <assert.h>.
(absolutePathFromBaseFile): Assert that converting size_t to int is valid.
Reverse length/string args to match "%.*s".
Explicitly ignore the return value of virAsprintf.

15 years agoabsolutePathFromBaseFile: don't leak when first arg contains no "/"
Jim Meyering [Thu, 4 Feb 2010 15:55:57 +0000 (16:55 +0100)]
absolutePathFromBaseFile: don't leak when first arg contains no "/"

* src/util/storage_file.c: Include "dirname.h".
(absolutePathFromBaseFile): Rewrite not to leak, and to require
fewer allocations.
* bootstrap (modules): Add dirname-lgpl.
* .gnulib: Update submodule to the latest.

15 years agosexpr_string: avoid leak on OOM error path
Jim Meyering [Thu, 4 Feb 2010 16:55:15 +0000 (17:55 +0100)]
sexpr_string: avoid leak on OOM error path

* src/xen/sexpr.c (sexpr_string): Free sexpr buffer upon allocation
failure.

15 years agovirDomainChrDefParseXML: don't leak upon invalid input
Jim Meyering [Thu, 4 Feb 2010 11:49:53 +0000 (12:49 +0100)]
virDomainChrDefParseXML: don't leak upon invalid input

* src/conf/domain_conf.c (virDomainChrDefParseXML): Don't leak a
virDomainChrDef buffer upon "unknown target type for char device" error.

15 years agovirExecWithHook: avoid leak on OOM error path
Jim Meyering [Thu, 4 Feb 2010 11:25:34 +0000 (12:25 +0100)]
virExecWithHook: avoid leak on OOM error path

* src/util/util.c (virExecWithHook): Free argv_str string before
returning upon failure to allocate space for environment.

15 years agocgroup.c: don't leak mem+FD upon OOM
Jim Meyering [Thu, 4 Feb 2010 10:22:20 +0000 (11:22 +0100)]
cgroup.c: don't leak mem+FD upon OOM

* src/util/cgroup.c (virCgroupDetectPlacement): Close the mapping
FILE* also upon error.

15 years agocgroup.c: avoid unconditional leaks
Jim Meyering [Thu, 4 Feb 2010 10:14:03 +0000 (11:14 +0100)]
cgroup.c: avoid unconditional leaks

* src/util/cgroup.c (virCgroupCpuSetInherit) [HAVE_MNTENT_H]:
Don't leak CPU-set inheritance value strings.

15 years agowebsite: Add a 1em right margin
Matthias Bolte [Thu, 4 Feb 2010 15:36:36 +0000 (16:36 +0100)]
website: Add a 1em right margin

This stops the text and pre-boxes from touching the right border.

15 years agostorage: Replace storageLog with VIR_ERROR
Matthias Bolte [Sun, 31 Jan 2010 17:12:05 +0000 (18:12 +0100)]
storage: Replace storageLog with VIR_ERROR

15 years agoopennebula: Remove unnecessary casts
Matthias Bolte [Sun, 31 Jan 2010 14:31:04 +0000 (15:31 +0100)]
opennebula: Remove unnecessary casts

15 years agoesx: Remove unnecessary casts
Matthias Bolte [Sun, 31 Jan 2010 14:29:02 +0000 (15:29 +0100)]
esx: Remove unnecessary casts

15 years agocpu conf: Use virBufferFreeAndReset instead of virBufferContentAndReset and VIR_FREE
Matthias Bolte [Sat, 30 Jan 2010 16:27:05 +0000 (17:27 +0100)]
cpu conf: Use virBufferFreeAndReset instead of virBufferContentAndReset and VIR_FREE

15 years agodocs: Refer to virReportOOMError in the HACKING file
Matthias Bolte [Sat, 30 Jan 2010 11:35:04 +0000 (12:35 +0100)]
docs: Refer to virReportOOMError in the HACKING file

Instead of refering to __virRaiseError(VIR_ERROR_NO_MEMORY).

15 years agoesx: Cleanup preprocessing structure in esxVI_EnsureSession
Matthias Bolte [Sat, 30 Jan 2010 10:16:01 +0000 (11:16 +0100)]
esx: Cleanup preprocessing structure in esxVI_EnsureSession

15 years agodocs: Emphasize that devices have to be inside the <devices> element
Matthias Bolte [Thu, 4 Feb 2010 14:27:52 +0000 (15:27 +0100)]
docs: Emphasize that devices have to be inside the <devices> element

Also cleanup indentation of domain XML examples.

15 years agovirt-pki-validate contains unexpanded SYSCONFDIR variable
Doug Goldstein [Thu, 4 Feb 2010 15:47:29 +0000 (16:47 +0100)]
virt-pki-validate contains unexpanded SYSCONFDIR variable

* tools/virt-pki-validate.in: use an automake variable instead of a
  shell variable so the resulting shell actually work

15 years agoRelease of libvirt-0.7.6
Daniel Veillard [Wed, 3 Feb 2010 17:16:25 +0000 (18:16 +0100)]
Release of libvirt-0.7.6

* configure.ac docs/news.html.in libvirt.spec.in: version bump and doc
  updates
* po/*.po*: updated and regenerated the localizations

15 years agoFix restore of QEMU guests with PCI device reservation
Daniel P. Berrange [Wed, 3 Feb 2010 16:11:29 +0000 (16:11 +0000)]
Fix restore of QEMU guests with PCI device reservation

When restoring from a saved guest image, the XML would already
contain the PCI slot ID of the IDE controller & video card.
The attempt to explicitly reserve this upfront would thus fail
everytime.

* src/qemu/qemu_conf.c: Reserve IDE controller / video card
  slot at time of need, rather than upfront

15 years agoAnother fork() log locking cleanup in file creation
Laine Stump [Wed, 3 Feb 2010 16:19:39 +0000 (17:19 +0100)]
Another fork() log locking cleanup in file creation

Similar fix as previous one but for fork() usage when creating
a file or directory

* src/util/util.c: virLogLock() and virLogUnlock() around fork()
  in virFileCreate() and virDirCreateSimple()

15 years agoFix log locking problem when using fork() in the library
Cole Robinson [Wed, 3 Feb 2010 16:12:57 +0000 (17:12 +0100)]
Fix log locking problem when using fork() in the library

Ad pointed out by Dan Berrange:
So if some thread in libvirtd is currently executing a logging call,
while another thread calls virExec(), that other thread no longer
exists in the child, but its lock is never released. So when the
child then does virLogReset() it deadlocks.

The only way I see to address this, is for the parent process to call
virLogLock(), immediately before fork(), and then virLogUnlock()
afterwards in both parent & child. This will ensure that no other
thread
can be holding the lock across fork().

* src/util/logging.[ch] src/libvirt_private.syms: export virLogLock() and
  virLogUnlock()
* src/util/util.c: lock just before forking and unlock just after - in
  both parent and child.

15 years agoFix locking for udev device add/remove
David Allan [Wed, 3 Feb 2010 15:56:33 +0000 (16:56 +0100)]
Fix locking for udev device add/remove

The original udev node device backend neglected to lock the driverState
struct containing the device list when adding and removing devices
* src/node_device/node_device_udev.c: add necessary locks in
  udevRemoveOneDevice() and udevAddOneDevice()

15 years agointerface_conf.c: don't use a negative value as allocation size
Jim Meyering [Tue, 2 Feb 2010 19:54:01 +0000 (20:54 +0100)]
interface_conf.c: don't use a negative value as allocation size

* src/conf/interface_conf.c (virInterfaceDefParseProtoIPv4): If
virXPathNodeSet returns -1, indicate failure by returning -1 right away.
(virInterfaceDefParseProtoIPv6): Likewise.

15 years agovirStoragePoolSourceListNewSource: avoid unconditional leak
Jim Meyering [Tue, 2 Feb 2010 18:59:14 +0000 (19:59 +0100)]
virStoragePoolSourceListNewSource: avoid unconditional leak

* src/conf/storage_conf.c (virStoragePoolSourceListNewSource):
Remove an unused (and leaked) allocation.

15 years agoxs_internal.c: don't use a negative value as allocation size
Jim Meyering [Tue, 2 Feb 2010 11:22:17 +0000 (12:22 +0100)]
xs_internal.c: don't use a negative value as allocation size

* src/xen/xs_internal.c (xenStoreDomainIntroduced): Don't use -1
as an allocation size upon xenStoreNumOfDomains failure.
(xenStoreDomainReleased): Likewise.

15 years agoEnsure QEMU DAC security driver is activated at all times
Daniel P. Berrange [Tue, 2 Feb 2010 16:19:20 +0000 (16:19 +0000)]
Ensure QEMU DAC security driver is activated at all times

If the primary security driver (SELinux/AppArmour) was disabled
then the secondary QEMU DAC security driver was also disabled.
This is mistaken, because the latter must be active at all times

* src/qemu/qemu_driver.c: Ensure DAC driver is always active

15 years agoxen_hypervisor.c: remove all "domain == NULL" tests, ...
Jim Meyering [Wed, 27 Jan 2010 12:34:03 +0000 (13:34 +0100)]
xen_hypervisor.c: remove all "domain == NULL" tests, ...

* src/xen/xen_hypervisor.c: Remove all "domain == NULL" tests.
* src/xen/xen_hypervisor.h: Instead, use ATTRIBUTE_NONNULL to
mark each "domain" parameter as "known always to be non-NULL".

15 years agoxen_hypervisor.c: avoid NULL deref for NULL domain argument
Jim Meyering [Tue, 26 Jan 2010 19:17:07 +0000 (20:17 +0100)]
xen_hypervisor.c: avoid NULL deref for NULL domain argument

* src/xen/xen_hypervisor.c (xenHypervisorGetVcpus): Don't attempt
to diagnose an unlikely NULL-domain or NULL-domain->conn error.

15 years agoTweak USB hostdevice XML handling
Daniel P. Berrange [Mon, 1 Feb 2010 17:21:05 +0000 (17:21 +0000)]
Tweak USB hostdevice XML handling

When attaching a USB host device based on vendor/product, libvirt
will resolve the vendor/product into a device/bus pair. This means
that when printing XML we should allow device/bus info to be printed
at any time if present

* src/conf/domain_conf.c, docs/schemas/domain.rng: Allow USB device
  bus info alongside vendor/product

15 years agoFix QEMU hotplug device alias assignment
Daniel P. Berrange [Mon, 1 Feb 2010 16:28:46 +0000 (16:28 +0000)]
Fix QEMU hotplug device alias assignment

To allow devices to be hot(un-)plugged it is neccessary to ensure
they all have a unique device aliases. This fixes the hotplug
methods to assign device aliases before invoking the monitor
commands which need them

* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Expose methods
  for assigning device aliases for disks, host devices and
  controllers
* src/qemu/qemu_driver.c: Assign device aliases when hotplugging
  all types of device
* tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-address-device.args,
  tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address-device.args:
  Update for changed hostdev naming scheme

15 years agoDisable QEMU monitor IO debugging by default
Daniel P. Berrange [Mon, 1 Feb 2010 16:28:27 +0000 (16:28 +0000)]
Disable QEMU monitor IO debugging by default

15 years agoRe-arrange QEMU device alias assignment code
Daniel P. Berrange [Mon, 1 Feb 2010 15:58:38 +0000 (15:58 +0000)]
Re-arrange QEMU device alias assignment code

This patch re-arranges the QEMU device alias assignment code to
make it easier to call into the same codeblock when performing
device hotplug. The new code has the ability to skip over already
assigned names to facilitate hotplug

* src/qemu/qemu_driver.c: Call qemuAssignDeviceNetAlias()
  instead of qemuAssignNetNames
* src/qemu/qemu_conf.h: Export qemuAssignDeviceNetAlias()
  instead of qemuAssignNetNames
* src/qemu/qemu_driver.c: Merge the legacy disk/network alias
  assignment code into the main methods

15 years agoRemove direct storage of hostnet_name & vlan
Daniel P. Berrange [Mon, 1 Feb 2010 15:06:36 +0000 (15:06 +0000)]
Remove direct storage of hostnet_name & vlan

The current way of assigning names to the host network backend and
NIC device in QEMU was over complicated, by varying naming scheme
based on the NIC model and backend type. This simplifies the naming
to simply be 'net0' and 'hostnet0', allowing code to easily determine
the host network name and vlan based off the primary device alias
name 'net0'. This in turn allows removal of alot of QEMU specific
code from the XML parser, and makes it easier to assign new unique
names for NICs that are hotplugged

* src/conf/domain_conf.c, src/conf/domain_conf.h: Remove hostnet_name
  and vlan fields from virNetworkDefPtr
* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h, src/qemu/qemu_driver.c:
  Use a single network alias naming scheme regardless of NIC type
  or backend type. Determine VLANs from the alias name.
* tests/qemuxml2argvdata/qemuxml2argv-net-eth-names.args,
  tests/qemuxml2argvdata/qemuxml2argv-net-virtio-device.args,
  tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev.args: Update
  for new simpler naming scheme

15 years agoRemove use of -netdev arg with QEMU
Daniel P. Berrange [Fri, 29 Jan 2010 18:07:04 +0000 (18:07 +0000)]
Remove use of -netdev arg with QEMU

The QEMU 0.12.x tree has the -netdev command line argument, but not
corresponding monitor command. We can't enable the former, without
the latter since it will break hotplug/unplug.

* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Disable -netdev usage
  until 0.13 at earliest
* tests/qemuxml2argvtest.c: Add test for -netdev syntax
* tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev.args,
  tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev.xml: Test
  data files for -netdev syntax

15 years agoAssign PCI addresses before hotplugging devices
Daniel P. Berrange [Wed, 27 Jan 2010 17:49:19 +0000 (17:49 +0000)]
Assign PCI addresses before hotplugging devices

PCI disk, disk controllers, net devices and host devices need to
have PCI addresses assigned before they are hot-plugged

* src/qemu/qemu_conf.c: Add APIs for ensuring a device has an
  address and releasing unused addresses
* src/qemu/qemu_driver.c: Ensure all devices have addresses
  when hotplugging.

15 years agoRewrite way QEMU PCI addresses are allocated
Daniel P. Berrange [Wed, 27 Jan 2010 17:03:54 +0000 (17:03 +0000)]
Rewrite way QEMU PCI addresses are allocated

The current QEMU code allocates PCI addresses incrementally starting
at 4. This is not satisfactory because the user may have given some
addresses in their XML config, which need to be skipped over when
allocating addresses to remaining devices.

It is thus neccessary to maintain a list of already allocated PCI
addresses and then only allocate ones that remain unused. This is
also required for domain device hotplug to work properly later.

* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Add APIs for creating
  list of existing PCI addresses, and allocating new addresses.
  Refactor address assignment to use this code
* src/qemu/qemu_driver.c: Pull PCI address assignment up into the
  qemuStartVMDaemon() method, as a prelude to moving it into the
  'define' method. Update list of allocated addresses when connecting
  to a running VM at daemon startup.
* tests/qemuxml2argvtest.c, tests/qemuargv2xmltest.c,
  tests/qemuxml2xmltest.c: Remove USB product test since all
  passthrough is done based on address
* tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.args,
  tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.xml: Kil
  unused data files

15 years agoIntroduce generic virDomainDeviceInfo iterator function
Daniel P. Berrange [Wed, 27 Jan 2010 15:10:34 +0000 (15:10 +0000)]
Introduce generic virDomainDeviceInfo iterator function

The virDomainDeviceInfoIterate() function will provide a
convenient way to iterate over all devices in a domain.

* src/conf/domain_conf.c, src/conf/domain_conf.h,
  src/libvirt_private.syms: Add virDomainDeviceInfoIterate()
  function.

15 years agoMake hotplug use new device_add where possible
Daniel P. Berrange [Tue, 26 Jan 2010 17:40:19 +0000 (17:40 +0000)]
Make hotplug use new device_add where possible

Since QEMU startup uses the new -device argument, the hotplug
code needs todo the same. This converts disk, network and
host device hotplug to use the device_add command

* src/qemu/qemu_driver.c: Use new device_add monitor APIs
  whereever possible

15 years agoIntroduce internal QEMU monitor APIs for drive + device hotadd
Daniel P. Berrange [Tue, 26 Jan 2010 15:34:46 +0000 (15:34 +0000)]
Introduce internal QEMU monitor APIs for drive + device hotadd

The way QEMU is started has been changed to use '-device' and
the new style '-drive' syntax. This needs to be mirrored in
the hotplug code, requiring addition of two new APIs.

* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Define APIs
  qemuMonitorAddDevice() and qemuMonitorAddDrive()
* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
  src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
  Implement the new monitor APIs

15 years agoSplit out QEMU code for building PCI/USB hostdev arg values
Daniel P. Berrange [Tue, 26 Jan 2010 13:44:12 +0000 (13:44 +0000)]
Split out QEMU code for building PCI/USB hostdev arg values

To allow for better code reuse from hotplug methods, the code for
generating PCI/USB hostdev arg values is split out into separate
methods

* qemu/qemu_conf.h, qemu/qemu_conf.c: Introduce new APis for
  qemuBuildPCIHostdevPCIDevStr, qemuBuildUSBHostdevUsbDevStr
  and qemuBuildUSBHostdevDevStr

15 years agoStandard internal API syntax for building QEMU command line arguments
Daniel P. Berrange [Tue, 26 Jan 2010 13:00:18 +0000 (13:00 +0000)]
Standard internal API syntax for building QEMU command line arguments

All the helper functions for building command line arguments
now return a 'char *', instead of acepting a 'char **' or
virBufferPtr argument

* qemu/qemu_conf.c: Standardize syntax for building args
* qemu/qemu_conf.h: Export all functions for building args
* qemu/qemu_driver.c: Update for changed syntax for building
  NIC/hostnet args

15 years agolibvirtd.c: avoid closing a negative socket file descriptor
Jim Meyering [Tue, 2 Feb 2010 10:27:25 +0000 (11:27 +0100)]
libvirtd.c: avoid closing a negative socket file descriptor

* daemon/libvirtd.c (qemudListenUnix): Close socket only if non-negative.

15 years agostorage_backend.c: avoid closing a negative file descriptor
Jim Meyering [Tue, 2 Feb 2010 10:11:49 +0000 (11:11 +0100)]
storage_backend.c: avoid closing a negative file descriptor

* src/storage/storage_backend.c (virStorageBackendRunProgRegex):
Don't close a negative (read-only) file descriptor.

15 years agoavoid a probable EINVAL from lseek
Jim Meyering [Mon, 1 Feb 2010 21:17:44 +0000 (22:17 +0100)]
avoid a probable EINVAL from lseek

* src/qemu/qemu_driver.c (qemudLogReadFD): Don't pass a negative
offset (from a preceding failed attempt to seek to EOF) to this use
of lseek.

15 years agoudev: Don't let strtoul parse USB busnum and devnum as octal
Matthias Bolte [Sat, 30 Jan 2010 23:53:40 +0000 (00:53 +0100)]
udev: Don't let strtoul parse USB busnum and devnum as octal

udevGetUintProperty was called with base set to 0 for busnum and devnum.
With base 0 strtoul parses the number as octal if it start with a 0. But
busnum and devnum are decimal and udev returns them padded with leading
zeros. So strtoul parses them as octal. This works for certain decimal
values like 001-007, but fails for values like 008.

Change udevProcessUSBDevice to use base 10 for busnum and devnum.

15 years agoutil.c (two more): don't use a negative value as allocation size
Jim Meyering [Mon, 1 Feb 2010 20:45:06 +0000 (21:45 +0100)]
util.c (two more): don't use a negative value as allocation size

* src/util/util.c (virGetUserID, virGetGroupID): In the unlikely event
that sysconf(_SC_GETPW_R_SIZE_MAX) fails, don't use -1 as the size in
the subsequent allocation.

15 years agojson.c: avoid an unconditional leak from most qemuMonitorJSON* functions
Jim Meyering [Wed, 27 Jan 2010 08:58:12 +0000 (09:58 +0100)]
json.c: avoid an unconditional leak from most qemuMonitorJSON* functions

* src/util/json.c (virJSONValueFree): Free the "value" pointer, too.

15 years agoavoid format-related warnings
Jim Meyering [Mon, 1 Feb 2010 17:25:23 +0000 (18:25 +0100)]
avoid format-related warnings

* src/qemu/qemu_monitor_text.c (qemuMonitorTextGetAllPCIAddresses):
Use %s.
* src/storage/storage_backend_iscsi.c (virStorageBackendCreateIfaceIQN):
Likewise.
* tools/virsh.c (cmdSecretSetValue): Likewise.

15 years agomaint: avoid excess parens in STREQ
Eric Blake [Wed, 27 Jan 2010 13:59:02 +0000 (06:59 -0700)]
maint: avoid excess parens in STREQ

* src/internal.h (STREQ, STRCASEEQ, STRNEQ, STRCASENEQ, STREQLEN)
(STRCASEEQLEN, STRNEQLEN, STRCASENEQLEN, STRPREFIX): Avoid
redundant parenthesis.
* examples/domain-events/events-c/event-test.c (STREQ): Likewise.
* src/storage/parthelper.c (STREQ): Likewise.

15 years agoMove models/nmodels mismatch checking one level up
Jiri Denemark [Mon, 1 Feb 2010 11:42:27 +0000 (12:42 +0100)]
Move models/nmodels mismatch checking one level up

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
15 years agoLog flags in virConnectCompareCPU
Jiri Denemark [Mon, 1 Feb 2010 15:22:33 +0000 (16:22 +0100)]
Log flags in virConnectCompareCPU

* src/libvirt.c: extend the debug statement to log flags too

15 years agoFix PCI host reattach on domain detach.
Chris Lalancette [Tue, 26 Jan 2010 15:01:23 +0000 (10:01 -0500)]
Fix PCI host reattach on domain detach.

Similar to the race fixed by
be34c3c7efbb1ea8999530f98b99c5dde3793f84, make sure
to wait around for KVM to release the resources from
a hot-detached PCI device before attempting to
rebind that device to the host driver.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoClarify controllers -device string in QEMU driver
Matthew Booth [Mon, 1 Feb 2010 15:08:36 +0000 (16:08 +0100)]
Clarify controllers -device string in QEMU driver

The QEMU driver contained code to generate a -device string for piix4-ide, but
wasn't using it. This change removes this string generation. It also adds a
comment explaining why IDE and FDC controllers don't generate -device strings.

The change also generates an error if a sata controller is specified for a QEMU
domain, as this isn't supported.

* src/qemu/qemu_conf.c: Remove VIR_DOMAIN_CONTROLLER_TYPE_IDE handler in
  qemuBuildControllerDevStr(). Ignore IDE and FDC controllers. Error if
  SATA controller is discovered. Add comments.

15 years agoFix up a comment in virHashUpdateEntry
Chris Lalancette [Sun, 31 Jan 2010 02:27:12 +0000 (21:27 -0500)]
Fix up a comment in virHashUpdateEntry

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoLook in /usr/libexec for the qemu-kvm binary.
Chris Lalancette [Mon, 25 Jan 2010 15:01:15 +0000 (10:01 -0500)]
Look in /usr/libexec for the qemu-kvm binary.

On RHEL-5 the qemu-kvm binary is located in /usr/libexec.
To reduce confusion for people trying to run upstream libvirt
on RHEL-5 machines, make the qemu driver look in /usr/libexec
for the qemu-kvm binary.

To make this work, I modified virFindFileInPath to handle an
absolute path correctly.  I also ran into an issue where
NULL was sometimes being passed for the file parameter
to virFindFileInPath; it didn't crash prior to this patch
since it was building paths like /usr/bin/(null).  This
is non-standard behavior, though, so I added a NULL
check at the beginning.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agomaint: fix spelling error in hacking
Eric Blake [Wed, 27 Jan 2010 13:33:58 +0000 (06:33 -0700)]
maint: fix spelling error in hacking

* HACKING: STRCASEEQ is case insensitive.
* docs/hacking.html.in: Likewise.