]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
10 years agovbox: Rewrite vboxDomainDefineXML
Taowei [Mon, 11 Aug 2014 10:06:19 +0000 (18:06 +0800)]
vbox: Rewrite vboxDomainDefineXML

10 years agovbox: Rewrite vboxDomainUndefineFlags
Taowei [Mon, 11 Aug 2014 10:06:18 +0000 (18:06 +0800)]
vbox: Rewrite vboxDomainUndefineFlags

10 years agovbox: Rewrite vboxDomainLookupByUUID
Taowei [Mon, 11 Aug 2014 10:06:17 +0000 (18:06 +0800)]
vbox: Rewrite vboxDomainLookupByUUID

10 years agovbox: Rewrite vboxDomainLookupById
Taowei [Mon, 11 Aug 2014 10:06:16 +0000 (18:06 +0800)]
vbox: Rewrite vboxDomainLookupById

10 years agovbox: Rewrite vboxConnectNumOfDomains
Taowei [Mon, 11 Aug 2014 10:06:15 +0000 (18:06 +0800)]
vbox: Rewrite vboxConnectNumOfDomains

10 years agovbox: Rewrite vboxConnectListDomains
Taowei [Mon, 11 Aug 2014 10:06:14 +0000 (18:06 +0800)]
vbox: Rewrite vboxConnectListDomains

10 years agovbox: Rewrite vboxConnectGetCapabilities
Taowei [Mon, 11 Aug 2014 10:06:13 +0000 (18:06 +0800)]
vbox: Rewrite vboxConnectGetCapabilities

10 years agovbox: Rewrite vboxConnectGetMaxVcpus
Taowei [Mon, 11 Aug 2014 10:06:12 +0000 (18:06 +0800)]
vbox: Rewrite vboxConnectGetMaxVcpus

10 years agovbox: Rewrite vboxConnectIsAlive
Taowei [Mon, 11 Aug 2014 10:06:11 +0000 (18:06 +0800)]
vbox: Rewrite vboxConnectIsAlive

10 years agovbox: Rewrite vboxConnectIsEncrypted
Taowei [Mon, 11 Aug 2014 10:06:10 +0000 (18:06 +0800)]
vbox: Rewrite vboxConnectIsEncrypted

10 years agovbox: Rewrite vboxConnectIsSecure
Taowei [Mon, 11 Aug 2014 10:06:09 +0000 (18:06 +0800)]
vbox: Rewrite vboxConnectIsSecure

10 years agovbox: Rewrite vboxConnectGetHostname
Taowei [Mon, 11 Aug 2014 10:06:08 +0000 (18:06 +0800)]
vbox: Rewrite vboxConnectGetHostname

10 years agovbox: Rewrite vboxConnectGetVersion
Taowei [Mon, 11 Aug 2014 10:06:07 +0000 (18:06 +0800)]
vbox: Rewrite vboxConnectGetVersion

10 years agovbox: Rewrite vboxDomainSave
Taowei [Mon, 11 Aug 2014 10:06:06 +0000 (18:06 +0800)]
vbox: Rewrite vboxDomainSave

All vbox objects are child objects from the nsISupports in vbox's
C++ API version. Since the CAPI is generated from the C++ API, I
kept their relationship here, by the definitations below:

typedef struct nsISupports nsISupports;
typedef nsISupports IVirtualBox;
typedef nsISupports ISession;
and so on...

So, when calling the API from nsISupports, we don't need to do
typecasting, and things work still work well.

10 years agovbox: Rewrite vboxConnectClose
Taowei [Mon, 11 Aug 2014 10:06:05 +0000 (18:06 +0800)]
vbox: Rewrite vboxConnectClose

10 years agovbox: Begin to rewrite, vboxConnectOpen
Taowei [Mon, 11 Aug 2014 10:06:04 +0000 (18:06 +0800)]
vbox: Begin to rewrite, vboxConnectOpen

Introduce vbox_uniformed_api to deal with version conflicts. Use
vbox_install_api to register the currect vboxUniformedAPI with
vbox version.

vboxConnectOpen has been rewritten.

10 years agonetwork: fix crash when starting a network with no <pf> element
Laine Stump [Thu, 14 Aug 2014 16:34:23 +0000 (12:34 -0400)]
network: fix crash when starting a network with no <pf> element

Martin Kletzander pointed out in email that my commit 2a193f64
introduced a crash in networkCreateInterfacePool() during startup of
any network that doesn't have a <pf> subelement of its <forward>
element. He also supplied a patch.

 http://www.redhat.com/archives/libvir-list/2014-August/msg00655.html

I expanded on that patch by cleaning up now-extraneous checks in the
callers of networkCreateInterfacePool().

Fortunately the offending patch hasn't been in any release, and hasn't
been (to my knowledge) backported to any other branch.

10 years agosrc/xenxs: Refactor code formating vif device config
Jim Fehlig [Wed, 13 Aug 2014 20:46:16 +0000 (14:46 -0600)]
src/xenxs: Refactor code formating vif device config

Handle formating of VIF config in a new function xenFormatXMVif().

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
10 years agosrc/xenxs: Refactor code formating peripheral device config
Kiarie Kahurani [Mon, 11 Aug 2014 21:21:34 +0000 (00:21 +0300)]
src/xenxs: Refactor code formating peripheral device config

introduce functions
  xenFormatXMSound
  xenFormatXMInputDevs(virConfPtr conf,....);
which formats peripheral device config instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
10 years agosrc/xenxs: Refactor code formating Vfb config
Kiarie Kahurani [Mon, 11 Aug 2014 21:21:33 +0000 (00:21 +0300)]
src/xenxs: Refactor code formating Vfb config

introduce function
   xenFormatXMVfb(virConfPtr conf,.........);
which formats Vfb config instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
10 years agosrc/xenxs: Refactor code formating OS config
Kiarie Kahurani [Mon, 11 Aug 2014 21:21:32 +0000 (00:21 +0300)]
src/xenxs: Refactor code formating OS config

introduce functions
   xenFormatXMEmulator(virConfPtr conf,........);
   xenFormatXMCDROM(virConfPtr conf, .......);
   xenFormatXMOS(virConfPtr conf,........);
which formats OS and associated config instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agosrc/xenxs: Refactor code formating CPU config
Kiarie Kahurani [Mon, 11 Aug 2014 21:21:31 +0000 (00:21 +0300)]
src/xenxs: Refactor code formating CPU config

introduce functions
  xenFormatXMCPUAllocation(virConfPtr conf, ......);
  xenFormatXMCPUFeatures(virConfPtr conf, ......);
