]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
15 years agoAdd SCM_RIGHTS support to QEMU monitor code
Mark McLoughlin [Wed, 22 Jul 2009 19:17:14 +0000 (20:17 +0100)]
Add SCM_RIGHTS support to QEMU monitor code

Add qemudMonitorCommandWithFd() which allows a file descriptor to be
sent to qemu over a unix monitor socket using SCM_RIGHTS. See the
unix(7) and cmsg(3) man pages.

* src/qemu_conf.c: add a scm_fd param to qemudMonitorCommandExtra(),
  add qemudMonitorCommandWithFd(), implement SCM_RIGHTS support in
  qemudMonitorSendUnix()

15 years agoUse sendmsg() on QEMU monitor socket
Mark McLoughlin [Wed, 22 Jul 2009 19:17:14 +0000 (20:17 +0100)]
Use sendmsg() on QEMU monitor socket

Switch from using write() to using sendmsg() on QEMU's monitor socket
so that we can add support for SCM_RIGHTS.

* src/qemu_driver.c: add sendmsg() based qemudMonitorSendUnix() and use
  it when the monitor fd is a unix socket

15 years agoFactor qemudMonitorSend() out of qemudMonitorCommandExtra()
Mark McLoughlin [Wed, 22 Jul 2009 19:17:14 +0000 (20:17 +0100)]
Factor qemudMonitorSend() out of qemudMonitorCommandExtra()

Add a little helper function to write the monitor command followed by
carriage return in a single write.

This doesn't make any real difference, but allows us to more easily
switch to using sendmsg() when using the monitor over a unix socket.

* src/qemu_conf.c: split qemudMonitorSend() out

15 years agoClean up error handling in qemudDomainAttachNetDevice()
Mark McLoughlin [Wed, 22 Jul 2009 19:17:14 +0000 (20:17 +0100)]
Clean up error handling in qemudDomainAttachNetDevice()

In subsequent patches we're going to have a file descriptor to close
too, so centralize the error handling cleanups to make things easier.

* src/qemu_conf.c: in qemudDomainAttachNetDevice() consolidate the
  error handling cleanups together

15 years agoMake qemuBuildHostNetStr() take tapfd as a string
Mark McLoughlin [Wed, 22 Jul 2009 19:17:14 +0000 (20:17 +0100)]
Make qemuBuildHostNetStr() take tapfd as a string

With hotplug, we're going to want to pass a tapfd name rather than an
actual file descriptor, so prepare the way by passing a string tapfd to
qemuBuildHostNetStr().

* src/qemu_conf.h: qemuBuildHostNetStr() takes a string tapfd now

* src/qemu_conf.c: pass qemuBuildHostNetStr() a string rather than an
  actual file descriptor

* src/qemu_driver.c: update qemudDomainAttachNetDevice() for change

15 years agoMove vnet_hdr logic into qemudNetworkIfaceConnect() and export it
Mark McLoughlin [Wed, 22 Jul 2009 19:17:13 +0000 (20:17 +0100)]
Move vnet_hdr logic into qemudNetworkIfaceConnect() and export it

* src/qemu_conf.h: export qemudNetworkIfaceConnect()

* src/qemu_conf.c: move vnet_hdr logic into qemudNetworkIfaceConnect()
  since we need it for hotplug too

15 years agoOnly probe qemu for machine types when binary changes
Mark McLoughlin [Fri, 24 Jul 2009 11:34:20 +0000 (12:34 +0100)]
Only probe qemu for machine types when binary changes

By probing for qemu machine types, we increased the time of a
GetCapabilities call from 100us to a whopping 60ms.

This patch takes the approach of only probing for machine types
when the mtime of the emulator binary changed since the last time
the capabilities were generated.

* src/capabilities.h: cache the emulator binary mtime

* src/qemu_conf.c: add qemudGetOldMachines() to copy the machine
  types from the old caps struct if the mtime for the binary hasn't
  changed

* src/qemu_conf.h, src/qemu_driver.c: pass the old caps pointer to
  qemudCapsInit()

15 years agoAdd canonical machine name to capabilities output
Mark McLoughlin [Thu, 23 Jul 2009 17:31:35 +0000 (18:31 +0100)]
Add canonical machine name to capabilities output

e.g. <machine canonical='pc'>pc-0.11</machine>

* src/capabilities.c: output the canonical machine names in the
  capabilities output, if available

* docs/schemas/capabilities.rng: add the new attribute

15 years agoProbe QEMU directly for machine aliases if not found in capabilties
Mark McLoughlin [Thu, 23 Jul 2009 17:31:34 +0000 (18:31 +0100)]
Probe QEMU directly for machine aliases if not found in capabilties

Not all possible emulators are actually in the capabilities, so if we
don't find the supplied emulator we should probe it directly for machine
types.

* src/qemu_driver.c: add qemudCanonicalizeMachineDirect() to directly
  probe an emulator for the canonical machine type

15 years agoCanonicalize qemu machine types
Mark McLoughlin [Thu, 23 Jul 2009 17:31:34 +0000 (18:31 +0100)]
Canonicalize qemu machine types

In qemu-0.11 there is a 'pc-0.10' machine type which allows you to run
guests with a machine which is compatible with the pc machine in
qemu-0.10 - e.g. using the original PCI class for virtio-blk and
virtio-console and disabling MSI support in virtio-net. The idea here
is that we don't want to suprise guests by changing the hardware when
qemu is updated.

I've just posted some patches for qemu-0.11 which allows libvirt to
canonicalize the 'pc' machine alias to the latest machine version.

