Commit Graph

840 Commits

Author SHA1 Message Date
Paolo Bonzini
1a09553e52 unbreak migration
Fix migration, broken in two different ways by the QEMU monitor
abstraction.  Note that the QEMU console emits a "\r\n" as the
line-ending.

* src/qemu/qemu_monitor_text.c (qemuMonitorGetMigrationStatus):
Fix "info migrate" command and its output's parsing.
2009-10-02 11:57:31 +02:00
Chris Lalancette
6e16575a37 Tunnelled migration.
Implementation of tunnelled migration, using a Unix Domain Socket
on the qemu backend.  Note that this requires very new versions of
qemu (0.10.7 at least) in order to get the appropriate bugfixes.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-10-02 11:43:26 +02:00
Chris Lalancette
7cc1491d10 Various monitor improvements for migration.
The upcoming tunnelled migration needs to be able to set
a migration in progress in the background, as well as
be able to cancel a migration when a problem has happened.
This patch allows for both of these to properly work.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-10-01 13:24:22 +02: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
879cd8cc2b Fix crash in device hotplug cleanup code
* src/qemu/qemu_driver.c: Fix crash in scenario where XML
  parsing of hotplugged device failed & thus 'dev' is NULL
2009-09-29 12:20:56 +01:00
Daniel P. Berrange
46da355022 Standardize debugging messages in QEMU monitor code
* src/qemu/qemu_monitor_text.c: Always print command and reply
  in qemuMonitorCommandWithHandler. Print all args in each monitor
  command API & remove redundant relpy printing
2009-09-29 12:20:56 +01:00
Daniel P. Berrange
79f45855a6 Remove low level monitor APIs from header file
* src/qemu/qemu_monitor_text.h: Remove qemudMonitorCommand,
  qemudMonitorCommandWithFd, qemudMonitorCommandWithHandler,
  qemudMonitorCommandExtra low level APIs
* src/qemu/qemu_monitor_text.c: Replace s/qemud/qemuMonitor/
2009-09-29 12:20:56 +01:00
Daniel P. Berrange
b06c97e51d Add API for issuing 'host_net_remove' monitor command
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add new
  qemuMonitorRemoveHostNetwork() command for removing host
  networks
* src/qemu/qemu_driver.c: Convert NIC hotplug methods over
  to use qemuMonitorRemoveHostNetwork()
2009-09-29 12:20:56 +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
Daniel P. Berrange
aadab51541 Add API for issuing 'getfd' and 'closefd' monitor commands
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  qemuMonitorCloseFileHandle and qemuMonitorSendFileHandle
  APIs for processing file handles
* src/qemu/qemu_driver.c: Convert NIC hotplug method over to
  use   qemuMonitorCloseFileHandle and qemuMonitorSendFileHandle
2009-09-29 12:20:55 +01:00
Daniel P. Berrange
85df93399c Add API for issuing 'pci_add storage' monitor command
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  API qemuMonitorAddPCIDisk()
* src/qemu/qemu_driver.c: Convert over to using the new
  qemuMonitorAddPCIDisk() method, and remove now obsolete
  qemudEscape() method
2009-09-29 12:20:53 +01:00
Daniel P. Berrange
3e11f9ff90 Add API for issuing 'pci_del' monitor command
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new API
  qemuMonitorRemovePCIDevice() for removing PCI device
* src/qemu/qemu_driver.c: Convert all places removing PCI devices
  over to new qemuMonitorRemovePCIDevice() API
2009-09-29 11:59:40 +01:00
Daniel P. Berrange
e7f38d96f0 Add API for issuing 'pci_add host' monitor command
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  API qemuMonitorAddPCIHostDevice()
* src/qemu/qemu_driver.c: Switch to using qemuMonitorAddPCIHostDevice()
  for PCI host device hotplug
2009-09-29 11:59:21 +01:00
Daniel P. Berrange
61ea9c89c5 Add APIs for sending 'usb_add' command for host devices
One API adds an exact device based on bus+dev, the other adds
any device matching vendor+product

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  qemuMonitorAddUSBDeviceExact() and qemuMonitorAddUSBDeviceMatch()
  commands.