which formats CPU allocation and features config

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agosrc/xenxs: Refactor code formating xm disk config
Kiarie Kahurani [Mon, 11 Aug 2014 21:21:30 +0000 (00:21 +0300)]
src/xenxs: Refactor code formating xm disk config

introduce function
  xenFormatXMDisks(virConfPtr conf,.........);
which formats domain disks config instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agosrc/xenxs: Refactor code formating Char devices config
Kiarie Kahurani [Mon, 11 Aug 2014 21:21:29 +0000 (00:21 +0300)]
src/xenxs: Refactor code formating Char devices config

introduce function
   xenFormatXMCharDev(virConfPtr conf,........);
which formats Char devices config instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agosrc/xenxs: Refactor code formating event actions config
Kiarie Kahurani [Mon, 11 Aug 2014 21:21:28 +0000 (00:21 +0300)]
src/xenxs: Refactor code formating event actions config

introduce function
   xenFormatXMEventActions(virConfPtr conf,.........);
which formats event actions instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
10 years agosrc/xenxs: Refactor code formating virtual time config
Kiarie Kahurani [Mon, 11 Aug 2014 21:21:27 +0000 (00:21 +0300)]
src/xenxs: Refactor code formating virtual time config

introduce function
  xenFormatXMTimeOffset(virConfPtr conf,........);
which formats time config instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agosrc/xenxs: Refactor code formating memory config
Kiarie Kahurani [Mon, 11 Aug 2014 21:21:26 +0000 (00:21 +0300)]
src/xenxs: Refactor code formating memory config

introduce function
   xenFormatXMMem(virConfPtr conf,...........);
which parses memory config instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
10 years agosrc/xenxs: Refactor code formating general VM config
Kiarie Kahurani [Mon, 11 Aug 2014 21:21:25 +0000 (00:21 +0300)]
src/xenxs: Refactor code formating general VM config

introduce function
  xenFormatXMGeneralMeta(virConfPtr conf,......);
which parses uuid and name instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agoqemu_process: fix memleak found by coverity
Pavel Hrdina [Thu, 14 Aug 2014 17:33:06 +0000 (19:33 +0200)]
qemu_process: fix memleak found by coverity

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agoMaximum vlanid should be 4095 in interface.rng
Jianwei Hu [Wed, 13 Aug 2014 08:10:43 +0000 (16:10 +0800)]
Maximum vlanid should be 4095 in interface.rng

The correct vlanid range is 0~4095.

After merging this patch, we can not validate a interface xml with vlanid >= 4096.
[root@localhost ~]# cat vlan.xml
<interface type='vlan' name='eno1.4096'>
   <start mode='onboot'/>
   <protocol family='ipv4'>
    <dhcp/>
   </protocol>
   <vlan tag='4096'>
     <interface name='eno1'/>
   </vlan>
</interface>
[root@localhost ~]# virt-xml-validate vlan.xml
vlan.xml:1: element interface: Relax-NG validity error : Invalid sequence in interleave
vlan.xml:6: element vlan: Relax-NG validity error : Element interface failed to validate content
vlan.xml:6: element vlan: Relax-NG validity error : Element vlan failed to validate attributes
vlan.xml fails to validate
[root@localhost ~]#

Here is a ip command help on this.
[root@localhost /]# ip link add link eno1 name eno1.90 type vlan help
Usage: ... vlan [ protocol VLANPROTO ] id VLANID                [ FLAG-LIST ]
                [ ingress-qos-map QOS-MAP ] [ egress-qos-map QOS-MAP ]

VLANPROTO: [ 802.1Q / 802.1ad ]
VLANID := 0-4095
FLAG-LIST := [ FLAG-LIST ] FLAG
FLAG := [ reorder_hdr { on | off } ] [ gvrp { on | off } ] [ mvrp { on | off } ]
        [ loose_binding { on | off } ]
QOS-MAP := [ QOS-MAP ] QOS-MAPPING
QOS-MAPPING := FROM:TO

10 years agoLXC: Fix virLXCControllerSetupDevPTS() wrt user namespaces
Richard Weinberger [Mon, 28 Jul 2014 20:59:17 +0000 (22:59 +0200)]
LXC: Fix virLXCControllerSetupDevPTS() wrt user namespaces

The gid value passed to devpts has to be translated by hand as
virLXCControllerSetupDevPTS() is called before setting up the user
and group mappings.
Otherwise devpts will use an unmapped gid and openpty()
will fail within containers.
Linux kernel commit 23adbe12
("fs,userns: Change inode_capable to capable_wrt_inode_uidgid")
uncovered that issue.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agodocs: fix missing forward slash
Jianwei Hu [Thu, 14 Aug 2014 10:17:41 +0000 (18:17 +0800)]
docs: fix missing forward slash

   Should like below:
    <interface type='server'>
      <mac address='52:54:00:22:c9:42'/>
      <source address='192.168.0.1' port='5558'/>
    </interface>
    ...
    <interface type='client'>
      <mac address='52:54:00:8b:c9:51'/>
      <source address='192.168.0.1' port='5558'/>
    </interface>

10 years agoqemu: Tidy up job handling during live migration
Sam Bobroff [Tue, 12 Aug 2014 02:54:42 +0000 (12:54 +1000)]
qemu: Tidy up job handling during live migration

During a QEMU live migration several warning messages about job
handling could be written to syslog on the destination host:

"entering monitor without asking for a nested job is dangerous"

The messages are written because the job handling during migration
uses hard coded asyncJob values in several places that are incorrect.

This patch passes the required asyncJob value around and prevents
the warnings as well as any issues that the warnings may be referring
to.

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

Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agobuild: force configure failed when perl is missing
Jincheng Miao [Thu, 14 Aug 2014 03:37:45 +0000 (11:37 +0800)]
build: force configure failed when perl is missing

Perl is necessary to our build processing, it will invoke a lot of
generating script, like: gendispatch.pl. If perl is missing, it's
ok for build from git checkout, because autogen.sh will tell you.
But for compiling from a release tarball, configure will just record
a missing message, and continue, then build failed, like:
https://www.redhat.com/archives/libvirt-users/2014-August/msg00050.html

So need to enhance configure script to handle this negative case.

Reported-by: Hongbin Lu <hongbin@savinetwork.ca>
Signed-off-by: Jincheng Miao <jmiao@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoconf: fix parsing 'cmd_per_lun' and 'max_sectors'
Mo yuxiang [Thu, 14 Aug 2014 07:55:34 +0000 (15:55 +0800)]
conf: fix parsing 'cmd_per_lun' and 'max_sectors'

