Commit Graph

124 Commits

Author SHA1 Message Date
Daniel P. Berrange
774c757e67 Clear assigned PCI devices at shutdown
The PCI device addresses are only valid while the VM is running,
since they are auto-assigned by QEMU. After shutdown they must
all be cleared. Future QEMU driver enhancement will allow for
persistent PCI address assignment

* src/conf/domain_conf.h, src/conf/domain_conf.c, src/libvirt_private.syms
  Add virDomainDefClearPCIAddresses() method for wiping out auto assigned
  PCI addresses
* src/qemu/qemu_driver.c: Clear PCI addresses at VM shutdown
2010-01-18 13:35:51 +00:00
Daniel P. Berrange
989051a85e Detect PCI addresses at QEMU startup
Hotunplug of devices requires that we know their PCI address. Even
hotplug of SCSI drives, required that we know the PCI address of
the SCSI controller to attach the drive to. We can find this out
by running 'info pci' and then correlating the vendor/product IDs
with the devices we booted with.

Although this approach is somewhat fragile, it is the only viable
option with QEMU < 0.12, since there is no way for libvirto set
explicit PCI addresses when creating devices in the first place.
For QEMU > 0.12, this code will not be used.

* src/qemu/qemu_driver.c: Assign all dynamic PCI addresses on
  startup of QEMU VM, matching vendor/product IDs
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
  src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
  API for fetching PCI device address mapping
2010-01-18 12:44:50 +00:00
Daniel P. Berrange
3a6bf1bb78 Properly support SCSI drive hotplug
The current SCSI hotplug support attaches a brand new SCSI controller
for every disk. This is broken because the semantics differ from those
used when starting the VM initially. In the latter case, each SCSI
controller is filled before a new one is added.

If the user specifies an high drive index (sdazz) then at initial
startup, many intermediate SCSI controllers may be added with no
drives.

This patch changes SCSI hotplug so that it exactly matches the
behaviour of initial startup. First the SCSI controller number is
determined for the drive to be hotplugged. If any controller upto
and including that controller number is not yet present, it is
attached. Then finally the drive is attached to the last controller.

NB, this breaks SCSI hotunplug, because there is no 'drive_del'
command in current QEMU. Previous SCSI hotunplug was broken in
any case because it was unplugging the entire controller, not
just the drive in question.

A future QEMU will allow proper SCSI hotunplug of a drive.

This patch is derived from work done by Wolfgang Mauerer on disk
controllers.

* src/qemu/qemu_driver.c: Fix SCSI hotplug to add a drive to
 the correct controller, instead of just attaching a new
  controller.
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
  src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
  support for 'drive_add' command
2010-01-18 12:44:50 +00:00
Wolfgang Mauerer
da9d937b94 Implement SCSI controller hotplug/unplug for QEMU
This patch allows for explicit hotplug/unplug of SCSI controllers.
Ordinarily this is not required, since QEMU/libvirt will attach
a new SCSI controller whenever one is required. Allowing explicit
hotplug of controllers though, enables the caller to specify a
static PCI address, instead of auto-assigning the next available
PCI slot. Or it will when we have static PCI addressing.

This patch is derived from Wolfgang Mauerer's disk controller
patch series.

* src/qemu/qemu_driver.c: Support hotplug & unplug of SCSI
  controllers
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
  src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
  new API for attaching PCI SCSI controllers
2010-01-18 12:44:50 +00:00
Matthias Bolte
a0356bcc41 qemu: Use log output for pty assignment if 'info chardev' is unavailable
qemudFindCharDevicePTYsMonitor reports an error if 'info chardev' didn't
provide information for a requested device, even if the log output parsing
had found the pty path for that device. This makes pty assignment fail for
older QEMU/KVM versions. For example KVM 72 on Debian doesn't support
'info chardev', so qemuMonitorTextGetPtyPaths cannot parse any useful
information and the hash for device-id-to-pty-path mapping stays empty.

Make qemudFindCharDevicePTYsMonitor report an error only if the log output
parsing and the 'info chardev' parsing failed to provide the pty path.
2010-01-18 01:54:40 +01:00
Daniel P. Berrange
ab0da52b43 Convert monitor over to use virDomainDeviceAddress
Convert the QEMU monitor APIs over to use virDomainDeviceAddress
structs for passing addresses in/out, instead of individual bits.
This makes the number of parameters smaller & easier to deal with.
No functional change

