]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
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.

15 years agobuild: submodule machinery now works also when no tag is reachable
Jim Meyering [Wed, 15 Jul 2009 07:54:26 +0000 (09:54 +0200)]
build: submodule machinery now works also when no tag is reachable

The code in cfg.mk to detect when the git submodule was out of date
worked most of the time, but not when checked out in a certain way.
* cfg.mk: Extract submodule hash from command output and file,
and compare only that, since the format of the full line may vary.
Reported by Mike Burns, with some diagnosis by Daniel P Berrange.

15 years agoRun QEMU guests as an unprivileged user
Daniel P. Berrange [Wed, 15 Jul 2009 21:25:01 +0000 (22:25 +0100)]
Run QEMU guests as an unprivileged user

* 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

15 years agoImplement the new virinterface functions
Laine Stump [Thu, 16 Jul 2009 15:58:15 +0000 (17:58 +0200)]
Implement the new virinterface functions

* 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

15 years agoPublic API for new virInterface functions
Laine Stump [Thu, 16 Jul 2009 15:49:50 +0000 (17:49 +0200)]
Public API for new virInterface functions

* include/libvirt/libvirt.h[.in]: adds signatures for the new exported
  functions virConnectNumOfDefinedInterfaces and
  virConnectListDefinedInterfaces
* src/libvirt_public.syms: export the new symbols

15 years agoFix configure flags in spec file
Daniel Veillard [Thu, 16 Jul 2009 15:28:41 +0000 (17:28 +0200)]
Fix configure flags in spec file

* libvirt.spec.in: we were still using deprecated configure switches

15 years agoRename a bunch of internal methods to clarify their meaning
Daniel P. Berrange [Fri, 10 Jul 2009 16:54:23 +0000 (17:54 +0100)]
Rename a bunch of internal methods to clarify their meaning

This renames a lot of the methods in the remote driver client
to more accurately reflect their responsibility of IO handling
vs message handling.

15 years agoSimplify remote driver error reporting
Daniel P. Berrange [Fri, 10 Jul 2009 16:11:31 +0000 (17:11 +0100)]
Simplify remote driver error reporting

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

15 years agoRefactor message sending to allow code reuse for data streams
Daniel P. Berrange [Fri, 10 Jul 2009 15:10:56 +0000 (16:10 +0100)]
Refactor message sending to allow code reuse for data streams

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

15 years agoRefactor incoming message handling to prepare for data stream support
Daniel P. Berrange [Fri, 10 Jul 2009 15:03:22 +0000 (16:03 +0100)]
Refactor incoming message handling to prepare for data stream support

* src/remote_internal.c: Rename processCallRecvMsg to
  processCallDispatch, and move code specific to method replies
  into processCallDispatchReply, and rename processCallAsyncEvent
  to processCallDispatchMessage

15 years agoRename 'direction' to 'type' in remote_message_header
Daniel P. Berrange [Fri, 10 Jul 2009 12:02:08 +0000 (13:02 +0100)]
Rename 'direction' to 'type' in remote_message_header

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'

15 years agoDefine an API for registering incoming message dispatch filters
Daniel P. Berrange [Fri, 10 Jul 2009 11:58:22 +0000 (12:58 +0100)]
Define an API for registering incoming message dispatch filters

All incoming messages currently get routed to the generic method
remoteDispatchClientRequest() for processing. To allow incoming
data stream messages to bypass this and be routed to a specific
location, a concept of dispatch filters is introduced.

* qemud/qemud.h: Add a qemud_client_filter struct and a callback
  qemud_client_filter_func. Maintain a list of filters on every
  struct qemud_client
* qemud/qemud.c: Move remoteDecodeClientMessageHeader() out of
  qemudWorker() into qemudDispatchClientRead(). Check registered
  message filters in qemudDispatchClientRead() to decide where
  to send incoming messages for dispatch.

15 years agoSplit out code for handling incoming method call messages
Daniel P. Berrange [Fri, 10 Jul 2009 11:53:54 +0000 (12:53 +0100)]
Split out code for handling incoming method call messages