This patches makes us use that so that when a guest is configured to
use the 'pc' machine type, we resolve that to 'pc-0.11' machine and
save that in the guest XML.

See also:

  https://fedoraproject.org/wiki/Features/KVM_Stable_Guest_ABI

* src/qemu_conf.c: add qemudCanonicalizeMachine() to canonicalize
  the machine type according to the machine aliases in capabilities

* src/qemu_driver.c: parse aliases in qemudParseMachineTypesStr()

15 years agoAdd virCapsGuestMachine structure
Mark McLoughlin [Thu, 23 Jul 2009 17:31:34 +0000 (18:31 +0100)]
Add virCapsGuestMachine structure

A subsequent commit will add a "canonical" field to this structure,
this patch basically just prepares the way for that.

The new type is added, along with virCapabilitiesAlloc/FreeMachines()
helpers and a whole bunch of code to make the transition.

One quirk is that virCapabilitiesAddGuestDomain() and
virCapabilitiesAddGuest() take ownership of the machine list rather
than duping it. This makes sense to avoid needless copying.

* src/capabilities.h: add the virCapsGuestMachine struct and use it
  in virCapsGuestDomainInfo, add prototypes for new functions and
  update the AddGuest() prototypes

* src/capabilities.c: add code for allocating and freeing the new
  type, change the machines parameter to AddGuest() etc.

* src/libvirt_private.syms: export the new helpers

* src/qemu_conf.c: update all the machine type code to use the new
  struct

* src/xen_internal.c: ditto

* tests/testutilsqemu.c: ditto

15 years agoProbe for QEMU machine types
Mark McLoughlin [Thu, 23 Jul 2009 17:31:34 +0000 (18:31 +0100)]
Probe for QEMU machine types

Currently we hardcode the QEMU machine types. We should really just
parse the output of 'qemu -M ?' so the lists don't get out of sync.

xenner doesn't support '-M ?', so we still need to hardcode that.

The horrible (const char *const *) is removed in a subsequent patch.

* src/qemu_conf.c: kill the arch_info*machines tables, retain the
  hardcoded xenner machine type, add qemudProbeMachineTypes() to
  run and parse 'qemu -M ?' and use it in qemudCapsInitGuest()

15 years agoCleanup qemu binary detection logic in qemudCapsInitGuest()
Mark McLoughlin [Thu, 23 Jul 2009 17:31:34 +0000 (18:31 +0100)]
Cleanup qemu binary detection logic in qemudCapsInitGuest()

There's no need for the hasbase/hasaltbase confusion, just store the
first binary path found in a variable.

* src/qemu_conf.c: kill hasbase/hasaltbase logic in qemudCapsInitGuest()

15 years agoESX driver accept VI API version 4.0
Matthias Bolte [Mon, 27 Jul 2009 12:27:09 +0000 (14:27 +0200)]
ESX driver accept VI API version 4.0

* src/esx/esx_driver.c src/esx/esx_vi.c src/esx/esx_vi.h
  src/esx/esx_vmx.c src/esx/esx_vmx.h: extend the VI API version checks
  to accept version 4.0 and takes care of the virtualHW.version change
  from 4 to 7.

15 years agoAllow leading dots in VMX config entry names
Matthias Bolte [Mon, 27 Jul 2009 12:21:17 +0000 (14:21 +0200)]
Allow leading dots in VMX config entry names

* src/conf.c: the virConfParser must accept leading dot when in VMX mode

15 years agoAdd no_verify query parameter to ESX URIs
Matthias Bolte [Mon, 27 Jul 2009 12:18:25 +0000 (14:18 +0200)]
Add no_verify query parameter to ESX URIs

* src/esx/esx_driver.c src/esx/esx_util.c src/esx/esx_util.h
  src/esx/esx_vi.c src/esx/esx_vi.h: adds a no_verify query parameter to
  stop libcurl from verifying theserver certificate for the https
  transport.

15 years agoFix memory leaks in esxDomainDumpXML
Matthias Bolte [Mon, 27 Jul 2009 12:13:11 +0000 (14:13 +0200)]
Fix memory leaks in esxDomainDumpXML

* src/esx/esx_driver.c: remove leaks in esxDomainDumpXML() and simplify
  esxDomainXMLFromNative()

15 years agoCommit newly generated docs, after changes from commit 2348cf.
Cole Robinson [Sun, 26 Jul 2009 21:54:13 +0000 (17:54 -0400)]
Commit newly generated docs, after changes from commit 2348cf.

15 years agoAdd phyp files to POTFILES, to make syntax-check happy.
Cole Robinson [Sun, 26 Jul 2009 21:53:34 +0000 (17:53 -0400)]
Add phyp files to POTFILES, to make syntax-check happy.

15 years agotest: Implement BlockStats and InterfaceStats
Cole Robinson [Fri, 24 Jul 2009 15:05:30 +0000 (11:05 -0400)]
test: Implement BlockStats and InterfaceStats

We fake stats values based on the current time, similar to how it's done
for cpu time.

15 years agotest: Generate net interface names when assigning XML.
Cole Robinson [Fri, 24 Jul 2009 15:05:29 +0000 (11:05 -0400)]
test: Generate net interface names when assigning XML.

We need interface names to implement InterfaceStats.

15 years agoDon't allow NULL paths for BlockStats and InterfaceStats
Cole Robinson [Fri, 24 Jul 2009 15:05:28 +0000 (11:05 -0400)]
Don't allow NULL paths for BlockStats and InterfaceStats

Do the check in libvirt.c, to save drivers from the burden. This changes
behavior slightly in the qemu driver: we no longer explictly error if
passed an empty string. An error will still be thrown when the device
lookup fails.