* src/qemu/qemu_driver.c, src/qemu/qemu_monitor.c,
  src/qemu/qemu_monitor.h, src/qemu/qemu_monitor_text.c,
  src/qemu/qemu_monitor_text.h: Change monitor hotplug APIs to
  take an explicit address ptr for all host/guest addresses
2010-01-15 17:55:58 +00:00
Daniel P. Berrange
1b0cce7d3a Introduce a standardized data structure for device addresses
All guest devices now use a common device address structure
summarized by:

  enum virDomainDeviceAddressType {
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE,
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI,
  };

  struct _virDomainDevicePCIAddress {
    unsigned int domain;
    unsigned int bus;
    unsigned int slot;
    unsigned int function;
  };

  struct _virDomainDeviceInfo {
    int type;
    union {
        virDomainDevicePCIAddress pci;
    } addr;
  };

This replaces the anonymous structs in Disk/Net/Hostdev data
structures. Where available, the address is *always* printed
in the XML file, instead of being hidden in the internal state
file.

  <address type='pci' domain='0x0000' bus='0x1e' slot='0x07' function='0x0'/>

The structure definition is based on Wolfgang Mauerer's disk
controller patch series.

* docs/schemas/domain.rng: Define the <address> syntax and
  associate it with disk/net/hostdev devices
* src/conf/domain_conf.h, src/conf/domain_conf.c,
  src/libvirt_private.syms: APIs for parsing/formatting address
  information. Also remove the QEMU specific 'pci_addr' attributes
* src/qemu/qemu_driver.c: Replace use of 'pci_addr' attrs with
  new standardized format.
2010-01-15 16:37:44 +00:00
Cole Robinson
5073aa994a Implement path lookup for USB by vendor:product
Based off how QEMU does it, look through /sys/bus/usb/devices/* for
matching vendor:product info, and if found, use info from the surrounding
files to build the device's /dev/bus/usb path.

This fixes USB device assignment by vendor:product when running qemu
as non-root (well, it should, but for some reason I couldn't reproduce
the failure people are seeing in [1], but it appears to work properly)

[1] https://bugzilla.redhat.com/show_bug.cgi?id=542450
2010-01-13 15:24:41 -05:00
Cole Robinson
978dd6d48b qemu: Disable errors in qemudShutdownVMDaemon 2010-01-12 10:48:34 -05:00
Cole Robinson
a9d12c2444 qemu: migrate: Save MigratePerform error in MigrateFinish.
This way we won't squash the original error report in
MigratePerform, as is done for P2P and Tunneled migration.
2010-01-12 10:48:34 -05:00
Matthias Bolte
f01ee2acc8 qemu: Fix a memory leak in qemudExtractTTYPath
qemudWaitForMonitor calls qemudReadLogOutput with qemudFindCharDevicePTYs
as callback. qemudFindCharDevicePTYs calls qemudExtractTTYPath to assign
a string to chr->data.file.path. Afterwards qemudWaitForMonitor may call
qemudFindCharDevicePTYsMonitor that overwrites chr->data.file.path without
freeing the old value. This results in leaking the memory allocated by
qemudExtractTTYPath.

Report an OOM error if the strdup in qemudFindCharDevicePTYsMonitor fails.
2010-01-11 23:58:56 +01:00
Jim Meyering
f2d8c9d087 qemu_driver.c: remove useless, warning-provoking test
* src/qemu/qemu_driver.c (qemudDomainMigratePrepare2): Remove useless
test of always-non-NULL uri_out parameter.  Use ATTRIBUTE_NONNULL to
inform tools.
2010-01-05 17:25:26 +01:00
Jim Meyering
eebf932e94 qemu_driver.c: avoid NULL dereference upon disk-op failure
* src/qemu/qemu_driver.c (qemudDomainAttachDevice): Call
virCgroupDenyDevicePath only if cgroup is non-NULL.
2010-01-05 17:25:19 +01:00
Daniel P. Berrange
c90e545f83 Fix detection of JSON when restarting libvirtd
The XML XPath for detecting JSON in the running VM statefile was
wrong causing all VMs to get JSON mode enabled at libvirtd restart.

In addition if a VM was running a JSON enabled QEMU once, and then
altered to point to a non-JSON enabled QEMU later the 'monJSON'
flag would not get reset to 0.

* src/qemu/qemu_driver.c: Fix setting/detection of JSON mode
2009-12-21 23:37:37 +00:00
Daniel Veillard
9b2c299a35 Fix typo in qemudDomainAttachHostPciDevice()
* src/qemu/qemu_driver.c: The 'if' statement is supposed to check return
  value of pci = pciGetDevice(conn, ...); , but check uses if (!dev),
  fix it
2009-12-21 12:32:55 +01:00
Adam Litke
c7523b410a Implements domainMemStats in the qemu driver
Support for memory statistics reporting is accepted for qemu inclusion.
Statistics are reported via the monitor command 'info balloon' as a comma
seprated list:

(qemu) info balloon
balloon: actual=1024,mem_swapped_in=0,mem_swapped_out=0,major_page_faults=88,minor_page_faults=105535,free_mem=1017065472,total_mem=1045229568

Libvirt, qemu, and the guest operating system may support a subset of the
statistics defined by the virtio spec.  Thus, only statistics recognized by
components will be reported.

* src/qemu/qemu_driver.c src/qemu/qemu_monitor_text.[ch]: implement the
  new entry point by using info balloon monitor command
2009-12-20 13:36:28 +01:00
Adam Litke
3a70131312 Add new API virDomainMemoryStats to header and drivers
Set up the types for the domainMemoryStats function and insert it into the
virDriver structure definition.  Because of static initializers, update
every driver and set the new field to NULL.

* include/libvirt/libvirt.h.in: new API
* src/driver.h src/*/*_driver.c src/vbox/vbox_tmpl.c: add the new
  entry to the driver structure
