Commit Graph

182 Commits

Author SHA1 Message Date
Jiri Denemark
8153c72b97 Only probe for CPU models if required
* src/qemu/qemu_conf.c: CPU models should be probed only if the
  a guest's XML contains CPU model, not each time a qemu command line
  is generated.
2009-12-22 12:23:56 +01:00
Jiri Denemark
ffb13b1115 Implement CPU selection in QEMU driver
* src/qemu/qemu_conf.c src/qemu/qemu_conf.h src/qemu/qemu_driver.c:
  add the new entry point, extend capabilities and code to interract
  with qemu
2009-12-18 16:24:14 +01:00
Matthias Bolte
2b844f1614 Fix memory leak in qemudBuildCommandLine 2009-12-15 22:53:45 +01:00
Matthew Booth
a8eb010ea2 Make QEMU driver use -chardev everywhere if available
Change -monitor, -serial and -parallel output to use -chardev if it is
available.
* src/qemu/qemu_conf.c: Update qemudBuildCommandLine to use -chardev where
  available.
* tests/qemuxml2argvtest.c tests/qemuxml2argvdata/: Add -chardev equivalents
  for all current serial and parallel tests.
2009-12-14 10:38:44 +01:00
Matthias Bolte
1b9d074493 Add virBufferFreeAndReset() and replace free()
Replace free(virBufferContentAndReset()) with virBufferFreeAndReset().
Update documentation and replace all remaining calls to free() with
calls to VIR_FREE(). Also add missing calls to virBufferFreeAndReset()
and virReportOOMError() in OOM error cases.
2009-12-10 00:00:50 +01:00
Daniel P. Berrange
3a4f172fdd Support for JSON mode monitor
Initial support for the new QEMU monitor protocol  using JSON
as the data encoding format instead of plain text

* po/POTFILES.in: Add src/qemu/qemu_monitor_json.c
* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Hack to turn on QMP
  mode. Replace with a version number check on >= 0.12 later
* src/qemu/qemu_monitor.c: Delegate to json monitor if enabled
* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h: Add
  impl of QMP protocol
* src/Makefile.am: Add src/qemu/qemu_monitor_json.{c,h}
2009-12-08 13:46:54 +00:00
Daniel P. Berrange
8f147d16f1 Fix default disk type when parsing QEMU argv
* src/qemu/qemu_conf.c: Fix default disk type to be 'FILE'
  again, after previous commit accidentally changed it
2009-11-24 10:59:05 +00:00
Daniel P. Berrange
e7c78b0a94 Support QEMU's virtual FAT block device driver
Introduce a new type="dir"  mode for <disks> that allows use of
QEMU's  virtual FAT block device driver. eg

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

gets turned into

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

Only read-only disks are supported with virtual FAT mode

* src/conf/domain_conf.c, src/conf/domain_conf.h: Add type="dir"
* docs/schemas/domain.rng: Document new disk type
* src/xen/xend_internal.c, src/xen/xm_internal.c: Raise error for
  unsupported disk types
* tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-empty.args: Fix
  empty disk file handling
* tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.args,
  tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.xml,
  tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.args,
  tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml
  tests/qemuxml2argvtest.c: Test QEMU vitual FAT driver
* src/qemu/qemu_conf.c: Support generating fat:/some/dir type
  disk args
* src/security/security_selinux.c: Temporarily skip labelling
  of directory based disks
2009-11-23 12:17:16 +00:00
Steve Yarmie
b827338a72 qemu-kvm needs -enable-kvm flag for VT optimization
Recent qemu releases require command option '-enable-qemu' in order
for the kvm functionality be activated. Libvirt needs to pass this flag
to qemu when starting a domain. Note that without the option,
even if both the kernel and qemu support KVM, KVM will not be activated
and VMs will be very slow.

* src/qemu/qemu_conf.h src/qemu/qemu_conf.c: parse the extra command
  line option from help and add it when running kvm
* tests/qemuhelptest.c: this modified the flags output for qemu-0.10.5
  and qemu-kvm-0.11.0-rc2 regression tests
2009-11-20 15:41:05 +01:00
Matthew Booth
da82b03fb0 Small guestfwd code cleanup
* src/qemu/qemu_conf.c: Remove and inline qemudBuildCommandLineChrDevTargetStr
2009-11-13 16:05:27 +01:00
pritesh
2e23607448 Support for SATA Disks in virDomainDiskBus
* src/conf/domain_conf.h src/conf/domain_conf.c: add the new entry in
  the enum and lists of virDomainDiskBus
* src/qemu/qemu_conf.c: same for virDomainDiskQEMUBus
2009-11-12 15:45:18 +01:00
Ryota Ozaki
6008cfc7c0 Prevent initializing ebtables if disabled in qemu.conf
* src/qemu/qemu_conf.c: don't initialize ebtables if
  disabled
