Commit Graph

14444 Commits

Author SHA1 Message Date
Ján Tomko
f733eac058 virsh: free the list from ListAll APIs even for 0 items
virsh secret-list leak when no secrets are defined:

==27== 8 bytes in 1 blocks are definitely lost in loss record 6 of 726
==27==    by 0x4E941DD: virAllocN (viralloc.c:183)
==27==    by 0x5037F1A: remoteConnectListAllSecrets (remote_driver.c:3076)
==27==    by 0x5004EC6: virConnectListAllSecrets (libvirt.c:16298)
==27==    by 0x15F813: vshSecretListCollect (virsh-secret.c:397)
==27==    by 0x15F0E1: cmdSecretList (virsh-secret.c:532)

And so do some other *-list commands.

https://bugzilla.redhat.com/show_bug.cgi?id=1001536
2013-08-28 08:05:56 +02:00
Ján Tomko
66d124b454 virsh: free messages after logging them to a file
The messages were only freed on error.

==12== 1,100 bytes in 1 blocks are definitely lost in loss record 698 of 729
==12==    by 0x4E98C22: virBufferAsprintf (virbuffer.c:294)
==12==    by 0x12C950: vshOutputLogFile (virsh.c:2440)
==12==    by 0x12880B: vshError (virsh.c:2254)
==12==    by 0x131957: vshCommandOptDomainBy (virsh-domain.c:109)
==12==    by 0x14253E: cmdStart (virsh-domain.c:3333)

https://bugzilla.redhat.com/show_bug.cgi?id=1001536
2013-08-28 08:05:56 +02:00
Ján Tomko
2d9185a9f3 Test network update XML parsing
Add checks for updating sections of network definition via
virNetworkDefUpdateSection.

https://bugzilla.redhat.com/show_bug.cgi?id=989569
2013-08-28 08:05:46 +02:00
Ján Tomko
d8bd24a9ec Remove the space before the slash in network XML
This matches the style we use elsewhere and allows
nat-network-dns-srv-record{,-minimal}.xml to be tested in
network XML -> XML test.
2013-08-28 08:05:46 +02:00
Ján Tomko
63ee776f8c Build QEMU command line for pcihole64
QEMU commit 3984890 introduced the "pci-hole64-size" property,
to i440FX-pcihost and q35-pcihost with a default setting of 2 GB.

Translate <pcihole64>x<pcihole64/> to:
-global q35-pcihost.pci-hole64-size=x for q35 machines and
-global i440FX-pcihost.pci-hole64-size=x for i440FX-based machines.

Error out on other machine types or if the size was specified
but the pcihost device lacks 'pci-hole64-size' property.

https://bugzilla.redhat.com/show_bug.cgi?id=990418
2013-08-27 17:42:29 +02:00
Ján Tomko
01cda91809 Add pcihole64 element to root PCI controllers
<controller type='pci' index='0' model='pci-root'>
  <pcihole64 unit='KiB'>1048576</pcihole64>
</controller>

It can be used to adjust (or disable) the size of the 64-bit
PCI hole. The size attribute is in kilobytes (different unit
can be specified on input), but it gets rounded up to
the nearest GB by QEMU.

Disabling it will be needed for guests that crash with the
64-bit PCI hole (like Windows XP), see:
https://bugzilla.redhat.com/show_bug.cgi?id=990418
2013-08-27 17:42:29 +02:00
Ján Tomko
4582bc2e78 Allow controller XML parsing to use XPath context
virDomainParseScaledValue requires it.
2013-08-27 17:42:29 +02:00
Ján Tomko
87e3a05cba Move virDomainParseScaledValue earlier
Let virDomainControllerDefParseXML use it without
a forward declaration.
2013-08-27 17:42:29 +02:00
Aline Manera
796513d7cc Add ftp protocol support for cdrom disk
The ftp protocol is already recognized by qemu/KVM so add this support to
libvirt as well.
The xml should be as following:

     <disk type='network' device='cdrom'>
       <source protocol='ftp' name='/url/path'>
         <host name='host.name' port='21'/>
       </source>
     </disk>

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
2013-08-27 14:50:24 +02:00
Aline Manera
3485ce4e9d Add http protocol support for cdrom disk
QEMU/KVM already allows a HTTP URL for the cdrom ISO image so add this support
to libvirt as well.
The xml should be as following:

    <disk type='network' device='cdrom'>
      <source protocol='http' name='/url/path'>
        <host name='host.name' port='80'/>
      </source>
    </disk>

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
2013-08-27 14:50:24 +02:00
Ján Tomko
bab2eda6ad Always specify qcow2 compat level on qemu-img command line
qemu-img is going to switch the default for QCOW2
to QCOW2v3 (compat=1.1)

Extend the probing for qemu-img command line options to check
if -o compat is supported. If the volume definition specifies
the qcow2 format but no compat level and -o compat is supported,
specify -o compat=0.10 to create a QCOW2v2 image.

