]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
15 years agoFix crash when deleting monitor while a command is in progress
Daniel P. Berrange [Thu, 26 Nov 2009 13:29:29 +0000 (13:29 +0000)]
Fix crash when deleting monitor while a command is in progress

If QEMU shuts down while we're in the middle of processing a
monitor command, the monitor will be freed, and upon cleaning
up we attempt to do  qemuMonitorUnlock(priv->mon) when priv->mon
is NULL.

To address this we introduce proper reference counting into
the qemuMonitorPtr object, and hold an extra reference whenever
executing a command.

* src/qemu/qemu_driver.c: Hold a reference on the monitor while
  executing commands, and only NULL-ify the priv->mon field when
  the last reference is released
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add reference
  counting to handle safe deletion of monitor objects

15 years agoudev_device_get_devpath might return NULL
Guido Günther [Mon, 7 Dec 2009 18:00:11 +0000 (19:00 +0100)]
udev_device_get_devpath might return NULL

Fix crash on strdup in that case.

15 years agoFix a compilation failure if yajl not avail
Daniel Veillard [Tue, 8 Dec 2009 10:08:17 +0000 (11:08 +0100)]
Fix a compilation failure if yajl not avail

configure:     yajl: no
CC     libvirt_util_la-json.lo
util/json.c:32:27: error: yajl/yajl_gen.h: No such file or directory
util/json.c:33:29: error: yajl/yajl_parse.h: No such file or directory

* src/util/json.c: remove the includes if yajl not configured in

15 years agoFix compilation for configure --disable-nls
Matthias Bolte [Sat, 5 Dec 2009 00:10:01 +0000 (01:10 +0100)]
Fix compilation for configure --disable-nls

15 years agovbox: Update IIDs from version 3.1-beta2 to 3.1-final
Matthias Bolte [Mon, 7 Dec 2009 21:46:50 +0000 (22:46 +0100)]
vbox: Update IIDs from version 3.1-beta2 to 3.1-final

This solves the 'nsIEventQueue object is null' error when trying
to connect to a VirtualBox 3.1 hypervisor instance.

15 years agoFix ReprotError vs ReportError typo in JSON code
Daniel P. Berrange [Mon, 7 Dec 2009 17:01:33 +0000 (17:01 +0000)]
Fix ReprotError vs ReportError typo in JSON code

* src/util/json.c: Fix ReprotError typo when YAJL is not available

15 years agoFix inverted conditional test in configure.ac check for yajl
Daniel P. Berrange [Mon, 7 Dec 2009 16:51:14 +0000 (16:51 +0000)]
Fix inverted conditional test in configure.ac check for yajl

* configure.in: Fix inverted conditional test when yajl is not
  found

15 years agoIntroduce a simple API for handling JSON data
Daniel P. Berrange [Tue, 3 Nov 2009 18:59:18 +0000 (13:59 -0500)]
Introduce a simple API for handling JSON data

This introduces simple API for handling JSON data. There is
an internal data structure 'virJSONValuePtr' which stores a
arbitrary nested JSON value (number, string, array, object,
nul, etc).  There are APIs for constructing/querying objects
and APIs for parsing/formatting string formatted JSON data.

This uses the YAJL library for parsing/formatting from

 http://lloyd.github.com/yajl/

* src/util/json.h, src/util/json.c: Data structures and APIs
  for representing JSON data, and parsing/formatting it
* configure.in: Add check for yajl library
* libvirt.spec.in: Add build requires for yajl
* src/Makefile.am: Add json.c/h
* src/libvirt_private.syms: Export JSON symbols to drivers

15 years agoAdd --system flag to autogen.sh to make it easy to build with right prefix
Daniel P. Berrange [Thu, 26 Nov 2009 14:38:50 +0000 (14:38 +0000)]
Add --system flag to autogen.sh to make it easy to build with right prefix

Add a --system flag to autogen.sh which gets turned into the args
--prefix=/usr --sysconfdir=/etc --localstatedir=/var to make it
easy to build with settings that match an RPM build

* autogen.sh: Add --system flag

15 years agoExport all symbols from xml.h for internal use
Jiri Denemark [Fri, 4 Dec 2009 18:24:25 +0000 (19:24 +0100)]
Export all symbols from xml.h for internal use

Some of the very useful calls for XML parsing provided by util/xml.[ch]
were not exported as private symbols. This patch fixes this.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
15 years agovbox: Use virIndexToDiskName() in vboxGenerateMediumName()
Matthias Bolte [Fri, 4 Dec 2009 14:18:45 +0000 (15:18 +0100)]
vbox: Use virIndexToDiskName() in vboxGenerateMediumName()

15 years agoTests for interface type/model configuration
Jiri Denemark [Fri, 4 Dec 2009 16:01:34 +0000 (17:01 +0100)]
Tests for interface type/model configuration

add a set of tests for Xen interface type and model configurations

15 years agoSupport for interface model='netfront'
Jiri Denemark [Fri, 4 Dec 2009 15:55:59 +0000 (16:55 +0100)]
Support for interface model='netfront'

Xen HVM guests with PV drivers end up with two network interfaces for
each configured interface. One of them being emulated by qemu and the
other one paravirtual. As this might not be desirable, the attached
patch provides a way for users to specify that only paravirtual network
interface should be presented to the guest.

The configuration was inspired by qemu/kvm driver, for which users can
specify model='virtio' to use paravirtual network interface.

The patch adds support for model='netfront' which results in
type=netfront instead of type=ioemu (or nothing for newer xen versions)
in guests native configuration. Xen's qemu ignores interfaces with
type != ioemu and only paravirtual network device will be seen in the
guest.

