Commit Graph

1863 Commits

Author SHA1 Message Date
Mark McLoughlin
9de2972c30 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
2009-07-27 15:31:51 +01:00
Mark McLoughlin
be44cabd7f 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
2009-07-27 15:31:51 +01:00
Mark McLoughlin
32db8dd75b 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
2009-07-27 15:31:51 +01:00
Mark McLoughlin
a3f33b6531 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
2009-07-27 15:31:51 +01:00
Mark McLoughlin
707302b2cf 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()
2009-07-27 15:30:35 +01:00
Mark McLoughlin
0f15d0344d 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
2009-07-27 15:30:17 +01:00
Mark McLoughlin
c14c6b083e 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
2009-07-27 15:17:55 +01:00
Mark McLoughlin
be291b330a 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()
2009-07-27 15:17:55 +01:00
Mark McLoughlin
38fd207e53 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
2009-07-27 15:17:55 +01:00
Mark McLoughlin
d412487eb7 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()
2009-07-27 15:17:55 +01:00
Mark McLoughlin
7803e6f3ed 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()
2009-07-27 15:17:55 +01:00
Matthias Bolte
84255632cb 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.
2009-07-27 14:27:09 +02:00
Matthias Bolte
b557a36890 Allow leading dots in VMX config entry names
* src/conf.c: the virConfParser must accept leading dot when in VMX mode
2009-07-27 14:21:17 +02:00
Matthias Bolte
e4e50f52e8 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.
2009-07-27 14:18:25 +02:00
Matthias Bolte
e74d6c5009 Fix memory leaks in esxDomainDumpXML
* src/esx/esx_driver.c: remove leaks in esxDomainDumpXML() and simplify
  esxDomainXMLFromNative()
2009-07-27 14:13:11 +02:00
Cole Robinson
b4ad955d9e test: Implement BlockStats and InterfaceStats
We fake stats values based on the current time, similar to how it's done
for cpu time.
2009-07-26 17:26:15 -04:00
Cole Robinson
3b4a542c06 test: Generate net interface names when assigning XML.
We need interface names to implement InterfaceStats.
2009-07-26 17:25:46 -04:00
Cole Robinson
13f3d40cbf 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.
2009-07-26 17:25:20 -04:00
Daniel P. Berrange
484640eaf6 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
2009-07-24 17:20:50 +01:00
Pritesh Kothari
41e097e91a 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
2009-07-24 18:12:16 +02:00
Daniel P. Berrange
1112330e46 Fix cgroup compile warnings
* src/cgroup.c: Fix cast to uint64 from unsigned long long
2009-07-24 16:11:00 +01:00
Eduardo Otubo
a7a82f9889 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
2009-07-24 16:17:06 +02:00
Matthias Bolte
e2aeee6811 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
2009-07-23 22:25:34 +02:00
Daniel P. Berrange
f4c3acdf35 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.
2009-07-23 17:38:06 +01:00
Daniel P. Berrange
e88d638ac6 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.
2009-07-23 17:38:06 +01:00
Daniel P. Berrange
55bc5090b9 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
2009-07-23 17:38:06 +01:00
Daniel P. Berrange
38f6f47be9 Place every QEMU guest in a private cgroup
* src/qemu_driver.c: Place guest in cgroup upon startup. Remove
  cgroup upon shutdown
