]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
13 years agoFix build after commit e3ba4025
Jim Fehlig [Mon, 5 Mar 2012 19:08:54 +0000 (12:08 -0700)]
Fix build after commit e3ba4025

Commit e3ba4025 introduced a few build errors with HAVE_LIBNL undefined.

13 years agoutil: eliminate crash in virNetDevMacVLanCreateWithVPortProfile
Laine Stump [Mon, 5 Mar 2012 19:53:48 +0000 (14:53 -0500)]
util: eliminate crash in virNetDevMacVLanCreateWithVPortProfile

Commit 723d5c (added after the release of 0.9.10) adds a
NetlinkEventClient for each interface sent to
virNetDevMacVLanCreateWithVPortProfile. This should only be done if
the interface actually *has* a virtPortProfile, otherwise the event
handler would be a NOP. The bigger problem is that part of the setup
to create the NetlinkEventClient is to do a memcpy of virtPortProfile
- if it's NULL, this triggers a segv.

This patch just qualifies the code that adds the client - if
virtPortProfile is NULL, it's skipped.

13 years agoblockResize: add flag for bytes
Eric Blake [Sat, 3 Mar 2012 14:43:22 +0000 (07:43 -0700)]
blockResize: add flag for bytes

Qemu supports sizing by bytes; we shouldn't force the user to
round up if they really wanted an unaligned total size.

* include/libvirt/libvirt.h.in (VIR_DOMAIN_BLOCK_RESIZE_BYTES):
New flag.
* src/libvirt.c (virDomainBlockResize): Document it.
* src/qemu/qemu_monitor_json.c (qemuMonitorJSONBlockResize): Take
size in bytes.
* src/qemu/qemu_monitor_text.c (qemuMonitorTextBlockResize):
Likewise.  Pass bytes, not megabytes, to monitor.
* src/qemu/qemu_driver.c (qemuDomainBlockResize): Implement new
flag.

13 years agoqemu: Shared or readonly disks are always safe wrt migration
Jiri Denemark [Mon, 5 Mar 2012 11:10:21 +0000 (12:10 +0100)]
qemu: Shared or readonly disks are always safe wrt migration

No matter what cache mode is used, readonly disks are always safe wrt
migration. Shared disks are required to be readonly or to disable
host-side cache, which makes them safe as well.

13 years agolibvirt-guests: Add parallel startup and shutdown of guests
Peter Krempa [Tue, 28 Feb 2012 15:09:42 +0000 (16:09 +0100)]
libvirt-guests: Add parallel startup and shutdown of guests

With this patch, it's possible to shut down guests in parallel. Parallel
startup was possible before, but this functionality was not documented
properly.

To enable parallel startup set the START_DELAY to 0.

Parallel shutdown has a configurable parameter PARALLEL_SHUTDOWN that
defines the number of machines being shut down in parallel. Enabling
this feature changes the semantics of SHUTDOWN_TIMEOUT parameter that is
applied as a cumulative timeout to shutdown all guests on a URI.

13 years agorpc: Fix client crash on connection close
Jiri Denemark [Fri, 2 Mar 2012 18:57:27 +0000 (19:57 +0100)]
rpc: Fix client crash on connection close

A multi-threaded client with event loop may crash if one of its threads
closes a connection while event loop is in the middle of sending
keep-alive message (either request or response). The right place for it
is inside virNetClientIOEventLoop() between poll() and
virNetClientLock(). We should only close a connection directly if no-one
is using it and defer the closing to the last user otherwise. So far we
only did so if the close was initiated by keep-alive timeout.

13 years agobuild: Fix build with dtrace + apparmor
Jiri Denemark [Thu, 1 Mar 2012 15:02:31 +0000 (16:02 +0100)]
build: Fix build with dtrace + apparmor

Building virt-aa-helper with dtrace probes enabled, ldd complained about
undefined references:

