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.
* 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
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.
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.
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.
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.
* configure.in: Add --with-qemu-user and --with-qemu-group args
* libvirt.spec.in: use 'qemu' for user/group for Fedora >= 12
* qemud/libvirtd_qemu.arg, qemud/test_libvirtd_qemu.aug,
src/qemu.conf: Add 'user' and 'group' args for configuration
* src/Makefile.am: Create %localstatedir/cache/libvirt/qemu
* src/qemu_conf.c, src/qemu_conf.h: Load user/group from config
* src/qemu_driver.c: Change user ID/group ID when launching QEMU
guests. Change user/group ownership on disks/usb/pci devs.
Put memory dumps in %localstatedir/cache/libvirt/qemu
* src/util.c, src/util.h: Add convenient APIs for converting
username/groupname to user ID / group ID
* src/driver.h: add new driver functions virDrvNumOfDefinedInterfaces
and virDrvListDefinedInterfaces
* src/libvirt.c: implements the entry points, calling new driver
functions
* qemud/remote.c qemud/remote_dispatch_args.h qemud/remote_protocol.[chx]
qemud/remote_dispatch_prototypes.h qemud/remote_dispatch_ret.h
qemud/remote_dispatch_table.h src/remote_internal.c: implement the
client/server side of the RPC
* include/libvirt/libvirt.h[.in]: adds signatures for the new exported
functions virConnectNumOfDefinedInterfaces and
virConnectListDefinedInterfaces
* src/libvirt_public.syms: export the new symbols
Remove redundant error reporting functions which obscured the
filename/line number reporting. Removed code which created a
virDomain/virNetwork object, since those are silently dropped
in error reporting functions now
* src/remote_internal.c: Remove error() and errorf() in favour of
macros, and remove server_error in favour of direct call
Splits up the 'call' method moving generic IO code out into
separate method to allow it to be easily reused for sending
data streams
* src/remote_internal.c: Split 'call' into two methods, the first
with same name serializes a set of method arguments into a
message, the second 'remoteIO' takes a pre-serialized messages,
sends it and awaits a reply
* src/remote_internal.c: Rename processCallRecvMsg to
processCallDispatch, and move code specific to method replies
into processCallDispatchReply, and rename processCallAsyncEvent
to processCallDispatchMessage
The 'remote_message_header' struct has a mis-leadingly named
field 'direction'. It is really a reflection of the type of
message, and some types can be sent in either direction. Thus
the field is more accurately named 'type'. No function change.
* qemud/remote_protocol.x: Rename 'direction' to 'type' in
'remote_message_header. Write better docs describing the
message header field semantics & usage
* qemud/remote_protocol.c, qemud/remote_protocol.h: Regenerate
* qemud/remote.c, qemud/dispatch.c, src/remote_internal.c
Update to reflect rename of 'direction' to 'type'
The naming convention for structs used in the RPC layer is for
incoming requests to be called XXXX_args, and the associated
outgoing reply to be called XXXX_ret. Asynchronously emitted
messages (eg events) are re-using the XXXX_ret naming scheme.
This patch changes that such that async messages are XXXX_msg,
and stops adding entries for them in the dispatch table, avoiding
the need for a dummy no-op implementation.
* qemud/remote.c: Remove dummy remoteDispatchDomainEvent, no
longer required. Update to replace remote_domain_event_ret
with xdr_remote_domain_event_msg
* qemud/remote_protocol.x: Rename remote_domain_event_ret to
remote_domain_event_msg
* qemud/remote_generate_stubs.pl: Adding handling for new
XXX_msg structs.
* src/remote_internal.c: Rename remote_domain_event_ret to
remote_domain_event_msg
* qemud/remote_dispatch_prototypes.h, qemud/remote_dispatch_ret.h,
qemud/remote_dispatch_table.h, qemud/remote_protocol.h,
qemud/remote_protocol.c: auto-regenerate
* src/virsh.c: adds cd and pwd commands to virsh useful for save and
restore commands
* docs/virsh.pod virsh.1: update the documentation
* AUTHORS: add Paolo Bonzini
by running this command:
git ls-files -z | xargs -0 perl -pi -0777 -e 's/\n\n+$/\n/'
This is in preparation for a more strict make syntax-check
rule that will detect trailing blank lines.
* src/remote_internal.c: Disable libvirtd autostart if the
LIBVIRT_AUTOSTART=0 env variable is set
* src/libvirt.c: Document environment variables can impact
the virConnectOpen API
* src/interface_conf.c src/interface_conf.h: the import and export
routines and the internal APIs
* src/Makefile.am: hook the new file in the makefiles
* src/libvirt_private.syms: export a few private symbols internally
* po/POTFILES.in: the new file contains translatable strings
* qemud/remote.c: Send back the actual libvirt connection error
rather than formatting a generic error for security driver
methods
* src/libvirt.c: Fix virDomainGetSecurityLabel, and
virNodeGetSecurityModel to correctly set the error on
the virConnectPtr object, and raise a full error rather
than warning when not supported
The 'pipe' character type wasn't documented.
TCP uses a <protocol> element, not <wire>
We weren't doing strict validation for protocol and source mode values.
* src/domain_conf.c: replace open coded chr type parsing with
virDomainChrTypeFromString(), retaining the existing semantics
where unknown types are silently mapped to the "null" type and
"pty" is used if none is specified
We keep support for the pty based monitor so that we can re-connect
to VMs started by older versions of libvirtd.
* src/domain_conf.c: handle formatting and parsing unix monitors
* src/qemu_driver.c: add qemudOpenMonitorUnix(), remove the monitor
pty path searching from qemudFindCharDevicePTYs(), switch
qemudStartVMDaemon() and qemuDomainXMLToNative() to using a unix
monitor
* tests/qemuxml2argvtest.c: switch to using a unix monitor
* tests/qemuxml2argvdata/qemuxml2argv-*.args: update test data
There are no functional changes in this patch apart from adding the
monitor type to the state XML.
The patch mostly consists of switching to use virDomainChrDef every
where to describe the monitor.
* src/domain_conf.h: replace monitorpath with monitor_chr
* src/domain_conf.c: handle parsing the monitor type and initializing
monitor chr
* src/qemu_conf.[ch]: make qemudBuildCommandLine take a
virDomainChrDefPtr and use that to build the -monitor parameter
* src/qemu_driver.c: split pty specific and common code from
qemudOpenMonitor, have qemudStartVMDaemon() initialize monitor_chr
* tests/qemuxml2argvtest.c: update for qemudBuildCommandLine() change
* src/qemu_driver.c: vm->monitorpath is already initialized in the case
of re-connect, so move the initialization for the normal startup case
out of the common code
* src/qemu_conf.c, src/qemu_conf.h: Use -vga or -std-vga
when starting guests if video card is present
* tests/qemuhelptest.c: Change to use constants instead
of hardcoded hex numbers, and add VGA support
* tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml,
tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args,
tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml,
tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.args,
tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml,
tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml,
tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml,
tests/qemuxml2argvdata/qemuxml2argv-input-xen.xml: Add <video>
element for testing graphics adapter
* tests/qemuxml2argvtest.c: Add QEMUD_CMD_FLAG_VGA flag
* tests/qemuxml2xmltest.c: Add missing graphics-vnc-sasl/tls tests
* docs/schemas/domain.rng: Define <video> element schema
* src/domain_conf.c, src/domain_conf.h, src/libvirt_private.syms:
Add parsing and formatting for <video> element
* src/network_driver.c src/node_device.c src/storage_driver.c:
many places in the code reported 'No xxx with matching name" after
a Lookup error without reporting the name used by the failed lookup
Fixes startup of guest's with sourceless cdrom devices.
Patch from Cole Robinson originally posted here:
https://bugzilla.redhat.com/499569
but never sent upstream.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
As pointed out by Tim Waugh here:
https://bugzilla.redhat.com/507555
We shouldn't bother trying to set the context of a file if it already
matches what we want.
(Fixed to use STREQ() and not use tabs, as pointed out by danpb)
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
This patch was posted ages ago here:
https://bugzilla.redhat.com/493692
But was never posted upstream AFAICT.
Patch from Dan Berrange
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
* docs/schemas/network.rng: fix the network schemas to match
new accepted elements, patch by Satoru SATOH
* src/network_conf.c: fix network driver to save the domain name
in XML if present, patch by Satoru SATOH
* AUTHORS: adding Satoru SATOH
Daniel
* src/libvirt.c src/virterror.c: fix some missing comments in public
modules.
* docs/libvirt-api.xml docs/libvirt-refs.xml
docs/devhelp/libvirt-libvirt.html docs/html/libvirt-libvirt.html:
regenerated documentation
* po/*: updated the polish localization and regenerated
Daniel
* docs/logging.html[.in] qemud/libvirtd.conf qemud/qemud.c
src/logging.[ch]: cleanup the logging code and docs to remove
all references to log level 0, cleanup hardcoded values and add
a default VIR_LOG_DEFAULT value, patch by Amy Griffis
daniel