2009-07-23 17:38:06 +01:00
Daniel P. Berrange
946c489c68 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
2009-07-23 17:38:06 +01:00
Daniel P. Berrange
de1ecd5302 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
2009-07-23 17:38:06 +01:00
Laine Stump
165ed4a00e 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
2009-07-23 18:27:47 +02:00
Daniel P. Berrange
ed5a25841f 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
2009-07-23 16:26:25 +01:00
Daniel P. Berrange
be18d3a732 Use virFileReadAll/virFileWriteStr for key cgroup read/write helpers 2009-07-23 16:20:13 +01:00
Daniel P. Berrange
6c5d4e7cf4 Use enums for cgroup controller types / labels 2009-07-23 16:19:31 +01:00
Daniel P. Berrange
5320ce02d8 Add domain autostart for LXC driver
* src/lxc_driver.c: Implement support for domain autostart
2009-07-23 16:11:35 +01:00
Daniel P. Berrange
9b5655a89e 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
2009-07-23 16:11:26 +01:00
Daniel P. Berrange
899ae0d2b5 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
2009-07-23 16:07:32 +01:00
Jim Paris
7922e247f1 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"
2009-07-22 20:51:28 +02:00
Laine Stump
647247740f 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.
2009-07-22 19:22:41 +02:00
Laine Stump
335f6bc251 Rename variable for compilation in Mingw32 (end)
* qemud/remote.c src/interface_conf.[ch] src/veth.[ch]: more renaming
  from interface to iface
2009-07-22 19:18:19 +02:00
Nguyen Anh Quynh
e4c48e02b4 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
2009-07-22 16:29:38 +02:00
Laine Stump
528d37bdfe 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
2009-07-22 16:15:52 +02:00
Laine Stump
fb1b7d8ed0 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
2009-07-22 16:07:26 +02:00
Laine Stump
d26d18a1a6 Fix multiple memory leaks in virsh
* virsh.c: fix a number of leaks of virDomain, virStoragePool,
  virNodeDevice, etc.
2009-07-22 15:46:16 +02:00
Daniel P. Berrange
2cc33bfe20 Fix typo in storage cloning 2009-07-22 12:40:02 +01:00
Mark McLoughlin
c2709cdaaa 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()
2009-07-22 11:34:07 +01:00
Mark McLoughlin
4e21a95afe 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
2009-07-22 11:34:07 +01:00
Mark McLoughlin
ffec099e75 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
2009-07-22 11:34:07 +01:00
Mark McLoughlin
d06f261cb1 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
2009-07-22 11:34:07 +01:00
Mark McLoughlin
35153940e3 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()
2009-07-22 11:34:06 +01:00
Mark McLoughlin
423af1977f 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()
2009-07-22 11:34:06 +01:00
Mark McLoughlin
30605477f2 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
2009-07-22 11:34:06 +01:00
Mark McLoughlin
36c820e6c8 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"/>
2009-07-22 11:34:06 +01:00
Mark McLoughlin
c23dae4e5c 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
2009-07-22 11:34:06 +01:00
Mark McLoughlin
948897687e 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
2009-07-22 11:34:06 +01:00
Mark McLoughlin
63e67ee013 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
2009-07-22 11:34:06 +01:00
Mark McLoughlin
ce2e300a4f 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
2009-07-22 11:34:06 +01:00
Mark McLoughlin
0165410712 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
2009-07-22 11:34:05 +01:00
Mark McLoughlin
aa98871c77 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
2009-07-22 11:34:05 +01:00
Laine Stump
1499e1d5f4 Rename variable for compilation in Mingw32
* src/virsh.c: rename interface into iface
2009-07-22 10:32:03 +02:00
Thomas Treutner
683241de5a Fix documentation of virStoragePoolUndefine return
* src/libvirt.c: the documented return was wrong
2009-07-22 08:41:40 +02:00
Daniel P. Berrange
6c3f7d7fd6 Fix typo in check for glusterfs format pools
* src/storage_backend_fs.c: Replace = with == for comparison
2009-07-21 12:49:44 -04:00
Harshavardhana
44948f5b69 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
2009-07-21 17:49:20 +02:00
Pritesh Kothari
e1506cb4eb Fix reconnect bug for VBox
* src/vbox/vbox_tmpl.c: reconnecting to vbox:///session was failing
2009-07-21 16:44:50 +02:00
Daniel Veillard
909d647aab 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
2009-07-21 16:15:39 +02:00
Laine Stump
da4f146f83 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
2009-07-21 16:02:16 +02:00
Laine Stump
3edbc2c4a9 Add a test interface driver
* test.c: includes an interface driver to the test framework
2009-07-21 15:45:55 +02:00
Daniel Veillard
d6fa6f3e92 Remove trailing blank lines 2009-07-21 15:43:11 +02:00
Laine Stump
846f694908 Add interface object list manipulation functions
* interface_conf.c interface_conf.h: utilities function usful for
  interface driver like the test interface driver