15 years agopython: Raise exceptions if virDomain*Stats fail.
Cole Robinson [Fri, 24 Jul 2009 15:05:27 +0000 (11:05 -0400)]
python: Raise exceptions if virDomain*Stats fail.

The generator couldn't tell that the stats return values were pointers.
Stick a white list in the function which tries to make this distinction.

15 years agodocument tcp listen and raw wire option
Guido Günther [Fri, 24 Jul 2009 20:16:51 +0000 (22:16 +0200)]
document tcp listen and raw wire option

15 years agoFix misc build problems due to new drivers
Daniel P. Berrange [Fri, 24 Jul 2009 16:20:50 +0000 (17:20 +0100)]
Fix misc build problems due to new drivers

* autobuild.sh: Disable esx/phyp build on mingw32
* configure.in: Fix handling of --without-phyp so it actually works
* libvirt.spec.in: Add missing interface.rng
* mingw32-libvirt.spec.in: Disable phyp/esx drivers
* src/phyp/phyp_driver.c: Fix missing i18n of error messages

15 years agoAdd support for VBox 3 and event callbacks on vbox
Pritesh Kothari [Fri, 24 Jul 2009 16:12:16 +0000 (18:12 +0200)]
Add support for VBox 3 and event callbacks on vbox

* src/vbox/vbox_driver.c: remove some old 2.5 switches and plug the
  3.0 driver
* src/vbox/vbox_V3_0.c src/vbox/vbox_CAPI_v3_0.h: the driver for
  VirtualBox 3.0
* src/vbox/vbox_tmpl.c: handle the new driver and add event support
* src/Makefile.am: plug in the new module

15 years agoFix cgroup compile warnings
Daniel P. Berrange [Fri, 24 Jul 2009 15:11:00 +0000 (16:11 +0100)]
Fix cgroup compile warnings

* src/cgroup.c: Fix cast to uint64 from unsigned long long

15 years agoDesactivate phyp build and indicate libssh builreq
Daniel Veillard [Fri, 24 Jul 2009 14:26:54 +0000 (16:26 +0200)]
Desactivate phyp build and indicate libssh builreq

15 years agoFirst version of the Power Hypervisor driver
Eduardo Otubo [Fri, 24 Jul 2009 14:17:06 +0000 (16:17 +0200)]
First version of the Power Hypervisor driver

Features supported:
- Connects to HMC/VIOS or IVM systems.
- Life cycle commands (resume and shutdown).
- dumpxml
- 'list' and 'list --all'

What is being implemented:
- better and centralized control for UUID
- definexml
- CPU management commands

* src/domain_conf.c src/domain_conf.h: first version of the driver
* configure.in src/Makefile.am include/libvirt/virterror.h
  src/domain_conf.[ch] src/libvirt.c src/virterror.c: glue the driver
  in the general framework

15 years agodocs: say that the old repository is deprecated...
Jim Meyering [Fri, 24 Jul 2009 08:57:39 +0000 (10:57 +0200)]
docs: say that the old repository is deprecated...

* docs/downloads.html.in: but will remain for sake of old links.

15 years agoAdded Matthias Bolte to AUTHORS list
Daniel Veillard [Thu, 23 Jul 2009 20:31:13 +0000 (22:31 +0200)]
Added Matthias Bolte to AUTHORS list

15 years agoFirst version of the driver for VMWare ESX
Matthias Bolte [Thu, 23 Jul 2009 20:21:08 +0000 (22:21 +0200)]
First version of the driver for VMWare ESX

* src/esx/esx_*.[ch]: the driver, uses a remote minimal SOAP client
  to talk to the VI services on ESX nodes.
* configure.in include/libvirt/virterror.h src/Makefile.am src/driver.h
  src/libvirt.c src/virterror.c: glue in the new driver

15 years agoMake QEMU cgroups use configurable
Daniel P. Berrange [Wed, 22 Jul 2009 15:08:04 +0000 (16:08 +0100)]
Make QEMU cgroups use configurable

 * qemud/libvirtd_qemu.aug, qemud/test_libvirtd_qemu.aug,
   src/qemu.conf: Add 'cgroups_controllers' and 'cgroups_device_acl'
   parameters
 * src/qemu_conf.h, src/qemu_conf.c: Load & parse configuration params
   for cgroups
 * src/qemu_driver.c: Only use cgroups controllers that are activated,
   and use configured device whitelist instead of default, if set.

15 years agoUse cgroups for block device whitelisting in QEMU guests
Daniel P. Berrange [Thu, 9 Jul 2009 13:11:49 +0000 (14:11 +0100)]
Use cgroups for block device whitelisting in QEMU guests

* src/qemu_driver.c: Set a restrictive block device whitelist for
  all QEMU guests. Update whitelist when hotplugging disks.
* src/cgroup.h, src/cgroup.c: Add some more convenience methods
  for dealing with block device whitelists.

15 years agoImplement schedular tunables API using cgroups
Daniel P. Berrange [Thu, 9 Jul 2009 13:11:21 +0000 (14:11 +0100)]
Implement schedular tunables API using cgroups

* src/qemu_driver.c:  Add driver methods qemuGetSchedulerType,
  qemuGetSchedulerParameters, qemuSetSchedulerParameters
* src/lxc_driver.c: Fix to use unsigned long long consistently
  for schedular parameters
* src/cgroup.h, src/cgroup.c: Fix cpu_shares to take unsigned
  long long
* src/util.c, src/util.h, src/libvirt_private.syms: Add a
  virStrToDouble helper