commit d9504941 introduces two new attributes "cmd_per_lun" and
"max_sectors" same with the names QEMU uses for virtio-scsi.
But the case of parsing them is not exact. Change to parse
them if controller has "driver" element.

Signed-off-by: Mo yuxiang <moyuxiang@huawei.com>
10 years agoLXC: resolve issues in lxcDomainSetMaxMemory
Chen Hanxiao [Thu, 31 Jul 2014 03:41:10 +0000 (11:41 +0800)]
LXC: resolve issues in lxcDomainSetMaxMemory

This patch changes the setmaxmem function to support the '--live',
'--config', and '--current' flags by revectoring the code through
the setmem function using the VIR_DOMAIN_MEM_MAXIMUM flag. The
setmem code is refactored to handle both cases depending on the flag.

The changed maxmem code for the MEM_MAXIMUM path will not allow
modification to the memory values of an active guest unless the --config
switch is used.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
10 years agodaemon: Limit default log level to journald to VIR_LOG_INFO
Peter Krempa [Tue, 12 Aug 2014 14:10:39 +0000 (16:10 +0200)]
daemon: Limit default log level to journald to VIR_LOG_INFO

Libvirt is really chatty when the DEBUG log level is enabled. When a
host uses journald we'd enable debug logging to journald when only
specifying the debug log level. As journald may employ rate throttling
this would lock up the daemon until it's able to flush all debug
messages.

This patch changes the default log level to VIR_LOG_INFO when using the
default (unconfigured) log output to journald.

To still allow debug logging to journald the user now has to explicitly
specify journald as a log output with priority 1 in the "log_outputs"
configuration option. This patch also changes the config file template
to be explicit about this change and notify the user about the possible
consequence of debug logging into journald.

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

10 years agolibvirtd: conf: Mention support for logging into journald
Peter Krempa [Tue, 12 Aug 2014 14:05:36 +0000 (16:05 +0200)]
libvirtd: conf: Mention support for logging into journald

Our docs didn't mention the explicit option to log into journald.

10 years agomaint: improve syntax check for space around =
Eric Blake [Mon, 11 Aug 2014 23:04:19 +0000 (17:04 -0600)]
maint: improve syntax check for space around =

Laine Stump noted on IRC that syntax check wasn't flagging his
typo of 'i= 0'.  This fixes it.

* build-aux/bracket-spacing.pl: Tighten 'space around =' rule.
* src/storage/storage_backend.c
(virStorageBackendCreateExecCommand): Fix offenders.
* src/util/virnuma.c (virNumaGetDistances): Likewise.
* src/vbox/vbox_tmpl.c (vboxDomainSnapshotDeleteMetadataOnly)
(vboxNetworkGetXMLDesc): Likewise.
* src/xenapi/xenapi_driver.c (xenapiDomainLookupByName):
Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agobhyve: fix error message in bhyveStateInitialize
Dmitry Guryanov [Tue, 12 Aug 2014 15:46:18 +0000 (19:46 +0400)]
bhyve: fix error message in bhyveStateInitialize

If we failed to create BHYVE_STATE_DIR, we should show this
path, not BHYVE_LOG_DIR.

10 years agoqemu_conf: Undefine the correct symbol
Michal Privoznik [Tue, 12 Aug 2014 15:39:52 +0000 (17:39 +0200)]
qemu_conf: Undefine the correct symbol

At the beginning of the qemu config file parsing function there
are 3 helper macros defined: GET_VALUE_BOOL, GET_VALUE_LONG and
GET_VALUE_STR. Later, when they are no longer needed they are
undefined in order to keep the namespace clean. However, the
GET_VALUE_STRING is undefined instead of GET_VALUE_STR.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agostorage: ZFS support
Roman Bogorodskiy [Mon, 21 Jul 2014 14:38:42 +0000 (18:38 +0400)]
storage: ZFS support

Implement ZFS storage backend driver. Currently supported
only on FreeBSD because of ZFS limitations on Linux.

Features supported:

 - pool-start, pool-stop
 - pool-info
 - vol-list
 - vol-create / vol-delete

Pool definition looks like that:

 <pool type='zfs'>
  <name>myzfspool</name>
  <source>
    <name>actualpoolname</name>
  </source>
 </pool>

The 'actualpoolname' value is a name of the pool on the system,
such as shown by 'zpool list' command. Target makes no sense
here because volumes path is always /dev/zvol/$poolname/$volname.

User has to create a pool on his own, this driver doesn't
support pool creation currently.

A volume could be used with Qemu by adding an entry like this:

    <disk type='volume' device='disk'>
      <driver name='qemu' type='raw'/>
      <source pool='myzfspool' volume='vol5'/>
      <target dev='hdc' bus='ide'/>
    </disk>

10 years agoqemu: migration: Check domain live state after exitting the monitor
Peter Krempa [Tue, 12 Aug 2014 13:21:56 +0000 (15:21 +0200)]
qemu: migration: Check domain live state after exitting the monitor

In qemuMigrationToFile we enter the monitor multiple times and don't
check if the VM is still alive after returning form the monitor. Add the
checks to skip pieces of code in case the VM crashes while saving it's
state.

10 years agoqemu: managedsave: Check that VM is alive after entering async job
Peter Krempa [Tue, 12 Aug 2014 12:31:26 +0000 (14:31 +0200)]
qemu: managedsave: Check that VM is alive after entering async job

Saving a shutoff VM doesn't make sense and libvirtd crashes while
attempting to do that. Check that the domain is alive after entering
the save async job.

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

10 years agoqemu: process: Fix header format of qemuProcessSetVcpuAffinities
Peter Krempa [Tue, 12 Aug 2014 15:24:34 +0000 (17:24 +0200)]
qemu: process: Fix header format of qemuProcessSetVcpuAffinities

Fix header alignment and remove the unused conn parameter.

10 years agonumatune: Fix parsing of empty nodeset (0,^0)
Erik Skultety [Mon, 11 Aug 2014 14:06:23 +0000 (16:06 +0200)]
numatune: Fix parsing of empty nodeset (0,^0)

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

10 years agoconf: Format interface's driver more frequently
Michal Privoznik [Mon, 11 Aug 2014 12:51:49 +0000 (14:51 +0200)]
conf: Format interface's driver more frequently

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

There's this <driver/> element under <interface/> which can have
several attributes. However, the driver element is currently formated
only if the driver's name or txmode has been specified. This makes
only a little sense as we parse even partial <driver/>, for instance:

    <interface type='user'>
      <mac address='52:54:00:e5:48:58'/>
      <model type='virtio'/>
      <driver ioeventfd='on' event_idx='on' queues='5'/>
    </interface>

