]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
13 years agopython: add Python binding for virDomainGetVcpuPinInfo API
Taku Izumi [Mon, 25 Jul 2011 07:04:50 +0000 (15:04 +0800)]
python: add Python binding for virDomainGetVcpuPinInfo API

This patch adds the Python bindings for virDomainGetVcpuPinInfo API.
* python/generator.py: add it to generator skip list
* python/libvirt-override-api.xml: provide an override description
* python/libvirt-override.c: provide an override binding implementation

13 years agopython: add Python binding for virDomainPinVcpusFlags API
Taku Izumi [Mon, 25 Jul 2011 07:00:11 +0000 (15:00 +0800)]
python: add Python binding for virDomainPinVcpusFlags API

This patch adds the Python bindings for virDomainPinVcpuFlags API.
* python/generator.py: add it to the generator skip list
* python/libvirt-override-api.xml: provide override description
* python/libvirt-override.c: provide override bindings implementation

13 years agopython: add Python binding for virDomainGetSchedulerParametersFlags API
Taku Izumi [Mon, 25 Jul 2011 06:57:33 +0000 (14:57 +0800)]
python: add Python binding for virDomainGetSchedulerParametersFlags API

This patch adds the Python bindings for
virDomainGetSchedulerParametersFlags API.

13 years agopython: add Python binding for virDomainGetSchedulerParametersFlags API
Taku Izumi [Mon, 25 Jul 2011 06:54:34 +0000 (14:54 +0800)]
python: add Python binding for virDomainGetSchedulerParametersFlags API

This patch adds the Python bindings for
virDomainGetSchedulerParametersFlags API.
* python/libvirt-override-api.xml: provide and override description
* python/libvirt-override.c: implement the bindings

13 years agotests: detect gnutls errors
Eric Blake [Fri, 22 Jul 2011 20:10:39 +0000 (14:10 -0600)]
tests: detect gnutls errors

* tests/virnettlscontexttest.c (testTLSLoadKey): Report errors.

13 years agodriver.h: Fix two driver documentation mistakes
Wieland Hoffmann [Fri, 22 Jul 2011 15:53:16 +0000 (17:53 +0200)]
driver.h: Fix two driver documentation mistakes

13 years agobandwidth: Add domain schema and xml2xml tests
Michal Privoznik [Fri, 22 Jul 2011 14:07:29 +0000 (16:07 +0200)]
bandwidth: Add domain schema and xml2xml tests

13 years agobandwidth: Add test cases for network
Michal Privoznik [Fri, 22 Jul 2011 14:07:28 +0000 (16:07 +0200)]
bandwidth: Add test cases for network

13 years agobandwidth: Implement functions to enable and disable QoS
Michal Privoznik [Fri, 22 Jul 2011 14:07:27 +0000 (16:07 +0200)]
bandwidth: Implement functions to enable and disable QoS

These function executes 'tc' with appropriate arguments to set
desired QoS setting on interface or bridge during its creation.

13 years agobandwidth: Create format functions
Michal Privoznik [Fri, 22 Jul 2011 14:07:26 +0000 (16:07 +0200)]
bandwidth: Create format functions

13 years agobandwidth: Add parsing and free functions
Michal Privoznik [Fri, 22 Jul 2011 14:07:25 +0000 (16:07 +0200)]
bandwidth: Add parsing and free functions

These functions parse given XML node and return pointer to the
output. Unknown elements are silently ignored. Attributes must
be integer and must fit in unsigned long long.

Free function frees elements of virBandwidth structure.

13 years agobandwidth: Declare internal structures
Michal Privoznik [Fri, 22 Jul 2011 14:07:24 +0000 (16:07 +0200)]
bandwidth: Declare internal structures

13 years agobandwidth: Define schema and create documentation
Michal Privoznik [Fri, 22 Jul 2011 14:07:23 +0000 (16:07 +0200)]
bandwidth: Define schema and create documentation

Define new 'bandwidth' element with possible child element 'inbound'
and 'outbound' addressing incoming and outgoing traffic respectively:

<bandwidth>
  <inbound average='1000' peak='2000' burst='5120'/>
  <outbound average='500'/>
</bandwidth>

Leaving any element out means not to shape traffic in that
direction.
The units for average and peak (rate) are in kilobytes per second,
for burst (size) are just in kilobytes.
This element can be inserted into domain's 'interface' and
'network'.

13 years agonetwork: provide internal API to return IP of a network
Laine Stump [Thu, 7 Jul 2011 04:24:08 +0000 (00:24 -0400)]
network: provide internal API to return IP of a network

The new listenNetwork attribute needs to learn an IP address based on a
named network. This patch provides a function networkGetNetworkAddress
which provides that.

Some networks have an IP address explicitly in their configuration
(ie, those with a forward type of "none", "route", or "nat"). For
those, we can just return the IP address from the config.