* src/qemu/qemu_driver.c: Switch over to using the new
    qemuMonitorAddUSBDeviceExact() and qemuMonitorAddUSBDeviceMatch()
2009-09-29 11:59:15 +01:00
Daniel P. Berrange
f566c5924a Add API for using 'usb_add' for disk devices
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  qemuMonitorAddUSBDisk() API
* src/qemu/qemu_driver.c: Switch USB disk hotplug to the new
  src/qemu/qemu_driver.c API.
2009-09-29 11:59:02 +01:00
Daniel P. Berrange
ed2a10a1c5 Add API for issuing 'migrate' command with exec protocol
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  qemuMonitorMigrateToCommand() API
* src/qemu/qemu_driver.c: Switch over to using the
  qemuMonitorMigrateToCommand() API for core dumps and save
  to file APIs
2009-09-29 11:58:52 +01:00
Daniel P. Berrange
81f3edea8f Add API for issuing a 'migrate' monitor command for TCP
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new API
  qemuMonitorMigrateToHost() for doing TCP migration
* src/qemu/qemu_driver.c: Convert to use qemuMonitorMigrateToHost().
  Also handle proper URIs (tcp:// as well as tcp:)
2009-09-29 11:57:27 +01:00
Daniel P. Berrange
d7a3c8352e Add API for running 'info migration' monitor command
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  qemuMonitorGetMigrationStatus() command.
* src/qemu/qemu_driver.c: Use new qemuMonitorGetMigrationStatus()
  command to check completion status.
2009-09-29 11:56:44 +01:00
Daniel P. Berrange
bdc8861aac Add API for issuing the 'migrate_set_speed' monitor command
* src/qemu/qemu_driver.c: Use new qemuMonitorSetMigrationSpeed()
  API during migration
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add new
  qemuMonitorSetMigrationSpeed() API
2009-09-29 11:54:57 +01:00
Daniel P. Berrange
f225e560de Add API for issuing 'info blockstats' command
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add a new
  qemuMonitorGetBlockStatsInfo() command
* src/qemu/qemu_driver.c: Remove directly use of blockstats in
  favour of calling qemuMonitorGetBlockStatsInfo()
2009-09-29 11:54:27 +01:00
Daniel P. Berrange
316e9f9032 Add APIs for issuing 'memsave' and 'pmemsave' monitor commands
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add new APIs
  qemuMonitorSaveVirtualMemory() and qemuMonitorSavePhysicalMemory()
* src/qemu/qemu_driver.c: Use the new qemuMonitorSaveVirtualMemory()
  and qemuMonitorSavePhysicalMemory() APIs
2009-09-29 11:54:25 +01:00
Daniel P. Berrange
6d9c4758ae Add APIs for issuing 'eject' and 'change dev' monitor commands
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new APis
  qemuMonitorChangeMedia and qemuMonitorEjectMedia. Pull in code
  for qemudEscape
* src/qemu/qemu_driver.c: Remove code that directly issues 'eject'
  and 'change' commands in favour of API calls.
2009-09-29 11:54:21 +01:00
Daniel P. Berrange
eff29c8b28 Add API for issuing 'balloon' monitor command
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  qemuMonitorSetBalloon() based on existing code in
  qemudDomainSetMemoryBalloon
* src/qemu/qemu_driver.c: Remove use of qemudDomainSetMemoryBalloon()
  in favour of qemuMonitorSetBalloon(). Fix error code when balloon
  is not supported
2009-09-29 11:51:28 +01:00
Daniel P. Berrange
6f19c16c78 Add API for running 'info balloon' monitor command
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Pull old
  qemudDomainGetMemoryBalloon() code into a new method called
  qemuMonitorGetBalloonInfo()
* src/qemu/qemu_driver.c: Update to call qemuMonitorGetBalloonInfo()
  and remove qemudDomainGetMemoryBalloon().
2009-09-29 11:51:19 +01:00
Daniel P. Berrange
19d70c7d96 Add API for the 'system_powerdown' monitor command
* src/qemu/qemu_driver.c: Remove use of 'system_powerdown'
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add a new
  qemuMonitorSystemPowerdown() api call
2009-09-29 11:51:12 +01:00
Daniel P. Berrange
1e64d8c731 Add API for 'stop' monitor command
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add a new
  qemuMonitorStopCPUs() API
* src/qemu/qemu_driver.c: Replace direct monitor commands for 'stop'
  with qemuMonitorStopCPUs()
2009-09-29 11:51:06 +01:00
Daniel P. Berrange
4734a4227f Rename qemudMonitorSendCont to qemuMonitorStartCPUs
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Rename
  Rename qemudMonitorSendCont to qemuMonitorStartCPUs
* src/qemu/qemu_driver.c: Update callers for new name
2009-09-29 11:49:52 +01:00
Daniel P. Berrange
3aee261527 Add API for 'change vnc password' monitor command
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add a
  new qemuMonitorSetVNCPassword() API
* src/qemu/qemu_driver.c: Refactor qemudInitPasswords to
  call qemuMonitorSetVNCPassword()
2009-09-29 11:49:50 +01:00
Daniel P. Berrange
f38b654e9b Add API for 'info cpus' monitor command
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add a new
  qemuMonitorGetCPUInfo() command
* src/qemu/qemu_driver.c: Refactor qemudDetectVcpuPIDs to
  use qemuMonitorGetCPUInfo()
2009-09-29 11:47:24 +01:00
Daniel P. Berrange
a541c76238 Pull QEMU monitor interaction out to separate file
Pull out all the QEMU monitor interaction code to a separate
file. This will make life easier when we need to drop in a
new implementation for the forthcoming QMP machine friendly
monitor support.

Next step is to add formal APIs for each monitor command,
and remove direct commands for sending/receiving generic
data.

* src/Makefile.am: Add qemu_monitor.c to build
* src/qemu/qemu_driver.c: Remove code for monitor interaction
* src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: New
  file for monitor interaction
* po/POTFILES.in: Add src/qemu/qemu_monitor_text.c
2009-09-29 11:47:05 +01:00
Charles Duffy
580ad29288 Fix unitialized variable in qemudDomainDetachHostPciDevice()
* src/qemu/qemu_driver.c: initialize detach var
2009-09-24 09:02: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
Charles Duffy
faa8bf1079 prevent attempt to call cat -c during virDomainSave to raw
This was prevent virDomainSave from working properly by default,
which is a bad thing.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-09-22 08:56:39 +02: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
ec171c529a Move config files to align with driver sources
* daemon/default-network.xml: Move to src/network/default.xml
* daemon/libvirtd_qemu.aug, daemon/test_libvirtd_qemu.aug: Move
  to src/qemu/
* src/qemu.conf: Move to src/qemu/qemu.conf
* daemon/Makefile.am: Remove rules for default-nmetwork.xml and
  libvirtd_qemu.aug and test_libvirtd_qemu.aug. Fix typo in
  uninstall-local that would install polkit again.
* src/Makefile.am: Add rules for installing network/default.xml
  and the qemu/*.aug files. Add test case for QEMU augeas files.
  Add uninstall-local rule for files/directories created during
  install. Rename install-exec-local to install-data-local.
  Only install qemu.conf if WITH_QEMU is set.
* tests/networkschematest: Update for XML location move
2009-09-21 14:41:45 +01:00
Daniel P. Berrange
e56c6a83b4 Move security drivers to src/security/
* src/Makefile.am, src/qemu/qemu_conf.h, src/qemu/qemu_driver.c,
  tests/seclabeltest.c: Adapt for changed paths
* src/security.c: Rename to src/security/security_driver.c
* src/security.h: Rename to src/security/security_driver.h
* src/security_selinux.c, src/security_selinux.h: Move to src/security/
2009-09-21 14:41:44 +01: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