* python/generator.py: fix compiler errors, the actual python binding is
  implemented later
2009-12-20 13:28:42 +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
Jiri Denemark
16e4084a10 Adds the internal driver API
* src/driver.h: add an extra entry point in the structure
* src/esx/esx_driver.c src/lxc/lxc_driver.c src/opennebula/one_driver.c
  src/openvz/openvz_driver.c src/phyp/phyp_driver.c src/qemu/qemu_driver.c
  src/remote/remote_driver.c src/test/test_driver.c src/uml/uml_driver.c
  src/vbox/vbox_tmpl.c src/xen/xen_driver.c: add NULL entry points for
  all drivers
2009-12-18 14:59:39 +01:00
Jim Meyering
643ee3fa44 qemu migration: avoid NULL-deref given an invalid input
* src/qemu/qemu_driver.c (doNonTunnelMigrate): Don't let a
NULL "uri_out" provoke a NULL-dereference in doNativeMigrate:
supply omitted goto-after-qemudReportError.
2009-12-15 11:26:24 +01:00
Jim Meyering
1428704d2a qemu_driver.c: don't unlink(NULL) on OOM error path
* src/qemu/qemu_driver.c (qemudDomainMigratePrepareTunnel): Upon an
out of memory error, we would end up with unixfile==NULL and attempt
to unlink(NULL).  Skip the unlink when it's NULL.
2009-12-15 11:26:24 +01:00
Jim Meyering
dd16045041 qemu_driver.c: avoid double free on error path
* src/qemu/qemu_driver.c (qemudDomainMigrateFinish2): Set
"event" to NULL after qemuDomainEventQueue frees it, so a
subsequent free (after endjob label) upon qemuMonitorStartCPUs
failure does not cause a double free.
2009-12-15 07:53:44 +01:00
Matthew Booth
057ad3a2f5 Cleanup temporary #define after use
* src/qemu/qemu_driver.c: #undef LOOKUP_PTYS after use in
  qemudFindCharDevicePTYsMonitor()
2009-12-14 16:05:45 +01:00
Paolo Bonzini
921d2225ba Fix possible NULL pointer dereference
If there are no references remaining to the object, vm is set to NULL
and vm->persistent cannot be accessed.  Fixed by this trivial patch.

* src/qemu/qemu_driver.c (qemudDomainCoreDump): Avoid possible
  NULL pointer dereference on --crash dump.
2009-12-14 14:09:10 +01:00
Paolo Bonzini
1fb7af40cd add --live support to "virsh dump"
This is trivial for QEMU since you just have to not stop the vm before
starting the dump.  And for Xen, you just pass the flag down to xend.