But such XML would never get formatted back.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agodocs: use correct hints per bus type in <disk> examples
Eric Blake [Mon, 11 Aug 2014 21:42:45 +0000 (15:42 -0600)]
docs: use correct hints per bus type in <disk> examples

Commit 4cf53158 tried to set up unique labels per disk in the
example, but ended up choosing strings that don't correspond
to the usual choice of bus types.  Tweak the strings once again.

* docs/formatdomain.html.in: Use preferred names.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agonetwork: populate interface pool immediately when network is started
Laine Stump [Tue, 5 Aug 2014 21:15:31 +0000 (17:15 -0400)]
network: populate interface pool immediately when network is started

When a network is defined with "<pf dev='xyz'/>", libvirt will query
sysfs to learn the list of all virtual functions (VF) associated with
that Physical Function (PF) then populate the network's interface pool
accordingly. This action was previously done only when the first guest
actually requested an interface from the network. This patch changes
it to populate the pool immediately when the network is started. This
way any problems with the PF or its VFs will become apparent sooner.

Note that we can't remove the old calls to networkCreateInterfacePool
that happen whenever a guest requests an interface - doing so would be
asking for failures on hosts that had libvirt upgraded with a network
that had been started but not yet used.

This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1047818

10 years agonetwork: make networkCreateInterfacePool more robust
Laine Stump [Tue, 5 Aug 2014 20:40:52 +0000 (16:40 -0400)]
network: make networkCreateInterfacePool more robust

networkCreateInterfacePool was a bit loose in its error cleanup, which
could result in a network definition with interfaces in the pool that
were NULL. This would in turn lead to a libvirtd crash when a guest
tried to attach an interface using the network with that pool.

In particular this would happen when creating a pool to be used for
macvtap connections. macvtap needs the netdev name of the virtual
function in order to use it, and each VF only has a netdev name if it
is currently bound to a network driver. If one of the VFs of a PF
happened to be bound to the pci-stub or vfio-pci driver (indicating
it's already in use for PCI passthrough), or no driver at all, it
would have no name. In this case networkCreateInterfacePool would
return an error, but would leave the netdef->forward.nifs set to the
total number of VFs in the PF. The interface attach that triggered
calling of networkCreateInterfacePool (it uses a "lazy fill" strategy)
would simply fail, but the very next attempt to attach an interface
using the same network pool would result in a crash.

This patch refactors networkCreateInterfacePool to bring it more in
line with current coding practices (label name, use of a switch with
no default case) as well as providing the following two changes to
behavior:

1) If a VF with no netdev name is encountered, just log a warning and
continue; only fail if exactly 0 devices are found to put in the pool.

2) If the function fails, clean up any partial interface pool and set
netdef->forward.nifs to 0.

This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1111455

10 years agoMake 'uri' command a bit more prominent.
Guido Günther [Mon, 11 Aug 2014 20:02:13 +0000 (22:02 +0200)]
Make 'uri' command a bit more prominent.

This tries to address

    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=688778

were libvirt autodetected vbox:///session and it wasn't listed in the
manpage.

10 years agoDon't fail qemu driver intialization if we can't determine hugepage size
Guido Günther [Sun, 10 Aug 2014 10:42:37 +0000 (12:42 +0200)]
Don't fail qemu driver intialization if we can't determine hugepage size

Otherwise we fail like

  libvirt version: 1.2.7, package: 6 (root 2014-08-08-16:09:22 bogon)
  virAuditOpen:62 : Unable to initialize audit layer: Protocol not supported
  virFileGetDefaultHugepageSize:2958 : internal error: Unable to parse /proc/meminfo
  virStateInitialize:749 : Initialization of QEMU state driver failed: internal error: Unable to parse /proc/meminfo
  daemonRunStateInit:922 : Driver state initialization failed

if the data can't be determined.

Reference: http://bugs.debian.org/757609

10 years agoInclude param.h in case of HAVE_BSD_CPU_AFFINITY
Guido Günther [Tue, 8 Apr 2014 21:14:25 +0000 (23:14 +0200)]
Include param.h in case of HAVE_BSD_CPU_AFFINITY

This fixes compilation on kFreeBSD which otherwise fails like

  CC       util/libvirt_util_la-virprocess.lo
In file included from /usr/include/sys/cpuset.h:35:0,
                 from util/virprocess.c:43:
/usr/include/sys/_cpuset.h:49:43: error: 'NBBY' undeclared here (not in
a function)
  long __bits[howmany(CPU_SETSIZE, _NCPUBITS)];
                                           ^
In file included from util/virprocess.c:43:0:
/usr/include/sys/cpuset.h:215:12: error: unknown type name 'cpusetid_t'
 int cpuset(cpusetid_t *);
            ^
/usr/include/sys/cpuset.h:216:30: error: expected ')' before 'id_t'
 int cpuset_setid(cpuwhich_t, id_t, cpusetid_t);
                              ^
/usr/include/sys/cpuset.h:217:42: error: expected ')' before 'id_t'
 int cpuset_getid(cpulevel_t, cpuwhich_t, id_t, cpusetid_t *);
                                          ^
/usr/include/sys/cpuset.h:218:48: error: expected ')' before 'id_t'
 int cpuset_getaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, cpuset_t
*);
                                                ^
/usr/include/sys/cpuset.h:219:48: error: expected ')' before 'id_t'
 int cpuset_setaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, const
cpuset_t *);

And it's the correct usage as documented in

  http://www.freebsd.org/cgi/man.cgi?query=cpuset_setid

Also change the #ifdef HAVE_BSH_CPU_AFFINITY to #if for consistency.

10 years agoqemu: use guest-fsfreeze-freeze-list command if mountpoints to freeze specified
Tomoki Sekiyama [Fri, 8 Aug 2014 20:03:41 +0000 (16:03 -0400)]
qemu: use guest-fsfreeze-freeze-list command if mountpoints to freeze specified

A command to freeze a part of mounted file systems is implemented in
upstream QEMU-guest-agent with a name of 'guest-fsfreeze-freeze-list'.
This fixes the name of the command used to partial fsfreeze in qemu driver
when 'mountpoints' option is specified to virDomainFSFreeze API.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
10 years agoqemu: Actually clear bandwidth settings
Jianwei Hu [Mon, 11 Aug 2014 06:41:33 +0000 (14:41 +0800)]
qemu: Actually clear bandwidth settings