* src/virsh.c: Fix handling of --set arg to schedinfo command
  to honour the designated data type of each schedular tunable
  as declared by the driver

15 years agoPlace every QEMU guest in a private cgroup
Daniel P. Berrange [Thu, 9 Jul 2009 13:10:59 +0000 (14:10 +0100)]
Place every QEMU guest in a private cgroup

* src/qemu_driver.c: Place guest in cgroup upon startup. Remove
  cgroup upon shutdown

15 years agoRefactor cgroups to allow a group per driver to be managed directly
Daniel P. Berrange [Fri, 10 Jul 2009 10:40:04 +0000 (11:40 +0100)]
Refactor cgroups to allow a group per driver to be managed directly

Allow the driver level cgroup to be managed explicitly by the
hypervisor drivers, in order to detect whether to enable or
disable cgroup support for domains. Provides better error
reporting of failures. Also allow for creation of cgroups for
unprivileged drivers if controller is accessible by the user.

* src/cgroup.c, src/cgroup.h: Add an API to obtain a driver cgroup
* src/lxc_conf.h, src/lxc_controller.c, src/lxc_driver.c:
  Obtain a driver cgroup at startup and use that instead of
  re-creating everytime.
* src/util.c, src/util.h, src/libvirt_private.syms: Add a
  virGetUserName() helper

15 years agoMake cgroups a little more efficient
Daniel P. Berrange [Thu, 9 Jul 2009 13:10:41 +0000 (14:10 +0100)]
Make cgroups a little more efficient

* src/cgroup.c: Detect the mount location of every controller at
  time a virCgroupPtr is created. Detect current process' placement
  within group to avoid assuming it is in the root. Pass controller
  ID into SetValueStr/GetValueStr to enable much duplicated code to
  be eliminated

15 years agoAdd bare format string to printf-derivatives troubles
Laine Stump [Thu, 23 Jul 2009 16:27:47 +0000 (18:27 +0200)]
Add bare format string to printf-derivatives troubles

* src/datatypes.c src/domain_conf.c src/interface_conf.c
  src/lxc_driver.c src/qemu_driver.c src/storage_backend.c src/virsh.c:
  add bare %s format string to printf-derivatives called with no format
  string

15 years agoDon't restore labels on shared/readonly disks
Daniel P. Berrange [Wed, 15 Jul 2009 11:45:13 +0000 (12:45 +0100)]
Don't restore labels on shared/readonly disks

* src/security_selinux.c: Skip relabelling of shared/readonly
  disks upon shutdown, since this breaks other VMs still active
  using those disks

15 years agoUse virFileReadAll/virFileWriteStr for key cgroup read/write helpers
Daniel P. Berrange [Thu, 9 Jul 2009 13:10:06 +0000 (14:10 +0100)]
Use virFileReadAll/virFileWriteStr for key cgroup read/write helpers

15 years agoUse enums for cgroup controller types / labels
Daniel P. Berrange [Thu, 9 Jul 2009 13:09:38 +0000 (14:09 +0100)]
Use enums for cgroup controller types / labels

15 years agoAdd domain autostart for LXC driver
Daniel P. Berrange [Mon, 6 Jul 2009 15:05:32 +0000 (16:05 +0100)]
Add domain autostart for LXC driver

* src/lxc_driver.c: Implement support for domain autostart

15 years agoAdd domain events support to LXC driver
Daniel P. Berrange [Mon, 6 Jul 2009 15:04:36 +0000 (16:04 +0100)]
Add domain events support to LXC driver

* src/lxc_conf.h: Add queue for dispatch of domain events
* src/lxc_driver.c: Trigger domain events upon important lifecycle transitions

15 years agoFix misc Win32 compile warnings
Daniel P. Berrange [Thu, 23 Jul 2009 15:07:32 +0000 (16:07 +0100)]
Fix misc Win32 compile warnings

GCC >= 4.4 assumes the 'printf' attribute refers to the native
runtime libraries format specifiers. Thanks to gnulib, libvirt
has GNU format specifiers everywhere.  This means we need to
use 'gnu_printf' with GCC >= 4.4 to get correct compiler
checking of printf format specifiers.

* HACKING: Document new rules for ATTRIBUTE_FMT_PRINTF
* autobuild.sh, mingw32-libvirt.spec.in: Disable OpenNebula
  driver on mingw32 builds
* qemud/dispatch.h, qemud/qemu.h, src/buf.h src/internal.h,
  src/logging.h, src/security.h, src/sexpr.h, src/util.h,
  src/virterror_internal.h, src/xend_internal.c: Change
  over to ATTRIBUTE_FMT_PRINTF.
* src/virsh.c: Disable 'cd' and 'pwd' commands on Win32
  since they don't compile
* src/threads-win32.c: Add missing return value check

15 years agoAlways add -no-kvm and -no-kqemu, for qemu domains
Jim Paris [Wed, 22 Jul 2009 18:51:28 +0000 (20:51 +0200)]
Always add -no-kvm and -no-kqemu, for qemu domains

If the qemu binary supports "-no-kvm" and/or "-no-kqemu", they should
always be added for plain "qemu" domains.  Previously, we omitted them
whenever the host and guest architectures implied that they would be
disabled automatically, but that logic was flawed in some cases
(such as i686 and x86_64).
* src/qemu_conf.c: fix the conditions for adding "-no-kvm" and/or "-no-kqemu"

15 years agoRelease conn lock before reporting errors (end)
Laine Stump [Wed, 22 Jul 2009 17:22:41 +0000 (19:22 +0200)]
Release conn lock before reporting errors (end)