2009-11-11 12:59:54 +01:00
Matthias Bolte
790f0b3057 Add missing OOM error checks, reports and cleanups 2009-11-09 23:17:45 +01:00
Matthew Booth
bb4ec5550b Use virBuffer when building QEMU char dev command line
* src/qemu/qemu_conf.c: Update qemudBuildCommandLineChrDevStr to use a
  virBuffer
2009-11-06 14:44:25 +01:00
Matthew Booth
8f67f6448b Cleanup virBuffer usage in qemdBuildCommandLine
* src/qemu_qemu_conf.c: Cleanup usage of virBuffer in qemudBuildCommandLine
2009-11-06 12:19:21 +01:00
Matthew Booth
af249ea468 Support for <channel> in domain and QEmu backend
allows the following to be specified in a domain:
<channel type='pipe'>
  <source path='/tmp/guestfwd'/>
  <target type='guestfwd' address='10.0.2.1' port='4600'/>
</channel>

* proxy/Makefile.am: add network.c as dep of domain_conf.c
* docs/schemas/domain.rng src/conf/domain_conf.[ch]: extend the domain
  schemas and the parsing/serialization side for the new construct

QEmu support will add the following on the qemu command line:
 -chardev pipe,id=channel0,path=/tmp/guestfwd
 -net user,guestfwd=tcp:10.0.2.1:4600-chardev:channel0

* src/qemu/qemu_conf.c: Add argument output for channel
* tests/qemuxml2(argv|xml)test.c: Add test for <channel> domain syntax
2009-11-05 15:31:03 +01:00
Matthew Booth
7400396801 Detect availability of QEMU -chardev CLI option
* src/qemu/qemu_conf.h: defines a new QEMUD_CMD_FLAG_CHARDEV flag
* src/qemu/qemu_conf.c: parse the output for -chardev and set flag
  appropriately
2009-11-05 14:41:24 +01:00
Matthew Booth
89d549c3eb Allow character devices to have different target types
A character device's target (it's interface in the guest) had only a
single property: port. This patch is in preparation for adding targets
which require other properties.
Since this changes the conf type for character devices this affects
a number of drivers:

* src/conf/domain_conf.[ch] src/esx/esx_vmx.c src/qemu/qemu_conf.c
  src/qemu/qemu_driver.c src/uml/uml_conf.c src/uml/uml_driver.c
  src/vbox/vbox_tmpl.c src/xen/xend_internal.c src/xen/xm_internal.c:
  target properties are moved into a union in virDomainChrDef, and a
  targetType field is added to identify which union member should be
  used. All current code which touches a virDomainChrDef is updated both
  to use the new union field, and to populate targetType if necessary.
2009-11-05 14:28:39 +01:00
Gerhard Stenzel
0aa72ac6fd add MAC address based port filtering to qemu
* src/qemu/qemu.conf src/qemu/qemu_conf.c src/qemu/qemu_conf.h: there is
  a new config type option for mac filtering
* src/qemu/qemu_bridge_filter.[ch]: new module for the ebtable entry points
* src/qemu/qemu_driver.c: plug the MAC filtering at the right places
  in the domain life cycle
* src/Makefile.am po/POTFILES.in: add the new module
2009-11-03 23:44:48 +01:00
Cole Robinson
4c44cdcce3 Various error reporting fixes
- Don't duplicate SystemError
- Use proper error code in domain_conf
- Fix a broken error call in qemu_conf
- Don't use VIR_ERR_ERROR in security driver (isn't a valid code in this case)
2009-11-03 16:46:54 -05:00
Daniel P. Berrange
46992453b9 Annotate many methods with ATTRIBUTE_RETURN_CHECK & fix problems
Nearly all of the methods in src/util/util.h have error codes that
must be checked by the caller to correct detect & report failure.
Add ATTRIBUTE_RETURN_CHECK to ensure compile time validation of
this

* daemon/libvirtd.c: Add explicit check on return value of virAsprintf
* src/conf/domain_conf.c: Add missing check on virParseMacAddr return
  value status & report error
* src/network/bridge_driver.c: Add missing OOM check on virAsprintf
  and report error
* src/qemu/qemu_conf.c: Add missing check on virParseMacAddr return
  value status & report error
* src/security/security_selinux.c: Remove call to virRandomInitialize
  that's done in libvirt.c already
* src/storage/storage_backend_logical.c: Add check & log on virRun
  return status
* src/util/util.c: Add missing checks on virAsprintf/Run status
* src/util/util.h: Annotate all methods with ATTRIBUTE_RETURN_CHECK
  if they return an error status code
* src/vbox/vbox_tmpl.c: Add missing check on virParseMacAddr
* src/xen/xm_internal.c: Add missing checks on virAsprintf
* tests/qemuargv2xmltest.c: Remove bogus call to virRandomInitialize()
2009-11-02 11:09:03 -05:00
Matthias Bolte
dfdfc601ac Fix error message in qemudLoadDriverConfig()
* src/qemu/qemu_conf.c: change the error message to refer to
  'cgroup_controllers' instead of 'cgroup_device_acl'