./.libs/libvirt_util.a(libvirt_util_la-event_poll.o):(.note.stapsdt+0x24):
undefined reference to `libvirt_event_poll_purge_timeout_semaphore'
...

13 years agoFix type and add missed comment for diskChange callback
Osier Yang [Mon, 5 Mar 2012 10:41:20 +0000 (18:41 +0800)]
Fix type and add missed comment for diskChange callback

Comment for parameter devAlias is missed. And a typo should
be caused by copy & paste.

13 years agoqemu: Fix indention
Osier Yang [Mon, 5 Mar 2012 10:31:59 +0000 (18:31 +0800)]
qemu: Fix indention

13 years agocpu: Add new flag supported by qemu to the cpu definition
Peter Krempa [Wed, 29 Feb 2012 14:47:38 +0000 (15:47 +0100)]
cpu: Add new flag supported by qemu to the cpu definition

Some new cpu features were added to qemu. This patch adds some of them
to our CPU map.

13 years agoCorrect a check for capacity arg of storageVolumeResize()
Zeeshan Ali (Khattak) [Sat, 3 Mar 2012 03:18:59 +0000 (05:18 +0200)]
Correct a check for capacity arg of storageVolumeResize()

Lets say I got a volume with '1G' allocation and '10G' capacity. The
available space in the parent pool is '5G'. With the current check for
overcapacity, I can only try to resize to <= '6G'. You see the problem?

13 years agoutil: combine bools in virNetDevTapCreateInBridgePort into flags
Laine Stump [Thu, 1 Mar 2012 20:35:30 +0000 (15:35 -0500)]
util: combine bools in virNetDevTapCreateInBridgePort into flags

With an additional new bool added to determine whether or not to
discourage the use of the supplied MAC address by the bridge itself,
virNetDevTapCreateInBridgePort had three booleans (well, 2 bools and
an int used as a bool) in the arg list, which made it increasingly
difficult to follow what was going on. This patch combines those three
into a single flags arg, which not only shortens the arg list, but
makes it more self-documenting.

13 years agoutil: centralize tap device MAC address 1st byte "0xFE" modification
Ansis Atteka [Thu, 16 Feb 2012 23:49:57 +0000 (15:49 -0800)]
util: centralize tap device MAC address 1st byte "0xFE" modification

When a tap device for a domain is created and attached to a bridge,
the first byte of the tap device MAC address is set to 0xFE, while the
rest is set to match the MAC address that will be presented to the
guest as its network device MAC address. Setting this high value in
the tap's MAC address discourages the bridge from using the tap
device's MAC address as the bridge's own MAC address (Linux bridges
always take on the lowest numbered MAC address of all attached devices
as their own).

In one case within libvirt, a tap device is created and attached to
the bridge with the intent that its MAC address be taken on by the
bridge as its own (this is used to assure that the bridge has a fixed
MAC address to prevent network outages created by the bridge MAC
address "flapping" as guests are started and stopped). In this case,
the first byte of the mac address is *not* altered to 0xFE.

In the current code, callers to virNetDevTapCreateInBridgePort each
make the MAC address modification themselves before calling, which
leads to code duplication, and also prevents lower level functions
from knowing the real MAC address being used by the guest. The problem
here is that openvswitch bridges must be informed about this MAC
address, or they will be unable to pass traffic to/from the guest.

This patch centralizes the location of the MAC address "0xFE fixup"
into virNetDevTapCreateInBridgePort(), meaning 1) callers of this
function no longer need the extra strange bit of code, and 2)
bitNetDevTapCreateBridgeInPort itself now is called with the guest's
unaltered MAC address, and can pass it on, unmodified, to
virNetDevOpenvswitchAddPort.

There is no other behavioral change created by this patch.

13 years agodaemon: Remove deprecated HAL from init script dependencies
Peter Krempa [Fri, 2 Mar 2012 14:12:32 +0000 (15:12 +0100)]
daemon: Remove deprecated HAL from init script dependencies

The init script for the daemon requests to start HAL although it has
been deprecated long time ago. This patch removes the dependency.

13 years agobuild: fix output of pid values
Eric Blake [Fri, 10 Feb 2012 23:52:01 +0000 (16:52 -0700)]
build: fix output of pid values

Nuke the last vestiges of printing pid_t values with the wrong
types, at least in code compiled on mingw64.  There may be other
places, but for now they are only compiled on systems where the
existing %d doesn't trigger gcc warnings.

* src/rpc/virnetsocket.c (virNetSocketNew): Use %lld and casting,
rather than assuming any particular int type for pid_t.
* src/util/command.c (virCommandRunAsync, virPidWait)
(virPidAbort): Likewise.
(verify): Drop a now stale assertion.

13 years agobuild: use correct type for pid and similar types
Eric Blake [Fri, 10 Feb 2012 23:08:11 +0000 (16:08 -0700)]
build: use correct type for pid and similar types

No thanks to 64-bit windows, with 64-bit pid_t, we have to avoid
constructs like 'int pid'.  Our API in libvirt-qemu cannot be
changed without breaking ABI; but then again, libvirt-qemu can
only be used on systems that support UNIX sockets, which rules
out Windows (even if qemu could be compiled there) - so for all
points on the call chain that interact with this API decision,
we require a different variable name to make it clear that we
audited the use for safety.

Adding a syntax-check rule only solves half the battle; anywhere
that uses printf on a pid_t still needs to be converted, but that
will be a separate patch.

* cfg.mk (sc_correct_id_types): New syntax check.
* src/libvirt-qemu.c (virDomainQemuAttach): Document why we didn't
use pid_t for pid, and validate for overflow.
* include/libvirt/libvirt-qemu.h (virDomainQemuAttach): Tweak name
for syntax check.
* src/vmware/vmware_conf.c (vmwareExtractPid): Likewise.
* src/driver.h (virDrvDomainQemuAttach): Likewise.
* tools/virsh.c (cmdQemuAttach): Likewise.
* src/remote/qemu_protocol.x (qemu_domain_attach_args): Likewise.
* src/qemu_protocol-structs (qemu_domain_attach_args): Likewise.
* src/util/cgroup.c (virCgroupPidCode, virCgroupKillInternal):
Likewise.
* src/qemu/qemu_command.c(qemuParseProcFileStrings): Likewise.
(qemuParseCommandLinePid): Use pid_t for pid.
* daemon/libvirtd.c (daemonForkIntoBackground): Likewise.
* src/conf/domain_conf.h (_virDomainObj): Likewise.
* src/probes.d (rpc_socket_new): Likewise.
* src/qemu/qemu_command.h (qemuParseCommandLinePid): Likewise.
* src/qemu/qemu_driver.c (qemudGetProcessInfo, qemuDomainAttach):
Likewise.
* src/qemu/qemu_process.c (qemuProcessAttach): Likewise.
* src/qemu/qemu_process.h (qemuProcessAttach): Likewise.
* src/uml/uml_driver.c (umlGetProcessInfo): Likewise.
* src/util/virnetdev.h (virNetDevSetNamespace): Likewise.
* src/util/virnetdev.c (virNetDevSetNamespace): Likewise.
* tests/testutils.c (virtTestCaptureProgramOutput): Likewise.
* src/conf/storage_conf.h (_virStoragePerms): Use mode_t, uid_t,
and gid_t rather than int.
* src/security/security_dac.c (virSecurityDACSetOwnership): Likewise.
* src/conf/storage_conf.c (virStorageDefParsePerms): Avoid
compiler warning.

13 years agobuild: prohibit cross-inclusion
Eric Blake [Fri, 2 Mar 2012 00:21:08 +0000 (17:21 -0700)]
build: prohibit cross-inclusion

Make it easier to detect invalid cross-directory includes, by
adding a syntax check.  The check is designed to be extensible:
the default case lists only the non-driver directories, and
specific directories can list a different set (for example,
util/ can only use itself, network/ can only use itself, util/,
or conf/).

* .gnulib: Update to latest, for syntax check improvment.
* cfg.mk (sc_prohibit_cross_inclusion): New check.
(sc_prohibit_strncmp, sc_libvirt_unmarked_diagnostics): Simplify.

13 years agoavoid global variable shadowed
Hu Tao [Fri, 2 Mar 2012 02:52:59 +0000 (10:52 +0800)]
avoid global variable shadowed

If "conf/domain_conf.h" included in file nodeinfo.c, gcc complains about
a variable shadowing. fix it for potential further including of the file.

ref: https://www.redhat.com/archives/libvir-list/2012-February/msg00955.html

13 years agoutil: remove unneeded #include in virrandom.c
Laine Stump [Thu, 1 Mar 2012 16:42:30 +0000 (11:42 -0500)]
util: remove unneeded #include in virrandom.c

Commit 7c90026 added #include "conf/domain_conf.h" to
util/virrandom.c. Fortunately it didn't actually use anything from
domain_conf.h, since as far as I'm aware, files in util aren't allowed
to reference anything in conf (although the opposite is allowed). So
this #include is unnecessary.

I verified it still compiles with the line removed, but have placed a
one day moratorium on me doing any "trivial rule" pushes, so will
wait for someone else to verify/ACK before pushing.

13 years agovirsh: expose partial pull
Eric Blake [Sat, 18 Feb 2012 16:55:45 +0000 (09:55 -0700)]
virsh: expose partial pull

Now virsh can call virDomainBlockRebase.

* tools/virsh.c (cmdBlockPull): Add --base parameter.
(blockJobImpl): Use it to expose BlockRebase API.
* tools/virsh.pod (blockpull): Document it.

13 years agoqemu: pass block pull backing file to monitor
Eric Blake [Sat, 18 Feb 2012 16:20:01 +0000 (09:20 -0700)]
qemu: pass block pull backing file to monitor

This actually wires up the new optional parameter to block_stream:
http://wiki.qemu.org/Features/LiveBlockMigration/ImageStreamingAPI

The error checking is still sparse, since libvirt must not use
qemu-img or header probing on a qcow2 file in use by qemu to
check if the backing file name is valid; so for now, libvirt is
relying on qemu to diagnose an incorrect backing name.  Fixing this
will require libvirt to track the entire backing file chain at the
time qemu is started and keeps it updated with snapshot and pull
operations.

* src/qemu/qemu_monitor_json.c (qemuMonitorJSONBlockJob): Add
parameter, and update callers.
* src/qemu/qemu_monitor_json.h (qemuMonitorJSONBlockJob): Update
signature.
* src/qemu/qemu_monitor.h (qemuMonitorBlockJob): Likewise.
* src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Update caller.
* src/qemu/qemu_monitor.c (qemuMonitorBlockJob): Likewise.

13 years agoqemu: require json for block jobs
Eric Blake [Fri, 17 Feb 2012 21:55:35 +0000 (14:55 -0700)]
qemu: require json for block jobs

Block job commands are not part of upstream qemu until 1.1; and
proper support of job completion and cancellation depends on being
able to receive QMP events, which implies the JSON monitor.
Additionally, some early versions of block job commands were
backported to RHEL qemu, but these versions lacked asynchronous
job cancellation and partial block pull, so there are several
patches that will still be needed in this area of libvirt code
to support both flavors of block job commands.

Due to earlier patches in libvirt, we are guaranteed that all versions
of qemu that support block job commands already require libvirt to
use the JSON monitor.  That means that the text version of block jobs
will not be used, and having to refactor two copies of the block job
handlers makes no sense.  So instead, we delete the text handlers.

* src/qemu/qemu_monitor.c (qemuMonitorBlockJob): Drop text monitor
support.
* src/qemu/qemu_monitor_text.h (qemuMonitorTextBlockJob): Delete.
* src/qemu/qemu_monitor_text.c (qemuMonitorTextParseBlockJobOne)
(qemuMonitorTextParseBlockJob, qemuMonitorTextBlockJob):
Likewise.

13 years agofix alphabetical order of virNetlink functions in symbol file
Laine Stump [Wed, 29 Feb 2012 20:20:33 +0000 (15:20 -0500)]
fix alphabetical order of virNetlink functions in symbol file

13 years agoutil: wrap virnetlink.c to 80 columns
Laine Stump [Wed, 29 Feb 2012 20:21:27 +0000 (15:21 -0500)]
util: wrap virnetlink.c to 80 columns

13 years agobuild: update to latest gnulib
Eric Blake [Fri, 24 Feb 2012 19:01:15 +0000 (12:01 -0700)]
build: update to latest gnulib

It's been a while, and we're between releases, so now's as good
a time as any to resync.  This also fixes a build-breaker on
cygwin, where cygwin 1.7.11 introduced a header bug in <termios.h>.

* .gnulib: Update to latest.
* bootstrap: Resync.
* cfg.mk (sc_prohibit_strncmp): Copy upstream changes to
sc_prohibit_strcmp.

13 years agoFix typo in domain XML documentation
Christophe Fergeau [Wed, 29 Feb 2012 12:47:06 +0000 (13:47 +0100)]
Fix typo in domain XML documentation

s/Modyfing/Modifying

13 years agoAdd de-association handling to macvlan code
D. Herrendoerfer [Wed, 22 Feb 2012 13:17:14 +0000 (14:17 +0100)]
Add de-association handling to macvlan code

Add de-association handling for 802.1qbg (vepa) via lldpad
netlink messages. Also adds the possibility to perform an
association request without waiting for a confirmation.

Signed-off-by: D. Herrendoerfer <d.herrendoerfer@herrendoerfer.name>
13 years agoutil: Add netlink event handling to virnetlink.c
D. Herrendoerfer [Wed, 22 Feb 2012 13:17:13 +0000 (14:17 +0100)]
util: Add netlink event handling to virnetlink.c

This code adds a netlink event interface to libvirt.
It is based upon the event_poll code and makes use of
it. An event is generated for each netlink message sent
to the libvirt pid.

Signed-off-by: D. Herrendoerfer <d.herrendoerfer@herrendoerfer.name>
13 years agoSupport for cpu64-rhel* qemu cpu models
Martin Kletzander [Fri, 24 Feb 2012 09:44:19 +0000 (10:44 +0100)]
Support for cpu64-rhel* qemu cpu models

In qemu there are 2 cpu models (cpu64-rhel5 and cpu64-rhel6) not
supported by libvirt. This patch adds the support with the flags
specifications from /usr/share/qemu-kvm/cpu-model/cpu-x86_64.conf
The only difference is that AMD-specific features are removed so
the processor type is not vendor-specific. Those features are either
emulated or ignored by qemu if host CPU doesn't support them.

13 years agolxc: Cleaner fix for compilation without SELinux
Martin Kletzander [Fri, 10 Feb 2012 15:22:50 +0000 (16:22 +0100)]
lxc: Cleaner fix for compilation without SELinux

Just a cleanup of commit 32f881c6c42f94da70a3782fe20a058fe3dc39cc.

13 years agolibvirt-guests: Check if URI is reachable before launching commands
Peter Krempa [Tue, 28 Feb 2012 13:39:17 +0000 (14:39 +0100)]
libvirt-guests: Check if URI is reachable before launching commands

This patch adds a check to the libvirt-guests script to check for the
URI to be alive before attempting any calls. This avoids nasty error
messages and allows us to fail gracefully and continue on other URIs
configured in the script.

13 years agolibvirt-guests: Don't try to do a managed-save of transient guests
Peter Krempa [Tue, 28 Feb 2012 13:32:21 +0000 (14:32 +0100)]
libvirt-guests: Don't try to do a managed-save of transient guests

The libvirt-guests script tried to do a managed save of transient guest
that failed. This patch notifies which guests are transient (and not
being saved) and saves only the persistent ones.

13 years agolibvirt-guests: Add documentation and clean up to use virsh's improved list
Peter Krempa [Tue, 28 Feb 2012 12:58:59 +0000 (13:58 +0100)]
libvirt-guests: Add documentation and clean up to use virsh's improved list

This patch adds documentation to functions defined in the libvirt-guests
init script and changes use of virsh's new commands to make the script
easier.

13 years agoqemu: Add pre-migration hook
Jiri Denemark [Tue, 28 Feb 2012 12:42:42 +0000 (13:42 +0100)]
qemu: Add pre-migration hook

This hook is called during the Prepare phase on destination host and may
be used for changing domain XML.

13 years agohooks: Add support for capturing hook output
Jiri Denemark [Mon, 27 Feb 2012 16:06:22 +0000 (17:06 +0100)]
hooks: Add support for capturing hook output

Hooks may now be used as filters.

13 years agostorage: fix typo
Michal Privoznik [Wed, 29 Feb 2012 10:42:00 +0000 (11:42 +0100)]
storage: fix typo

* src/storage/storage_driver.c (storageVolumeWipeInternal):
    s/ pfitzner33/pfitzner33/.

13 years agoqemu: Don't emit tls-port spice option if port is -1
Jiri Denemark [Tue, 28 Feb 2012 12:44:08 +0000 (13:44 +0100)]
qemu: Don't emit tls-port spice option if port is -1

Bug introduced by commit eda0fc7a.

13 years agodocs: comments wiping supported algorithms
Alex Jia [Wed, 29 Feb 2012 09:48:58 +0000 (17:48 +0800)]
docs: comments wiping supported algorithms

The current scrub version doesn't support pfitzner7, pfitzner33 and schneier
patterns on RHEL, we should comment it in virsh man page.

* tools/virsh.pod: update wiping algorithms docs.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agoutil: fix a typo
Alex Jia [Wed, 29 Feb 2012 06:53:48 +0000 (14:53 +0800)]
util: fix a typo

* src/util/event_poll.c: (virEventPollRunOnce): s/imeout/timeout/.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agostorage: fix a typo
Alex Jia [Wed, 29 Feb 2012 06:20:32 +0000 (14:20 +0800)]
storage: fix a typo

* src/storage/storage_driver.c (storageVolumeWipeInternal): s/shneier/schneier.

http://code.google.com/p/diskscrub/

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agoDo not include binaries in EXTRA_DIST
Daniel Veillard [Wed, 29 Feb 2012 07:24:35 +0000 (15:24 +0800)]
Do not include binaries in EXTRA_DIST

commit f27f616ff899732fe90ce1f0f4abb3887cea5e17 broke "make dist"
by adding qemumonitortest which is a generated binary to the
EXTRA_DIST, hence breaking "make dist"

13 years agodocs: Fix libvirt name in qemu commandline namespace URL
Michal Privoznik [Tue, 28 Feb 2012 16:30:30 +0000 (17:30 +0100)]
docs: Fix libvirt name in qemu commandline namespace URL

s/libirt/libvirt/g

13 years agolibxl: eliminate memory leak in libxmlDomainModifyDeviceFlags
Laine Stump [Mon, 27 Feb 2012 10:52:29 +0000 (05:52 -0500)]
libxl: eliminate memory leak in libxmlDomainModifyDeviceFlags

This call to virDomainDeviceDefParse is both unnecessary (since
it will again be called at the top of the immediately following if(),
and if not there, then at the top of the if following that), but it
also creates a leak of one virDomainDeviceDef and one [whatever type
of device the DeviceDef is pointing to; probably a virDomainDiskDef]
in the case that the function has been called with
VIR_DOMAIN_DEVICE_MODIFY_CONFIG (the second parse will overwrite the
devicedef that was just created).

13 years agovirsh: Break long lines in virsh.pod
Osier Yang [Tue, 28 Feb 2012 07:41:37 +0000 (15:41 +0800)]
virsh: Break long lines in virsh.pod

No content changes, just breaking long lines.

13 years agovirsh: New command cmdChangeMedia
Osier Yang [Tue, 28 Feb 2012 07:36:38 +0000 (15:36 +0800)]
virsh: New command cmdChangeMedia

One could use it to eject, insert, or update media of the CDROM
or floppy drive. See the documentation for more details.

13 years agovirsh: Use vshFindDisk and vshPrepareDiskXML in cmdDetachDisk
Osier Yang [Tue, 14 Feb 2012 09:16:53 +0000 (17:16 +0800)]
virsh: Use vshFindDisk and vshPrepareDiskXML in cmdDetachDisk

The first use of the two new helper functions.

13 years agovirsh: Two new helper functions for disk device changes
Osier Yang [Tue, 28 Feb 2012 06:38:03 +0000 (14:38 +0800)]
virsh: Two new helper functions for disk device changes

vshFindDisk is to find the disk node in xml doc with given source
path or target of disk device, and type (indicates disk type,
normal disk or changeable disk).

vshPrepareDiskXML is to make changes on the disk node (e.g. create
and insert the new <source> node for inserting media of CDROM drive).

They are marked as unused temporarily.

13 years agotests: Add tests for virtio-scsi and ibmvscsi controllers
Osier Yang [Tue, 28 Feb 2012 06:01:31 +0000 (14:01 +0800)]
tests: Add tests for virtio-scsi and ibmvscsi controllers

13 years agoqemu: Build command line for the new address format
Osier Yang [Tue, 28 Feb 2012 03:39:43 +0000 (11:39 +0800)]
qemu: Build command line for the new address format

For any disk controller model which is not "lsilogic", the command
line will be like:

  -drive file=/dev/sda,if=none,id=drive-scsi0-0-3-0,format=raw \
  -device scsi-disk,bus=scsi0.0,channel=0,scsi-id=3,lun=0,i\
  drive=drive-scsi0-0-3-0,id=scsi0-0-3-0

The relationship between the libvirt address attrs and the qdev
properties are (controller model is not "lsilogic"; strings
inside <> represent libvirt adress attrs):
  bus=scsi<controller>.0
  channel=<bus>
  scsi-id=<target>
  lun=<unit>

* src/qemu/qemu_command.h: (New param "virDomainDefPtr def"
  for function qemuBuildDriveDevStr; new param "virDomainDefPtr
  vmdef" for function qemuAssignDeviceDiskAlias. Both for
  virDomainDiskFindControllerModel's use).

* src/qemu/qemu_command.c:
  - New param "virDomainDefPtr def" for qemuAssignDeviceDiskAliasCustom.
    For virDomainDiskFindControllerModel's use, if the disk bus is "scsi"
    and the controller model is not "lsilogic", "target" is one part of
    the alias name.
  - According change on qemuAssignDeviceDiskAlias and qemuBuildDriveDevStr

* src/qemu/qemu_hotplug.c:
  - Changes to be consistent with declarations of qemuAssignDeviceDiskAlias
    qemuBuildDriveDevStr, and qemuBuildControllerDevStr.

* tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.args,
  tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.args: Update the
  generated command line.

13 years agoqemu: New cap flag to indicate if channel is supported by scsi-disk
Osier Yang [Mon, 27 Feb 2012 10:20:21 +0000 (18:20 +0800)]
qemu: New cap flag to indicate if channel is supported by scsi-disk

13 years agoconf: Introduce new attribute for device address format
Osier Yang [Mon, 27 Feb 2012 10:19:54 +0000 (18:19 +0800)]
conf: Introduce new attribute for device address format

* src/conf/domain_conf.h: Add new member "target" to struct
  _virDomainDeviceDriveAddress.

* src/conf/domain_conf.c: Parse and format "target"

* Lots of tests (.xml) in tests/domainsnapshotxml2xmlout,
  tests/qemuxml2argvdata, tests/qemuxml2xmloutdata, and
  tests/vmx2xmldata/ are modified for newly introduced
  attribute "target" for address of "drive" type.

13 years agoconf: Add helper function to look up disk controller model
Osier Yang [Mon, 27 Feb 2012 09:20:11 +0000 (17:20 +0800)]
conf: Add helper function to look up disk controller model

13 years agoqemu: add virtio-scsi controller model
Paolo Bonzini [Mon, 27 Feb 2012 09:16:20 +0000 (17:16 +0800)]
qemu: add virtio-scsi controller model

Adding a new model for virtio-scsi roughly follows the same scheme
as the previous patch.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
13 years agoqemu: add ibmvscsi controller model
Paolo Bonzini [Mon, 27 Feb 2012 09:08:23 +0000 (17:08 +0800)]
qemu: add ibmvscsi controller model

KVM will be able to use a PCI SCSI controller even on POWER.  Let
the user specify the vSCSI controller by other means than a default.

After this patch, the QEMU driver will actually look at the model
and reject anything but auto, lsilogic and ibmvscsi.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Osier Yang <jyang@redhat.com>
13 years agoqemu: fix cleanup of bridge during failure of qemuDomainAttachNetDevice
Laine Stump [Tue, 28 Feb 2012 03:43:23 +0000 (22:43 -0500)]
qemu: fix cleanup of bridge during failure of qemuDomainAttachNetDevice

In qemuDomainAttachNetDevice, the guest's tap interface has only been
attached to the bridge if iface_connected is true. It's possible for
an error to occur prior to that happening, and previously we would
attempt to remove the tap interface from the bridge even if it hadn't
been attached.

13 years agoqemu: unescape HMP commands before converting them to json
Josh Durgin [Sun, 26 Feb 2012 00:48:02 +0000 (16:48 -0800)]
qemu: unescape HMP commands before converting them to json

QMP commands don't need to be escaped since converting them to json
also escapes special characters. When a QMP command fails, however,
libvirt falls back to HMP commands. These fallback functions
(qemuMonitorText*) do their own escaping, and pass the result directly
to qemuMonitorHMPCommandWithFd. If the monitor is in json mode, these
pre-escaped commands will be escaped again when converted to json,
which can result in the wrong arguments being sent.

For example, a filename test\file would be sent in json as
test\\file.

This prevented attaching an image file with a " or \ in its name in
qemu 1.0.50, and also broke rbd attachment (which uses backslashes to
escape some internal arguments.)

Reported-by: Masuko Tomoya <tomoya.masuko@gmail.com>
Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
13 years agoqemu: Add ability to abort existing console while creating new one
Peter Krempa [Thu, 6 Oct 2011 10:24:47 +0000 (12:24 +0200)]
qemu: Add ability to abort existing console while creating new one

This patch fixes console corruption, that happens if two concurrent
sessions are opened for a single console on a domain. Result of this
corruption was that each of the console streams recieved just a part
of the data written to the pipe so every console rendered unusable.

New helper function for safe console handling is used to establish the
console stream connection. This function ensures that no other libvirt
client is using the console (with the ability to disconnect consoles of
libvirt clients) and that no UUCP style lockfile is placed on the PTY
device.

* src/qemu/qemu_domain.h
        - add data structure to domain's private data dealing with
          console connections
* src/qemu/qemu_domain.c:
        - allocate/free domain's console data structure
* src/qemu/qemu_driver.c
        - use the new helper function for console handling

13 years agoutil: Add helpers for safe domain console operations
Peter Krempa [Fri, 25 Nov 2011 15:25:14 +0000 (16:25 +0100)]
util: Add helpers for safe domain console operations

This patch adds a set of functions used in creating console streams for
domains using PTYs and ensures mutually exclusive access to the PTYs.

If mutually exclusive access is not used, two clients may open the same
console, which results in corruption on both clients as both of them
race to read data from the PTY.

Two approaches are used to ensure this:
1) Internal data structure holding open PTYs.
        This is used internally and enables the user to forcibly
        terminate another console connection eg. when somebody leaves
        the console open on another host.

2) UUCP style lock files:
        This uses UUCP lock files according to the  FHS
        ( http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLOCKLOCKFILES )
        to check if other programs (like minicom) are not using the pty
        device of the console.

        This feature is disabled by default and may be enabled using
        configure parameter
        --with-console-lock-files=/path/to/lock/file/directory
        or --with-console-lock-files=auto (which tries to infer the
        location from OS used (currently only linux).

        On usual linux systems, normal users may not write to the
        /var/lock directory containing the locks. This poses problems
        while in session mode. If the current user has no access to the
        lockfile directory, check for presence of the file is still
        done, but no lock file is created. This does NOT result in an
        error.

13 years agofdstream: Add internal callback on stream close
Peter Krempa [Thu, 23 Feb 2012 12:45:25 +0000 (13:45 +0100)]
fdstream: Add internal callback on stream close

This patch adds another callback to a FDstream object. The original
callback is used by the daemon stream driver to handle events.

This callback is called if and only if the stream is about to be closed.
This might be used to handle cleanup steps after a fdstream exits. This
will be used later on in ensuring mutually exclusive access to consoles.

* src/fdstream.c:
        - emit the callback, when stream is being closed
        - add data structures needed to handle the callback
        - add function to register callback
* src/fdstream.h:
        - define function prototypes for the callback

13 years agofdstream: Emit stream abort callback even if poll() doesnt.
Peter Krempa [Thu, 23 Feb 2012 11:54:18 +0000 (12:54 +0100)]
fdstream: Emit stream abort callback even if poll() doesnt.

This patch causes the fdstream driver to call the stream event callback
if virStreamAbort() is called on a stream using this driver.

A remote handler for a stream can only detect changes via stream events,
so this event callback is necessary in order to enable a daemon to abort
a stream in such a way that the client will see the change.

* src/fdstream.c:
        - modify close function to call stream event callback

13 years agovirsh: add support for VIR_DOMAIN_CONSOLE_* flags
Peter Krempa [Wed, 12 Oct 2011 10:59:15 +0000 (12:59 +0200)]
virsh: add support for VIR_DOMAIN_CONSOLE_* flags

This patch adds support for the newly introduced
VIR_DOMAIN_CONSOLE_FORCE and VIR_DOMAIN_CONSOLE_SAFE flags. The console
command now has an optional parameter --force that specifies that the
user wants to forcibly interrupt an ongoing console session and create
a new one. Flag --safe requests that the console should be opened only
if the hypervisor driver supports safe console handling.

The behaviour to this point was that the daemon opened two streams to
the console, that competed for data from the pipe, and the result was
that both of the consoles ended up scrambled.

This patch doesn't modify operation of other commands dealing with
console connections (start, create) as those open connections to newly
started domains making it virtually impossible for another client to race
for the console and steal it.

* tools/console.c:
        - add support for flag passthrough
* tools/console.h:
        - modify function prototypes to match impl.
* tools/virsh.c:
        - add flag --force for the console command

13 years agoAdd flags for virDomainOpenConsole
Peter Krempa [Wed, 12 Oct 2011 11:19:48 +0000 (13:19 +0200)]
Add flags for virDomainOpenConsole

This patch adds a set of flags to be used with the virDomainOpenConsole
API call to specify if the user wishes to interrupt an existing console
session or just to try open a new one.

VIR_DOMAIN_CONSOLE_SAFE - specifies that the console connection should
                          be opened only if the hypervisor supports
                          mutually exclusive access to console devices

VIR_DOMAIN_CONSOLE_FORCE - specifies that the caller wishes to interrupt
                           existing session and force a creation of a
                           new one.

13 years agopidfile: Make checking binary path in virPidFileRead optional
Peter Krempa [Thu, 26 Jan 2012 15:25:38 +0000 (16:25 +0100)]
pidfile: Make checking binary path in virPidFileRead optional

This patch changes behavior of virPidFileRead to enable passing NULL as
path to the binary the pid file should be checked against to skip this
check. This enables using this function for reading files that have same
semantics as pid files, but belong to unknown processes.

13 years agoqemu: Implement virDomainPMWakeup API
Michal Privoznik [Fri, 10 Feb 2012 12:33:52 +0000 (13:33 +0100)]
qemu: Implement virDomainPMWakeup API

using 'system-wakeup' monitor command. It is supported only in JSON,
as we are enabling it if possible. Moreover, this command is available
in qemu-1.1+ which definitely has JSON.

13 years agovirsh: Expose virDomainPMWakeup
Michal Privoznik [Fri, 10 Feb 2012 12:07:24 +0000 (13:07 +0100)]
virsh: Expose virDomainPMWakeup

13 years agoIntroduce virDomainPMWakeup API
Michal Privoznik [Fri, 10 Feb 2012 11:40:52 +0000 (12:40 +0100)]
Introduce virDomainPMWakeup API

This API allows a domain which previously called
virDomainPMSuspendForDuration() to be woken up.

13 years agoFixed URI parsing
Martin Kletzander [Fri, 24 Feb 2012 18:48:55 +0000 (19:48 +0100)]
Fixed URI parsing

Function xmlParseURI does not remove square brackets around IPv6
address when parsing. One of the solutions is making wrappers around
functions working with xmlURI*. This assures that uri->server will be
always properly assigned and it doesn't have to be changed when used
on some new place in the code.
For this purpose, functions virParseURI and virSaveURI were
added. These function are wrappers around xmlParseURI and xmlSaveUri
respectively.
Also there is one new syntax check function to prohibit these functions
anywhere else.

File changes:
 - src/util/viruri.h        -- declaration
 - src/util/viruri.c        -- definition
 - src/libvirt_private.syms -- symbol export
 - src/Makefile.am          -- added source and header files
 - cfg.mk                   -- added sc_prohibit_xmlURI
 - all others               -- ID name and include fixes

13 years agoFixed service handling in specfile
Martin Kletzander [Fri, 24 Feb 2012 11:28:58 +0000 (12:28 +0100)]
Fixed service handling in specfile

After adding the libvirt-guests service into usual runlevels, we used
to start the libvirt-guests service. However this is usually not a
good practice. As mentioned on fedoraproject wiki, the installations
can be in changeroots, in an installer context, or in other situations
where we don't want the services autostarted.

13 years agovirsh: fix informational message in iface-bridge command
Laine Stump [Fri, 24 Feb 2012 19:32:33 +0000 (14:32 -0500)]
virsh: fix informational message in iface-bridge command

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

The position of the bridge name and ethernet device name were
accidentally swapped in the message informing of success creating the
bridge.

13 years agoWorkaround python header file insanity
Daniel P. Berrange [Fri, 24 Feb 2012 15:10:53 +0000 (15:10 +0000)]
Workaround python header file insanity

The /usr/include/python/pyconfig.h file pollutes the global
namespace with a huge number of HAVE_XXX and WITH_XXX
defines. These change what we detected in our own config.h
In particular if you try to build without DTrace, python's
headers turn it back on with predictable fail.

THe hack to workaround this is to rename WITH_DTRACE to
WITH_DTRACE_PROBES to avoid the namespace clash

13 years agoImprove error reporting when virsh console is run without a TTY
Daniel P. Berrange [Wed, 15 Feb 2012 13:12:11 +0000 (13:12 +0000)]
Improve error reporting when virsh console is run without a TTY

If attempting to run

  ssh root@somehost virsh console someguest

You'll get an error

  2012-02-15 13:11:47.683+0000: 4765: info : libvirt version: 0.9.10, package: 1.fc18 (Unknown, 2012-02-15-11:48:57, lettuce.camlab.fab.redhat.com)
  2012-02-15 13:11:47.683+0000: 4765: error : vshRunConsole:320 : unable to get tty attributes: Invalid argument
  Connected to domain f16x86_64
  Escape character is ^]

There are several problems here

 - The actual error message is bad for users
 - We shouldn't rely on VIR_ERROR for this case
 - The prompt makes it look like we still connected
   because we didn't flush stdout.

* virsh.c: Flush stdout before starting console and check
  for a valid tty

13 years agoError out when using SPICE TLS with spice_tls=0
Christophe Fergeau [Fri, 24 Feb 2012 10:34:45 +0000 (11:34 +0100)]
Error out when using SPICE TLS with spice_tls=0

It's possible to disable SPICE TLS in qemu.conf. When this happens,
libvirt ignores any SPICE TLS port or x509 directory that may have
been set when it builds the qemu command line to use. However, it's
not ignoring the secure channels that may have been set and adds
tls-channel arguments to qemu command line.
Current qemu versions don't report an error when this happens, and try to use
TLS for the specified channels.

Before this patch

<domain type='kvm'>
  <name>auto-tls-port</name>
  <memory>65536</memory>
  <os>
    <type arch='x86_64' machine='pc'>hvm</type>
  </os>
  <devices>
    <graphics type='spice' port='5900' tlsPort='-1' autoport='yes' listen='0' ke
      <listen type='address' address='0'/>
      <channel name='main' mode='secure'/>
      <channel name='inputs' mode='secure'/>
    </graphics>
  </devices>
</domain>

generates

-spice port=5900,addr=0,disable-ticketing,tls-channel=main,tls-channel=inputs

and starts QEMU.

After this patch, an error is reported if a TLS port is set in the XML
or if secure channels are specified but TLS is disabled in qemu.conf.
This is the behaviour the oVirt people (where I spotted this issue) said
they would expect.

This fixes bug #790436

13 years agovmx: Better Workstation vmx handling
Jean-Baptiste Rouault [Thu, 23 Feb 2012 09:34:45 +0000 (10:34 +0100)]
vmx: Better Workstation vmx handling

This patch adds support for vmx files with empty networkName
values (which is the case for vmx generated by Workstation).
It also adds support for vmx containing NATed network interfaces.

Update test suite accordingly

13 years agovirterror: Misleading error message when name is missing
Benjamin Cama [Thu, 23 Feb 2012 16:37:30 +0000 (17:37 +0100)]
virterror: Misleading error message when name is missing

[forwarding this here from RH bug #796732]

When creating a network (virsh net-create) with an erroneous XML
containing an empty <name> element, the error message is misleading:

error: Failed to create network from foo.xml
error: missing domain name information

It took me a bit of time to figure out that it was the *network* name
that was missing (I generate this xml and didn't look at it, first).

I realized that the same message is used for missing name when creating
a domain, network, or device node.

13 years agoUpdate bug reporting page
Dave Allan [Thu, 23 Feb 2012 22:49:25 +0000 (17:49 -0500)]
Update bug reporting page

Remove suggestion that people file bugs against RHEL 5 and add a
suggestion that people increase the visibility of their bugs by
mentioning them on libvir-list.

13 years agoqemu: nicer error message on failed graceful destroy
Eric Blake [Wed, 22 Feb 2012 18:41:17 +0000 (11:41 -0700)]
qemu: nicer error message on failed graceful destroy

https://bugzilla.redhat.com/show_bug.cgi?id=795656 mentions
that a graceful destroy request can time out, meaning that the
error message is user-visible and should be more appropriate
than just internal error.

* src/qemu/qemu_driver.c (qemuDomainDestroyFlags): Swap error type.

13 years agoqemu: Forbid migration with cache != none
Jiri Denemark [Tue, 21 Feb 2012 12:20:06 +0000 (13:20 +0100)]
qemu: Forbid migration with cache != none

Migrating domains with disks using cache != none is unsafe unless the
disk images are stored on coherent clustered filesystem. Thus we forbid
migrating such domains unless VIR_MIGRATE_UNSAFE flags is used.

13 years agoIntroduce virStorageFileIsClusterFS
Jiri Denemark [Tue, 21 Feb 2012 21:58:50 +0000 (22:58 +0100)]
Introduce virStorageFileIsClusterFS

13 years agovirsh: Add --unsafe option to migrate command
Jiri Denemark [Tue, 21 Feb 2012 12:19:46 +0000 (13:19 +0100)]
virsh: Add --unsafe option to migrate command

13 years agoAdd support for unsafe migration
Jiri Denemark [Mon, 20 Feb 2012 08:16:23 +0000 (09:16 +0100)]
Add support for unsafe migration

This patch adds VIR_MIGRATE_UNSAFE flag for migration APIs and new
VIR_ERR_MIGRATION_UNSAFE error code.  The error code should be returned
whenever migrating a domain is considered unsafe (e.g., it's configured
in a way that does not ensure data integrity once it is migrated).
VIR_MIGRATE_UNSAFE flag may be used to force migration even though it
would normally be considered unsafe and forbidden.

13 years agoconfigure: Define program name if not found
Michal Privoznik [Wed, 22 Feb 2012 10:18:59 +0000 (11:18 +0100)]
configure: Define program name if not found

AC_CHECK_PROG checks for program in given path. However, if it doesn't
exists, [variable] is set to [value-if-not-found]. We don't want this
to be the empty string in case of 'modprobe' and 'scrub' as we want to
fallback to runtime detection.

13 years agoutil: Fix virFileAccessibleAs return path from parent
Michal Privoznik [Wed, 22 Feb 2012 08:55:27 +0000 (09:55 +0100)]
util: Fix virFileAccessibleAs return path from parent

Despite documentation, if we do fork() parent always returns -1
even if file is accessible. Which is wrong obviously.

13 years agovirsh: Enhance list command to ease creation of shell scripts
Peter Krempa [Tue, 21 Feb 2012 14:02:23 +0000 (15:02 +0100)]
virsh: Enhance list command to ease creation of shell scripts

This patch adds new options to the "virsh list" command enabling
filtering of persistent and transient domains along with the option to
print only UUIDs or names of domains instead of printing the table.

Option --name prints domain names (one per line) instead of the default
table. Similarly --uuid prints domain's UUID. The option --table is
an alias for the default behavior.

Aditionally --persistent and/or --transient may be specified to filter
the output of domains.

13 years agovmware: implement domainXMLFromNative
Jean-Baptiste Rouault [Wed, 22 Feb 2012 09:28:06 +0000 (10:28 +0100)]
vmware: implement domainXMLFromNative

13 years agolib: Fix function documentation for virConnectListDomains
Peter Krempa [Tue, 21 Feb 2012 14:00:33 +0000 (15:00 +0100)]
lib: Fix function documentation for virConnectListDomains

Clarify the documentation of virConnectListDomains.

13 years agoesx: Correctly disable HTTP Expect header usage of libcurl
Matthias Bolte [Mon, 20 Feb 2012 21:34:52 +0000 (22:34 +0100)]
esx: Correctly disable HTTP Expect header usage of libcurl

Adding "Expect:" to the header list stops libcurl from sending a
Expect header at all.

Before, a dummy Expect header was added that might confuse HTTP
proxies and result in HTTP error code 417 being reported.

13 years agovirsh: Fix docs for list command
Peter Krempa [Tue, 21 Feb 2012 14:05:49 +0000 (15:05 +0100)]
virsh: Fix docs for list command

Commit fad5cd210899dfde4afe36712754dc921c3f3051 introduced option to
display domain's title in the list command output. There was a mistake
in the virsh man page example for this command stating --note instead of
--title.

13 years agocaps: Improve error if passed an unknown arch
Cole Robinson [Mon, 20 Feb 2012 18:40:30 +0000 (13:40 -0500)]
caps: Improve error if passed an unknown arch

Previously we would have:

"os type 'hvm' & arch 'idontexist' combination is not supported"

Now we get

"No guest options available for arch 'idontexist'"

or if options available but guest OS type not applicable:

"No os type 'xen' available for arch 'x86_64'"

13 years agospec: use ix86 macros
Peter Robinson [Mon, 20 Feb 2012 16:27:11 +0000 (09:27 -0700)]
spec: use ix86 macros

* libvirt.spec.in: Use %{ix86} rather than open-coded list.

13 years agoFix compilation on MacOS X
Lincoln Myers [Mon, 20 Feb 2012 03:21:00 +0000 (11:21 +0800)]
Fix compilation on MacOS X

* src/util/virfile.h: the virFileWrapperFdFlags being defined as
  a globa variable instead of a type ended up generating a duplicate
  symbol error.
* AUTHORS: added Lincoln Myers

13 years agonwfilter: improved logging during driver initialization
Stefan Berger [Thu, 16 Feb 2012 23:56:39 +0000 (18:56 -0500)]
nwfilter: improved logging during driver initialization

Improve the logging during driver initialization when testing the command
line tools.

13 years agoqemu: Prevent crash of libvirtd without guest agent
Alex Jia [Thu, 16 Feb 2012 02:32:03 +0000 (10:32 +0800)]
qemu: Prevent crash of libvirtd without guest agent

* src/qemu/qemu_process.c (qemuFindAgentConfig): avoid crash libvirtd due to
deref a NULL pointer.

* How to reproduce?
1. virsh edit the following xml into guest configuration:
    <channel type='pty'>
      <target type='virtio'/>
    </channel>
2. virsh start <domain>

or
% virt-install -n foo -r 1024 --disk path=/var/lib/libvirt/images/foo.img,size=1 \
--channel pty,target_type=virtio -l <installation tree>

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agoqemu: Unlock monitor when connecting to dest qemu fails
Jiri Denemark [Wed, 15 Feb 2012 15:48:54 +0000 (16:48 +0100)]
qemu: Unlock monitor when connecting to dest qemu fails

When migrating a qemu domain, we enter the monitor, send some commands,
try to connect to destination qemu, send other commands, end exit the
monitor. However, if we couldn't connect to destination qemu we forgot
to exit the monitor.

Bug introduced by commit d9d518b1c8ef3b65658cc91f85ba33a63c0959a4.

13 years agoqemu: Fix segfault when host CPU is empty
Jiri Denemark [Wed, 15 Feb 2012 11:18:25 +0000 (12:18 +0100)]
qemu: Fix segfault when host CPU is empty

In case libvirtd cannot detect host CPU model (which may happen if it
runs inside a virtual machine), the daemon is likely to segfault when
starting a new qemu domain. It segfaults when domain XML asks for host
(either model or passthrough) CPU or does not ask for any specific CPU
model at all.

13 years agostorage: Allow runtime detection of scrub
Michal Privoznik [Tue, 14 Feb 2012 10:09:42 +0000 (11:09 +0100)]
storage: Allow runtime detection of scrub

Currently, if scrub (used for wiping algorithms) is not present
at compile time, we don't support any other wiping algorithms than
zeroing, even if it was installed later. Switch to runtime detection
instead.

13 years agoFix polkit0 authentication
Jim Fehlig [Wed, 15 Feb 2012 17:01:50 +0000 (10:01 -0700)]
Fix polkit0 authentication

Commit 7033c5f2 introduced some bugs in polkit0 authentication.

Fix libvirtd segfault in remoteDispatchAuthPolkit().

Fix polkit authentication bypass when caller UID = 0.

13 years agoFix build with polkit0
Jim Fehlig [Thu, 16 Feb 2012 04:34:13 +0000 (21:34 -0700)]
Fix build with polkit0

Commit 8dd623b9 introduced a build error with --enable-compile-warnings=error

  remote.c:2593: error: unused variable 'rv' [-Wunused-variable]

Pushing under build-breaker rule.

13 years agopython: Expose virDomain{G,S}etInterfaceParameters APIs in python binding
Alex Jia [Tue, 14 Feb 2012 02:46:23 +0000 (10:46 +0800)]
python: Expose virDomain{G,S}etInterfaceParameters APIs in python binding

The v4 patch corrects indentation issues.

The v3 patch follows latest python binding codes and change 'size'
type from int to Py_ssize_t.

An simple example to show how to use it:

#!/usr/bin/env python

import libvirt

conn = libvirt.open(None)
dom = conn.lookupByName('foo')

print dom.interfaceParameters('vnet0', 0)

params = {'outbound.peak': 10,
          'inbound.peak': 10,
          'inbound.burst': 20,
          'inbound.average': 20,
          'outbound.average': 30,
          'outbound.burst': 30}

print dom.setInterfaceParameters('vnet0', params, 0)
print dom.interfaceParameters('vnet0', 0)

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agosnapshot: fix snapshot deletion use-after-free
Eric Blake [Tue, 14 Feb 2012 20:08:56 +0000 (13:08 -0700)]
snapshot: fix snapshot deletion use-after-free

Bug introduced in commit 35abced.  On an inactive domain,
$ virsh snapshot-create-as dom snap
$ virsh snapshot-create dom
$ virsh snapshot-create dom
$ virsh snapshot-delete --children dom snap
could crash libvirtd, due to a use-after-free that results
when the callback freed the current element in the iteration.

* src/conf/domain_conf.c (virDomainSnapshotForEachChild)
(virDomainSnapshotActOnDescendant): Allow iteration to delete
current child.

13 years agodaemon: fix logic bug with virAsprintf
Eric Blake [Tue, 14 Feb 2012 23:00:28 +0000 (16:00 -0700)]
daemon: fix logic bug with virAsprintf

Regression introduced in commit 7033c5f2, due to improper conversion
from snprintf to virAsprintf.

* daemon/remote.c (remoteDispatchAuthList): Check return value
correctly.