* src/datatypes.c: more cleanup, where lock must be released before
  calling error handling which tries to get it.

15 years agoRename variable for compilation in Mingw32 (end)
Laine Stump [Wed, 22 Jul 2009 17:18:19 +0000 (19:18 +0200)]
Rename variable for compilation in Mingw32 (end)

* qemud/remote.c src/interface_conf.[ch] src/veth.[ch]: more renaming
  from interface to iface

15 years agoAdd support for physical memory access for QEmu
Nguyen Anh Quynh [Wed, 22 Jul 2009 14:27:09 +0000 (16:27 +0200)]
Add support for physical memory access for QEmu

* include/libvirt/libvirt.h include/libvirt/libvirt.h.in: adds the new
  flag VIR_MEMORY_PHYSICAL for virDomainMemoryPeek
* src/libvirt.c: update the front-end checking
* src/qemu_driver.c: extend the QEmu driver

15 years agoavoid a make distcheck failure: distribute docs/schemas/interface.rng
Jim Meyering [Wed, 22 Jul 2009 09:10:14 +0000 (05:10 -0400)]
avoid a make distcheck failure: distribute docs/schemas/interface.rng

* docs/schemas/Makefile.am (schema_DATA): Add interface.rng.

15 years agoavoid a make distcheck failure: distribute tests/interfaceschemadata/
Jim Meyering [Wed, 22 Jul 2009 09:07:07 +0000 (05:07 -0400)]
avoid a make distcheck failure: distribute tests/interfaceschemadata/

* tests/Makefile.am (EXTRA_DIST): Add interfaceschemadata.

15 years agoRelease conn lock before reporting interface errors
Laine Stump [Wed, 22 Jul 2009 14:15:52 +0000 (16:15 +0200)]
Release conn lock before reporting interface errors

* src/datatypes.c: fix a lock problem on error handling, as the
  error report takes the lock, it must be released before, fixes
  the problem but just for Interface objects

15 years agoUpdate modified mac address in place in virGetInterface
Laine Stump [Wed, 22 Jul 2009 14:07:26 +0000 (16:07 +0200)]
Update modified mac address in place in virGetInterface

* src/datatypes.c: handle the nasty case where an interface
  mac address change, while it's already in use

15 years agoFix multiple memory leaks in virsh
Laine Stump [Wed, 22 Jul 2009 13:46:16 +0000 (15:46 +0200)]
Fix multiple memory leaks in virsh

* virsh.c: fix a number of leaks of virDomain, virStoragePool,
  virNodeDevice, etc.

15 years agoFix typo in storage cloning
Daniel P. Berrange [Fri, 17 Jul 2009 12:33:24 +0000 (13:33 +0100)]
Fix typo in storage cloning

15 years agoAdd support for network device detach
Mark McLoughlin [Fri, 17 Jul 2009 21:08:34 +0000 (22:08 +0100)]
Add support for network device detach

qemu network devices are hot-unplugged in two stages - first the PCI NIC
is removed using 'pci_del <pci_addr>' and then the backend is removed
using 'host_net_remove <vlan> <name>'.

In order to perform these operations we need to have retained the
PCI address, backend name and vlan number.

* src/qemu_driver.c: add qemudDomainDetachNetDevice()

15 years agoRetain PCI address from NIC attach
Mark McLoughlin [Fri, 17 Jul 2009 21:08:34 +0000 (22:08 +0100)]
Retain PCI address from NIC attach

When we pci_add a NIC, we need to retain the PCI address assigned by
qemu for using during detach.

* src/qemu_driver.c: use qemudParsePciAddReply() to pull the PCI
  address from the pci_add reply

* src/domain_conf.c: handle storing and parsing the PCI address in the
  domain state XML file

15 years agoRe-factor pci_add reply parsing and parse domain/bus numbers
Mark McLoughlin [Fri, 17 Jul 2009 21:08:34 +0000 (22:08 +0100)]
Re-factor pci_add reply parsing and parse domain/bus numbers

The current code for parsing pci_add replies ignores the the domain and
bus numbers. Re-write the code to rectify that.

Also, since pci_add is used for NIC hotplug as well ask disk hotplug,
re-factor the code into a separate function.

* src/qemu_driver.c: add qemudParsePciAddReply() function which can
  handle parsing domain and bus numbers

15 years agoRemove the network backend if NIC hotplug fails
Mark McLoughlin [Fri, 17 Jul 2009 21:08:34 +0000 (22:08 +0100)]
Remove the network backend if NIC hotplug fails

If we fail to pci_add a NIC, we should remove the network backend and
leave things the way we found them. To do that, we pre-allocate a
host_net_remove monitor command and issue that if the pci_add fails.
If the remove fails, we just log a warning.

We can only do this if we have a name for the network backend and
we know the vlan number its associated with.

* src/qemu_driver.c: host_net_remove the network backend if the
  pci_add fails

15 years agoBasic qemu NIC hotplug support
Mark McLoughlin [Fri, 17 Jul 2009 21:08:34 +0000 (22:08 +0100)]
Basic qemu NIC hotplug support

Implement basic NIC hotplug support using the 'host_net_add' and
'pci_add' qemu monitor commands.

For now, we don't support 'bridge' or 'network' types.

Also, if pci_add fails, we currently fail to remove the backend
which we added.

Finally, NIC hot-unplug support is missing.

* src/qemu_driver.c: add qemudDomainAttachNetDevice()

* src/qemu_conf.[ch]: export qemuBuildNicStr(), qemuBuildHostNetStr()
  and qemuAssignNames()

* src/libvirt_private.syms: export virDomainNetTypeToString()