2009-07-21 15:40:55 +02:00
Laine Stump
9734c81f3a 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
2009-07-21 15:37:20 +02:00
Laine Stump
6eeca586d4 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.
2009-07-21 15:13:32 +02:00
Jun Koi
b2fd033cd5 Fix an uninitialized variable in Unix socket open
* src/qemu_driver.c: qemudOpenMonitorUnix() had an uninitialized loop
  counter
2009-07-21 11:57:54 +02:00
Daniel Veillard
86941f55d5 Remove some unused variables and cut long lines
* src/virsh.c: a bit of cleanup on previous commit
2009-07-16 22:04:24 +02:00
Laine Stump
6b56ac24df 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
2009-07-16 21:44:10 +02:00
Cole Robinson
3b5417687d 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.
2009-07-16 12:52:53 -04:00
Cole Robinson
fd06fd1442 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.
2009-07-16 12:52:52 -04:00
Cole Robinson
f23814e0cd 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.
2009-07-16 12:52:52 -04:00
Cole Robinson
7471357081 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.
2009-07-16 12:52:52 -04:00
Cole Robinson
a256fccfe1 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.
2009-07-16 12:52:52 -04:00
Cole Robinson
16e4833492 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.
2009-07-16 12:52:52 -04:00
Cole Robinson
6d7d465a04 storage: Move most of the FS creation functions to common backend.
These will be used by other pool cloning implementations.
2009-07-16 12:52:52 -04:00
Cole Robinson
1b16bf4ec7 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.
2009-07-16 12:52:52 -04:00
Cole Robinson
045176bf35 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.
2009-07-16 12:52:52 -04:00
Cole Robinson
a500d73ac0 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.
2009-07-16 12:52:52 -04:00
Cole Robinson
bd70595c9d 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.
2009-07-16 12:52:52 -04:00
Cole Robinson
12a6278135 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.
2009-07-16 12:52:51 -04:00
Cole Robinson
a3711708f7 storage: disk: Fix parthelper '-g' option handling.
Typo was breaking 'parthelper -g', preventing disk pool definition.
2009-07-16 12:52:51 -04:00
Daniel P. Berrange
0714b2ba4c 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
2009-07-16 17:06:55 +01:00
Laine Stump
d4ad29be2a 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
2009-07-16 17:58:15 +02:00
Laine Stump
043c954e9f 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
2009-07-16 17:49:50 +02:00
Daniel P. Berrange
5dd21f2a75 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.
2009-07-16 16:09:48 +01:00
Daniel P. Berrange
d65707a5b4 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
2009-07-16 16:09:48 +01:00
Daniel P. Berrange
9c9ed0f3f6 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
2009-07-16 16:09:48 +01:00
Daniel P. Berrange
7a61c13834 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
2009-07-16 16:09:48 +01:00
Daniel P. Berrange
27944fac9c 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'
2009-07-16 16:09:48 +01:00
Daniel P. Berrange
aa23d432cd 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
2009-07-16 16:09:47 +01:00
Paolo Bonzini
e1abc44814 Implement qemu dump capabilities
* src/qemu_driver.c (qemudDomainCoreDump): New
  (qemuDriver): Add core dump function. The behaviour is similar
  as the current Xen dump
2009-07-16 16:50:23 +02:00
Paolo Bonzini
c4951f11b7 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
2009-07-16 16:40:08 +02:00
Jim Meyering
07613d2020 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.
2009-07-16 15:06:42 +02:00
Daniel P. Berrange
4a7acedd3c Fix free of unitialized data upon PCI open fail 2009-07-16 13:57:44 +01:00
Daniel P. Berrange
1795bfe4a1 Fix SELinux denial during hotplug
* src/qemu_driver.c: Relabel disk images *before* running QEMU
hotplug monitor commands
2009-07-16 11:32:09 +01:00