The rest will have a physical device associated with them (either via
<bridge name='...'/>, <forward ... dev='...'/>, or possibly via a pool
of interfaces inside the network's <forward> element) and we will need
to ask the kernel for a current IP address of that device (via the
newly added ifaceGetIPAddress)

If networkGetNetworkAddress encounters an error while trying to learn
the address for a network, it will return -1. In the case that libvirt
has been compiled without the network driver, the call is a macro
which reduces to -2. This allows differentiating between a failure of
the network driver, and its complete absence.

13 years agoutil: add an ifaceGetIPAddress to the interface utilities
Laine Stump [Thu, 7 Jul 2011 04:15:08 +0000 (00:15 -0400)]
util: add an ifaceGetIPAddress to the interface utilities

This function uses ioctl(SIOCGIFADDR), which limits it to returning
the first IPv4 address of an interface, but that's what we want right
now (the place we're going to use the address only accepts one).

13 years agotests: fix compilation failures
Eric Blake [Fri, 22 Jul 2011 17:59:37 +0000 (11:59 -0600)]
tests: fix compilation failures

Even though gnutls is a hard-req for libvirt, and gnutls depends
on libtasn1, that does not mean that you have to have the libtasn1
development files installed.  Skip the test rather than failing
compilation in that case.

With newer gcc, the test consumed too much stack space.  Move
things to static storage to fix that.

* configure.ac (AC_CHECK_HEADERS): Check for libtasn1.h.
(HAVE_LIBTASN1): New automake conditional.
* tests/Makefile.am (virnettlsconvirnettlscontexttest_SOURCES)
(virnettlscontexttest_LDADD): Allow compilation without libtasn1.
* tests/virnettlscontexttest.c: Skip test if headers not present.
(struct testTLSCertReq): Alter time members.
(testTLSGenerateCert): Reflect the change.
(mymain): Reduce stack usage.

13 years agoPre-create /var/lib/libvirt/sanlock directory
Daniel P. Berrange [Fri, 22 Jul 2011 08:38:46 +0000 (09:38 +0100)]
Pre-create /var/lib/libvirt/sanlock directory

The sanlock plugin for libvirt expects the directory
/var/lib/libvirt/sanlock to exist. Create this and add
it to the RPM

* libvirt.spec.in: Add /var/lib/libvirt/sanlock
* src/Makefile.am: Create /var/lib/libvirt/sanlock

13 years agoHonour filesystem readonly flag & make special FS readonly
Daniel P. Berrange [Fri, 22 Jul 2011 12:08:20 +0000 (13:08 +0100)]
Honour filesystem readonly flag & make special FS readonly

A container should not be allowed to modify stuff in /sys
or /proc/sys so make them readonly. Make /selinux readonly
so that containers think that selinux is disabled.

Honour the readonly flag when mounting container filesystems
from the guest XML config

* src/lxc/lxc_container.c: Support readonly mounts

13 years agoRefactor mounting of special filesystems
Daniel P. Berrange [Fri, 22 Jul 2011 12:02:05 +0000 (13:02 +0100)]
Refactor mounting of special filesystems

Even in non-virtual root filesystem mode we should be mounting
more than just a new /proc. Refactor lxcContainerMountBasicFS
so that it does everything except for /dev and /dev/pts moving
that into lxcContainerMountDevFS. Pass in a source prefix
to lxcContainerMountBasicFS() so it can be used in both shared
root and private root modes.

* src/lxc/lxc_container.c: Unify mounting code for special
  filesystems

13 years agoPull code for doing a bind mount into separate method
Daniel P. Berrange [Fri, 22 Jul 2011 11:11:12 +0000 (12:11 +0100)]
Pull code for doing a bind mount into separate method

The bind mount setup is about to get more complicated.
To avoid having to deal with several copies, pull it
out into a separate lxcContainerMountFSBind method.

Also pull out the iteration over container filesystems,
so that it will be easier to drop in support for non-bind
mount filesystems

* src/lxc/lxc_container.c: Pull bind mount code out into
  lxcContainerMountFSBind

13 years agoFix typos in daemon config file from previous commit
Daniel P. Berrange [Fri, 22 Jul 2011 14:19:32 +0000 (15:19 +0100)]
Fix typos in daemon config file from previous commit

13 years agoAdd a test case for certificate validation
Daniel P. Berrange [Wed, 20 Jul 2011 18:04:18 +0000 (19:04 +0100)]
Add a test case for certificate validation

This test case checks certification validation rules for

 - Basic constraints
 - Key purpose
 - Key usage
 - Start/expiry times

It checks initial context creation sanity checks, and live
session validation

13 years agoAllow certificate sanity checking to be disabled
Daniel P. Berrange [Thu, 21 Jul 2011 10:13:11 +0000 (11:13 +0100)]
Allow certificate sanity checking to be disabled

When libvirtd starts it it will sanity check its own certs,
and before libvirt clients connect to a remote server they
will sanity check their own certs. This patch allows such
sanity checking to be skipped. There is no strong reason to
need to do this, other than to bypass possible libvirt bugs
in sanity checking, or for testing purposes.

libvirt.conf gains tls_no_sanity_certificate parameter to
go along with tls_no_verify_certificate. The remote driver
client URIs gain a no_sanity URI parameter

* daemon/test_libvirtd.aug, daemon/libvirtd.conf,
  daemon/libvirtd.c, daemon/libvirtd.aug: Add parameter to
  allow cert sanity checks to be skipped
* src/remote/remote_driver.c: Add no_sanity parameter to
  skip cert checks
* src/rpc/virnettlscontext.c, src/rpc/virnettlscontext.h:
  Add new parameter for skipping sanity checks independantly
  of skipping session cert validation checks

13 years agobuild: Use $(PYTHON) instead of python for the keycode map generator
Matthias Bolte [Fri, 22 Jul 2011 14:16:33 +0000 (16:16 +0200)]
build: Use $(PYTHON) instead of python for the keycode map generator

Also prepend $(AM_V_GEN) to the command line, mark virkeycode-mapgen.py
as executable and switch the shebang line from /bin/python to the
commonly use /usr/bin/python.

13 years agoxenapi: Fix double-freeing the session in xenapiClose
Matthias Bolte [Thu, 21 Jul 2011 16:11:20 +0000 (18:11 +0200)]
xenapi: Fix double-freeing the session in xenapiClose

xen_session_logout already frees the whole session object.
Don't call xenSessionFree on a freed session object.

Reported by Sharmila Radhakrishnan.

13 years agoremote/ssh: optional "keyfile" parameter.
Oskari Saarenmaa [Tue, 19 Jul 2011 17:52:21 +0000 (20:52 +0300)]
remote/ssh: optional "keyfile" parameter.

New optional parameter "keyfile" for ssh transport allows the user to select
the private key to be used to authenticate to the remote host.

13 years agoutil: make interface.c functions consistently return < 0 on error
Laine Stump [Fri, 22 Jul 2011 02:48:32 +0000 (22:48 -0400)]
util: make interface.c functions consistently return < 0 on error

All of the functions in util/interface.c were returning 0 on success,
but some returned -1 on error, and some returned a positive value
(usually the value of errno, but sometimes just 1). Libvirt's standard
is to return < 0 on error (in the case of functions that need to
return errno, -errno is returned.

This patch modifies all functions in interface.c to consistently
return < 0 on error, and makes changes to callers of those functions
where necessary.

13 years agoRefactor the certification validation code
Daniel P. Berrange [Wed, 20 Jul 2011 14:18:51 +0000 (15:18 +0100)]
Refactor the certification validation code

There is some commonality between the code for sanity checking
certs when initializing libvirt and the code for validating
certs during a live TLS session handshake. This patchset splits
up the sanity checking function into several smaller functions
each doing a specific type of check. The cert validation code
is then updated to also call into these functions

* src/rpc/virnettlscontext.c: Refactor cert validation code

13 years agoRemove call to deprecated gnutls_certificate_type_set_priority (again)
Daniel P. Berrange [Thu, 21 Jul 2011 17:25:22 +0000 (18:25 +0100)]
Remove call to deprecated gnutls_certificate_type_set_priority (again)

The gnutls_certificate_type_set_priority method is deprecated.
Since we already set the default gnutls priority, it was not
serving any useful purpose and can be removed

* src/rpc/virnettlscontext.c: Remove gnutls_certificate_type_set_priority
  call

13 years agoEnsure that libvirtd shuts down if initialization fails
Daniel P. Berrange [Thu, 21 Jul 2011 17:23:21 +0000 (18:23 +0100)]
Ensure that libvirtd shuts down if initialization fails

If the virStateInitialize call fails we must shutdown libvirtd
since drivers will not be available. Just free'ing the virNetServer
is not sufficient, we must send a SIGTERM to ourselves so that
we interrupt the event loop and trigger a orderly shutdown

* daemon/libvirtd.c: Kill ourselves if state init fails
* src/rpc/virnetserver.c: Add some debugging to event loop

13 years agoAsynchronous event for BlockJob completion
Adam Litke [Fri, 22 Jul 2011 05:57:42 +0000 (13:57 +0800)]
Asynchronous event for BlockJob completion

When an operation started by virDomainBlockPull completes (either with
success or with failure), raise an event to indicate the final status.
This API allow users to avoid polling on virDomainGetBlockJobInfo if
they would prefer to use an event mechanism.

* daemon/remote.c: Dispatch events to client
* include/libvirt/libvirt.h.in: Define event ID and callback signature
* src/conf/domain_event.c, src/conf/domain_event.h,
  src/libvirt_private.syms: Extend API to handle the new event
* src/qemu/qemu_driver.c: Connect to the QEMU monitor event
  for block_stream completion and emit a libvirt block pull event
* src/remote/remote_driver.c: Receive and dispatch events to application
* src/remote/remote_protocol.x: Wire protocol definition for the event
* src/remote_protocol-structs: structure definitions for protocol verification
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c: Watch for BLOCK_STREAM_COMPLETED event
  from QEMU monitor

13 years agoEnable virDomainBlockPull in the python API
Adam Litke [Fri, 22 Jul 2011 05:43:53 +0000 (13:43 +0800)]
Enable virDomainBlockPull in the python API

virDomainGetBlockJobInfo requires manual override since it returns a
custom type.

* python/generator.py: reenable bindings for this entry point
* python/libvirt-override-api.xml python/libvirt-override.c:
  manual overrides

13 years agoEnable the virDomainBlockPull API in virsh
Adam Litke [Fri, 22 Jul 2011 05:41:55 +0000 (13:41 +0800)]
Enable the virDomainBlockPull API in virsh

Define two new virsh commands:
 * blockpull: Initiate a blockPull for the given disk
 * blockjob: Retrieve progress info, modify speed, and cancel active block jobs

Share print_job_progress() with the migration code.

* tools/virsh.c: implement the new commands

13 years agoImplement virDomainBlockPull for the qemu driver
Adam Litke [Fri, 22 Jul 2011 05:39:37 +0000 (13:39 +0800)]
Implement virDomainBlockPull for the qemu driver

The virDomainBlockPull* family of commands are enabled by the
following HMP/QMP commands: 'block_stream', 'block_job_cancel',
 'info block-jobs' / 'query-block-jobs', and 'block_job_set_speed'.

* src/qemu/qemu_driver.c src/qemu/qemu_monitor_text.[ch]: implement disk
  streaming by using the proper qemu monitor commands.
* src/qemu/qemu_monitor_json.[ch]: implement commands using the qmp monitor

13 years agoAdd virDomainBlockPull support to the remote driver
Adam Litke [Fri, 22 Jul 2011 05:31:16 +0000 (13:31 +0800)]
Add virDomainBlockPull support to the remote driver

The generator can handle everything except virDomainGetBlockJobInfo().

* src/remote/remote_protocol.x: provide defines for the new entry points
* src/remote/remote_driver.c daemon/remote.c: implement the client and
  server side for virDomainGetBlockJobInfo.
* src/remote_protocol-structs: structure definitions for protocol verification
* src/rpc/gendispatch.pl: Permit some unsigned long parameters

13 years agovirDomainBlockPull: Implement the main entry points
Adam Litke [Fri, 22 Jul 2011 05:21:13 +0000 (13:21 +0800)]
virDomainBlockPull: Implement the main entry points

* src/libvirt.c: implement the main entry points

13 years agoAdd new API virDomainBlockPull* to headers
Adam Litke [Fri, 22 Jul 2011 05:18:06 +0000 (13:18 +0800)]
Add new API virDomainBlockPull* to headers

Set up the types for the block pull functions and insert them into the
virDriver structure definition.  Symbols are exported in this patch to
prevent
documentation compile failures.

* include/libvirt/libvirt.h.in: new API
* src/driver.h: add the new entry to the driver structure
* python/generator.py: fix compiler errors, the actual python bindings
* are
  implemented later
* src/libvirt_public.syms: export symbols
* docs/apibuild.py: Extend 'unsigned long' parameter exception to this
* API

13 years agosave: add virsh commands for manipulating save files
Eric Blake [Wed, 20 Jul 2011 16:23:57 +0000 (10:23 -0600)]
save: add virsh commands for manipulating save files

Now you can edit a saved state file even if you forgot to grab
a dumpxml file prior to saving a domain.  Plus, in-place editing
feels so much nicer.

* tools/virsh.c (cmdSaveImageDumpxml, cmdSaveImageDefine)
(cmdSaveImageEdit): New commands.
* tools/virsh.pod (save-image-dumpxml, save-image-define)
(save-image-edit): Document them.

13 years agosave: wire up remote protocol
Eric Blake [Wed, 20 Jul 2011 15:00:38 +0000 (09:00 -0600)]
save: wire up remote protocol

* src/remote/remote_driver.c (remote_driver): Add new callbacks.
* src/remote/remote_protocol.x (remote_procedure): New RPCs.
(remote_domain_save_image_get_xml_desc_args)
(remote_domain_save_image_get_xml_desc_ret)
(remote_domain_save_image_define_xml_args): New structs.
* src/remote_protocol-structs: Update.

13 years agosave: new API to manipulate save file images
Eric Blake [Wed, 20 Jul 2011 04:29:26 +0000 (22:29 -0600)]
save: new API to manipulate save file images

Modifying the xml on either save or restore only gets you so
far - you have to remember to 'virsh dumpxml dom' just prior
to the 'virsh save' in order to have an xml file worth modifying
that won't be rejected due to abi breaks.  To make this more
powerful, we need a way to grab the xml embedded within a state
file, and from there, it's not much harder to also support
modifying a state file in-place.

Also, virDomainGetXMLDesc didn't document its flags.

* include/libvirt/libvirt.h.in (virDomainSaveImageGetXMLDesc)
(virDomainSaveImageDefineXML): New prototypes.
* src/libvirt.c (virDomainSaveImageGetXMLDesc)
(virDomainSaveImageDefineXML): New API.
* src/libvirt_public.syms: Export them.
* src/driver.h (virDrvDomainSaveImageGetXMLDesc)
(virDrvDomainSaveImgeDefineXML): New driver callbacks.

13 years agosave: support bypass-cache flag in libvirt-guests init script
Eric Blake [Thu, 14 Jul 2011 23:22:53 +0000 (17:22 -0600)]
save: support bypass-cache flag in libvirt-guests init script

libvirt-guests is a perfect use case for bypassing the file system
cache - lots of filesystem traffic done at system shutdown, where
caching is pointless, and startup, where reading large files only
once just gets in the way.  Make this a configurable option in the
init script, but defaulting to existing behavior.

* tools/libvirt-guests.sysconf (BYPASS_CACHE): New variable.
* tools/libvirt-guests.init.sh (start, suspend_guest): Use it.

13 years agosave: support bypass-cache flag in qemu.conf
Eric Blake [Tue, 19 Jul 2011 21:54:48 +0000 (15:54 -0600)]
save: support bypass-cache flag in qemu.conf

When auto-dumping a domain on crash events, or autostarting a domain
with managed save state, let the user configure whether to imply
the bypass cache flag.

* src/qemu/qemu.conf (auto_dump_bypass_cache, auto_start_bypass_cache):
Document new variables.
* src/qemu/libvirtd_qemu.aug (vnc_entry): Let augeas parse them.
* src/qemu/qemu_conf.h (qemud_driver): Store new preferences.
* src/qemu/qemu_conf.c (qemudLoadDriverConfig): Parse them.
* src/qemu/qemu_driver.c (processWatchdogEvent, qemuAutostartDomain):
Honor them.

13 years agosave: support BYPASS_CACHE during qemu save/restore
Eric Blake [Mon, 11 Jul 2011 18:07:50 +0000 (12:07 -0600)]
save: support BYPASS_CACHE during qemu save/restore

Wire together the previous patches to support file system cache
bypass during API save/restore requests in qemu.

* src/qemu/qemu_driver.c (qemuDomainSaveInternal, doCoreDump)
(qemudDomainObjStart, qemuDomainSaveImageOpen, qemuDomainObjRestore)
(qemuDomainObjStart): Add parameter.
(qemuDomainSaveFlags, qemuDomainManagedSave, qemudDomainCoreDump)
(processWatchdogEvent, qemudDomainStartWithFlags, qemuAutostartDomain)
(qemuDomainRestoreFlags): Update callers.

13 years agosave: add virFileDirectFd wrapper type
Eric Blake [Mon, 11 Jul 2011 21:26:33 +0000 (15:26 -0600)]
save: add virFileDirectFd wrapper type

O_DIRECT has stringent requirements.  Rather than make lots of changes
at each site that wants to use O_DIRECT, it is easier to offload
the work through a helper process that mirrors the I/O between a
pipe and the actual direct fd, so that the other end of the pipe
no longer has to worry about constraints.

Plus, if the kernel ever gains better posix_fadvise support, then we
only have to touch a single file to let all callers benefit from a
more efficient way to avoid file system caching.

* src/util/virfile.h (virFileDirectFdFlag, virFileDirectFdNew)
(virFileDirectFdClose, virFileDirectFdFree): New prototypes.
* src/util/virdirect.c: Implement new wrapper object.
* src/libvirt_private.syms (virfile.h): Export new symbols.
* cfg.mk (useless_free_options): Add to list.
* po/POTFILES.in: Add new translations.

13 years agosave: let iohelper work on O_DIRECT fds
Eric Blake [Tue, 12 Jul 2011 14:35:05 +0000 (08:35 -0600)]
save: let iohelper work on O_DIRECT fds

Required for a coming patch where iohelper will operate on O_DIRECT
fds.  There, the user-space memory must be aligned to file system
boundaries (at least 512, but using page-aligned works better, and
some file systems prefer 64k).  Made tougher by the fact that
VIR_ALLOC won't work on void *, but posix_memalign won't work on
char * and isn't available everywhere.

This patch makes some simplifying assumptions - namely, output
to an O_DIRECT fd will only be attempted on an empty seekable
file (hence, no need to worry about preserving existing data
on a partial block, and ftruncate will work to undo the effects
of having to round up the size of the last block written), and
input from an O_DIRECT fd will only be attempted on a complete
seekable file with the only possible short read at EOF.

* configure.ac (AC_CHECK_FUNCS_ONCE): Check for posix_memalign.
* src/util/iohelper.c (runIO): Use aligned memory, and handle
quirks of O_DIRECT on last write.

13 years agosave: let iohelper handle inherited fd
Eric Blake [Tue, 12 Jul 2011 15:17:52 +0000 (09:17 -0600)]
save: let iohelper handle inherited fd

Rather than making the iohelper subject to a race in reopening
the file, it is nicer to pass an already-open fd by inheritance.

The old synopsis form must continue to work - if someone updates
their libvirt package and installs a new libvirt_iohelper but
without restarting the old libvirtd daemon, then the daemon can
still make calls using the old syntax but the new iohelper.

* src/util/iohelper.c (runIO): Split code for open...
(prepare): ...to new function.
(usage): Update synopsis.
(main): Allow alternate calling form.
* src/fdstream.c (virFDStreamOpenFileInternal): Use alternate form.

13 years agosave: support --xml to virsh save/restore
Eric Blake [Tue, 19 Jul 2011 20:24:29 +0000 (14:24 -0600)]
save: support --xml to virsh save/restore

Also, migrate was missing documentation for the --xml option
added in commit ec5301cb.

* tools/virsh.c (cmdSave, cmdRestore): Add xml argument.
* tools/virsh.pod (save, restore, migrate): Document it.

13 years agosave: add --bypass-cache flag to virsh save/restore operations
Eric Blake [Sat, 9 Jul 2011 03:09:16 +0000 (21:09 -0600)]
save: add --bypass-cache flag to virsh save/restore operations

Wire up the new flag to several virsh commands.  Also, the
'dump' command had undocumented flags.

* tools/virsh.c (cmdSave, cmdManagedSave, cmdDump, cmdStart)
(cmdRestore): Add new flag.
* tools/virsh.pod (save, managedsave, dump, start, restore):
Document flags.

13 years agosave: wire up trivial save/restore flags implementations
Eric Blake [Sat, 9 Jul 2011 02:55:29 +0000 (20:55 -0600)]
save: wire up trivial save/restore flags implementations

For all hypervisors that support save and restore, the new API
now performs the same functions as the old.

VBox is excluded from this list, because its existing domainsave
is broken (there is no corresponding domainrestore, and there
is no control over the filename used in the save).  A later
patch should change vbox to use its implementation for
managedsave, and teach start to use managedsave results.

* src/libxl/libxl_driver.c (libxlDomainSave): Move guts...
(libxlDomainSaveFlags): ...to new function.
(libxlDomainRestore): Move guts...
(libxlDomainRestoreFlags): ...to new function.
* src/test/test_driver.c (testDomainSave, testDomainSaveFlags)
(testDomainRestore, testDomainRestoreFlags): Likewise.
* src/xen/xen_driver.c (xenUnifiedDomainSave)
(xenUnifiedDomainSaveFlags, xenUnifiedDomainRestore)
(xenUnifiedDomainRestoreFlags): Likewise.
* src/qemu/qemu_driver.c (qemudDomainSave, qemudDomainRestore):
Rename and move guts.
(qemuDomainSave, qemuDomainSaveFlags, qemuDomainRestore)
(qemuDomainRestoreFlags): ...here.
(qemudDomainSaveFlag): Rename...
(qemuDomainSaveInternal): ...to this, and update callers.

13 years agoerror: add new error type for reflecting partial API support
Eric Blake [Thu, 21 Jul 2011 18:13:59 +0000 (12:13 -0600)]
error: add new error type for reflecting partial API support

VIR_ERR_INVALID_ARG implies that an argument cannot possibly
be correct, given the current state of the API.
VIR_ERR_CONFIG_UNSUPPORTED implies that a configuration is
wrong, but arguments aren't configuration.
VIR_ERR_NO_SUPPORT implies that a function is completely
unimplemented.

But in the case of a function that is partially implemented,
yet the full power of the API is not available for that
driver, none of the above messages make sense.  Hence a new
error message, implying that the argument is known to comply
with the current state of the API, and that while the driver
supports aspects of the function, it does not support that
particular use of the argument.

A good use case for this is a driver that supports
virDomainSaveFlags, but not the dxml argument of that API.

It might be feasible to also use this new error for all functions
that check flags, and which accept fewer flags than what is possible
in the public API.  But doing so would get complicated, since
neither libvirt.c nor the remote driver may do flag filtering,
and every other driver would have to do a two-part check, first
using virCheckFlags on all public flags (which gives
VIR_ERR_INVALID_ARG for an impossible flag), followed by a
particular mask check for VIR_ERR_ARGUMENT_UNSUPPORTED (for a
possible public flag but unsupported by this driver).

* include/libvirt/virterror.h (VIR_ERR_ARGUMENT_UNSUPPORTED): New
error.
* src/util/virterror.c (virErrorMsg): Give it a message.
Suggested by Daniel P. Berrange.

13 years agobuild: fix bugs with destroyFlags patches
Eric Blake [Thu, 21 Jul 2011 19:41:15 +0000 (13:41 -0600)]
build: fix bugs with destroyFlags patches

Build failure on xenapi_driver from compiler warnings (flags was unused).

Build failure on xen (incorrect number of arguments).  And in fixing
that, I obeyed the comments of struct xenUnifiedDriver that state
that we want to minimize the number of callback functions in that
struct, not add to it.

* src/xen/xen_driver.c (xenUnifiedDomainDestroyFlags): Use correct
arguments.
(xenUnifiedDomainDestroy): Simplify.
* src/xen/xen_driver.h (xenUnifiedDriver): Remove unused callback.
* src/xen/xen_hypervisor.c (xenHypervisorDestroyDomain): Likewise.
* src/xen/xend_internal.c (xenDaemonDomainDestroy): Likewise.
* src/xen/xend_internal.h (xenDaemonDomainDestroyFlags): Likewise.
* src/xen/xm_internal.c (xenXMDriver): Likewise.
* src/xen/xs_internal.c (xenStoreDriver): Likewise.
* src/xen/xen_inotify.c (xenInotifyDriver): Likewise.
* src/xenapi/xenapi_driver.c (xenapiDomainDestroyFlags): Reject
unknown flags.

13 years agoremote: Fix forgotten comma
Michal Privoznik [Thu, 21 Jul 2011 19:06:08 +0000 (21:06 +0200)]
remote: Fix forgotten comma

during conflict resolving

13 years agonetwork: internal API functions to manage assignment of physdev to guest
Laine Stump [Mon, 4 Jul 2011 06:27:12 +0000 (02:27 -0400)]
network: internal API functions to manage assignment of physdev to guest

The network driver needs to assign physical devices for use by modes
that use macvtap, keeping track of which physical devices are in use
(and how many instances, when the devices can be shared). Three calls
are added:

networkAllocateActualDevice - finds a physical device for use by the
domain, and sets up the virDomainActualNetDef accordingly.

networkNotifyActualDevice - assumes that the domain was already
running, but libvirtd was restarted, and needs to be notified by each
already-running domain about what interfaces they are using.

networkReleaseActualDevice - decrements the usage count of the
allocated physical device, and frees the virDomainActualNetDef to
avoid later accidentally using the device.

bridge_driver.[hc] - the new APIs. When WITH_NETWORK is false, these
functions are all #defined to be "0" in the .h file (effectively
becoming a NOP) to prevent link errors.

qemu_(command|driver|hotplug|process).c - add calls to the above APIs
    in the appropriate places.

tests/Makefile.am - we need to include libvirt_driver_network.la
    whenever libvirt_driver_qemu.la is linked, to avoid unreferenced
    symbols (in functions that are never called by the test
    programs...)

13 years agoqemu: use virDomainNetGetActual*() in qemuDomainXMLToNative
Laine Stump [Wed, 20 Jul 2011 04:06:45 +0000 (00:06 -0400)]
qemu: use virDomainNetGetActual*() in qemuDomainXMLToNative

This is the one function outside of domain_conf.c that plays around
with (even modifying) the internals of the virDomainNetDef, and thus
can't be fixed up simply by replacing direct accesses to the fields of
the struct with the GetActual*() access functions.

In this case, we need to check if the defined type is "network", and
if it is *then* check the actual type; if the actual type is "bridge",
then we can at least put the bridgename in a place where it can be
used; otherwise (if type isn't "bridge"), we behave exactly as we used
to - just null out *everything*.

13 years agoqemu: use virDomainNetGetActual*() functions where appropriate
Laine Stump [Mon, 4 Jul 2011 01:57:45 +0000 (21:57 -0400)]
qemu: use virDomainNetGetActual*() functions where appropriate

The qemu driver accesses fields in the virDomainNetDef directly, but
with the advent of the virDomainActualNetDef, some pieces of
information may be found in a different place (the ActualNetDef) if
the network connection is of type='network' and that network is of
forward type='bridge|private|vepa|passthrough'. The previous patch
added functions to mask this difference from callers - they hide the
decision making process and just pick the value from the proper place.

This patch uses those functions in the qemu driver as a first step in
making qemu work with the new network types. At this point, the
virDomainActualNetDef is guaranteed always NULL, so the GetActualX()
function will return exactly what the def->X that's being replaced
would have returned (ie bisecting is not compromised).

There is one place (in qemu_driver.c) where the internal details of
the NetDef are directly manipulated by the code, so the GetActual
functions cannot be used there without extra additional code; that
file will be treated in a separate patch.

13 years agonetwork: separate Start/Shutdown functions for new network types
Laine Stump [Thu, 30 Jun 2011 21:05:07 +0000 (17:05 -0400)]
network: separate Start/Shutdown functions for new network types

Previously all networks were composed of bridge devices created and
managed by libvirt, and the same operations needed to be done for all
of them when they were started and stopped (create and start the
bridge device, configure its MAC address and IP address, add iptables
rules). The new network types are (for now at least) managed outside
of libvirt, and the network object is used only to contain information
about the network, which is then used as each individual guest
connects itself.

This means that when starting/stopping one of these new networks, we
really want to do nothing, aside from marking the network as
active/inactive.

This has been setup as toplevel Start/Shutdown functions that do the
small bit of common stuff, then have a switch statement to execute
network type-specific start/shutdown code, then do a bit more common
code. The type-specific functions called for the new host bridge and
macvtap based types are currently empty.

In the future these functions may actually do something, and we will
surely add more functions that are similarly patterned. Once
everything has settled, we can make a table of "sub-driver" function
pointers for each network type, and store a pointer to that table in
the network object, then we can replace the switch statements with
calls to functions in the table.

The final step in this will be to add a new table (and corresponding
new functions) for new network types as they are added.

13 years agoconf: support abstracted interface info in network XML
Laine Stump [Wed, 20 Jul 2011 03:01:09 +0000 (23:01 -0400)]
conf: support abstracted interface info in network XML

The network XML is updated in the following ways:

1) The <forward> element can now contain a list of forward interfaces:

     <forward .... >
       <interface dev='eth10'/>
       <interface dev='eth11'/>
       <interface dev='eth12'/>
       <interface dev='eth13'/>
     </forward>

   The first of these takes the place of the dev attribute that is
   normally in <forward> - when defining a network you can specify
   either one, and on output both will be present. If you specify
   both on input, they must match.

2) In addition to forward modes of 'nat' and 'route', these new modes
   are supported:

     private, passthrough, vepa - when this network is referenced by a
     domain's interface, it will have the same effect as if the
     interface had been defined as type='direct', e.g.:

        <interface type='direct'>
          <source mode='${mode}' dev='${dev}>
          ...
        </interface>

     where ${mode} is one of the three new modes, and ${dev} is an interface
     selected from the list given in <forward>.

     bridge - if a <forward> dev (or multiple devs) is defined, and
     forward mode is 'bridge' this is just like the modes 'private',
     'passthrough', and 'vepa' above. If there is no forward dev
     specified but a bridge name is given (e.g. "<bridge
     name='br0'/>"), then guest interfaces using this network will use
     libvirt's "host bridge" mode, equivalent to this:

       <interface type='bridge'>
          <source bridge='${bridge-name}'/>
          ...
       </interface>

3) A network can have multiple <portgroup> elements, which may be
   selected by the guest interface definition (by adding
   "portgroup='${name}'" in the <source> element along with the
   network name). Currently a portgroup can only contain a
   virtportprofile, but the intent is that other configuration items
   may be put there int the future (e.g. bandwidth config). When
   building a guest's interface, if the <interface> XML itself has no
   virtportprofile, and if the requested network has a portgroup with
   a name matching the name given in the <interface> (or if one of the
   network's portgroups is marked with the "default='yes'" attribute),
   the virtportprofile from that portgroup will be used by the
   interface.

4) A network can have a virtportprofile defined at the top level,
   which will be used by a guest interface when connecting in one of
   the 'direct' modes if the guest interface XML itself hasn't
   specified any virtportprofile, and if there are also no matching
   portgroups on the network.

13 years agoconf: support abstracted interface info in domain interface XML
Laine Stump [Sun, 26 Jun 2011 08:09:00 +0000 (04:09 -0400)]
conf: support abstracted interface info in domain interface XML

the domain XML <interface> element is updated in the following ways:

1) <virtualportprofile> can be specified when source type='network'
(previously it was only valid for source type='direct')