* include/libvirt/libvirt.h.in (virDomainCoreDumpFlags): Add VIR_DUMP_LIVE.
* src/qemu/qemu_driver.c (qemudDomainCoreDump): Support live dumping.
* src/xen/xend_internal.c (xenDaemonDomainCoreDump): Support live dumping.
* tools/virsh.c (opts_dump): Add --live. (cmdDump): Map it to VIR_DUMP_LIVE.
2009-12-14 12:10:38 +01:00
Paolo Bonzini
b927aed8a3 add --crash support to "virsh dump"
This patch adds the --crash option (already present in "xm dump-core")
to "virsh dump".  virDomainCoreDump already has a flags argument, so
the API/ABI is untouched.

* include/libvirt/libvirt.h.in (virDomainCoreDumpFlags): New flag for
  CoreDump
* src/test/test_driver.c (testDomainCoreDump): Do not crash
  after dump unless VIR_DUMP_CRASH is given.
* src/qemu/qemu_driver.c (qemudDomainCoreDump): Shutdown the domain
  instead of restarting it if --crash is passed.
* src/xen/xend_internal.c (xenDaemonDomainCoreDump): Support --crash.
* tools/virsh.c (opts_dump): Add --crash.
  (cmdDump): Map it to flags for virDomainCoreDump and pass them.
2009-12-14 11:59:27 +01:00
Paolo Bonzini
f509e16241 fix various breakages in qemu Dump command
1) qemuMigrateToCommand uses ">>" so we have to truncate the file
before starting the migration;

2) the command wasn't updated to chown the driver and set/restore
the security lavels;

3) the VM does not have to be resumed if migration fails;

4) the file is not removed when migration fails.

* src/qemu/qemu_driver.c (qemuDomainCoreDump): Truncate file before
  dumping, set/restore ownership and security labels for the file.
2009-12-14 11:27:41 +01:00
Daniel Veillard
a7d1eb3c44 Fix a couple of problems in last patch
Those were pointed by DanB in his review but not yet fixed

* src/qemu/qemu_driver.c: qemudWaitForMonitor() use EnterMonitorWithDriver()
  and ExitMonitorWithDriver() there
* src/qemu/qemu_monitor_text.c: checking fro strdu failure and hash
  table add error in qemuMonitorTextGetPtyPaths()
2009-12-14 11:05:55 +01:00
Matthew Booth
60e8977fdd Get QEMU pty paths from the monitor
This change makes the QEMU driver get pty paths from the output of the
monitor 'info chardev' command. This output is structured, and contains
both the name of the device and the path on the same line. This is
considerably more reliable than parsing the startup log output, which
requires the parsing code to know which order QEMU will print pty
information in.

Note that we still need to parse the log output as the monitor itself
may be on a pty. This should be rare, however, and the new code will
replace all pty paths parsed by the log output method once the monitor
is available.

* src/qemu/qemu_monitor.(c|h) src/qemu_monitor_text.(c|h): Implement
  qemuMonitorGetPtyPaths().
* src/qemu/qemu_driver.c: Get pty path information using
  qemuMonitorGetPtyPaths().
2009-12-14 10:50:01 +01:00
Matthew Booth
033eef4358 Extract the assigned pty device for QEmu channels
* src/qemu/qemu_driver.c: Parse pty devices for channels
2009-12-14 10:42:14 +01:00
Ryota Ozaki
2597f8ecc9 Suppress cgroup error message on sucess startup
Even if qemudStartVMDaemon suceeds, an error was logged such as
'qemuRemoveCgroup:1778 : internal error Unable to find cgroup for'.
This is because qemudStartVMDaemon calls qemuRemoveCgroup to
ensure that old cgroup does not remain. This workaround makes
sense but leaving an error message may confuse users.
* src/qemu/qemu_driver.c: a an option to the function to suppress the
  error being logged
2009-12-14 10:30:49 +01:00
Paolo Bonzini
edc9e78b48 add virsh --suspend arg to migrate command
This adds a new flag, VIR_MIGRATE_PAUSED, that mandates pausing
the migrated VM before starting it.

* include/libvirt/libvirt.h.in (virDomainMigrateFlags): Add VIR_MIGRATE_PAUSED.
* src/qemu/qemu_driver.c (qemudDomainMigrateFinish2): Handle VIR_MIGRATE_PAUSED.
* tools/virsh.c (opts_migrate): Add --suspend. (cmdMigrate): Handle it.
* tools/virsh.pod (migrate): Document it.
2009-12-11 10:00:44 +01:00
Paolo Bonzini
ba7d82c699 fix migration of paused vms upon failure
This makes a small change on the failed-migration path.  Up to now,
all VMs that failed non-live migration after the "stop" command
were restarted.  This must not be done when the VM was paused in
the first place.