The virDomainSetInterfaceParameters implementation in qemu over
VIR_DOMAIN_AFFECT_CONFIG doesn't work as expected. When trying to
clear out the bandwidth settings for an interface, it has no
actual effect:

    virsh # domiftune --config $domain $interface
    inbound.average: 100
    inbound.peak   : 0
    inbound.burst  : 0
    outbound.average: 10
    outbound.peak  : 0
    outbound.burst : 0

    virsh domiftune --config $domain $interface 0 0

    virsh # domiftune --config $domain $interface
    inbound.average: 100
    inbound.peak   : 0
    inbound.burst  : 0
    outbound.average: 10
    outbound.peak  : 0
    outbound.burst : 0

But according to virsh man page:

    To clear inbound or outbound settings, use --inbound or
    --outbound respectfully with average value of zero.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agosrc/xenxs: Refactor code parsing OS config
Kiarie Kahurani [Thu, 7 Aug 2014 18:33:01 +0000 (21:33 +0300)]
src/xenxs: Refactor code parsing OS config

introduce function
  xenParseXMOS(virConfPtr conf,...........);
which parses the OS config instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
10 years agosrc/xenxs: Refactor code parsing general config
Kiarie Kahurani [Thu, 7 Aug 2014 18:33:00 +0000 (21:33 +0300)]
src/xenxs: Refactor code parsing general config

introduce function
   xenParseXMGeneralMeta(virConfPtr conf, .......);
which parses general metadata instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
10 years agosrc/xenxs: Refactor code parsing emulated hardware config
Kiarie Kahurani [Thu, 7 Aug 2014 18:32:59 +0000 (21:32 +0300)]
src/xenxs: Refactor code parsing emulated hardware config

introduce function
   xenParseXMEmulatedHardware(virConfPtr conf,.........);
which parses emulated devices config instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
10 years agosrc/xenxs: Refactor code parsing Vif config
Kiarie Kahurani [Thu, 7 Aug 2014 18:32:58 +0000 (21:32 +0300)]
src/xenxs: Refactor code parsing Vif config

introduce function
  xenParseXMVif(virConfPtr conf,........);
which parses Vfb config instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
10 years agosrc/xenxs: Refactor code parsing Char devices config
Kiarie Kahurani [Thu, 7 Aug 2014 18:32:57 +0000 (21:32 +0300)]
src/xenxs: Refactor code parsing Char devices config

introduce function
  xenParseXMCharDev(virConfPtr conf,.........);
which parses Char devices config instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
10 years agosrc/xenxs: Refactor code parsing Vfb config
Kiarie Kahurani [Thu, 7 Aug 2014 18:32:56 +0000 (21:32 +0300)]
src/xenxs: Refactor code parsing Vfb config

introduce function
 xenParseXMVfb(virConfPtr conf,..........);
which parses Vfb config instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
10 years agosrc/xenxs: Refactor code parsing xm disk config
Kiarie Kahurani [Thu, 7 Aug 2014 18:32:55 +0000 (21:32 +0300)]
src/xenxs: Refactor code parsing xm disk config

introduce function
  xenParseXMDisk(virConfPtr conf, ........);
which parses xm disk config instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
10 years agosrc/xenxs: Refactor code parsing CPU features
Kiarie Kahurani [Thu, 7 Aug 2014 18:32:54 +0000 (21:32 +0300)]
src/xenxs: Refactor code parsing CPU features

introduce function
  xenParseXMCPUFeatures(virConfPtr conf,.........);
which parses CPU features instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
10 years agosrc/xenxs: Refactor code parsing PCI config
Kiarie Kahurani [Thu, 7 Aug 2014 18:32:53 +0000 (21:32 +0300)]
src/xenxs: Refactor code parsing PCI config

introduce function
   xenParseXMPCI(virConfPtr conf, ........);
which parses PCI config instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
10 years agosrc/xenxs: Refactor code parsing event actions
Kiarie Kahurani [Thu, 7 Aug 2014 18:32:52 +0000 (21:32 +0300)]
src/xenxs: Refactor code parsing event actions

introduce function
  xenParseXMEventActions(virConfPtr conf,........)
which parses events leading to certain actions

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
10 years agosrc/xenxs: Refactor code parsing virtual time config
Kiarie Kahurani [Thu, 7 Aug 2014 18:32:51 +0000 (21:32 +0300)]
src/xenxs: Refactor code parsing virtual time config

introduce function
    xenParseXMTimeOffset(virConfPtr conf,.......);
which parses time offset config instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
10 years agosrc/xenxs: Refactor code parsing memory config
Kiarie Kahurani [Thu, 7 Aug 2014 18:32:50 +0000 (21:32 +0300)]
src/xenxs: Refactor code parsing memory config

introduce function
  xenParseXMMem(virConfPtr conf,.........);
which parses memory config instead

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
10 years agoconf: Add USB sound card support and implement it for qemu
Peter Krempa [Thu, 24 Jul 2014 15:32:31 +0000 (17:32 +0200)]
conf: Add USB sound card support and implement it for qemu

10 years agoqemu: Remove extraneous space in function prototypes
John Ferlan [Thu, 24 Jul 2014 13:23:40 +0000 (09:23 -0400)]
qemu: Remove extraneous space in function prototypes

During review of the iSCSI hostdev series, eblake noted that the
prototypes shouldn't have the extranenous space between the "*" and
the function name:

http://www.redhat.com/archives/libvir-list/2014-July/msg01227.html

Since it was more invasive than 1 or 2 lines - I said I'd send a
patch covering this once committed.

Signed-off-by: John Ferlan <jferlan@redhat.com>
10 years agohostdev: Add iSCSI hostdev XML
John Ferlan [Wed, 9 Jul 2014 14:08:34 +0000 (10:08 -0400)]
hostdev: Add iSCSI hostdev XML

Introduce a new structure to handle an iSCSI host device based on the
existing virDomainHostdevSubsysSCSI by adding a "protocol='iscsi'" to
the <source/> element. The existing scsi_host subsystem RNG was modified
to read an optional "protocol='adapter'", although it won't be written
out nor is it documented as an option (by choice).

The new hostdev structure mimics the existing <disk/> element for an
iSCSI device (network) device. New XML is:

  <hostdev mode='subsystem' type='scsi' managed='yes'>
    <source protocol='iscsi' name='iqn.1992-01.com.example'>
      <host name='example.org' port='3260'/>
      <auth username='myname'>
        <secret type='iscsi' usage='mycluster_myname'/>
      </auth>
    </source>
    <address type='drive' controller='0' bus='0' target='2' unit='5'/>
  </hostdev>