2009-10-26 23:30:19 +01:00
Richard Jones
08bed02515 Support QEMU watchdog device.
This adds simple support for configuring a guest with a QEMU/KVM
virtual hardware watchdog device.
2009-10-21 16:37:44 +01:00
Mark McLoughlin
2210f8a3a8 Don't copy old machines from a domain which has none
If the the qemu and kvm binaries are the same, we don't include machine
types in the kvm domain info.

However, the code which refreshes the machine types info from the
previous capabilities structure first looks at the kvm domain's info,
finds it matches and then copies the empty machine types list over
for the top-level qemu domain.

That doesn't make sense, we shouldn't copy an empty machin types list.

* src/qemu/qemu_conf.c: qemudGetOldMachinesFromInfo(): don't copy an
  empty machine types list.
2009-10-15 13:27:57 +01:00
Chris Lalancette
b013ebc3b2 Add a qemu feature flag for unix socket migration.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-09-30 14:06:12 +02:00
Daniel P. Berrange
b08e6d38ae Allow control over QEMU audio backend
When using VNC for graphics + keyboard + mouse, we shouldn't
then use the host OS for audio. Audio should go back over
VNC.

When using SDL for graphics, we should use the host OS for
audio since that's where the display is. We need to allow
certain QEMU env variables to be passed through to guest
too to allow choice of QEMU audio backend.

* qemud/libvirtd.sysconf: Mention QEMU/SDL audio env vars
* src/qemu_conf.c: Passthrough QEMU/SDL audio env for SDL display,
  disable host audio for VNC display
2009-09-29 15:53:10 +01:00
Daniel P. Berrange
4c10127b2c Add API for issuing 'host_net_add' monitor command
* src/qemu/qemu_conf.h, src/qemu/qemu_conf.c: Remove prefix arg
  from qemuBuildHostNetStr which is no longer required
* src/qemu/qemu_driver.c: Refactor to use qemuMonitorAddHostNetwork()
  API for adding host network
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  qemuMonitorAddHostNetwork() method for adding host networks
2009-09-29 12:20:56 +01:00
Daniel P. Berrange
f8d54e7c94 Add API for issuing 'pci_add nic' monitor command
* src/qemu/qemu_conf.c: Remove separator from qemuBuildNicStr()
  args, and remove hardcoded 'nic' prefix. Leave it upto callers
  instead
* src/qemu/qemu_driver.c: Switch over to using the new
  qemuMonitorAddPCINetwork() method for NIC hotplug
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  qemuMonitorAddPCINetwork API for PCI network device hotplug
2009-09-29 12:20:56 +01:00
Chris Lalancette
03d777f345 Introduce virStrncpy.
Add the virStrncpy function, which takes a dst string, source string,
the number of bytes to copy and the number of bytes available in the
dest string.  If the source string is too large to fit into the
destination string, including the \0 byte, then no data is copied and
the function returns NULL.  Otherwise, this function copies n bytes
from source into dst, including the \0, and returns a pointer to the
dst string.  This function is intended to replace all unsafe uses
of strncpy in the code base, since strncpy does *not* guarantee that
the buffer terminates with a \0.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-09-22 20:10:00 +02:00
Daniel P. Berrange
b81a7ece97 Fix handling of Xen(ner) detection
Latest upstream QEMU can be built with Xen support, which introduces
a -xen-domid argument. This was  mistakenly detected as -domid due
to old Xenner support. Adapt to cope with both syntax. Also only
set domid if the virt type is xen, or the guest type is xen

* src/qemu_conf.c, src/qemu_conf.h: Detect new -xen-domid flag in
  preference to -domid.
* tests/qemuxml2argvdata/qemuxml2argv-bootloader.args,
  tests/qemuxml2argvdata/qemuxml2argv-input-xen.args: Add missing
  -domid param
* tests/qemuxml2argvdata/qemuxml2argv-misc-uuid.args: Remove bogus
  -boot param.
* tests/qemuxml2argvtest.c: Add missing QEMUD_CMD_FLAG_DOMID params
2009-09-22 16:13:33 +01:00
Chris Lalancette
aabafbea1d Simple fix of a comment in qemuStringToArgvEnv.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-09-21 18:15:31 +02:00
Daniel P. Berrange
58355a5bfb Move QEMU driver to src/qemu/
* src/qemu_conf.c, src/qemu_conf.h, src/qemu_driver.c,
  src/qemu_driver.h: Move to src/qemu/
* daemon/qemud.c, src/Makefile.am, tests/qemuargv2xmltest.c,
  tests/qemuhelptest.c, tests/qemuxml2argvtest.c,
  tests/qemuxml2xmltest.c: Adapt for changed paths
2009-09-21 14:41:43 +01:00