* 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.
* 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.
* 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
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
* 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
* 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
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
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"
* 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
* 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
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()
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
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
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
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()
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()
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
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"/>
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
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
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
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
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
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
* 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
* 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
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
* 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.