The controller element will mimic the existing scsi_host code insomuch
as when 'lsi' and 'virtio-scsi' are used.

10 years agodomain_conf: Common routine to handle network storage host xml def
John Ferlan [Thu, 10 Jul 2014 13:11:30 +0000 (09:11 -0400)]
domain_conf: Common routine to handle network storage host xml def

In preparation for hostdev support for iSCSI and a virStorageNetHostDefPtr,
split out the network disk storage parsing of the 'host' element into a
separate routine.

10 years agoblockjob: fix use-after-free in blockcopy
Eric Blake [Wed, 6 Aug 2014 20:06:23 +0000 (14:06 -0600)]
blockjob: fix use-after-free in blockcopy

Commit febf84c2 tried to delay in-memory modification of the actual
domain disk structure until after the qemu event was received.
However, I missed that the code for block pivot had been temporarily
setting disk->src = disk->mirror prior to the qemu command, in order
to label the backing chain of a reused external blockcopy disk;
and calls into qemu while still in that state before finally undoing
things at the cleanup label.  Since the qemu event handler then does:
 virStorageSourceFree(disk->src);
 disk->src = disk->mirror;
we have the sad race that a fast enough qemu event can cause a leak of
the original disk->src, as well as a use-after-free of the disk->mirror
contents, bad enough to crash libvirtd in some of my test runs, even
though the common case of the qemu event being much later won't trip
the race.

I'll go wear the brown paper bag of shame, for introducing a crasher
in between rc1 and rc2 of the freeze for 1.2.7 :(  My only
consolation is that virDomainBlockJobAbort requires the domain:write
ACL, so it is not a CVE.

The valgrind report when the race occurs looks like:

==25612== Invalid read of size 4
==25612==    at 0x50E7C90: virStorageSourceGetActualType (virstoragefile.c:1948)
==25612==    by 0x209C0B18: qemuDomainDetermineDiskChain (qemu_domain.c:2473)
==25612==    by 0x209D7F6A: qemuProcessHandleBlockJob (qemu_process.c:1087)
==25612==    by 0x209F40C9: qemuMonitorEmitBlockJob (qemu_monitor.c:1357)
...
==25612==  Address 0xe4b5610 is 0 bytes inside a block of size 200 free'd
==25612==    at 0x4A07577: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==25612==    by 0x50839E9: virFree (viralloc.c:582)
==25612==    by 0x50E7E51: virStorageSourceFree (virstoragefile.c:2015)
==25612==    by 0x209D7EFF: qemuProcessHandleBlockJob (qemu_process.c:1073)
==25612==    by 0x209F40C9: qemuMonitorEmitBlockJob (qemu_monitor.c:1357)

* src/qemu/qemu_driver.c (qemuDomainBlockPivot): Don't corrupt
disk->src, and only label chain for blockcopy.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoblockjob: avoid memory leak during block pivot
Eric Blake [Wed, 6 Aug 2014 20:48:59 +0000 (14:48 -0600)]
blockjob: avoid memory leak during block pivot

Valgrind caught a memory leak:

==2018== 9 bytes in 1 blocks are definitely lost in loss record 143 of 927
==2018==    at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==2018==    by 0x8C42369: strdup (strdup.c:42)
==2018==    by 0x50EACC9: virStrdup (virstring.c:676)
==2018==    by 0x50E79E5: virStorageSourceCopy (virstoragefile.c:1845)
==2018==    by 0x20A3FAA7: qemuDomainBlockCommit (qemu_driver.c:15620)
==2018==    by 0x51DC6B2: virDomainBlockCommit (libvirt.c:20092)

I traced it to the fact that blockcopy and blockcommit end up
reparsing a backing chain on pivot, but the chain parsing code
doesn't gracefully handle the case where the backing file is
already known.

I'm not exactly sure when this was introduced, but suspect that the
refactoring in commit 9944b71 and friends that moved towards probing
in-place rather than into a temporary structure are part of the cause.

* src/util/virstoragefile.c (virStorageFileGetMetadataInternal):
Don't leak any prior value.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agodocs: use unique dev names in <disk> examples
Eric Blake [Thu, 7 Aug 2014 14:35:53 +0000 (08:35 -0600)]
docs: use unique dev names in <disk> examples

Jiri Moskovcak reported on IRC that the documentation on valid
<disk> was confusing because it didn't have unique dev='...'
entries.

* docs/formatdomain.html.in: Use unique names.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agovirsh: clean up attach-interface paragraph in man page
Laine Stump [Thu, 7 Aug 2014 14:50:21 +0000 (10:50 -0400)]
virsh: clean up attach-interface paragraph in man page

This makes the paragaph about attach-interface more descriptive and
correct, adding in a few bits of information that were previously
missing, e.g. --script is only allowed for bridge interfaces of Xen
domains, target name is regenerated if it starts with vnet, mac
address will be autogenerated if not specified.

(I did this in response to an email asking why a script couldn't be
specified for a bridge interface of a qemu domain, and why an
interface of type='ethernet' couldn't be created with
attach-interface)

10 years agodaemon: Fix indentation in libvirtd.c
Wang Rui [Tue, 29 Jul 2014 08:47:13 +0000 (16:47 +0800)]
daemon: Fix indentation in libvirtd.c

Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
10 years agoaudit: Fix some comments
Wang Rui [Thu, 7 Aug 2014 08:12:58 +0000 (16:12 +0800)]
audit: Fix some comments

Fix a comment in virDomainAuditNetDevice.
Fix a typo in comment of qemuPhysIfaceConnect which is
the caller of virDomainAuditNetDevice.

Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
10 years agosnapshot: conf: Enforce absolute paths on disk and memory images
Peter Krempa [Wed, 6 Aug 2014 13:17:00 +0000 (15:17 +0200)]
snapshot: conf: Enforce absolute paths on disk and memory images

RNG schema as well as the qemu driver requires absolute paths for memory
and disk snapshot image files but the XML parser was not enforcing it.
Add checks to avoid problems in qemu where the configuration it creates
is invalid.

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

10 years agoqemu: Make virFileFindHugeTLBFS fault tolerant
Michal Privoznik [Wed, 6 Aug 2014 08:37:48 +0000 (10:37 +0200)]
qemu: Make virFileFindHugeTLBFS fault tolerant

Since commit be0782e1 we are parsing /proc/meminfo to find out the
default huge page size. However, if the host we are running at does
not support any huge pages (e.g. CONFIG_HUGETLB_PAGE is turned off),
we will not successfully parse the meminfo file and hence the whole
qemu driver init process fails. Moreover, the default huge page size
is needed if and only if there's at least one hugetlbfs mount point.
So the fix consists of moving the virFileGetDefaultHugepageSize
function call after the first hugetlbfs mount point is found.

With this fix, we fail to start with one or more hugetlbfs mounts and
malformed meminfo file, but that's expected (how can one mount
hugetlbfs without kernel supporting huge pages?). Workaround in that
case is to umount all the hugetlbfs mounts.