Four possible configuration scenarios follow:

- no model specified in domain's XML
    - libvirt will behave like before this change; it will set
      type=ioemu for HVM guests on xen host which is not newer than
      XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU
    - covered by existing tests

- PV guest, any model
    - no functional change, model is passed as is (and ignored by the
      hypervisor)
    - covered by existing tests (e.g., *-net-e1000.*)
- HVM guest, model=netfront
    - type is set to "netfront", model is not specified
    - covered by new *-net-netfront.* tests

- HVM guest, model != netfront
    - type is set to "ioemu", model is passed as is
    - covered by new *-net-ioemu.* tests

The fourth scenario feels like a regression for xen newer than
XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU as users who had a model specified
in their guest's configuration won't see a paravirtual interface in
their guests any more. On the other hand, the reason for specifying a
model is most likely the fact that they want to use such model which
implies emulated interface. Users of older xen won't be affected at all
as their xen provides paravirtual interface regardless of the type used.

- src/xen/xend_internal.c: add netfront support for the xend backend
- src/xen/xm_internal.c: add netfront support for the XM serialization too

15 years agovbox: Add support for version 3.1
Pritesh Kothari [Fri, 4 Dec 2009 13:49:45 +0000 (14:49 +0100)]
vbox: Add support for version 3.1

Also fixed serial port configuration which was broken due to recent
change in virDomainChrDef where targetType was newly added.

* src/Makefile.am: add new files
* src/vbox/vbox_driver.c: add case for version 3.1
* src/vbox/vbox_tmpl.c: refactor common patterns into macros, support for
  version 3.1, serial port configuration fix
* src/vbox/vbox_CAPI_v3_1.h, src/vbox/vbox_V3_1.c: generated code

15 years agoAdd virIndexToDiskName and fix mapping gap
Matthias Bolte [Thu, 3 Dec 2009 16:17:40 +0000 (17:17 +0100)]
Add virIndexToDiskName and fix mapping gap

esxVMX_IndexToDiskName handles indices up to 701. This limit comes
from a mapping gap in virDiskNameToIndex:

  sdzy -> 700
  sdzz -> 701
  sdaaa -> 728
  sdaab -> 729

This line in virDiskNameToIndex causes this gap:

  idx = (idx + i) * 26;

Fixing it by altering this line to:

  idx = (idx + (i < 1 ? 0 : 1)) * 26;

Also add a new version of virIndexToDiskName that handles the inverse
mapping for arbitrary indices.

* src/esx/esx_vmx.[ch]: remove esxVMX_IndexToDiskName
* src/util/util.[ch]: add virIndexToDiskName and fix mapping gap
* tests/esxutilstest.c: update test to verify that the gap is fixed

15 years agoFix some locking issues
Matthias Bolte [Wed, 2 Dec 2009 23:03:06 +0000 (00:03 +0100)]
Fix some locking issues

* src/conf/domain_conf.c: don't call virDomainObjUnlock twice
* src/qemu/qemu_driver.c: relock driver lock if an error occurs in
  qemuDomainObjBeginJobWithDriver, enter/exit monitor with driver
  in qemudDomainSave

15 years agoFix missing background color
Daniel Veillard [Thu, 3 Dec 2009 14:27:24 +0000 (15:27 +0100)]
Fix missing background color

15 years agoFix event test timer checks on kernels with HZ=100
Daniel P. Berrange [Wed, 2 Dec 2009 11:53:42 +0000 (11:53 +0000)]
Fix event test timer checks on kernels with HZ=100

On kernels with HZ=100, the resolution of sleeps in poll() is
quite bad. Doing a precise check on the expiry time vs the
current time will thus often thing the timer has not expired
even though we're within 10ms of the expected expiry time. This
then causes another pointless sleep in poll() for <10ms. Timers
do not need to have such precise expiration, so we treat a timer
as expired if it is within 20ms of the expected expiry time. This
also fixes the eventtest.c test suite on kernels with HZ=100

* daemon/event.c: Add 20ms fuzz when checking for timer expiry

15 years agoFix typo in QEMU driver webpage
Daniel P. Berrange [Mon, 30 Nov 2009 15:21:21 +0000 (15:21 +0000)]
Fix typo in QEMU driver webpage

* docs/drvqemu.html.in: Fix typo describing URI driver protocol

15 years agoAdd another SENTINEL attribute
Paolo Bonzini [Mon, 30 Nov 2009 09:49:05 +0000 (10:49 +0100)]
Add another SENTINEL attribute

* src/xen/xend_internal.c (xend_op): Add ATTRIBUTE_SENTINEL.

15 years agoClarify documentation for private symbols
Wolfgang Mauerer [Tue, 10 Nov 2009 14:53:20 +0000 (15:53 +0100)]
Clarify documentation for private symbols

The instruction "See Makefile.am" in libvirt.private_syms
always makes me think that this file is autogenerated
and should not be touched manually. This patch spares
every reader of libvirt.private_syms the hassle of
reading Makefile.am before augmenting libvirt.private_syms.

Signed-off-by: Wolfgang Mauerer <wolfgang.mauerer@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
15 years agoFix help message
Wolfgang Mauerer [Tue, 10 Nov 2009 14:53:20 +0000 (15:53 +0100)]
Fix help message

The configuration file setting is overriden by -f or --config, but
not with -c

Signed-off-by: Wolfgang Mauerer <wolfgang.mauerer@siemens.com>
15 years agoFix threading problems in python bindings
Daniel P. Berrange [Wed, 25 Nov 2009 12:04:47 +0000 (12:04 +0000)]
Fix threading problems in python bindings

