Commit Graph

6080 Commits

Author SHA1 Message Date
Daniel P. Berrange
22f4cb855c Move QEMU driver lock helpers to a separate file
To allow their use from other source files, move qemuDriverLock
and qemuDriverUnlock to qemu_conf.h and make them non-static

* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Add qemuDriverLock
  qemuDriverUnlock
* src/qemu/qemu_driver.c: Remove qemuDriverLock and qemuDriverUnlock
2010-12-17 13:50:47 +00:00
Daniel P. Berrange
01abc8a1b8 Move QEMU hostdev helper code out of the QEMU driver
The QEMU driver file is far too large. Move all the hostdev
helper code out into a separate file. No functional change.

* src/qemu/qemu_hostdev.c, src/qemu/qemu_hostdev.h,
  src/Makefile.am: Add hostdev helper file
* src/qemu/qemu_driver.c: Delete hostdev code
2010-12-17 13:50:21 +00:00
Daniel P. Berrange
52271cfc28 Move QEMU cgroup helper code out of the QEMU driver
The QEMU driver file is far too large. Move all the cgroup
helper code out into a separate file. No functional change.

* src/qemu/qemu_cgroup.c, src/qemu/qemu_cgroup.h,
  src/Makefile.am: Add cgroup helper file
* src/qemu/qemu_driver.c: Delete cgroup code
2010-12-17 13:48:30 +00:00
Daniel P. Berrange
1aecb6348c Move QEMU audit helper code out of the QEMU driver
The QEMU driver file is far too large. Move all the audit
helper code out into a separate file. No functional change.

* src/qemu/qemu_audit.c, src/qemu/qemu_audit.h,
  src/Makefile.am: Add audit helper file
* src/qemu/qemu_driver.c: Delete audit code
2010-12-17 13:46:15 +00:00
Daniel P. Berrange
df4aabafbe Move QEMU private data & namespace code into separate file
Move the code for handling the QEMU virDomainObjPtr private
data, and custom XML namespace into a separate file

* src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: New file
  for private data & namespace code
* src/qemu/qemu_driver.c, src/qemu/qemu_driver.h: Remove
  private data & namespace code
* src/qemu/qemu_driver.h, src/qemu/qemu_command.h: Update
  includes
* src/Makefile.am: Add src/qemu/qemu_domain.c
2010-12-17 13:44:54 +00:00
Daniel P. Berrange
0f2e4b9c68 Move QEMU command line management into a separate file
The qemu_conf.c code is doing three jobs, driver config file
loading, QEMU capabilities management and QEMU command line
management. Move the command line code into its own file

* src/qemu/qemu_command.c, src/qemu/qemu_command.h: New
  command line management code
* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Delete command
  line code
* src/qemu/qemu_conf.h, src/qemu_conf.c: Adapt for API renames
* src/Makefile.am: add src/qemu/qemu_command.c
* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_text.c: Add
  import of qemu_command.h
2010-12-17 13:43:20 +00:00
Daniel P. Berrange
d8ae147d8e Move QEMU capabilities management into a separate file
The qemu_conf.c code is doing three jobs, driver config file
loading, QEMU capabilities management and QEMU command line
management. Move the capabilities code into its own file

* src/qemu/qemu_capabilities.c, src/qemu/qemu_capabilities.h: New
  capabilities management code
* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Delete capabilities
  code
* src/qemu/qemu_conf.h: Adapt for API renames
* src/Makefile.am: add src/qemu/qemu_capabilities.c
2010-12-17 13:39:18 +00:00
Eric Blake
02b4d34a04 maint: doc fix
* src/libvirt.c: Avoid duplicate word.
2010-12-16 11:57:11 -07:00
Hu Tao
226f40542e Add a new function doStartCPUs 2010-12-14 08:43:53 -07:00
Hu Tao
fa139130fb Add a new function doStopCPUs 2010-12-14 08:40:26 -07:00
Hu Tao
54c6833392 Add a macro timeval_to_ms to compute micro seconds from timeval 2010-12-14 08:38:41 -07:00
Jiri Denemark
8806c0db63 cpu: Unify CPUID data structures
So far, CPUID data were stored in two different data structures. First
of them was a structure allowing direct access for CPUID data according
to function number and the second was a plain array of struct
cpuX86cpuid. This was a silly design which resulted in converting data
from one type to the other and back again or implementing similar
functionality for both data structures.