The remoteDispatchClientRequest() method is currently hardwired to
assume there is only one type of incoming message, a method call.
To allow for alternate types of incoming messags, the code that is
specific to method calls is being split into a separate method
remoteDispatchClientCall

* qemud/dispatch.c: Move method call specific code out into
  remoteDispatchClientCall. Add a helper remoteSerializeError
  for returning error messages to client

15 years agoChange the way client event loop watches are managed
Daniel P. Berrange [Fri, 10 Jul 2009 11:48:50 +0000 (12:48 +0100)]
Change the way client event loop watches are managed

The current qemudRegisterClientEvent() code is used both for
registering the initial socket watch, and updating the already
registered watch. This causes unneccessary complexity in alot
of code which only cares about updating existing watches. The
updating of a watch cannot ever fail, nor is a reference to the
'qemud_server' object required.

This introduces a new qemudUpdateClientEvent() method for that
case, allowing the elimination of unneccessary error checking
and removal of the server back-reference in struct qemud_client.

* qemud/qemud.h: Remove 'server' field from struct qemud_client.
  Add qemudUpdateClientEvent() method. Remove 'update' param
  from qemudRegisterClientEvent method
* qemud/dispatch.c, qemud/qemud.c, qemud/remote.c: Update alot
  of code to use qemudUpdateClientEvent() instead of
  qemudRegisterClientEvent(). Move more logic from remoteRelayDomainEvent
  into remoteDispatchDomainEventSend.

15 years agoMove queuing of RPC replies into dispatch code
Daniel P. Berrange [Fri, 10 Jul 2009 11:45:37 +0000 (12:45 +0100)]
Move queuing of RPC replies into dispatch code

This removes an assumption from qemudWorker() code that every
incoming message will generate a reply.

* qemud/dispatch.c: remoteDispatchClientRequest now has responsibility
  for queuing the reply message to the RPC call
* qemud/qemud.c: Do not queue the RPC call reply in qemudWorker(),
  allowing remoteDispatchClientRequest() to take care of it

15 years agoChange code generator to give async event messages their own postfix
Daniel P. Berrange [Fri, 10 Jul 2009 11:38:41 +0000 (12:38 +0100)]
Change code generator to give async event messages their own postfix

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

15 years agoSeparate code for encoding outgoing remote message headers
Daniel P. Berrange [Fri, 10 Jul 2009 11:31:39 +0000 (12:31 +0100)]
Separate code for encoding outgoing remote message headers

Introduces an API for encoding the header field for outgoing messages
allowing some duplicated code to be eliminated

* qemud/dispatch.c, qemud/dispatch.h: add remoteEncodeClientMessageHeader
  for encoding message header. Update remoteDispatchClientRequest to
  use this method.
* qemud/remote.c: Update remoteDispatchDomainEventSend to use the
  generic remoteEncodeClientMessageHeader() for encoding event
  message hedaders. Push some logic from remoteRelayDomainEvent
  down into remoteDispatchDomainEventSend.

15 years agoDecode incoming request header before invoking dispatch code
Daniel P. Berrange [Fri, 10 Jul 2009 11:26:00 +0000 (12:26 +0100)]
Decode incoming request header before invoking dispatch code

Separate the decoding of incoming request header out from the
dispatch code. This will allow later code to making dispatcher
routing decisions based on the header field data.

* qemud/dispatch.c, qemud/dispatch.h: Add remoteDecodeClientMessageHeader
  API for decoding the header of a client message. Update the
  remoteDispatchClientRequest method to assume a pre-decoded
  header.
* qemud/qemud.h: Include a 'remote_message_header' field in
  'struct qemud_client_message' for pre-decoded header data
* qemud/qemud.c: Decode the incoming client message header before
  invoking remoteDispatchClientRequest

15 years agoSplit generic RPC message dispatch code out from remote protocol API handlers
Daniel P. Berrange [Fri, 10 Jul 2009 11:20:03 +0000 (12:20 +0100)]
Split generic RPC message dispatch code out from remote protocol API handlers