* libvirt-override.c: Add many missing calls to allow threading
  when entering C code, otherwise python blocks & then deadlocks
  when we have an async event to dispatch back into python code.
  Fix return value check for virDomainPinVcpu binding.

15 years agoSupress annoying libcap-ng errors from valgrind
Daniel P. Berrange [Tue, 24 Nov 2009 11:45:30 +0000 (11:45 +0000)]
Supress annoying libcap-ng errors from valgrind

* tests/.valgrind.supp: Ignore capng problems

15 years agoFix two leaks in test driver
Daniel P. Berrange [Tue, 24 Nov 2009 11:44:49 +0000 (11:44 +0000)]
Fix two leaks in test driver

* src/test/test_driver.c: Fix leak of vcpu info, and nodedevice
  info

15 years agoFree cgroup device ACL list on driver shutdown
Daniel P. Berrange [Tue, 24 Nov 2009 11:44:23 +0000 (11:44 +0000)]
Free cgroup device ACL list on driver shutdown

* src/qemu/qemu_driver.c: Free cgroup ACLs

15 years agoxen: Fix unconditional freeing in xenDaemonListDefinedDomains()
Matthias Bolte [Wed, 25 Nov 2009 23:09:40 +0000 (00:09 +0100)]
xen: Fix unconditional freeing in xenDaemonListDefinedDomains()

Commit 790f0b3057787bb64da8c46c111ff8d3eff7b2af causes the contents of
the names array to be freed even on success, resulting in no listing of
defined but inactive Xen domains.

Spotted by Jim Fehlig

15 years agoFix default disk type when parsing QEMU argv
Daniel P. Berrange [Tue, 24 Nov 2009 10:58:08 +0000 (10:58 +0000)]
Fix default disk type when parsing QEMU argv

* src/qemu/qemu_conf.c: Fix default disk type to be 'FILE'
  again, after previous commit accidentally changed it

15 years agoremove port filter when network device is detached
Gerhard Stenzel [Tue, 24 Nov 2009 10:25:16 +0000 (11:25 +0100)]
remove port filter when network device is detached

* src/qemu/qemu_driver.c: remove the port filter if the network device
  is detached via virDomainDetachDevice.

15 years agoSupport QEMU's virtual FAT block device driver
Daniel P. Berrange [Mon, 16 Nov 2009 18:08:29 +0000 (18:08 +0000)]
Support QEMU's virtual FAT block device driver

Introduce a new type="dir"  mode for <disks> that allows use of
QEMU's  virtual FAT block device driver. eg

    <disk type='dir' device='floppy'>
      <source dir='/tmp/test'/>
      <target dev='fda' bus='fdc'/>
      <readonly/>
    </disk>

gets turned into

  -drive file=fat:floppy:/tmp/test,if=floppy,index=0

Only read-only disks are supported with virtual FAT mode

* src/conf/domain_conf.c, src/conf/domain_conf.h: Add type="dir"
* docs/schemas/domain.rng: Document new disk type
* src/xen/xend_internal.c, src/xen/xm_internal.c: Raise error for
  unsupported disk types
* tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-empty.args: Fix
  empty disk file handling
* tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.args,
  tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.xml,
  tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.args,
  tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml
  tests/qemuxml2argvtest.c: Test QEMU vitual FAT driver
* src/qemu/qemu_conf.c: Support generating fat:/some/dir type
  disk args
* src/security/security_selinux.c: Temporarily skip labelling
  of directory based disks

15 years agoAlternate CPU affinity impl to cope with NR_CPUS > 1024
Daniel P. Berrange [Mon, 16 Nov 2009 16:08:29 +0000 (16:08 +0000)]
Alternate CPU affinity impl to cope with NR_CPUS > 1024

The cpu_set_t type can only cope with NR_CPUS <= 1024, beyond this
it is neccessary to use alternate CPU_SET maps with a dynamically
allocated CPU map

* src/util/processinfo.c: Support new unlimited size CPU set type

15 years agoPull schedular affinity code out into a separate module
Daniel P. Berrange [Mon, 16 Nov 2009 15:22:34 +0000 (15:22 +0000)]
Pull schedular affinity code out into a separate module

* src/Makefile.am: Add processinfo.h/processinfo.c
* src/util/processinfo.c, src/util/processinfo.h: Module providing
  APIs for getting/setting process CPU affinity
* src/qemu/qemu_driver.c: Switch over to new APIs for schedular
  affinity
* src/libvirt_private.syms: Export virProcessInfoSetAffinity
  and virProcessInfoGetAffinity to internal drivers

15 years agoIgnore docs/ directory for strcmp() syntax check
Daniel P. Berrange [Mon, 23 Nov 2009 11:57:45 +0000 (11:57 +0000)]
Ignore docs/ directory for strcmp() syntax check

* .x-sc_prohibit_strcmp_and_strncmp: Ignore docs/

15 years agoFix news.html validation
Dan Kenigsberg [Sun, 22 Nov 2009 19:08:54 +0000 (20:08 +0100)]
Fix news.html validation

15 years agoRelease of libvirt-0.7.4
Daniel Veillard [Fri, 20 Nov 2009 18:43:59 +0000 (19:43 +0100)]
Release of libvirt-0.7.4

0.7.3 was broken

* configure.in docs/news.html.in: release of 0.7.4
* configure.in libvirt.spec.in: require netcf >= 0.1.4
* src/Makefile.am: node_device/node_device_udev.h was missing from
  NODE_DEVICE_DRIVER_UDEV_SOURCES breaking compilation on platforms with
  udev

15 years agoRelease of libvirt-0.7.3
Daniel Veillard [Fri, 20 Nov 2009 16:31:13 +0000 (17:31 +0100)]
Release of libvirt-0.7.3