* src/qemu/qemu_driver.c (qemudDomainMigratePerform): Do not restart
  a paused VM that fails migration.  Set paused state after "stop",
  reset it after failure.
2009-12-11 09:42:19 +01:00
Richard Jones
c11a82b62a qemu driver: Fix segfault in libvirt/libvirtd when uri->path is NULL.
See also:
https://bugzilla.redhat.com/show_bug.cgi?id=545400#c1
2009-12-10 16:39:07 +00: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
8e7d14953c Fix virDomainObj ref handling in QEMU driver
Since the monitor I/O is processed out of band from the main
thread(s) invoking monitor  commands, the virDomainObj may be
deleted by the I/O thread. The qemuDomainObjBeginJob takes an
extra reference to protect against final deletion, but this
reference is released by the corresponding EndJob call. THus
after the EndJob call it may not be valid to reference the
virDomainObj any more. To allow callers to detect this, the
EndJob call is changed to return the remaining reference count.

* src/conf/domain_conf.c: Make virDomainObjUnref return the
  remaining reference count
* src/qemu/qemu_driver.c: Avoid referencing virDomainObjPtr
  after qemuDomainObjEndJob if it has been deleted.
2009-12-09 10:32:45 +00:00
Daniel P. Berrange
e9f4c94301 Switch over to passing a callback table to QEMU monitor
With addition of events there will be alot of callbacks.
To avoid having to add many APIs to register callbacks,
provide them all at once in a big table

* src/qemu/qemu_driver.c: Pass in a callback table to QEMU
  monitor code
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h Replace
  the EOF and disk secret callbacks with a callback table
2009-12-08 13:46:55 +00: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
c5358c0e1f Introduce callbacks for serializing domain object private data to XML
Now that drivers are using a private domain object state blob,
the virDomainObjFormat/Parse methods are no longer able to
directly serialize all neccessary state to/from XML. It is
thus neccessary to introduce a pair of callbacks fo serializing
private state.

The code for serializing vCPU PIDs and the monitor device
config can now move out of domain_conf.c and into the
qemu_driver.c where they belong.

* src/conf/capabilities.h: Add callbacks for serializing private
  state to/from XML
* src/conf/domain_conf.c, src/conf/domain_conf.h: Remove the
  monitor, monitor_chr, monitorWatch, nvcpupids and vcpupids
  fields from virDomainObjPtr. Remove code that serialized
  those fields
* src/libvirt_private.syms: Export virXPathBoolean
* src/qemu/qemu_driver.c: Add callbacks for serializing monitor
  and vcpupid data to/from XML
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Pass monitor
  char device config into qemuMonitorOpen directly.
2009-12-08 13:46:54 +00:00
Daniel P. Berrange
5697aa848b Pull code to start CPUs executing out of qemudInitCpuAffinity()
The code to start CPUs executing has nothing todo with CPU
affinity masks, so pull it out of the qemudInitCpuAffinity()
method and up into qemudStartVMDaemon()

* src/qemu/qemu_driver.c: Pull code to start CPUs executing out
  of qemudInitCpuAffinity()
2009-12-08 13:46:53 +00:00
Daniel P. Berrange
8c12b20c61 Add a 'format' arg to qemuMonitorChangeMedia() since JSON will support it
The current QEMU disk media change does not support setting the
disk format. The new JSON monitor will support this, so add an
extra parameter to pass this info in

* src/qemu/qemu_driver.c: Pass in disk format when changing media
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c,
  src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
  Add a 'format' arg to qemuMonitorChangeMedia()
2009-12-08 13:46:53 +00:00
Daniel P. Berrange
79533da1b3 Fix crash when deleting monitor while a command is in progress
If QEMU shuts down while we're in the middle of processing a
monitor command, the monitor will be freed, and upon cleaning
up we attempt to do  qemuMonitorUnlock(priv->mon) when priv->mon
is NULL.

To address this we introduce proper reference counting into
the qemuMonitorPtr object, and hold an extra reference whenever
executing a command.