The patch leaves only the direct access structure. This makes the code
both smaller and more maintainable since operations on different objects
can use common low-level operations.

All 57 tests for cpu subsystem still pass after this rewrite.
2010-12-14 11:12:58 +01:00
Jiri Denemark
4262ff45e1 util: Fix logical error in virReportSystemErrorFull 2010-12-14 10:53:35 +01:00
Jiri Denemark
5b2c9f92ca util: Fix error message in __virExec
Remove superfluous ": %s" suffix from the error message.
2010-12-14 10:53:35 +01:00
Jiri Denemark
99800e54b7 daemon: Change CWD to / before daemonizing
We were doing so for child processes but not for libvirtd itself.
2010-12-14 10:53:35 +01:00
Matthias Bolte
e3fb2908cb esx: Add support for storage volume cloning 2010-12-14 01:13:51 +01:00
Eric Blake
6679943f94 selinux: avoid memory overhead of matchpathcon
https://bugzilla.redhat.com/show_bug.cgi?id=658657

* src/security/security_selinux.c
(SELinuxRestoreSecurityFileLabel): Use selabel_lookup instead of
matchpathcon.
Suggested by Daniel Walsh.
2010-12-13 17:01:57 -07:00
Eric Blake
6e9a29c887 daemon, threads: plug a memory leak
* daemon/libvirtd.c (qemudStartWorker, qemudStartEventLoop): Avoid
leaking pthread_attr resources.
* src/util/threads-pthread.c (virThreadCreate): Likewise.
2010-12-13 17:01:14 -07:00
Eric Blake
e414dab4d6 tests: test Fedora 14 qemu-kvm -help parsing
* tests/qemuhelpdata/qemu-kvm-0.13.0: New file.
* tests/qemuhelptest.c (mymain): New test from Fedora 14 qemu-kvm,
which covers some options (like -fstype passthrough) not tested elsewhere.
2010-12-13 16:30:02 -07:00
Eric Blake
d5a710eec1 tests: test RHEL 6.0 qemu-kvm -help parsing
* tests/qemuhelpdata/qemu-kvm-0.12.1.2-rhel60: New file.
* tests/qemuhelptest.c (mymain): New test from RHEL 6.0 qemu-kvm,
which covers some options (like -vga=qxl) not tested elsewhere.
* .x-sc_prohibit_empty_lines_at_EOF: Exempt qemu help output.
2010-12-13 16:30:02 -07:00
Eric Blake
3ce483af8c sysinfo: convert to virCommand
* src/util/sysinfo.c (virSysinfoRead): Use virCommand instead of
virExec.
2010-12-13 16:27:48 -07:00
Eric Blake
046ca3f411 sysinfo: formatting cleanups
* src/util/sysinfo.c: Indentation and () fixups.
2010-12-13 16:17:27 -07:00
Eric Blake
3fbc30d96a build: allow mingw compilation with virCommand
Allows compilation, but no creation of child processes yet.  Take it
one step at a time.

* src/util/util.c (virExecWithHook) [WIN32]: New dummy function.
* src/libvirt_private.syms: Export it.
2010-12-13 16:09:50 -07:00
Eric Blake
65c0f17acd build: update gnulib for pipe on mingw
* .gnulib: Update to latest.
* bootstrap.conf (gnulib_modules): Import pipe-posix and waitpid
for mingw.
* src/remote/remote_driver.c (pipe) [WIN32]: Drop dead macro.
* daemon/event.c (pipe) [WIN32]: Drop dead function.
2010-12-13 16:09:50 -07:00
Eric Blake
7aaf4e6439 test: fix commandtest under autobuild.sh
* tests/commandtest.c (mymain): Kill off any leaked-in fds.
* autobuild.sh: Don't leak fds.

Signed-off-by: Eric Blake <eblake@redhat.com>
2010-12-13 16:04:56 -07:00
Diego Elio Pettenò
30a4ee84c4 build: quote AC_LANG_PROGRAM to avoid warnings with autoconf 2.68 2010-12-13 11:01:15 -07:00
Diego Elio Pettenò
0b9ab2abf1 build: properly handle ./configure --with-libpcap
Without this fix, ./configure --with-libpcap will cause --with-libpcap=yes
to be implicitly passed down, which cause yes/bin/pcap-config to be
searched for rather than /usr/bin/pcap-config.