https://bugzilla.redhat.com/show_bug.cgi?id=997977
2013-08-27 12:45:58 +02:00
Guannan Ren
9eb444364e virsh: fix return value error of cpu-stats
virsh cpu-stats guest --start 0 --count 3
It outputs right but the return value is 1 rather than 0
echo $?
1

Found by running libvirt-autotest
./run -t libvirt --tests virsh_cpu_stats
2013-08-27 15:17:03 +08:00
Tomas Meszaros
a88924bc21 virsh: C99 style for info_domfstrim and opts_lxc_enter_namespace
Change info_domfstrim and opts_lxc_enter_namespace initialization style
to C99.
2013-08-26 10:23:16 -06:00
Michal Privoznik
a45ec678e9 qemuDomainAttachHostPciDevice: Fall back to mem balloon if there's no hard_limit
If there's no hard_limit set and domain uses VFIO we still must lock
the guest memory (prerequisite from qemu). Hence, we should compute
the amount to be locked from max_balloon.
2013-08-26 17:38:24 +02:00
Jiri Denemark
b02fd24f18 qemuhotplugtest: Add tests for virtio SCSI disk hotplug 2013-08-26 16:09:56 +02:00
Jiri Denemark
e191a3e699 qemuhotplugtest: Add tests for USB disk hotplug 2013-08-26 16:09:56 +02:00
Jiri Denemark
4aee8a70b8 qemuhotplugtest: Add tests for async virtio disk detach 2013-08-26 16:09:56 +02:00
Jiri Denemark
68d6f66e6e qemuhotplugtest: Add support for DEVICE_DELETED event 2013-08-26 16:09:55 +02:00
Jiri Denemark
419489e618 qemu: Let tests override waiting time for device unplug
We don't want tests to wait 5 seconds for an event which we know will
never come.
2013-08-26 16:09:55 +02:00
Jiri Denemark
b2f76cd20e qemu: Export qemuProcessHandleDeviceDeleted for tests 2013-08-26 16:09:55 +02:00
Jiri Denemark
201f01ab97 tests: Add support for passing driver to qemu monitor
The driver is then passed to monitor event handlers.
2013-08-26 16:09:55 +02:00
Jiri Denemark
a950b4f91d tests: Add support for passing vm to qemu monitor
Some tests need the monitor to operate on an already existing VM object
rather than on a new mock-up the monitor test normally creates.
2013-08-26 16:09:55 +02:00
Jiri Denemark
2074574821 qemuhotplugtest: Add tests for virtio disk hotplug 2013-08-26 16:09:55 +02:00
Jiri Denemark
2618dc2a45 qemuxml2argvtest: Add XML for testing device hotplug
This is a generic XML usable for hotplugging various types of devices.
2013-08-26 16:09:55 +02:00
Jiri Denemark
e06d12b345 qemuhotplugtest: Define QMP_OK for the most common reply 2013-08-26 16:09:55 +02:00
Jiri Denemark
ac5255f914 qemuhotplugtest: Compare domain XML after device hotplug
We need to make sure a device is properly added/removed (or not) to a
domain definition to check that a hotplug API did not lie to us.
2013-08-26 16:09:54 +02:00
Jiri Denemark
8d4189d504 qemuhotplugtest: Generate better output
Each test case label now contains more data useful to identify the test.
2013-08-26 16:09:54 +02:00
Jiri Denemark
4e6b05f5b6 qemu: Move qemuDomainDetachDeviceDiskLive to qemu_hotplug.c 2013-08-26 16:09:54 +02:00
Jiri Denemark
7a5d85f9b1 qemu: Move qemuDomainAttachDeviceDiskLive to qemu_hotplug.c 2013-08-26 16:09:54 +02:00
Jiri Denemark
809ee6bad4 qemu: Avoid using global qemu_driver in event handlers
We will have to pass a mock-up of the driver when testing monitor
events.
2013-08-26 16:09:54 +02:00
Jiri Denemark
6ac7cc8edc qemu: Typedef monitor callbacks
Otherwise defining variables that hold callbacks pointers is ugly and
several places have to be changed when new parameters are added.
2013-08-26 16:09:54 +02:00
Ján Tomko
784cca89c5 Don't free NULL network in cmdNetworkUpdate
If the network has not been found, virNetworkFree(NULL)
was called, resulting in an extra error:
error: invalid network pointer in virNetworkFree

https://bugzilla.redhat.com/show_bug.cgi?id=1001094
2013-08-26 15:51:15 +02:00
Jiri Denemark
8a38db0dd9 schema: Allow dots in device aliases
Commit 01b88127 changed aliases for PCI controller devices to "pcie.0" or
"pci.%u". Thus device aliases may now contain dots.
2013-08-26 15:26:49 +02:00
Peter Krempa
f17f164e3a qemu: Don't update count of vCPUs if hot-plug fails silently
When cpu hotplug fails without reporting an error, we would fail the
command but update the count of vCPUs anyways.