* src/qemu/qemu_driver.c: Hold a reference on the monitor while
  executing commands, and only NULL-ify the priv->mon field when
  the last reference is released
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add reference
  counting to handle safe deletion of monitor objects
2009-12-08 13:46:48 +00:00
Matthias Bolte
7a18fbeeb8 Fix some locking issues
* src/conf/domain_conf.c: don't call virDomainObjUnlock twice
* src/qemu/qemu_driver.c: relock driver lock if an error occurs in
  qemuDomainObjBeginJobWithDriver, enter/exit monitor with driver
  in qemudDomainSave
2009-12-03 17:06:38 +01:00
Daniel P. Berrange
db810b1148 Free cgroup device ACL list on driver shutdown
* src/qemu/qemu_driver.c: Free cgroup ACLs
2009-11-26 12:07:17 +00:00
Gerhard Stenzel
fb7cebb767 remove port filter when network device is detached
* src/qemu/qemu_driver.c: remove the port filter if the network device
  is detached via virDomainDetachDevice.
2009-11-24 11:25:16 +01:00
Daniel P. Berrange
37f415da42 Pull schedular affinity code out into a separate module
* src/Makefile.am: Add processinfo.h/processinfo.c
* src/util/processinfo.c, src/util/processinfo.h: Module providing
  APIs for getting/setting process CPU affinity
* src/qemu/qemu_driver.c: Switch over to new APIs for schedular
  affinity
* src/libvirt_private.syms: Export virProcessInfoSetAffinity
  and virProcessInfoGetAffinity to internal drivers
2009-11-23 11:58:13 +00:00
Daniel P. Berrange
278e947890 Ensure driver lock is released when entering QEMU monitor
The qemudStartVMDaemon() and several functions it calls use
the QEMU monitor. The QEMU driver is locked while this function
is executing, so it is rquired to release the driver lock and
reacquire it either side of issuing a monitor command. It
failed todo so, leading to deadlock

* qemu/qemu_driver.c: Release driver when in qemudStartVMDaemon
  and things it calls
2009-11-18 17:04:33 +00:00
Cole Robinson
ce4c0bf5a2 Add virConnectGetLibvirtVersion API
There is currently no way to determine the libvirt version of a remote
libvirtd we are connected to. This is a useful piece of data to enable
feature detection.
2009-11-12 10:53:26 -05:00
Daniel P. Berrange
bc0010b3d1 Fix save and restore with non-privileged guests and SELinux
When running qemu:///system instance, libvirtd runs as root,
but QEMU may optionally be configured to run non-root. When
then saving a guest to a state file, the file is initially
created as root, and thus QEMU cannot write to it. It is also
missing labelling required to allow access via SELinux.

* src/qemu/qemu_driver.c: Set ownership on save image before
  running migrate command in virDomainSave impl. Call out to
  security driver to set save image labelling
* src/security/security_driver.h: Add driver APIs for setting
  and restoring saved state file labelling
* src/security/security_selinux.c: Implement saved state file
  labelling for SELinux
2009-11-11 15:24:32 +00:00
Daniel P. Berrange
cabc2cc98f Implmentation of new APIs to checking state/persistence of objects
This implements the virConnectIsSecure, virConnectIsEncrypted,
virDomainIsPersistent, virDomainIsActive, virNetworkIsActive,
virNetworkIsPersistent, virStoragePoolIsActive,
virStoragePoolIsPersistent, virInterfaceIsActive APIs in
(nearly) all drivers. Exceptions are:

 phyp: missing domainIsActive/Persistent
 esx: missing domainIsPersistent
 opennebula: missing domainIsActive/Persistent

* src/remote/remote_protocol.x: Define remote wire ABI for newly
  added APIs.
* daemon/remote_dispatch*.h: Re-generated from remote_protocol.x
* src/esx/esx_driver.c, src/lxc/lxc_driver.c, src/network/bridge_driver.c,
  src/opennebula/one_driver.c, src/openvz/openvz_conf.c,
  src/openvz/openvz_driver.c, src/phyp/phyp_driver.c,
  src/remote/remote_driver.c, src/storage/storage_driver.c,
  src/test/test_driver.c, src/uml/uml_driver.c, src/vbox/vbox_tmpl.c,
  src/xen/xen_driver.c, src/xen/xen_driver.h, src/xen/xen_inotify.c,
  src/xen/xen_inotify.h: Implement all the new APIs where possible
2009-11-10 17:00:27 +00:00