* po/POTFILES.in: Add qemud/dispatch.c
* qemud/dispatch.c, qemud/dispatch.h: Generic code handling dispatch of
  RPC messages.
* qemud/Makefile.am: Add dispatch.c to build
* qemud/qemud.c: Include dispatch.h
* qemud/qemud.h: Remove remoteDispatchClientRequest, remoteRelayDomainEvent
  now in dispatch.h
* qemud/remote.c: Remove remoteDispatchClientRequest, remoteRelayDomainEvent
  now in dispatch.c, and dispatch_args, dispatch_ret, dispatch_fn & dispatch_data
  now in remote.h
* qemud/remote.h: Add typedefs for dispatch_args, dispatch_ret,
  dispatch_fn, dispath_data. Add remoteGetDispatchData() API

15 years agoImplement qemu dump capabilities
Paolo Bonzini [Thu, 16 Jul 2009 14:50:23 +0000 (16:50 +0200)]
Implement qemu dump capabilities

* src/qemu_driver.c (qemudDomainCoreDump): New
  (qemuDriver): Add core dump function. The behaviour is similar
  as the current Xen dump

15 years agoadd cd and pwd commands to virsh
Paolo Bonzini [Thu, 16 Jul 2009 14:40:08 +0000 (16:40 +0200)]
add cd and pwd commands to virsh

* 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

15 years agomake "make syntax-check" consistent with "git diff --check"
Jim Meyering [Thu, 16 Jul 2009 07:06:58 +0000 (09:06 +0200)]
make "make syntax-check" consistent with "git diff --check"

This makes "make syntax-check" fail when a version-controlled
file contains a trailing blank line.
* cfg.mk (sc_prohibit_trailing_blank_lines): New rule.

15 years agoremove all trailing blank lines
Jim Meyering [Thu, 16 Jul 2009 06:25:36 +0000 (08:25 +0200)]
remove all trailing blank lines

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.

15 years agoFix free of unitialized data upon PCI open fail
Daniel P. Berrange [Thu, 16 Jul 2009 12:23:32 +0000 (13:23 +0100)]
Fix free of unitialized data upon PCI open fail

15 years agoFix SELinux denial during hotplug
Daniel P. Berrange [Mon, 6 Jul 2009 15:01:55 +0000 (16:01 +0100)]
Fix SELinux denial during hotplug

* src/qemu_driver.c: Relabel disk images *before* running QEMU
hotplug monitor commands

15 years agoFix PCI device hotplug/unplug with newer QEMU
Daniel P. Berrange [Mon, 6 Jul 2009 14:58:55 +0000 (15:58 +0100)]
Fix PCI device hotplug/unplug with newer QEMU

* src/qemu_driver.c: Try new monitor syntax for hotplug first. If
  that fails fallback to old KVM specific syntax

15 years agoFix problem with QEMU monitor welcome prompt confusing libvirt
Daniel P. Berrange [Mon, 6 Jul 2009 14:45:04 +0000 (15:45 +0100)]
Fix problem with QEMU monitor welcome prompt confusing libvirt
after a libvirtd daemon restart with active guests

* src/qemu_driver: Read and dicard pending monitor data
  before issuing new monitor commands.

15 years agoEnsure spawned children have a stderr/out set to /dev/null if requested
Daniel P. Berrange [Mon, 6 Jul 2009 17:43:38 +0000 (18:43 +0100)]
Ensure spawned children have a stderr/out set to /dev/null if requested

15 years agoAllow autostart of libvirtd to be disabled with LIBVIRT_AUTOSTART=0
Daniel P. Berrange [Mon, 6 Jul 2009 17:43:21 +0000 (18:43 +0100)]
Allow autostart of libvirtd to be disabled with LIBVIRT_AUTOSTART=0

* 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

15 years agonetcf XML validation and input and output tests
Daniel Veillard [Wed, 15 Jul 2009 17:50:34 +0000 (19:50 +0200)]
netcf XML validation and input and output tests