Reported-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoNode Devices: Fix nodedev-list for fc_host & vports.
Prerna Saxena [Wed, 6 Aug 2014 10:20:11 +0000 (15:50 +0530)]
Node Devices: Fix nodedev-list for fc_host & vports.

In a system with Fiber Channel Host Adapters, a query to list all Fibre Channel
HBAs OR Vports currently returns empty list:
  $ virsh nodedev-list --cap fc_host

  $

Libvirt correctly discovers properties for all HBAs. However, the reporting
fails because of incorrect flag comparison while filtering these types.

This is fixed by removing references to 'VIR_CONNECT_LIST_NODE_DEVICES_CAP_*'
for comparison and replacing those with 'VIR_NODE_DEV_CAP_*'

Introduced by original commit id '652a2ec6'

Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
10 years agoqemu: reword caps-related error
Martin Kletzander [Tue, 5 Aug 2014 09:02:34 +0000 (11:02 +0200)]
qemu: reword caps-related error

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoblockjob: correctly report active commit for job info
Eric Blake [Tue, 5 Aug 2014 14:49:32 +0000 (08:49 -0600)]
blockjob: correctly report active commit for job info

Commit 232a31b munged job info to report 'active commit' instead of
'commit' when generating events, but forgot to also munge the polling
variant of the command.

* src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Adjust type as
needed.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoFix vlanid attribute name in nwfilter docs
Jianwei Hu [Tue, 5 Aug 2014 05:25:16 +0000 (13:25 +0800)]
Fix vlanid attribute name in nwfilter docs

'vlanid' is the attribute name in our XML,
'vlan-id' is the ebtables attribute:

[root@localhost ~]# virsh nwfilter-dumpxml myself
<filter name='myself' chain='root'>
  <uuid>7192ef51-cd50-4f14-ad7b-fa5c69ea19e3</uuid>
  <rule action='accept' direction='in' priority='500'>
    <vlan dstmacaddr='00:11:22:33:44:55' vlanid='44'/>
  </rule>
</filter>

[root@localhost ~]# ebtables -t nat -L
Bridge table: nat

...
-p 802_1Q -d 0:11:22:33:44:55 --vlan-id 44 -j ACCEPT

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agoDon't overwrite errors from virNetDevBandwidthSet
Ján Tomko [Mon, 28 Jul 2014 12:46:46 +0000 (14:46 +0200)]
Don't overwrite errors from virNetDevBandwidthSet

Otherwise this beautiful error would be overwritten when
the function is called with a really high rate number:

2014-07-28 12:51:47.920+0000: 2304: error : virCommandWait:2399 :
internal error: Child process (/sbin/tc class add dev vnet0 parent 1:
classid 1:1 htb rate 4294968kbps) unexpected exit status 1: Illegal "rate"
Usage: ... qdisc add ... htb [default N] [r2q N]
 default  minor id of class to which unclassified packets are sent {0}
 r2q      DRR quantums are computed as rate in Bps/r2q {10}
 debug    string of 16 numbers each 0-3 {0}

... class add ... htb rate R1 [burst B1] [mpu B] [overhead O]
                      [prio P] [slot S] [pslot PS]
                      [ceil R2] [cburst B2] [mtu MTU] [quantum Q]
 rate     rate allocated to this class (class can still borrow)
 burst    max bytes burst which can be accumulated during idle period {computed}
 mpu      minimum packet size used in rate computations
 overhead per-packet size overhead used in rate computations
 linklay  adapting to a linklayer e.g. atm
 ceil     definite upper class rate (no borrows) {rate}
 cburst   burst but for ceil {computed}
 mtu      max packet size we create rate map for {1600}
 prio     priority of leaf; lowe

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

10 years agovirsh: check if domiftune parameters fit into UINT
Ján Tomko [Thu, 26 Jun 2014 08:06:57 +0000 (10:06 +0200)]
virsh: check if domiftune parameters fit into UINT

We parse the bandwidth rates as unsinged long long,
then try to fit them in VIR_TYPED_PARAM_UINT.

Report an error if they exceed UINT_MAX instead of
quietly using wrong values.

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

10 years agostorage: Refresh storage pool after upload
John Ferlan [Mon, 28 Jul 2014 12:39:09 +0000 (08:39 -0400)]
storage: Refresh storage pool after upload

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

Upon successful upload of a volume, the target volume and storage pool
were not updated to reflect any changes as a result of the upload. Make
use of the existing stream close callback mechanism to force a backend
pool refresh to occur in a separate thread once the stream closes. The
separate thread should avoid potential deadlocks if the refresh needed
to wait on some event from the event loop which is used to perform
the stream callback.

10 years agoPost-release version bump for new dev cycle
Eric Blake [Wed, 2 Jul 2014 06:16:13 +0000 (08:16 +0200)]
Post-release version bump for new dev cycle

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agodomtop: Remove unused variable
Michal Privoznik [Mon, 4 Aug 2014 12:40:52 +0000 (14:40 +0200)]
domtop: Remove unused variable

The variable 'k' in the print_cpu_usage function is not used anywhere
and can fire a warning on some compilers.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agodomtop: Turn parse_argv into void
Michal Privoznik [Mon, 4 Aug 2014 12:37:14 +0000 (14:37 +0200)]
domtop: Turn parse_argv into void

Currently, the function follows the usual pattern used in our code:

  int ret = -1;
  ...
  ret = 0;
 cleanup:
  return ret;

However, the function always call exit() on error, so the cleanup
label is never jumped onto. Therefore, it doesn't make any sense to
have the parse_argv function return an integer value, if it
effectively can return only value of zero.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoqemu: fix comment in qemu.conf
Martin Kletzander [Thu, 31 Jul 2014 17:28:09 +0000 (19:28 +0200)]
qemu: fix comment in qemu.conf

There are multiple mount points after commit 725a211f, but one comment
wasn't changed to use plurals.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoRelease of libvirt-1.2.7
Daniel Veillard [Sun, 3 Aug 2014 12:55:15 +0000 (08:55 -0400)]
Release of libvirt-1.2.7