Also output pcap: no when pcap is not found or disabled.
2010-12-13 11:01:11 -07:00
Osier Yang
5faf88fe98 qemu: Introduce two new job types
Currently, all of domain "save/dump/managed save/migration"
use the same function "qemudDomainWaitForMigrationComplete"
to wait the job finished, but the error messages are all
about "migration", e.g. when a domain saving job is canceled
by user, "migration was cancled by client" will be throwed as
an error message, which will be confused for user.

As a solution, intoduce two new job types(QEMU_JOB_SAVE,
QEMU_JOB_DUMP), and set "priv->jobActive" to "QEMU_JOB_SAVE"
before saving, to "QEMU_JOB_DUMP" before dumping, so that we
could get the real job type in
"qemudDomainWaitForMigrationComplete", and give more clear
message further.

And as It's not important to figure out what's the exact job
is in the DEBUG and WARN log, also we don't need translated
string in logs, simply repace "migration" with "job" in some
statements.

* src/qemu/qemu_driver.c
2010-12-13 10:20:29 -07:00
Laurent Léonard
84094af780 Missing "Default-Stop" field in LSB comment in libvirt-guests
The "Default-Stop" field in LSB comment in libvirt-guests is missing and should
be added. I also suggests to add runlevel 2 to the "Default-Start" field.

--
Laurent Léonard
2010-12-13 10:13:13 -07:00
Eric Blake
24384a7579 daemon: plug a memory leak
* daemon/libvirtd.c (qemudFreeClient): Avoid a leak.
(qemudDispatchServer): Avoid null dereference.
2010-12-13 09:49:26 -07:00
Roopa Prabhu
013c000a6c 802.1Qbh: Add support for IFLA_VF_MAC
Current code does not pass VM mac address to a 802.1Qbh direct attach
interface using IFLA_VF_MAC.  This patch adds support in macvtap code to
send IFLA_VF_MAC netlink request during port profile association on a
802.1Qbh interface.

Stefan Cc'ed for comments because this patch changes a condition for
802.1Qbg

802.1Qbh support for IFLA_VF_MAC in enic driver has been posted and is
pending acceptance at http://marc.info/?l=linux-netdev&m=129185244410557&w=2
2010-12-13 11:07:38 -05:00
Eric Blake
e8d05c978d command: ease use with virBuffer, and fix qemu leak
* src/util/command.h (virCommandAddArgBuffer)
(virCommandAddEnvBuffer): New prototypes.
* src/util/command.c (virCommandAddArgBuffer)
(virCommandAddEnvBuffer): Implement them.
* src/libvirt_private.syms (command.h): Export them.
* src/qemu/qemu_conf.c (qemudBuildCommandLine): Use them, plugging
a memory leak on rbd_hosts in the process.
2010-12-10 14:37:09 -07:00
Eric Blake
20eb73e955 conf: plug memory leaks
* src/conf/domain_conf.c (virDomainGraphicsDefParseXML)
(virDomainDeviceVirtioSerialAddressParseXML)
(virDomainDiskDefFree): Free various leaks.
2010-12-10 14:25:05 -07:00
Eric Blake
7d5e79ffb9 tests: plug memory leaks
* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Don't
allocate, since we don't use virDomainChrDefFree.
2010-12-10 14:25:05 -07:00
Eric Blake
c3568ec289 virExec: avoid undefined behavior
* src/util/util.c (__virExec): Don't use FD_ISSET on out-of-bounds fd.
2010-12-10 14:18:57 -07:00
Laine Stump
044f2011aa Convert dhcpStartDhcpDaemon from virRun to virCommand
This is pretty straightforward - even though dnsmasq gets daemonized
and uses a pid file, those things are both handled by the dnsmasq
binary itself. And libvirt doesn't need any of the output of the
dnsmasq command either, so we just setup the args and call
virRun(). Mainly it was just a (mostly) mechanical job of replacing
the APPEND_ARG() macro (and some other *printfs()) with
virCommandAddArg*().
2010-12-10 16:06:21 -05:00
Matthias Bolte
c9006b6b1e esx: Refactor storage pool type lookup into a function 2010-12-10 20:31:57 +01:00
Matthias Bolte
2a151699f1 esx: Improve error reporting for failed tasks
Instead of just reporting that a task failed get the
localized message from the TaskInfo error and include
it in the reported error message.