* tests/interfaceschematest: test all XML data against the interface
  schemas
* tests/interfacexml2xmltest.c: parse and reserialize all XML data
  and check the output is identical
* tests/Makefile.am: hook up the tests
* tests/.gitignore: add ignore test

15 years agoAdd netcf XML schemas and test data
Daniel Veillard [Wed, 15 Jul 2009 17:37:20 +0000 (19:37 +0200)]
Add netcf XML schemas and test data

* docs/schemas/interface.rng: schemas for the interface XML files
  directly imported from netcf-0.1.0
* tests/interfaceschemadata/*.xml: set of test files from netcf-0.1.0
  changed to use single quote instead of double quote

15 years agoadd support for netcf XML import and export
Daniel Veillard [Wed, 15 Jul 2009 17:34:04 +0000 (19:34 +0200)]
add support for netcf XML import and export

* 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

15 years agoEnsure test:/// URIs get routed to the non-privileged libvirtd
Daniel P. Berrange [Fri, 10 Jul 2009 12:14:23 +0000 (13:14 +0100)]
Ensure test:/// URIs get routed to the non-privileged libvirtd

* src/remote_internal.c: Ensure that all test:/// URIs are dealt
  with by the auto-started, per-user unprivileged libvirtd instances

15 years agoFix error reporting for security driver over remote protocol
Daniel P. Berrange [Wed, 15 Jul 2009 09:36:32 +0000 (10:36 +0100)]
Fix error reporting for security driver over remote protocol

* 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

15 years agoUpdate the links for RHEL libvirt bugzillas
Garry Dolley [Wed, 15 Jul 2009 09:46:52 +0000 (11:46 +0200)]
Update the links for RHEL libvirt bugzillas

15 years agoUpdate links to bugzilla
Garry Dolley [Mon, 13 Jul 2009 08:31:24 +0000 (10:31 +0200)]
Update links to bugzilla

* docs/bugs.html[.in]: general tickets are under the 'Virtualization
  Tools' product category and Fedora specific tickets are under the
  'Fedora' product category.

15 years agoFix docs and code disagreements for character devices.
Cole Robinson [Wed, 8 Jul 2009 21:59:23 +0000 (17:59 -0400)]
Fix docs and code disagreements for character devices.

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.

15 years agoqemu: Check driver is initialized up front, to avoid segfault.
Cole Robinson [Wed, 8 Jul 2009 21:59:22 +0000 (17:59 -0400)]
qemu: Check driver is initialized up front, to avoid segfault.

If the qemu_driver was not initialized (possibly due to an error on driver
startup), we can segfault if attempting to connect to the URI.

15 years agobuild: automatically rerun ./bootstrap when needed
Jim Meyering [Fri, 10 Jul 2009 08:01:04 +0000 (10:01 +0200)]
build: automatically rerun ./bootstrap when needed

When "git pull" (or any other operation) brings in a new version of the
gnulib git submodule, you must rerun the autogen.sh script.  With this
change, "make" now fails and tells you to run ./autogen.sh, when needed.
* autogen.sh: Maintain a new file, .git-module-status, containing
the current submodule status.  If it doesn't exist or its content
is different from what "git submodule status" prints, then run
./bootstrap
* .gitignore: Add .git-module-status
* cfg.mk: Diagnose out of date submodule and fail.
* README-hacking: Update not to mention bootstrap.
* Makefile.am (MAINTAINERCLEANFILES): Add .git-module-status,
so that "make maintainerclean" will remove it.

15 years agobuild: make autogen.sh use autoreconf -if
Jim Meyering [Fri, 10 Jul 2009 10:06:36 +0000 (12:06 +0200)]
build: make autogen.sh use autoreconf -if

* autogen.sh: Use "autoreconf -if" instead of open-coding it with
manual and unconditional invocation of each separate tool.

15 years agoUse virDomainChrTypeFromString() instead of open coding
Mark McLoughlin [Fri, 10 Jul 2009 08:33:34 +0000 (09:33 +0100)]
Use virDomainChrTypeFromString() instead of open coding

* 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

15 years agoSwitch to using a unix socket for the qemu monitor
Mark McLoughlin [Thu, 9 Jul 2009 17:33:40 +0000 (18:33 +0100)]
Switch to using a unix socket for the qemu monitor

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

15 years agoAdd the monitor type to the domain state XML
Mark McLoughlin [Thu, 9 Jul 2009 17:06:38 +0000 (18:06 +0100)]
Add the monitor type to the domain state XML

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

15 years agoMinor qemu monitor coding style fixes
Mark McLoughlin [Thu, 9 Jul 2009 15:28:36 +0000 (16:28 +0100)]
Minor qemu monitor coding style fixes

* src/qemu_driver.c: use a consistent coding style for function
  definitions

15 years agoDon't leak vm->monitorpath on re-connect
Mark McLoughlin [Thu, 9 Jul 2009 15:02:19 +0000 (16:02 +0100)]
Don't leak vm->monitorpath on re-connect

* 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

15 years agobuild: update from gnulib, for latest maint.mk
Jim Meyering [Thu, 9 Jul 2009 18:02:31 +0000 (20:02 +0200)]
build: update from gnulib, for latest maint.mk

* gnulib: Update submodule to latest.
This fixes the make syntax-check failure whereby sc_po_check
would complain about cfg.mk.

15 years agoavoid a "make syntax-check" failure
Jim Meyering [Thu, 9 Jul 2009 18:00:37 +0000 (20:00 +0200)]
avoid a "make syntax-check" failure

* .x-sc_avoid_if_before_free: Ignore *all* ChangeLog files,
now, including ChangeLog-old.

15 years agoFix wierd build problems due to autopoint overwriting gnulib m4
Daniel P. Berrange [Thu, 9 Jul 2009 11:18:14 +0000 (12:18 +0100)]
Fix wierd build problems due to autopoint overwriting gnulib m4

* Makefile.am: List -I m4 first, in ACLOCAL_AMFLAGS
* .gitignore: ignore gnulib/, ChangeLog, *rej, *orig, *#*# (emacs
  temporary files)

15 years agodoc: clone+build instructions
Jim Meyering [Wed, 8 Jul 2009 19:37:59 +0000 (21:37 +0200)]
doc: clone+build instructions

* README-hacking: New file.
* bootstrap: Remove obsolete comments.

15 years agobuild: adjust aclocal's search patch to prefer gnulib's m4 files.
Jim Meyering [Wed, 8 Jul 2009 19:27:41 +0000 (21:27 +0200)]
build: adjust aclocal's search patch to prefer gnulib's m4 files.

* Makefile.am (ACLOCAL_AMFLAGS): Search gnulib/m4/ before m4/.

15 years agogenerate ChangeLog from git logs into distribution tarball
Jim Meyering [Wed, 8 Jul 2009 06:54:25 +0000 (08:54 +0200)]
generate ChangeLog from git logs into distribution tarball

No longer maintain a version-controlled ChangeLog file, but do
continue to include a ChangeLog file in distribution tarball.
* Makefile.am (gen-ChangeLog): New rule.
(dist-hook): Depend on it.
(EXTRA_DIST): Add ChangeLog-old.
* bootstrap (modules): Add gitlog-to-changelog.
* ChangeLog: Remove file.  Renamed to...
* ChangeLog-old: ...this.  New file.
* autogen.sh: Touch ChangeLog, to ensure it exists.  For automake.

15 years agouse gnumakefile and maintainer-makefile modules from gnulib
Jim Meyering [Tue, 7 Jul 2009 16:08:45 +0000 (18:08 +0200)]
use gnumakefile and maintainer-makefile modules from gnulib

* bootstrap (modules): Add gnumakefile and maintainer-makefile.
* GNUmakefile: Remove file, now provided by gnulib.
* Makefile.maint: Remove.  Replaced by maint.mk from gnulib.
.gitignore: Add GNUmakefile and maint.mk.
* cfg.mk (prev_version_file): Disable this feature.
Setting this to /dev/null avoids an otherwise harmless diagnostic.

15 years agoremove all .cvsignore files
Jim Meyering [Tue, 7 Jul 2009 10:05:18 +0000 (12:05 +0200)]
remove all .cvsignore files

15 years agomake .gnulib a submodule
Jim Meyering [Tue, 7 Jul 2009 09:22:52 +0000 (11:22 +0200)]
make .gnulib a submodule

This makes it so we record (via a git submodule)
a snapshot of whatever version of gnulib we're using,
and none of gnulib sources are in the libvirt repository.
The result is that we have as much reproducibility as when
we version-controlled imported copies of the gnulib sources,
but without the hassle of the manual process we used when
syncing with upstream.

Note that when you clone libvirt, you get only the libvirt
repository, but when you first run ./bootstrap, it clones
gnulib (at the SHA1 recorded via the submodule), creating
the .gnulib/ hierarchy.  Then, the bootstrap script runs
gnulib-tool to populate gnulib/ with the files that make
up the selected modules.

Put the following in your ~/.gitconfig file.
[alias]
  syncsub = submodule foreach git pull origin master

The update procedure is simple:
  git syncsub
  ...build & test...
  git commit -m 'gnulib: sync submodule to latest' .gnulib

* .gitmodules: New file.
* .gnulib: Initialize.
* bootstrap: Set up to use the new submodule.
Stop using --no-vc-files.
Don't remove .gitignore files.
Don't use or create .cvsignore.
Diagnose an invalid --gnulib-srcdir=DIR argument.
* build-aux/vc-list-files: Delete file, now pulled from gnulib.
* build-aux/useless-if-before-free: Likewise.
* po/POTFILES.in: Remove gnulib/lib/gai_strerror.c, since
it no longer contains translatable strings.
* gnulib/*: Remove gnulib/ hierarchy.

15 years agoskip some of gnulib's new rules
Jim Meyering [Mon, 6 Jul 2009 17:17:06 +0000 (19:17 +0200)]
skip some of gnulib's new rules

* cfg.mk (local-checks-to-skip): Add these: sc_error_message_uppercase,
sc_program_name, sc_require_test_exit_idiom, sc_makefile_check.

15 years agoPrepare to use maint.mk from gnulib
Jim Meyering [Mon, 6 Jul 2009 16:28:10 +0000 (18:28 +0200)]
Prepare to use maint.mk from gnulib

Since Makefile.maint will soon come from gnulib's maint.mk,
sync Makefile.maint to have the same contents (modulo minor
things).  In syncing it, we have to remove some libvirt-specific
rules.  Since we want to keep them (of course), put those in cfg.mk.
* Makefile.maint: Merge from gnulib's maint.mk.
* cfg.mk (sc_avoid_write): New rule.  From Makefile.cfg.
(sc_prohibit_strcmp_and_strncmp): Likewise, and rename.
(sc_prohibit_asprintf, sc_prohibit_VIR_ERR_NO_MEMORY): Likewise.
(sc_prohibit_nonreentrant): Likewise.
(sc_prohibit_ctype_h): Likewise.
(sc_TAB_in_indentation, sc_avoid_ctype_macros): Likewise.
(sc_prohibit_virBufferAdd_with_string_literal): Likewise.
(sc_prohibit_gethostby): Likewise.
(sc_libvirt_unmarked_diagnostics): Likewise.  Also, rename the
rule, inserting "_libvirt", since this rule is a specialization of
the one in gnulib.
* GNUmakefile: Include cfg.mk, not Makefile.cfg
* .x-sc_prohibit_strcmp_and_strncmp: New file.
* Makefile.am (EXTRA_DIST): Add .x-sc_prohibit_strcmp_and_strncmp

15 years ago* Makefile.cfg: Rename to...
Jim Meyering [Mon, 6 Jul 2009 16:23:44 +0000 (18:23 +0200)]
* Makefile.cfg: Rename to...

* cfg.mk: ...this.  New file.