Commit 761fc48136 fixed the case when CPU
hot-unplug failed silently, but forgot to fix up the value in this case.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1000357
2013-08-26 14:47:19 +02:00
Eric Blake
48d6ae1fb6 tests: skip schema validation tests if xmllint is missing
On IRC, someone complained that a system without xmllint installed
failed a number of tests.

* tests/schematestutils.sh: Probe for xmllint.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-08-23 15:23:44 -06:00
Claudio Bley
8f3ead2da9 python: simplify complicated conditional assignment 2013-08-23 10:54:58 +02:00
Claudio Bley
2a40951148 Test for object identity when checking for None in Python
Consistently use "is" or "is not" to compare variables to None,
because doing so is preferrable, as per PEP 8
(http://www.python.org/dev/peps/pep-0008/#programming-recommendations):

> Comparisons to singletons like None should always be done with is or
> is not, never the equality operators.
2013-08-23 08:12:26 +02:00
Nehal J Wani
6e17210930 qemuagenttest.c: Missing documentation (Timeout)
In tests/qemuagenttest.c, the Timeout test should always be
called last. Any additional tests should come before this.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-08-22 13:51:26 -06:00
Guido Günther
57c8d8076f python: Use RELRO_LDFLAGS and NO_INDIRECT_LDFLAGS
A readonly GOT and detecting indirect linkage is useful here too.
2013-08-22 16:17:36 +02:00
Guido Günther
3e2799add2 Check for --no-copy-dt-needed linker flag
and use it when available
2013-08-22 16:17:36 +02:00
Guido Günther
d9527b6d56 Simplify RELRO_LDFLAGS
by adding it to AM_LDFLAGS instead of every linking rule and
by avoiding a forked grep.
2013-08-22 16:17:35 +02:00
Martin Kletzander
398de14734 tests: Add URI precedence checking
Commit a0b6a36f is fixing what commit abfff210 broke, so to avoid having
to deal with this issue again, herec comes "virsh-uriprecedence".
2013-08-22 15:03:38 +02:00
Daniel P. Berrange
b6b94374b3 Set security label on FD for virDomainOpenGraphics
The virDomainOpenGraphics method accepts a UNIX socket FD from
the client app. It must set the label on this FD otherwise QEMU
will be prevented from receiving it with recvmsg.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-08-22 13:35:44 +01:00
Michal Privoznik
4c2d0b29d7 qemuBuildNicDevStr: Add mq=on for multiqueue networking
If user requested multiqueue networking, beside multiple /dev/tap and
/dev/vhost-net openings, we forgot to pass mq=on onto the -device
virtio-net-pci command line. This is advised at:

  http://www.linux-kvm.org/page/Multiqueue#Enable_MQ_feature
2013-08-22 13:48:56 +02:00
John Ferlan
fc82f0adde docs: Reformat <disk> attribute description in formatdomain
Reformat the description to more cleanly delineate the attributes
for a <disk> element.
2013-08-22 07:17:19 -04:00
Peter Krempa
106a2ddaa7 virBitmapParse: Fix behavior in case of error and fix up callers
Re-arrange the code so that the returned bitmap is always initialized to
NULL even on early failures and return an error message as some callers
are already expecting it. Fix up the rest not to shadow the error.
2013-08-22 11:38:36 +02:00
Martin Kletzander
a0b6a36f94 Fix URI connect precedence
Commit abfff210 changed the order of vshParseArgv() and vshInit() in
order to make fix debugging of parameter parsing.  However, vshInit()
did a vshReconnect() even though ctl->name wasn't set according to the
'-c' parameter yet.  In order to keep both issues fixed, I've split
the vshInit() into vshInitDebug() and vshInit().

One simple memleak of ctl->name is fixed as a part of this patch,
since it is related to the issue it's fixing.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=999323
2013-08-22 09:54:41 +02:00
Doug Goldstein
23263af678 VMX: Improve disk parse error for unknown values
Previously the error message showed the following:

error: internal error: Invalid or not yet handled value 'auto detect'
for VMX entry 'ide0:0.fileName'

This left the user unsure if it was a CD-ROM or a disk device that they
needed to fix. Now the error shows:

error: internal error: Invalid or not yet handled value 'auto detect'
for VMX entry 'ide0:0.fileName' for device type 'cdrom-raw'

Which should hopefully make it easier to see the issue with the VMX
configuration.
2013-08-21 22:19:27 -05:00
Roman Bogorodskiy
f083ff82ed bridge driver: implement networkEnableIpForwarding for BSD
Implement networkEnableIpForwarding() using BSD style sysctl.
2013-08-21 16:28:19 -06:00
Roman Bogorodskiy
3f0d2ee95b BSD: implement virNetDev(Set|Clear)IPv4Address
Provide an implementation of virNetDev(Set|Clear)IPv4Address based on
BSD ifconfig tool in addition to 'ip' from Linux iproute2 package.
2013-08-21 15:49:40 -06:00