Implement minimal deserialization support for the
MethodFault type in order to obtain the actual fault
type.

For example, this changes the reported error message
when trying to create a volume with zero size from

  Could not create volume

to

  Could not create volume: InvalidArgument - A specified parameter was not correct.

Not perfect yet, but better than before.
2010-12-10 20:31:57 +01:00
Eric Blake
f12d416927 command: plug memory leak
* src/util/command.c (virCommandFree): Free data from
virCommandSetInputBuffer.
2010-12-10 08:56:30 -07:00
Eric Blake
2a5ccbefb0 build: distribute commandtest files
* tests/Makefile.am (SUBDIRS): Add commanddata.
* tests/commandtest.c (checkoutput): Delete correct file.
(test4): Delete pid file.
(mymain): Delete unused variable.
* tests/commanddata/Makefile.am: New file.
* configure.ac (AC_OUTPUT): Build new makefile.
Reported by Dominik Klein.
2010-12-10 08:44:53 -07:00
Hu Tao
e8e9397cf7 Update documentation of watchdog dump option and add test data for it
The xml watchdog dump option is converted to qemu watchdog pause arg
but it is not reasonable to convert it back from qemu watchdog pause
arg since there already is a xml watchdog pause option, so a test for
the dump option to convert it from arg to xml is not added.
2010-12-10 08:00:05 -07:00
Dan Kenigsberg
91b3e1038f spec: do not start libvirt-guests if that service is off
starting a service during rpm installation is impolite. It is even worse if done
during upgrade, for a service that was explicitly turned off.
2010-12-09 16:55:48 -07:00
Josh Durgin
715bf4523e tests: Add tests for network disks
Signed-off-by: Josh Durgin <joshd@hq.newdream.net>
2010-12-09 14:20:53 -07:00
Josh Durgin
85400fb992 qemu: Add RBD support and some network disk fixes
Changes common to all network disks:
-Make source name optional in the domain schema, since NBD doesn't use it
-Add a hostName type to the domain schema, and use it instead of genericName, which doesn't include .
-Don't leak host names or ports
-Set the source protocol in qemuParseCommandline

Signed-off-by: Josh Durgin <joshd@hq.newdream.net>
2010-12-09 14:20:53 -07:00
MORITA Kazutaka
036ad5052b add network disk support
This patch adds network disk support to libvirt/QEMU.  The currently
supported protocols are nbd, rbd, and sheepdog.  The XML syntax is like
this:

    <disk type="network" device="disk">
      <driver name="qemu" type="raw" />
      <source protocol='rbd|sheepdog|nbd' name="...some image identifier...">
        <host name="mon1.example.org" port="6000">
        <host name="mon2.example.org" port="6000">
        <host name="mon3.example.org" port="6000">
      </source>
      <target dev="vda" bus="virtio" />
    </disk>

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
2010-12-09 14:09:12 -07:00
Wen Congyang
85d5fb19b1 correct the signal's name
The signal's name is wrong...

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2010-12-09 12:03:11 -07:00
Hu Tao
e19cdbfcf1 Add a watchdog action `dump'
`dump' watchdog action lets libvirtd to dump the guest when receives a
watchdog event (which probably means a guest crash)

Currently only qemu is supported.
2010-12-09 11:59:27 -07:00
Hu Tao
b4560bf2ef Add a new function doCoreDump
This patch prepares for the next patch.
2010-12-09 11:43:58 -07:00
Hu Tao
482380b587 threadpool impl
* src/util/threadpool.c, src/util/threadpool.h: Thread pool
  implementation
* src/Makefile.am: Build thread pool
* src/libvirt_private.syms: Export public functions
2010-12-09 11:39:17 -07:00
Eric Blake
8e9ee30e8a command: avoid memory leak
* src/util/command.c (virCommandRun): Fix yesterday's regression
on logging, and avoid leaking log-only output captures.
Reported by Hu Tao.
2010-12-09 09:14:13 -07:00