15 years agoMake qemuCmdFlags available in qemudDomainAttachDevice()
Mark McLoughlin [Fri, 17 Jul 2009 21:08:34 +0000 (22:08 +0100)]
Make qemuCmdFlags available in qemudDomainAttachDevice()

qemudDomainChangeEjectableMedia() currently extracts the qemu command
line flags, but other device attaching code might need it, so move
the qemudExtractVersionInfo() call up a frame.

* src/qemu_driver.c: move the qemudExtractVersionInfo() call from
  qemudDomainChangeEjectableMedia() to qemudDomainAttachDevice()

15 years agoStore the interface vlan number in the domain state
Mark McLoughlin [Fri, 17 Jul 2009 21:08:34 +0000 (22:08 +0100)]
Store the interface vlan number in the domain state

Currently, an interface's vlan number corresponds to its index in
the table of network interfaces. That is no longer true when we
allow devices to be removed.

To fix this, we store the vlan number in the domain's state XML
so that it survives libvirtd restarts.

* src/domain_conf.h: add vlan number to virDomainNetDef

* src/domain_conf.c: store it in XML as <state vlan='N'/>, defaulting
  to -1 if this is state saved by a previous version of libvirt

* src/qemu_conf.c: assign vlan numbers before starting qemu

15 years agoAdd NIC and hostnet names to domain state XML
Mark McLoughlin [Fri, 17 Jul 2009 21:08:34 +0000 (22:08 +0100)]
Add NIC and hostnet names to domain state XML

The qemu driver needs to assign and keep track of identifiers for
network devices so that it can remove them. We need to keep this state
across libvirtd restarts, but it's not configuration that needs to
be kept across guest restarts.

* src/domain_conf.c: parse and format <state nic="foo" hostnet="bar"/>

15 years agoAssign names to qemu NICs and network backends
Mark McLoughlin [Fri, 17 Jul 2009 21:08:33 +0000 (22:08 +0100)]
Assign names to qemu NICs and network backends

We need these so that we can remove the devices via the monitor.

* src/domain_conf.h: add nic_name and hostnet_name to virDomainNetDef

* src/domain_conf.c: free nic_name and hostnet_name

* src/qemu_conf.c: add qemuAssignNetNames(), use it if qemu has
  support for the param and pass the names on the command line

* tests/qemuxml2argv*: add a test for this

15 years agoAdd checks for some NIC hotplug related features added in qemu-0.10.0
Mark McLoughlin [Fri, 17 Jul 2009 21:08:33 +0000 (22:08 +0100)]
Add checks for some NIC hotplug related features added in qemu-0.10.0

Add QEMUD_CMD_FLAG_NET_NAME to indicate that '-net ...,name=foo' is
supported and QEMUD_CMD_FLAG_HOST_NET_ADD to indicate that the
'host_net_add' monitor command is available.

Set both these flags if the qemu version is greater than 0.10.0.
Checking via the '-help' output would not work for the monitor command
and even for the command line arg, it would be quite fragile.

* src/qemu_conf.h: add new flags as aliases of QEMUD_CMD_FLAG_0_10

* src/qemu_conf.c: set QEMUD_CMD_FLAG_0_10 for versions >= 0.10.0

* tests/qemuhelptest.c: set QEMUD_CMD_FLAG_0_10 for the appropriate
  qemu versions

15 years agoFactor qemuBuildHostNetStr() out from qemuBuildCommandLine()
Mark McLoughlin [Fri, 17 Jul 2009 21:08:33 +0000 (22:08 +0100)]
Factor qemuBuildHostNetStr() out from qemuBuildCommandLine()

Re-factor this code so that it can be used for NIC hotplug
too. The awkward prefix and type_sep arguments are needed to
allow us to do "host_net_add tap vlan=..."

* src/qemu_conf.c: factor the net backend string formatting
  code into its own function

15 years agoFactor qemuBuildNicStr() out from qemuBuildCommandLine()
Mark McLoughlin [Fri, 17 Jul 2009 21:08:33 +0000 (22:08 +0100)]
Factor qemuBuildNicStr() out from qemuBuildCommandLine()

Re-factor this code so that it can be used for NIC hotplug
too. The awkward arguments are needed to allow use to do
"pci_add auto nic macaddr=..."

* src/qemu_conf.c: factor the nic string formatting code into
  its own function

15 years agoRetain disk PCI address across libvirtd restarts
Mark McLoughlin [Fri, 17 Jul 2009 21:08:33 +0000 (22:08 +0100)]
Retain disk PCI address across libvirtd restarts

When we hot-plug a disk device into a qemu guest, we need to retain its
PCI address so that it can be removed again later. Currently, we do
retain the slot number, but not across libvirtd restarts.

Add <state devaddr="xxxx:xx:xx"/> to the disk device XML config when the
VIR_DOMAIN_XML_INTERNAL_STATUS flag is used. We still don't parse the
domain and bus number, but the format allows us to do that in future.

* src/domain_conf.h: replace slotnum with pci_addr struct, add helper
  for testing whether the address is valid

* src/domain_conf.c: handle formatting and parsing the address

* src/qemu_driver.c: store the parsed slot number as a full PCI address,
  and use this address with the pci_del monitor command

* src/vbox/vbox_tmpl.c: we're debug printing slotnum here even though
  it can never be set, just delete it

15 years agoAdd internal XML parsing/formatting flag
Mark McLoughlin [Fri, 17 Jul 2009 21:08:33 +0000 (22:08 +0100)]
Add internal XML parsing/formatting flag