* docs/news.html.in libvirt.spec.in: update for the release
* po/*.po*: update localizations and regenerate

10 years agobuild: fix build on cygwin
Eric Blake [Sun, 3 Aug 2014 02:47:36 +0000 (20:47 -0600)]
build: fix build on cygwin

Cygwin has getifaddrs(), but not AF_LINK, leading to:

util/virstats.c: In function 'virNetInterfaceStats':
util/virstats.c:138:41: error: 'AF_LINK' undeclared (first use in this function)
         if (ifa->ifa_addr->sa_family != AF_LINK)
...

* src/util/virstats.c (virNetInterfaceStats): Only use getifaddrs
if AF_LINK is present.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agonetwork: always set disable_ipv6, even when it should be 0
Laine Stump [Fri, 1 Aug 2014 21:51:37 +0000 (17:51 -0400)]
network: always set disable_ipv6, even when it should be 0

libvirt previously only touched an interface's disable_ipv6 setting in
sysfs if it needed to be set to 1, assuming that 0 is the
default. Apparently that isn't always the case though (kernel 3.15.7-1
in Arch Linux reportedly defaults a new interface's disable_ipv6
setting to 1) so this patch explicitly sets it to 0 or 1 as
appropriate.

10 years agoFix a crash when cloning a volume with no backing store
Ján Tomko [Fri, 1 Aug 2014 13:24:20 +0000 (15:24 +0200)]
Fix a crash when cloning a volume with no backing store

Introduced by commit 15213d1, not yet released.

10 years agodocs: bhyve: document recent changes
Roman Bogorodskiy [Thu, 24 Jul 2014 15:52:11 +0000 (19:52 +0400)]
docs: bhyve: document recent changes

 - mention that one disk and one network limitation
   is no longer current for 1.2.6 and newer
 - add 'cdrom' device to the sample domain XML

10 years agoblockcommit: turn on active commit
Eric Blake [Wed, 18 Jun 2014 23:16:27 +0000 (17:16 -0600)]
blockcommit: turn on active commit

With this in place, I can (finally!) now do:

virsh blockcommit $dom vda --shallow --verbose --pivot

and watch qemu shorten the backing chain by one, followed by
libvirt automatically updating the dumpxml output, effectively
undoing the work of virsh snapshot-commit --no-metadata --disk-only.
Commit is SOOOO much faster than blockpull, when I'm still fairly
close in time to when the temporary qcow2 wrapper file was created
via a snapshot operation!

* src/qemu/qemu_driver.c (qemuDomainBlockCommit): Implement live
commit.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoblockcommit: track job type in xml
Eric Blake [Tue, 29 Jul 2014 03:46:44 +0000 (21:46 -0600)]
blockcommit: track job type in xml

A future patch is going to wire up qemu active block commit jobs;
but as they have similar events and are canceled/pivoted in the
same way as block copy jobs, it is easiest to track all bookkeeping
for the commit job by reusing the <mirror> element.  This patch
adds domain XML to track which job was responsible for creating a
mirroring situation, and adds a job='copy' attribute to all
existing uses of <mirror>.  Along the way, it also massages the
qemu monitor backend to read the new field in order to generate
the correct type of libvirt job (even though it requires a
future patch to actually cause a qemu event that can be reported
as an active commit).  It also prepares to update persistent XML
to match changes made to live XML when a copy completes.

* docs/schemas/domaincommon.rng: Enhance schema.
* docs/formatdomain.html.in: Document it.
* src/conf/domain_conf.h (_virDomainDiskDef): Add a field.
* src/conf/domain_conf.c (virDomainBlockJobType): String conversion.
(virDomainDiskDefParseXML): Parse job type.
(virDomainDiskDefFormat): Output job type.
* src/qemu/qemu_process.c (qemuProcessHandleBlockJob): Distinguish
active from regular commit.
* src/qemu/qemu_driver.c (qemuDomainBlockCopy): Set job type.
(qemuDomainBlockPivot, qemuDomainBlockJobImpl): Clean up job type
on completion.
* tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml:
Update tests.
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: Likewise.
* tests/qemuxml2argvdata/qemuxml2argv-disk-active-commit.xml: New
file.
* tests/qemuxml2xmltest.c (mymain): Drive new test.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoDomain config: write <features/> if some capabilities are set.
Cédric Bosdonnat [Wed, 30 Jul 2014 09:20:59 +0000 (11:20 +0200)]
Domain config: write <features/> if some capabilities are set.

If all features are set to default (including the capabilities policy),
but some capabilities are toggled, we need to output the <features>
element when formatting the config.

10 years agodocs: fix an incorrect example for memoryBacking
Chen Hanxiao [Wed, 30 Jul 2014 03:03:15 +0000 (11:03 +0800)]
docs: fix an incorrect example for memoryBacking

commit 136ad49740f017aabcac48d02d2df6ab7b0195e9
forgot to add an end-tags for hugepages.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
10 years agoblockjob: properly track blockcopy xml changes on disk
Eric Blake [Tue, 29 Jul 2014 20:42:45 +0000 (14:42 -0600)]
blockjob: properly track blockcopy xml changes on disk

We were not directly saving the domain XML to file after starting
or finishing a blockcopy.  Without the startup write, a libvirtd
restart in the middle of a copy job would forget that the job was
underway.  Then at pivot, we were indirectly writing new XML in
reaction to events that occur as we stop and restart the guest CPUs.
But there was a race: since pivot is an async action, it is possible
that libvirtd is restarted before the pivot completes, so if XML
changes during the event, that change was not written.  The original
blockcopy code cleared out the <mirror> element prior to restarting
the CPUs, but this is also a race, observed if a user does an async
pivot and a dumpxml before the event occurs.  Furthermore, this race
will interfere with active commit in a future patch, because that
code will rely on the <mirror> element at the time of the qemu event
to determine whether to inform the user of a normal commit or an
active commit.

Fix things by saving state any time we modify live XML, while
delaying XML disk modifications until after the event completes.  We
still need a to teach libvirtd restarts to examine all existing
<mirror> elements to see if the job completed in the meantime (that
is, if libvirtd misses the event, the updated state still needs to be
updated in live XML), but that will be a later patch, in part because
we also need to to start taking advantage of newer qemu's ability to
keep the job around after completion rather than the current usage
where the job disappears both on error and on success.

* src/qemu/qemu_driver.c (qemuDomainBlockCopy): Track XML change
on disk.
(qemuDomainBlockJobImpl, qemuDomainBlockPivot): Move job-end XML
rewrites...
* src/qemu/qemu_process.c (qemuProcessHandleBlockJob): ...here.

Signed-off-by: Eric Blake <eblake@redhat.com>