* configure.in docs/news.html.in libvirt.spec.in: describe new release
* po/*.po*: regenerate

15 years agoEnable udev instead of hal on F12 / RHEL-6 or later
Daniel P. Berrange [Fri, 20 Nov 2009 15:45:46 +0000 (16:45 +0100)]
Enable udev instead of hal on F12 / RHEL-6 or later

HAL has been deprecated since F12 and RHEL-6, so if building on
these platforms, switch on the udev driver instead

* libvirt.spec.in: Activate udev on F12/RHEL6

15 years agoDocument overriding domain interface target
Cole Robinson [Fri, 20 Nov 2009 15:25:58 +0000 (16:25 +0100)]
Document overriding domain interface target

* docs/formatdomain.html.in: document that vnet and vif are reserved
  names and will be ignored if manually specified.

15 years agopython: Actually implement list*Interfaces bindings
Cole Robinson [Fri, 20 Nov 2009 15:22:42 +0000 (16:22 +0100)]
python: Actually implement list*Interfaces bindings

* python/generator.py python/libvirt-override-api.xml
  python/libvirt-override.c: implement the bindings for
  virConnectListInterfaces() and virConnectListDefinedInterfaces()

15 years ago514532 Fix man page, most operation are synchronous
Daniel Veillard [Wed, 18 Nov 2009 10:53:41 +0000 (11:53 +0100)]
514532 Fix man page, most operation are synchronous

* tools/virsh.pod: the man page was stating that most operations
  are asynchronous while in fact most of them are synchronous except
  domain shutdown, setvcpus and setmem.

15 years ago504262 Check for duplicated UUID in XM Xen defines
Daniel Veillard [Tue, 17 Nov 2009 11:06:46 +0000 (12:06 +0100)]
504262 Check for duplicated UUID in XM Xen defines

* src/xen/xm_internal.c: the XM driver was not checking for previously
  defined UUID on new defines. Similar to virDomainObjIsDuplicate()
  behaviour.

15 years ago512069 fix domain XML schemas for backward compatibility
Daniel Veillard [Wed, 18 Nov 2009 10:25:20 +0000 (11:25 +0100)]
512069 fix domain XML schemas for backward compatibility

For backward compatibility we used to add the tty path as
a tty attribute on console of type pty, duplicating the value
now found in source/@path, but the Relax-NG grammar wasn't
extended for this
    <console type='pty' tty='/dev/pts/8'>
      <source path='/dev/pts/8'/>
      <target port='0'/>
    </console>

* docs/schemas/domain.rng: allow an optional tty attribute
  containing a devicePath

15 years agoqemu-kvm needs -enable-kvm flag for VT optimization
Steve Yarmie [Fri, 20 Nov 2009 14:41:05 +0000 (15:41 +0100)]
qemu-kvm needs -enable-kvm flag for VT optimization

Recent qemu releases require command option '-enable-qemu' in order
for the kvm functionality be activated. Libvirt needs to pass this flag
to qemu when starting a domain. Note that without the option,
even if both the kernel and qemu support KVM, KVM will not be activated
and VMs will be very slow.

* src/qemu/qemu_conf.h src/qemu/qemu_conf.c: parse the extra command
  line option from help and add it when running kvm
* tests/qemuhelptest.c: this modified the flags output for qemu-0.10.5
  and qemu-kvm-0.11.0-rc2 regression tests

15 years agofix deprecated iptables command syntax
Steve Yarmie [Fri, 20 Nov 2009 14:29:59 +0000 (15:29 +0100)]
fix deprecated iptables command syntax

* src/util/iptables.c: `--option !  this` is deprecated in favor of
  `! --option this` syntax, change the output command accordingly

15 years agoremove sysfs_path and parent_sysfs_path from XML
Dave Allan [Thu, 19 Nov 2009 15:05:17 +0000 (16:05 +0100)]
remove sysfs_path and parent_sysfs_path from XML

Erroneously included the sysfs_path and parent_sysfs_path elements in
the node device xml, they were not supposed to show up there

* src/conf/node_device_conf.c: remove the output of the 2 fields

15 years agoRemoving devicePath member from dev struct
Dave Allan [Thu, 19 Nov 2009 15:02:18 +0000 (16:02 +0100)]
Removing devicePath member from dev struct

I realized that I inadvertently added a member to the def struct to
contain each device's sysfs path when there was an existing member in the
dev struct for "OS specific path to device metadat, eg sysfs"  Since the
udev backend needs to record the sysfs path while it's in the process of
creating the device, before the dev struct gets allocated, I chose to
remove the member from the dev struct.

* src/conf/node_device_conf.c src/conf/node_device_conf.h
  src/node_device/node_device_driver.c src/node_device/node_device_hal.c
  src/node_device/node_device_udev.c: remove devicePath from the
  structure and use def->sysfs_path instead

15 years agoreport OOM in two places in node_device_driver.c
Dave Allan [Thu, 19 Nov 2009 14:44:00 +0000 (15:44 +0100)]
report OOM in two places in node_device_driver.c

* src/node_device/node_device_driver.c: two places where not calling
  virReportOOMError after strdup failure

15 years agoEnsure driver lock is released when entering QEMU monitor
Daniel P. Berrange [Wed, 18 Nov 2009 15:58:32 +0000 (15:58 +0000)]
Ensure driver lock is released when entering QEMU monitor

The qemudStartVMDaemon() and several functions it calls use
the QEMU monitor. The QEMU driver is locked while this function
is executing, so it is rquired to release the driver lock and
reacquire it either side of issuing a monitor command. It
failed todo so, leading to deadlock

* qemu/qemu_driver.c: Release driver when in qemudStartVMDaemon
  and things it calls

15 years agoUpdated localization and regenerated the pos
Daniel Veillard [Tue, 17 Nov 2009 11:24:42 +0000 (12:24 +0100)]
Updated localization and regenerated the pos

updated el.po es.po or.po pl.po ta.po te.po
ran make update-po

15 years agoFix typo in error message
Matthew Booth [Tue, 17 Nov 2009 11:18:39 +0000 (12:18 +0100)]
Fix typo in error message

15 years agoWhitespace cleanup for pre-tags on the website
Matthias Bolte [Fri, 13 Nov 2009 23:09:20 +0000 (00:09 +0100)]
Whitespace cleanup for pre-tags on the website

15 years agoFix type in configure output summary
Daniel P. Berrange [Mon, 16 Nov 2009 16:11:05 +0000 (16:11 +0000)]
Fix type in configure output summary

* configure.in: Fix typo in PCIACCESS_LIBS

15 years agoRemove a compilation warning on uninitialized var
Daniel Veillard [Mon, 16 Nov 2009 16:31:35 +0000 (17:31 +0100)]
Remove a compilation warning on uninitialized var

15 years agoonly remove masquerade roles for VIR_NETWORK_FORWARD_NAT
Guido Günther [Thu, 5 Nov 2009 19:28:11 +0000 (20:28 +0100)]
only remove masquerade roles for VIR_NETWORK_FORWARD_NAT

Fixes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=549949

15 years agoesx: Fix CPU clock Hz to MHz conversion
Matthias Bolte [Sat, 14 Nov 2009 21:52:27 +0000 (22:52 +0100)]
esx: Fix CPU clock Hz to MHz conversion

15 years agoesx: Fix memory leak in esxVI_HostCpuIdInfo_Free()
Matthias Bolte [Sat, 14 Nov 2009 21:45:38 +0000 (22:45 +0100)]
esx: Fix memory leak in esxVI_HostCpuIdInfo_Free()

15 years agoesx: Fix MAC address formatting
Matthias Bolte [Sat, 14 Nov 2009 18:51:05 +0000 (19:51 +0100)]
esx: Fix MAC address formatting

VMware uses two MAC address prefixes: 00:0c:29 and 00:50:56. The 00:0c:29
prefix is used for ESX server generated addresses. The 00:50:56 prefix is
split into two parts. MAC addresses above 00:50:56:3f:ff:ff are generated
by a vCenter. The rest of the 00:50:56 prefix can be assigned manually.
Any MAC address within the 00:0c:29 and 00:50:56 prefix can be specified
in a domain XML config and the driver will handle the details internally.

* src/esx/esx_vmx.c: fix MAC address formatting
* tests/xml2vmxdata/*: update test files accordingly

15 years agoesx: Handle 'vmxnet3' in esxVMX_FormatEthernet()
Matthias Bolte [Fri, 13 Nov 2009 21:55:25 +0000 (22:55 +0100)]
esx: Handle 'vmxnet3' in esxVMX_FormatEthernet()

In commit 3c80fac2588cbc9e5ee7e7069e1ca4468f2359d3 'vmxnet3' handling
was added to esxVMX_ParseEthernet(), but not to the inverse function
esxVMX_FormatEthernet().

15 years agoesx: Add documentation to the website
Matthias Bolte [Fri, 13 Nov 2009 21:43:10 +0000 (22:43 +0100)]
esx: Add documentation to the website

* docs/drivers.html.in: list the ESX driver
* docs/drvesx.html.in: the new ESX driver documentation
* docs/hvsupport.html.in: add the ESX driver to the matrix
* docs/index.html.in, docs/sitemap.html.in: list the ESX driver
* src/esx/esx_driver.c: fix and cleanup some comments

15 years agoChange DTD references to use public instead of system identifier
Matthias Bolte [Fri, 13 Nov 2009 22:19:09 +0000 (23:19 +0100)]
Change DTD references to use public instead of system identifier

Debian's /etc/xml/catalog doesn't contain system identifiers, so use
public identifiers instead.

* docs/Makefile.am: use public instead of system identifier
* docs/site.xsl: use matching public identifier

15 years agoFix compilation of libvirt against xen-unstable
Jim Fehlig [Sun, 15 Nov 2009 08:40:36 +0000 (09:40 +0100)]
Fix compilation of libvirt against xen-unstable

* src/xen/xen_hypervisor.c: xen-unstable changeset 19788 removed
  MAX_VIRT_CPUS from public headers, breaking compilation of libvirt
  on -unstable.  Its semanitc was retained with XEN_LEGACY_MAX_VCPUS.
  Ensure MAX_VIRT_CPUS is defined accordingly.

15 years agoFix probing for libpciaccess
Daniel P. Berrange [Fri, 13 Nov 2009 12:12:09 +0000 (12:12 +0000)]
Fix probing for libpciaccess

If 'with_udev=check' then missing pciaccess should not be a fatal
error. It should merely disable the udev driver.

* configure.in: Fix pciaccess check to be non-fatal

15 years agoRemove obsolte devicekit checks
Daniel P. Berrange [Fri, 13 Nov 2009 12:12:09 +0000 (12:12 +0000)]
Remove obsolte devicekit checks

Device kit support was removed, but the configure.ac checks were
left in place. A number of the XXX_REQUIRED=X.Y.Z variables were
not declared in the correct location (ie top of the file)

* configure.in: Remove device kit checks & move mis-placed variables
  to correct location

15 years agoFix incorrect reference counting logic in qemu monitor open
Daniel P. Berrange [Fri, 13 Nov 2009 11:43:09 +0000 (11:43 +0000)]
Fix incorrect reference counting logic in qemu monitor open

The QEMU monitor open method would not take a reference on
the virDomainObjPtr until it had successfully opened the
monitor. The cleanup code upon failure to open though would
call qemuMonitorClose() which would in turn decrement the
reference count. This caused the virDoaminObjPtr to be mistakenly
freed and then the whole driver crashes

* src/qemu/qemu_monitor.c: Fix reference counting in
  qemuMonitorOpen

15 years agoDon't return fatal error in HAL driver init if HAL isn't running
Daniel P. Berrange [Fri, 13 Nov 2009 10:36:01 +0000 (10:36 +0000)]
Don't return fatal error in HAL driver init if HAL isn't running

The HAL driver returns a fatal error code in the case where HAL
is not running. This causes the entire libvirtd daemon to quit
which isn't desirable. Instead it should simply disable the HAL
driver

* src/node_device/node_device_hal.c: Quietly disable HAL if it is
  not running

15 years agoFix cleanup when state driver init fails
Daniel P. Berrange [Fri, 13 Nov 2009 10:34:47 +0000 (10:34 +0000)]
Fix cleanup when state driver init fails

* daemon/libvirtd.c: Fix incorrect goto label causing cleanup to
  be missed when state driver init fails

15 years agoSmall guestfwd code cleanup
Matthew Booth [Fri, 13 Nov 2009 15:05:27 +0000 (16:05 +0100)]
Small guestfwd code cleanup

* src/qemu/qemu_conf.c: Remove and inline qemudBuildCommandLineChrDevTargetStr

15 years agoSmall indentation cleanup of domain schema
Matthew Booth [Fri, 13 Nov 2009 15:03:43 +0000 (16:03 +0100)]
Small indentation cleanup of domain schema

15 years agoAppArmor code cleanups
Jamie Strandboge [Fri, 13 Nov 2009 14:27:43 +0000 (15:27 +0100)]
AppArmor code cleanups

* src/security/security_apparmor.c: a few code cleanups following a
  review on the list

15 years agoAppArmor handling of accesses to readonly files
Jamie Strandboge [Fri, 13 Nov 2009 14:25:30 +0000 (15:25 +0100)]
AppArmor handling of accesses to readonly files

Fixes https://launchpad.net/bugs/453335

* src/security/virt-aa-helper.c: suppress confusing and misleading
  apparmor denied message when kvm/qemu tries to open a libvirt specified
  readonly file (such as a cdrom) with write permissions. libvirt uses
  the readonly attribute for the security driver only, and has no way
  of telling kvm/qemu that the device should be opened readonly

15 years agoAppArmor require absolute paths
Jamie Strandboge [Fri, 13 Nov 2009 14:22:20 +0000 (15:22 +0100)]
AppArmor require absolute paths

Fixes https://launchpad.net/bugs/460271

* src/security/virt-aa-helper.c: require absolute path for dynamic added
  files. This is required by AppArmor and conveniently prevents adding
  tcp consoles to the profile

15 years agoAppArmor updates of examples
Jamie Strandboge [Fri, 13 Nov 2009 14:19:05 +0000 (15:19 +0100)]
AppArmor updates of examples

* examples/apparmor/libvirt-qemu: adds pulseaudio, alsa and preliminary
  save/restore to the example apparmor abstraction
* examples/apparmor/usr.sbin.libvirtd: allows libvirtd access to inet
  dgram, inet6 dgram, inet6 stream and /usr/lib/libvirt/*

15 years agoCheck that domain is running when starting console
Daniel P. Berrange [Thu, 12 Nov 2009 14:14:23 +0000 (14:14 +0000)]
Check that domain is running when starting console

The 'virsh console' command did not check if the domain was
already running before attempting to fetch the XML and extract
the console PTY path. This caused a slightly unhelpful / misleading
error message for the user. The explicit check ensures the user
gets an explicit 'domain is not running' message.

* tools/virsh.c: Validate that state != VIR_DOMAIN_SHUTOFF in
  virsh console command

15 years agoFix incorrect variable passed to LXC event callback
Daniel P. Berrange [Thu, 12 Nov 2009 14:13:33 +0000 (14:13 +0000)]
Fix incorrect variable passed to LXC event callback

The wrong variable was being passed in with the LXC event callback
resulting in a later deadlock or crash

* src/lxc/lxc_driver.c: Pass 'vm' instead of 'driver' to event
  callback

15 years agoFix check for existance of cgroups at creation
Daniel P. Berrange [Thu, 12 Nov 2009 14:11:43 +0000 (14:11 +0000)]
Fix check for existance of cgroups at creation

In the scenario where the cgroups were mounted but the
particular group did not exist, and the caller had not
requested auto-creation, the code would fail to return
an error condition. This caused the lxc_controller to
think the cgroup existed, and it then later failed when
attempting to use it

* src/util/cgroup.c: Raise an error if the cgroup path does not
  exist

15 years agoFix race condition in HAL driver startup
Daniel P. Berrange [Thu, 12 Nov 2009 14:10:45 +0000 (14:10 +0000)]
Fix race condition in HAL driver startup

There is a race condition in HAL driver startup where the callback
can get triggered before we have finished startup. This then causes
a deadlock in the driver.

* src/node_device/node_device_hal.c: RElease driver lock before
  registering DBus callbacks

15 years agoFix formatting of XML for an inactive guest
Daniel P. Berrange [Thu, 12 Nov 2009 14:08:43 +0000 (14:08 +0000)]
Fix formatting of XML for an inactive guest

If the virDomainDefPtr object has an 'id' of -1, then forcably
set the VIR_DOMAIN_XML_INACTIVE flag to ensure generated XML
does not include any cruft from the previously running guest
such as console PTY path, or VNC port.

* src/conf/domain_conf.c: Set VIR_DOMAIN_XML_INACTIVE if
  def->id is -1. Replace checks for def->id == -1 with
  check against flags & VIR_DOMAIN_XML_INACTIVE.

15 years agoRemove capng_lock() call when spawning LXC container init process
Daniel P. Berrange [Thu, 12 Nov 2009 11:03:23 +0000 (11:03 +0000)]
Remove capng_lock() call when spawning LXC container init process

The capng_lock() call sets the SECURE_NO_SETUID_FIXUP and SECURE_NOROOT
bits on the process. This prevents the kernel granting capabilities to
processes with an effective UID of 0, or with setuid programs. This is
not actually what we want in the container init process. It should be
allowed to run setuid processes & keep capabilities when root. All that
is required is masking a handful of dangerous capabilities from the
bounding set.

* src/lxc/lxc_container.c: Remove bogus capng_lock() call.

15 years agoFix initscript to check daemon pidfile
Daniel P. Berrange [Thu, 12 Nov 2009 19:31:48 +0000 (19:31 +0000)]
Fix initscript to check daemon pidfile

The libvirtd initscript could get confused between the system and
session instances of the daemon. To avoid this it is neccessary
to check the pidfile explicitly.

* daemon/libvirtd.init.in: Always check the pidfile of the system
  daemon to avoid confusion with the session daemons

15 years agoFix virt-aa-helper when host and os.type arch differ
Jamie Strandboge [Fri, 13 Nov 2009 10:04:23 +0000 (11:04 +0100)]
Fix virt-aa-helper when host and os.type arch differ

* src/security/virt-aa-helper.c: get_definition() now calls the new
  caps_mockup() function which will parse the XML for os.type,
  os.type.arch and then sets the wordsize.  These attributes are needed
  only to get a valid virCapsPtr for virDomainDefParseString(). The -H
  and -b options are now removed from virt-aa-helper (they weren't used
  yet anyway).
* tests/virt-aa-helper-test: extend and fixes tests, chmod'ed 755

15 years agoAdd translation of PCI vendor and product IDs
David Allan [Thu, 12 Nov 2009 22:22:00 +0000 (23:22 +0100)]
Add translation of PCI vendor and product IDs

uses libpciaccess to provide human readable names for PCI vendor and
device IDs
* configure.in: add a requirement for libpciaccess >= 0.10.0
* src/Makefile.am: add the associated compilation flags and link
* src/node_device/node_device_udev.c: lookup the libpciaccess for
  vendor name and product name based on their ids

15 years agoRemove DevKit node device backend
David Allan [Thu, 12 Nov 2009 22:09:24 +0000 (23:09 +0100)]
Remove DevKit node device backend

* configure.in src/Makefile.am: remove the configuration check and
  build instructions
* src/node_device/node_device_devkit.c: removed the module
* src/node_device/node_device_driver.c src/node_device/node_device_driver.h:
  removed references to the old backend

15 years agoAdd scsi_target device type
David Allan [Thu, 12 Nov 2009 22:03:47 +0000 (23:03 +0100)]
Add scsi_target device type

* src/conf/node_device_conf.h src/conf/node_device_conf.c: add specific
  support for SCSI target in node device capabilities
* src/node_device/node_device_udev.c: add some extra detection code
  when handling udev output

15 years agoImplement a node device backend using libudev
David Allan [Thu, 12 Nov 2009 21:48:24 +0000 (22:48 +0100)]
Implement a node device backend using libudev

* configure.in: add new --with-udev, disabled by default, and requiring
  libudev > 145
* src/node_device/node_device_udev.c src/node_device/node_device_udev.h:
  the new node device backend
* src/node_device/node_device_linux_sysfs.c: moved node_device_hal_linux.c
  to a better file name
* src/conf/node_device_conf.c src/conf/node_device_conf.h: add a couple
  of fields in node device definitions, and an API to look them up,
  remove a couple of unused fields from previous patch.
* src/node_device/node_device_driver.c src/node_device/node_device_driver.h:
  plug the new driver
* po/POTFILES.in src/Makefile.am src/libvirt_private.syms: add the new
  files and symbols
* src/util/util.h src/util/util.c: add a new convenience macro
  virBuildPath and virBuildPathInternal() function

15 years agoAdd several fields to node device capabilities
David Allan [Thu, 12 Nov 2009 21:39:40 +0000 (22:39 +0100)]
Add several fields to node device capabilities

* src/conf/node_device_conf.h src/conf/node_device_conf.c: add the new
  fields in the structure as well as parsing and serialization

15 years agoAdd virConnectGetLibvirtVersion API
Cole Robinson [Thu, 12 Nov 2009 15:53:26 +0000 (10:53 -0500)]
Add virConnectGetLibvirtVersion API

There is currently no way to determine the libvirt version of a remote
libvirtd we are connected to. This is a useful piece of data to enable
feature detection.

15 years agoImplement finer grained migration control for Xen
Maximilian Wilhelm [Thu, 12 Nov 2009 15:04:43 +0000 (16:04 +0100)]
Implement finer grained migration control for Xen

* src/xen/xen_driver.c: Add support for VIR_MIGRATE_PERSIST_DEST flag
* src/xen/xend_internal.c: Add support for VIR_MIGRATE_UNDEFINE_SOURCE flag
* include/libvirt/virterror.h, src/util/virterror.c: Add new errorcode
  VIR_ERR_MIGRATE_PERSIST_FAILED

15 years agoSupport for SATA Disks in virDomainDiskBus
pritesh [Thu, 12 Nov 2009 14:45:18 +0000 (15:45 +0100)]
Support for SATA Disks in virDomainDiskBus

* src/conf/domain_conf.h src/conf/domain_conf.c: add the new entry in
  the enum and lists of virDomainDiskBus
* src/qemu/qemu_conf.c: same for virDomainDiskQEMUBus

15 years agoLXC implement missing DomainInterfaceStats API
Ryota Ozaki [Thu, 12 Nov 2009 13:55:44 +0000 (14:55 +0100)]
LXC implement missing DomainInterfaceStats API

* src/lxc/lxc_driver.c: add lxcDomainInterfaceStats implementing
  virDomainInterfaceStats()

15 years agoFilter out stale domains from xenstore listing
Daniel P. Berrange [Fri, 9 Oct 2009 09:32:37 +0000 (10:32 +0100)]
Filter out stale domains from xenstore listing

The xenstore database sometimes has stale domain IDs which are not
present in the hypervisor anymore. Filter these out to avoid causing
confusion

* src/xen/xs_internal.c: Filter domain IDs against HV's list
* src/xen/xen_hypervisor.h, src/xen/xen_hypervisor.c: Add new
  xenHypervisorHasDomain() method for checking ID validity

15 years agoFix logic in xenUnifiedNumOfDomains to match xenUnifiedListDomains
Jonas Eriksson [Fri, 9 Oct 2009 09:23:23 +0000 (10:23 +0100)]
Fix logic in xenUnifiedNumOfDomains to match xenUnifiedListDomains

The xenUnifiedNumOfDomains and xenUnifiedListDomains methods work
together as a pair, so it is critical they both apply the same
logic. With the current mis-matched logic it is possible to sometimes
get into a state when you miss certain active guests.

* src/xen/xen_driver.c: Change xenUnifiedNumOfDomains ordering to
  match xenUnifiedListDomains.

15 years agoDisable IPv6 socket auto-binding to IPv4 socket
Daniel P. Berrange [Wed, 11 Nov 2009 15:19:50 +0000 (15:19 +0000)]
Disable IPv6 socket auto-binding to IPv4 socket

Sometimes getaddrinfo returns IPv4 addresses before IPv6 addresses.
IPv6 sockets default to attempting to bind to IPv4 addresses too.
So if the IPv4 address is activated first, then binding to IPv6
will unneccessarily fail.

* daemon/libvirtd.c: Bind to IPv6 and IPv4 addresses separately

15 years agoExclude numactl on s390[x]
Daniel P. Berrange [Wed, 11 Nov 2009 18:07:34 +0000 (18:07 +0000)]
Exclude numactl on s390[x]

The numactl package is not applicable for s390[x] arches, so do
not enable it as a build dep.

* libvirt.spec.in: Exclude numactl on s390[x]

15 years agoFix error handling in qemuMonitorOpen
Ryota Ozaki [Thu, 12 Nov 2009 10:33:30 +0000 (11:33 +0100)]
Fix error handling in qemuMonitorOpen

* src/qemu/qemu_monitor.c: add error check for qemuMonitorOpenXXX
  returned file descriptor

15 years agoFix save and restore with non-privileged guests and SELinux
Daniel P. Berrange [Wed, 11 Nov 2009 12:07:00 +0000 (12:07 +0000)]
Fix save and restore with non-privileged guests and SELinux

When running qemu:///system instance, libvirtd runs as root,
but QEMU may optionally be configured to run non-root. When
then saving a guest to a state file, the file is initially
created as root, and thus QEMU cannot write to it. It is also
missing labelling required to allow access via SELinux.

* src/qemu/qemu_driver.c: Set ownership on save image before
  running migrate command in virDomainSave impl. Call out to
  security driver to set save image labelling
* src/security/security_driver.h: Add driver APIs for setting
  and restoring saved state file labelling
* src/security/security_selinux.c: Implement saved state file
  labelling for SELinux

15 years agodisable mac_filter config switch by default
Gerhard Stenzel [Wed, 11 Nov 2009 12:02:57 +0000 (13:02 +0100)]
disable mac_filter config switch by default

* src/qemu/qemu.conf:  disables the mac_filter config switch by default
  to match existing convention, also document the option

15 years agoPrevent initializing ebtables if disabled in qemu.conf
Ryota Ozaki [Wed, 11 Nov 2009 11:59:54 +0000 (12:59 +0100)]
Prevent initializing ebtables if disabled in qemu.conf

* src/qemu/qemu_conf.c: don't initialize ebtables if
  disabled

15 years agophyp: too much timeout when polling socket
Eduardo Otubo [Wed, 11 Nov 2009 10:53:16 +0000 (11:53 +0100)]
phyp: too much timeout when polling socket

* src/phyp/phyp_driver.c: a 10s timeout on socket availability was way
  too long, reduced to 1ms

15 years agoFix warning on make due to missing cast (int)
Ryota Ozaki [Wed, 11 Nov 2009 10:30:01 +0000 (11:30 +0100)]
Fix warning on make due to missing cast (int)

* src/qemu/qemu_monitor.c src/qemu/qemu_monitor_text.c: cast size_t to
  int when passing to '%d'

15 years agophyp: Reorder keyboard_interactive label in openSSHSession()
Eduardo Otubo [Wed, 11 Nov 2009 01:45:51 +0000 (02:45 +0100)]
phyp: Reorder keyboard_interactive label in openSSHSession()

Finish changes intended to be part of commit
6c70802374d1cb9316769fea750a6c2c198901ff