We need to store things like device names and PCI slot numbers in the
qemu domain state file so that we don't lose that information on
libvirtd restart. Add a flag to indicate that this information should
be parsed or formatted.

Make bit 16 and above of the flags bitmask for internal use only and
consume the first bit for this new status flag.

* include/libvirt/libvirt.h: add VIR_DOMAIN_XML_FLAGS_MASK

* src/libvirt.c: reject private flags in virDomainGetXMLDesc()

* src/domain_conf.h: add VIR_DOMAIN_XML_INTERNAL_STATUS

* src/domain_conf.c: pass the flag from virDomainObjParseXML() and
  virDomainSaveStatus

15 years agoRename variable for compilation in Mingw32
Laine Stump [Wed, 22 Jul 2009 08:32:03 +0000 (10:32 +0200)]
Rename variable for compilation in Mingw32

* src/virsh.c: rename interface into iface

15 years agoFix documentation of virStoragePoolUndefine return
Thomas Treutner [Wed, 22 Jul 2009 06:41:40 +0000 (08:41 +0200)]
Fix documentation of virStoragePoolUndefine return

* src/libvirt.c: the documented return was wrong

15 years agoFix typo in check for glusterfs format pools
Daniel P. Berrange [Tue, 21 Jul 2009 16:49:44 +0000 (12:49 -0400)]
Fix typo in check for glusterfs format pools

* src/storage_backend_fs.c: Replace = with == for comparison

15 years agoSet specific flags for glusterfs fs mounts
Harshavardhana [Tue, 21 Jul 2009 15:49:20 +0000 (17:49 +0200)]
Set specific flags for glusterfs fs mounts

* src/storage_backend_fs.c: due to Fuse O_DIRECT problem one need
  to mount glusterfs with direct-IO mode, until fixed

15 years agoFix reconnect bug for VBox
Pritesh Kothari [Tue, 21 Jul 2009 14:44:50 +0000 (16:44 +0200)]
Fix reconnect bug for VBox

* src/vbox/vbox_tmpl.c: reconnecting to vbox:///session was failing

15 years agoActivate the interface drivers, and cleanups
Daniel Veillard [Tue, 21 Jul 2009 14:15:39 +0000 (16:15 +0200)]
Activate the interface drivers, and cleanups

* src/libvirt.c: activate the interface drivers
* po/POTFILES.in: add the netcf driver as a source of localization strings
* src/interface_driver.c: NETCF_ENOMEM -> VIR_ERR_NO_MEMORY mapping was
  breaking syntax checking

15 years agoNetcf based interface driver implementation
Laine Stump [Tue, 21 Jul 2009 14:02:16 +0000 (16:02 +0200)]
Netcf based interface driver implementation

* src/interface_driver.c src/interface_driver.h: the new driver
* src/Makefile.am qemud/Makefile.am qemud/qemud.c: hook the new driver
  in the build system and get ti activated by the daemon
* src/libvirt_private.syms: export needed symbols internally

15 years agoAdd a test interface driver
Laine Stump [Tue, 21 Jul 2009 13:45:55 +0000 (15:45 +0200)]
Add a test interface driver

* test.c: includes an interface driver to the test framework

15 years agoRemove trailing blank lines
Daniel Veillard [Tue, 21 Jul 2009 13:43:11 +0000 (15:43 +0200)]
Remove trailing blank lines

15 years agoAdd interface object list manipulation functions
Laine Stump [Tue, 21 Jul 2009 13:40:55 +0000 (15:40 +0200)]
Add interface object list manipulation functions

* interface_conf.c interface_conf.h: utilities function usful for
  interface driver like the test interface driver

15 years agovirGetinterface matching of MAC and interface name
Laine Stump [Tue, 21 Jul 2009 13:37:20 +0000 (15:37 +0200)]
virGetinterface matching of MAC and interface name

MAC address of a particular interface may change over time, and the
reduced virInterface object (which contains just name and mac) needs
to reflect these changes. Since we can't modify the mac address of an
existing virInterface (some other thread may currently be using it) we
just create a new virInterface, and let the old one die a dignified
death when its refct goes to 0.
* src/datatypes.c: fix the matching and lifetime of virInterface object
  accordingly

15 years agoAdd an error code for conflicting mac addresses
Laine Stump [Tue, 21 Jul 2009 13:13:32 +0000 (15:13 +0200)]
Add an error code for conflicting mac addresses

* include/libvirt/virterror.h src/virterror.c: if a driver's
  virInterfaceLookupByMACString() function finds more than one interface
  with the desired MAC Address, this new error is raised.

15 years agoFix an uninitialized variable in Unix socket open
Jun Koi [Tue, 21 Jul 2009 09:57:54 +0000 (11:57 +0200)]
Fix an uninitialized variable in Unix socket open

* src/qemu_driver.c: qemudOpenMonitorUnix() had an uninitialized loop
  counter

15 years agorpm spec cleanup and split off client only package
Daniel Veillard [Tue, 21 Jul 2009 09:16:15 +0000 (11:16 +0200)]
rpm spec cleanup and split off client only package

* libvirt.spec.in: make a client rpm with shared libs, client binaries
  and resources needed by those, and a small number of fixes and
  cleanups in the spec file.

15 years agobuild: do not emit a trailing blank line into VC'd file, NEWS
Jim Meyering [Thu, 16 Jul 2009 20:46:43 +0000 (22:46 +0200)]
build: do not emit a trailing blank line into VC'd file, NEWS

* docs/Makefile.am ($(top_builddir)/NEWS): Adjust rule to filter
out any trailing blank lines when generating this file.
* NEWS: Regenerate, so that it contains entries for 0.6.5.