2) A new attribute "portgroup" has been added to the <source>
element. When source type='network' (the only time portgroup is
recognized), extra configuration information will be taken from the
<portgroup> element of the given name in the network definition.

3) Each virDomainNetDef now also potentially has a
virDomainActualNetDef which is a private object (never
exported/imported via the public API, and not defined in the RNG) that
is used to maintain information about the physical device that was
actually used for a NetDef of type VIR_DOMAIN_NET_TYPE_NETWORK.

The virDomainActualNetDef will only be parsed/formatted if the
parse/format function is called with the
VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET flag set (which is only needed when
saving/loading a running domain's state info to the stateDir).

13 years agoconf: virDomainNetDef points to (rather than contains) virtPortProfile
Laine Stump [Mon, 18 Jul 2011 22:44:38 +0000 (18:44 -0400)]
conf: virDomainNetDef points to (rather than contains) virtPortProfile

The virtPortProfile in the domain interface struct is now a separately
allocated object *pointed to by* (rather than contained in) the main
virDomainNetDef object. This is done to make it easier to figure out
when a virtualPortProfile has/hasn't been specified in a particular
config.

13 years agoconf: put virtPortProfile struct / functions in a common location
Laine Stump [Wed, 29 Jun 2011 04:38:10 +0000 (00:38 -0400)]
conf: put virtPortProfile struct / functions in a common location

virtPortProfiles are currently only used in the domain XML, but will
soon also be used in the network XML. To prepare for that change, this
patch moves the structure definition into util/network.h and the parse
and format functions into util/network.c (I decided that this was a
better choice than macvtap.h/c for something that needed to always be
available on all platforms).

13 years agoutil: define MAX
Laine Stump [Wed, 20 Jul 2011 02:08:15 +0000 (22:08 -0400)]
util: define MAX

If util.h is going to have a MIN, it may as well also have MAX.

13 years agodestroy: Implement internal API for xenapi driver
Michal Privoznik [Thu, 21 Jul 2011 08:28:19 +0000 (10:28 +0200)]
destroy: Implement internal API for xenapi driver

13 years agodestroy: Implement internal API for xen driver
Michal Privoznik [Thu, 21 Jul 2011 08:19:59 +0000 (10:19 +0200)]
destroy: Implement internal API for xen driver

13 years agodestroy: Implement internal API for vmware driver
Michal Privoznik [Thu, 21 Jul 2011 08:01:44 +0000 (10:01 +0200)]
destroy: Implement internal API for vmware driver

13 years agodestroy: Implement internal API for vbox driver
Michal Privoznik [Thu, 21 Jul 2011 07:59:16 +0000 (09:59 +0200)]
destroy: Implement internal API for vbox driver

13 years agodestroy: Implement internal API for uml driver
Michal Privoznik [Thu, 21 Jul 2011 07:54:28 +0000 (09:54 +0200)]
destroy: Implement internal API for uml driver

13 years agodestroy: Implement internal API for phyp driver
Michal Privoznik [Thu, 21 Jul 2011 07:51:51 +0000 (09:51 +0200)]
destroy: Implement internal API for phyp driver

13 years agodestroy: Implement internal API for openvz driver
Michal Privoznik [Thu, 21 Jul 2011 07:49:02 +0000 (09:49 +0200)]
destroy: Implement internal API for openvz driver

13 years agodestroy: Implement internal API for lxc driver
Michal Privoznik [Wed, 20 Jul 2011 16:51:26 +0000 (18:51 +0200)]
destroy: Implement internal API for lxc driver

13 years agodestroy: Implement internal API for libxl driver
Michal Privoznik [Wed, 20 Jul 2011 16:47:46 +0000 (18:47 +0200)]
destroy: Implement internal API for libxl driver

13 years agodestroy: Implement internal API for ESX driver
Michal Privoznik [Wed, 20 Jul 2011 16:45:21 +0000 (18:45 +0200)]
destroy: Implement internal API for ESX driver

13 years agodestroy: Implement internal API for qemu driver
Michal Privoznik [Wed, 20 Jul 2011 16:41:24 +0000 (18:41 +0200)]
destroy: Implement internal API for qemu driver

13 years agodestroy: Wire up the remote protocol
Michal Privoznik [Wed, 20 Jul 2011 16:33:23 +0000 (18:33 +0200)]
destroy: Wire up the remote protocol

13 years agodestroy: Define new public API virDomainDestroyFlags
Michal Privoznik [Wed, 20 Jul 2011 15:02:48 +0000 (17:02 +0200)]
destroy: Define new public API virDomainDestroyFlags

This introduces new API virDomainDestroyFlags to allow
domain destroying with flags, as the existing API virDomainDestroy
misses flags.

The set of flags is defined in virDomainDestroyFlagsValues enum,
which is currently commented, because it is empty.

Calling this API with no flags set (@flags == 0) is equivalent calling
virDomainDestroy.

13 years agosave: wire up remote protocol
Eric Blake [Sat, 9 Jul 2011 02:35:16 +0000 (20:35 -0600)]
save: wire up remote protocol

* src/remote/remote_driver.c (remote_driver): Add new callbacks.
* src/remote/remote_protocol.x (remote_procedure): New RPCs.
(remote_domain_save_flags_args, remote_domain_restore_flags_args):
New structs.
* src/remote_protocol-structs: Update.

13 years agosave: new public API to bypass file system cache on save/restore
Eric Blake [Wed, 6 Jul 2011 18:10:11 +0000 (12:10 -0600)]
save: new public API to bypass file system cache on save/restore

In order to choose whether to use O_DIRECT when saving a domain image
to a file, we need a new flag.  But virDomainSave was implemented
before our policy of all new APIs having a flag argument.  Likewise
for virDomainRestore when restoring from a file.

The new flag name is chosen as CACHE_BYPASS so as not to preclude
a future solution that uses posix_fadvise once the Linux kernel has
a smarter implementation of that interface.

* include/libvirt/libvirt.h.in (virDomainCreateFlags)
(virDomainCoreDumpFlags): Add a flag.
(virDomainSaveFlags, virDomainRestoreFlags): New prototypes.
* src/libvirt.c (virDomainSaveFlags, virDomainRestoreFlags): New API.
* src/libvirt_public.syms: Export them.
* src/driver.h (virDrvDomainSaveFlags, virDrvDomainRestoreFlags):
New driver callbacks.

13 years agoqemu: fix error message with migrate2 xml
Eric Blake [Tue, 19 Jul 2011 22:40:32 +0000 (16:40 -0600)]
qemu: fix error message with migrate2 xml

Otherwise, an ABI mismatch gives error messages attributing the target
xml string as current, and the current domain state as the new xml.

* src/qemu/qemu_migration.c (qemuMigrationBegin): Use correct
argument order.

13 years agobuild: rename files.h to virfile.h
Eric Blake [Tue, 19 Jul 2011 18:32:58 +0000 (12:32 -0600)]
build: rename files.h to virfile.h

In preparation for a future patch adding new virFile APIs.

* src/util/files.h, src/util/files.c: Move...
* src/util/virfile.h, src/util/virfile.c: ...here, and rename
functions to virFile prefix.  Macro names are intentionally
left alone.
* *.c: All '#include "files.h"' uses changed.
* src/Makefile.am (UTIL_SOURCES): Reflect rename.
* cfg.mk (exclude_file_name_regexp--sc_prohibit_close): Likewise.
* src/libvirt_private.syms: Likewise.
* docs/hacking.html.in: Likewise.
* HACKING: Regenerate.

13 years agocommand: avoid leaking fds across fork
Eric Blake [Tue, 12 Jul 2011 20:56:03 +0000 (14:56 -0600)]
command: avoid leaking fds across fork

Since libvirt is multi-threaded, we should use FD_CLOEXEC as much
as possible in the parent, and only relax fds to inherited after
forking, to avoid leaking an fd created in one thread to a fork
run in another thread.  This gets us closer to that ideal, by
making virCommand automatically clear FD_CLOEXEC on fds intended
for the child, as well as avoiding a window of time with non-cloexec
pipes created for capturing output.

* src/util/command.c (virExecWithHook): Use CLOEXEC in parent.  In
child, guarantee that all fds to pass to child are inheritable.
(getDevNull): Use CLOEXEC.
(prepareStdFd): New helper function.
(virCommandRun, virCommandRequireHandshake): Use pipe2.
* src/qemu/qemu_command.c (qemuBuildCommandLine): Simplify caller.

13 years agocommand: move all docs into .c file
Eric Blake [Thu, 14 Jul 2011 19:47:25 +0000 (13:47 -0600)]
command: move all docs into .c file

We already have a precedent of function documentation in C files,
where it is closer to the implementation (witness libvirt.h vs.
libvirt.c); maintaining docs in both files risks docs going stale.

While I was at it, I used consistent doxygen style on all comments.

* src/util/command.h: Remove duplicate docs, and move unique
documentation...
* src/util/command.c: ...here.
Suggested by Matthias Bolte.

13 years agorpc: Make the dispatch generator handle 'void name(void)' style procedures
Matthias Bolte [Tue, 19 Jul 2011 12:16:47 +0000 (14:16 +0200)]
rpc: Make the dispatch generator handle 'void name(void)' style procedures

The only 'void name(void)' style procedure in the protocol is 'close' that
is handled special, but also programming errors like a missing _args or
_ret suffix on the structs in the .x files can create such a situation by
accident. Making the generator aware of this avoids bogus errors from the
generator such as:

  Use of uninitialized value in exists at ./rpc/gendispatch.pl line 967.

Also this allows to get rid of the -c option and the special case code for
the 'close' procedure, as the generator handles it now correctly.

Reported by Michal Privoznik

13 years agoerror: preserve errno when saving last error
Eric Blake [Wed, 20 Jul 2011 23:07:59 +0000 (17:07 -0600)]
error: preserve errno when saving last error

It is common to see the sequence:

virErrorPtr save_err = virSaveLastError();
// do cleanup
virSetError(save_err);
virFreeError(save_err);

on cleanup paths.  But for functions where it is desirable to
return the errno that caused failure, this sequence can clobber
that errno.  virFreeError was already safe; this makes the other
two functions in the sequence safe as well, assuming all goes
well (on OOM, errno will be clobbered, but then again, save_err
won't reflect the real error that happened, so you are no longer
preserving the real situation - that's life with OOM).

* src/util/virterror.c (virSaveLastError, virSetError): Preserve
errno.

13 years agopython: Fix makefile rule for code generation
Matthias Bolte [Thu, 21 Jul 2011 11:45:42 +0000 (13:45 +0200)]
python: Fix makefile rule for code generation

Commit 8665f85523f0451c changed generated.stamp to $(GENERATE).stamp,
but missed one instance in the CLEANFILES list. This can break the
build in case the generated code is deleted but the .stamp file stays
around and therefore the code isn't regenerated.

13 years agoFix uninitialized variable in QEMU CPU bandwidth code
Daniel P. Berrange [Thu, 21 Jul 2011 12:06:33 +0000 (13:06 +0100)]
Fix uninitialized variable in QEMU CPU bandwidth code

* src/qemu/qemu_driver.c: Fix uninitialized variable

13 years agofix make syntax-check error
Wen Congyang [Thu, 21 Jul 2011 09:32:57 +0000 (17:32 +0800)]
fix make syntax-check error

13 years agodoc: Add documentation for new cputune elements period and quota
Wen Congyang [Thu, 21 Jul 2011 08:36:39 +0000 (16:36 +0800)]
doc: Add documentation for new cputune elements period and quota

We have added element period and quota. Document them in formatdomain.html.in.

13 years agoqemu: Implement cfs_period and cfs_quota's modification
Wen Congyang [Thu, 21 Jul 2011 08:04:25 +0000 (16:04 +0800)]
qemu: Implement cfs_period and cfs_quota's modification

This patch implements cfs_period and cfs_quota's modification.
We can use the command 'virsh schedinfo' to query or modify cfs_period and
cfs_quota.
If you query period or quota from config file, the value 0 means it does not set
in the config file.
If you set period or quota to config file, the value 0 means that delete current
setting from config file.
If you modify period or quota while vm is running, the value 0 means that use
current value.

13 years agoqemu: Implement period and quota tunable XML configuration and parsing
Wen Congyang [Thu, 21 Jul 2011 02:10:31 +0000 (10:10 +0800)]
qemu: Implement period and quota tunable XML configuration and parsing

This patch implements period and quota tunable XML configuration and parsing.
A quota or period of zero will be simply ignored.

13 years agoUpdate XML Schema for new entries
Wen Congyang [Thu, 21 Jul 2011 02:09:46 +0000 (10:09 +0800)]
Update XML Schema for new entries

Define the element cputune's child elements 'period' and 'quota':
<cputune>
  <period>100000</period>
  <quota>50000</quota>
</cputune>

13 years agocgroup: Implement cpu.cfs_period_us and cpu.cfs_quota_us tuning API
Wen Congyang [Thu, 21 Jul 2011 07:21:05 +0000 (15:21 +0800)]
cgroup: Implement cpu.cfs_period_us and cpu.cfs_quota_us tuning API

This patch provides 4 APIs to get and set cpu.cfs_period_us and cpu.cfs_quota_us.

13 years agoIntroduce the function virCgroupForVcpu
Wen Congyang [Thu, 21 Jul 2011 07:12:55 +0000 (15:12 +0800)]
Introduce the function virCgroupForVcpu

Introduce the function virCgroupForVcpu() to create sub directory for each vcpu.

13 years agoqemu: send-key: Implement the driver methods
Lai Jiangshan [Thu, 21 Jul 2011 07:55:56 +0000 (15:55 +0800)]
qemu: send-key: Implement the driver methods

qemu driver just accept xt_kbd codeset's keycode, so the lib virtkey
is used for translating keycodes from other codesets

13 years agosend-key: Expose the new API in virsh
Lai Jiangshan [Thu, 21 Jul 2011 07:49:10 +0000 (15:49 +0800)]
send-key: Expose the new API in virsh

Also support string names for the linux keycode(auto detect)
* tools/virsh.c: add new command "send-key"
* tools/virsh.pod: documents the new command

13 years agoutil: add virtkeycode module
Lai Jiangshan [Thu, 21 Jul 2011 07:32:34 +0000 (15:32 +0800)]
util: add virtkeycode module

Add virtkey lib for usage-improvment and keycode translating.
Add 4 internal API for the aim

const char *virKeycodeSetTypeToString(int codeset);
int virKeycodeSetTypeFromString(const char *name);
int virKeycodeValueFromString(virKeycodeSet codeset, const char *keyname);
int virKeycodeValueTranslate(virKeycodeSet from_codeset,
                             virKeycodeSet to_offset,
                             int key_value);

* include/libvirt/libvirt.h.in: extend virKeycodeSet enum
* src/Makefile.am: add new virtkeycode module and rule to generate
  virkeymaps.h
* src/util/virkeycode.c src/util/virkeycode.h: new module
* src/util/virkeycode-mapgen.py: python generator for virkeymaps.h
  out of keymaps.csv
* src/libvirt_private.syms: extend private symbols for new module
* .gitignore: add generated virkeymaps.h

13 years agoutil: Add keymaps.csv
Lai Jiangshan [Thu, 21 Jul 2011 07:02:52 +0000 (15:02 +0800)]
util: Add keymaps.csv

Should keep it as the same as:
http://git.gnome.org/browse/gtk-vnc/commit/src/keymaps.csv

All master  keymaps are defined in a CSV file. THis covers
Linux keycodes, OSX keycodes, AT set1, 2 & 3, XT keycodes,
the XT encoding used by the Linux KBD driver, USB keycodes,
Win32 keycodes, the XT encoding used by Xorg on Cygwin,
the XT encoding used by Xorg on Linux with kbd driver.

* src/Makefile.am: added to EXTRA_DIST
* src/util/keymaps.csv: new file

13 years agomaint: fix typos on guaranteed
Eric Blake [Wed, 20 Jul 2011 22:53:31 +0000 (16:53 -0600)]
maint: fix typos on guaranteed

* src/conf/domain_event.c (virDomainEventDispatch): Fix typo.
* src/internal.h (ATTRIBUTE_FMT_PRINTF): Likewise.
* src/libvirt.c (virStreamEventUpdateCallback): Likewise.
* src/remote/remote_driver.c (doRemoteOpen): Likewise.
* src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
Likewise.
* src/util/virterror.c (virConnCopyLastError, virCopyLastError):
Likewise.
* src/xen/xend_internal.h (xend_wait_for_devices): Likewise.

13 years agorpc: Pass through DISPLAY so ssh can launch askpass
Cole Robinson [Wed, 20 Jul 2011 18:11:43 +0000 (14:11 -0400)]
rpc: Pass through DISPLAY so ssh can launch askpass

Though we prefer users to have SSH keys setup, virt-manager users still
depend on remote SSH connections to launch a password dialog. This fixes
launch ssh-askpass

Fix suggested by danpb

13 years agosysinfo: Don't try to run dmidecode on archs missing it
Michal Privoznik [Wed, 20 Jul 2011 15:03:17 +0000 (17:03 +0200)]
sysinfo: Don't try to run dmidecode on archs missing it

DMI table is Intel & Intel-compatible specific. Therefore other
architectures miss dmidecode command. So we always fail in searching
for that command on non-Intel architectures.

13 years agoDon't try to close a NULL virNetClientPtr
Guannan Ren [Wed, 20 Jul 2011 14:20:18 +0000 (15:20 +0100)]
Don't try to close a NULL virNetClientPtr

* src/rpc/virnetclient.c: Skip close attempt if virNetClientPtr
  is NULL

13 years agoHonour key usage/purpose criticality flag
Daniel P. Berrange [Wed, 20 Jul 2011 13:08:39 +0000 (14:08 +0100)]
Honour key usage/purpose criticality flag

If a key purpose or usage field is marked as non-critical in the
certificate, then a data mismatch is not (ordinarily) a cause for
rejecting the connection

* src/rpc/virnettlscontext.c: Honour key usage/purpose criticality