15 years agoRemove some unused variables and cut long lines
Daniel Veillard [Thu, 16 Jul 2009 20:04:24 +0000 (22:04 +0200)]
Remove some unused variables and cut long lines

* src/virsh.c: a bit of cleanup on previous commit

15 years agoAdd virsh commands for network interface management
Laine Stump [Thu, 16 Jul 2009 19:44:10 +0000 (21:44 +0200)]
Add virsh commands for network interface management

* src/virsh.c: add a number of interface related commands:
  iface-list, iface-name, iface-mac, iface-dumpxml, iface-define,
  iface-undefine, iface-edit, iface-start and iface-destroy

15 years agoFix gitweb link on download page.
Cole Robinson [Thu, 16 Jul 2009 15:50:38 +0000 (11:50 -0400)]
Fix gitweb link on download page.

15 years agoqemu: Try multiple times to open unix monitor socket
Cole Robinson [Tue, 14 Jul 2009 22:09:27 +0000 (18:09 -0400)]
qemu: Try multiple times to open unix monitor socket

Unlike the pty monitor (which we know exists since we scrape its path from
stdout), we have no way of knowing that the unix monitor socket should exist/
be initialized. As a result, some of my KVM guests randomly fail to start on
F10 host.

Try to open the unix socket in a 3 second timeout loop. Ignore EACCES (path
does not exist if a first time run) and ECONNREFUSED (leftover socket from
a previous run hasn't been removed yet). Fixes things for me.

15 years agostorage: Implement CreateVolFrom for logical and disk backend.
Cole Robinson [Thu, 9 Jul 2009 23:17:31 +0000 (19:17 -0400)]
storage: Implement CreateVolFrom for logical and disk backend.

With the previous refactoring, this is a simple process, since the global
'CreateBlockFrom' in storage_backend does all the work.

15 years agostorage: Don't try sparse detection if writing to block device.
Cole Robinson [Fri, 10 Jul 2009 18:04:27 +0000 (14:04 -0400)]
storage: Don't try sparse detection if writing to block device.

We don't gain any space savings, so skip the detection to speed up
the cloning operation.

15 years agostorage: Implement 'CreateBlockFrom' helper.
Cole Robinson [Thu, 9 Jul 2009 23:14:51 +0000 (19:14 -0400)]
storage: Implement 'CreateBlockFrom' helper.

Add a 'CreateBlockFrom' in the global storage_backend, which sets up the
destination block device: CopyFromFD does the rest of the cloning.

15 years agostorage: Break out actual raw cloning to separate function.
Cole Robinson [Thu, 25 Jun 2009 22:34:59 +0000 (18:34 -0400)]
storage: Break out actual raw cloning to separate function.

The CreateRaw function has some 'file' only assumptions, so break the agnostic
cloning bits to a separate function.

15 years agostorage: cleanup: do away with 'createFile'
Cole Robinson [Thu, 16 Jul 2009 16:27:07 +0000 (12:27 -0400)]
storage: cleanup: do away with 'createFile'

Have storage building functions be definitions of
virStorageBackendBuildVolFrom: we will need to do this in the future anyways
if we ever support the flags attribute.

15 years agostorage: Move most of the FS creation functions to common backend.
Cole Robinson [Thu, 16 Jul 2009 16:09:26 +0000 (12:09 -0400)]
storage: Move most of the FS creation functions to common backend.

These will be used by other pool cloning implementations.

15 years agostorage: Refactor FS backend 'create' function choosing.
Cole Robinson [Thu, 25 Jun 2009 21:28:23 +0000 (17:28 -0400)]
storage: Refactor FS backend 'create' function choosing.

Break out separate functions for

- Determining the supported '*-img' tool,
- The tool's associated create function,
- Desired function for cloning (CreateXMLFrom).

This will be eventually used to unify cloning across all backends.

15 years agostorage: Fix deadlock when cloning across pools.
Cole Robinson [Fri, 10 Jul 2009 16:56:12 +0000 (12:56 -0400)]
storage: Fix deadlock when cloning across pools.

We need to unlock the first pool before looking up the second, since the
search locks every pool it checks.

15 years agostorage: disk: Use capacity, not allocation, when creating volume.
Cole Robinson [Fri, 10 Jul 2009 13:05:20 +0000 (09:05 -0400)]
storage: disk: Use capacity, not allocation, when creating volume.

There isn't any way to dictate allocation when creating disk volumes, so
capacity is the only relevant value.

15 years agostorage: disk: Default to 'ext2' for new volumes.
Cole Robinson [Fri, 10 Jul 2009 13:02:30 +0000 (09:02 -0400)]
storage: disk: Default to 'ext2' for new volumes.

Currently, if no format is specified for a new disk volume, we pass the
invalid value "none" as the FS type to 'parted mkpart'.

There doesn't seem to be a way to have parted not format the drive, so
just default to using 'ext2' in this case: this shouldn't cause any harm,
since we are creating a new partition in the first place.

15 years agostorage: disk: Fix segfault creating volume without target path
Cole Robinson [Fri, 10 Jul 2009 01:51:36 +0000 (21:51 -0400)]
storage: disk: Fix segfault creating volume without target path

Remove unneeded target path duplication, which could carelessly dereference
NULL. Make it clear where 'key' is actually filled in.

15 years agostorage: disk: Fix parthelper '-g' option handling.
Cole Robinson [Fri, 10 Jul 2009 01:50:20 +0000 (21:50 -0400)]
storage: disk: Fix parthelper '-g' option handling.

Typo was breaking 'parthelper -g', preventing disk pool definition.