Commit Graph

503 Commits

Author SHA1 Message Date
Daniel Veillard
8fd68675e2 Release of libvirt-1.3.1
* docs/news.html.in libvirt.spec.in: update for release
* po/*.po*: regenerated
2016-01-17 10:29:57 +08:00
Daniel Veillard
11288f56ee Release of libvirt-1.3.0
* docs/news.html.in libvirt.spec.in: update for release
* po/*.po*: regenerated
2015-12-09 17:13:48 +08:00
Michal Privoznik
90f3c0d717 conf: Split virDomainObjList into a separate file
Our domain_conf.* files are big enough. Not only they contain XML
parsing code, but they served as a storage of all functions whose
name is virDomain prefixed. This is just wrong as it gathers not
related functions (and modules) into one big file which is then
harder to maintain. Split virDomainObjList module into a separate
file called virdomainobjlist.[ch].

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-11-30 13:55:10 +01:00
Erik Skultety
a474371fc6 admin: Introduce virAdmConnectGetLibVersion
Introduce a new API to get libvirt version. It is worth noting, that
libvirt-admin and libvirt share the same version number. Unfortunately,
our existing API isn't generic enough to be used with virAdmConnectPtr
as well. Also this patch wires up this API to the virt-admin client
as a generic cmdVersion command.
2015-11-30 09:44:28 +01:00
Erik Skultety
6409578790 virt-admin: Introduce first working skeleton
This patch introduces virt-admin client which is based on virsh client,
but had to reimplement several methods to meet virt-admin specific needs
or remove unnecessary virsh specific logic.
2015-11-30 09:44:28 +01:00
Daniel P. Berrange
37ed422404 logging: add client for virtlogd daemon
Add the virLogManager API which allows for communication with
the virtlogd daemon to RPC program. This provides the client
side API to open log files for guest domains.

The virtlogd daemon is setup to auto-spawn on first use when
running unprivileged. For privileged usage, systemd socket
activation is used instead.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-26 14:30:13 +00:00
Daniel P. Berrange
19e5db4ae2 logging: introduce log handling protocol
Define a new RPC protocol for the virtlogd daemon that provides
for handling of logs. The initial RPC method defined allows a
client to obtain a file handle to use for writing to a log
file for a guest domain. The file handle passed back will not
actually refer to the log file, but rather an anonymous pipe.
The virtlogd daemon will forward I/O between them, ensuring
file rotation happens when required.

Initially the log setup is hardcoded to cap log files at
128 KB, and keep 3 backups when rolling over, which gives
a max usage of 512 KB per guest.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-26 14:28:55 +00:00
Daniel P. Berrange
323a329b26 Import stripped down virtlockd code as basis of virtlogd
Copy the virtlockd codebase across to form the initial virlogd
code. Simple search & replace of s/lock/log/ and gut the remote
protocol & dispatcher. This gives us a daemon that starts up
and listens for connections, but does nothing with them.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-26 14:28:55 +00:00
Daniel P. Berrange
910e65d973 util: add APIs for reading/writing from/to rotating files
Add virRotatingFileReader and virRotatingFileWriter objects
which allow reading & writing from/to files with automation
rotation to N backup files when a size limit is reached. This
is useful for guest logging when a guaranteed finite size
limit is required. Use of external tools like logrotate is
inadequate since it leaves the possibility for guest to DOS
the host in between invokations of logrotate.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-26 14:28:55 +00:00
Daniel Veillard
b091fef5cf Release of libvirt-1.2.21
* docs/news.html.in libvirt.spec.in: Updated for the release
* po/*.po*: regenerated
2015-11-04 10:59:12 +08:00
Maxim Nestratov
bd6ae7b8ab vz: remove storage driver as never used
In fact, it was never used as far as vz has no features supporting it.
That is why there will be no harm to anyone if we just remove this code to
prevent further misunderstanding and efforts to support dead code.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-10-06 18:22:47 +03:00
Maxim Nestratov
439f29e78c vz: remove network driver as never used
At the time this code was added we had intentions to support libvirt interface
to manage vz networks. In fact, it was never implemented completely to work
correctly that makes me think that there will be no harm to anyone if we just
rip it off. Moreover, in vz7 we started to use libvirt bridge network driver to
manage networks.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-10-06 18:22:47 +03:00
Daniel Veillard
439760214c Release of libvirt-1.2.20
* docs/news.html.in libvirt.spec.in: update for new release
* po/*.po*: regenerate localization
2015-10-02 13:17:16 +02:00
Daniel Veillard
66c5f02b96 Release of libvirt-1.2.19
* docs/news.html.in libvirt.spec.in: updated for the release
* po/*.po*: regenerated
2015-09-02 10:19:20 +08:00
ik.nitk
c27553b6e2 lxc: Inherit namespace feature
This patch adds feature for lxc containers to inherit namespaces.
This is very similar to what lxc-tools or docker provides.  Look
for "man lxc-start" and you will find that you can pass command
args as [ --share-[net|ipc|uts] name|pid ]. Or check out docker
networking option in which you can give --net=container:NAME_or_ID
as an option for sharing +namespace.

>From this patch you can add extra libvirt option to share
namespace in following way.

 <lxc:namespace>
   <lxc:sharenet type='netns' value='red'/>
   <lxc:shareipc type='pid' value='12345'/>
   <lxc:shareuts type='name' value='container1'/>
 </lxc:namespace>

The netns option is specific to sharenet. It can be used to
inherit from existing network namespace.

Co-authored: Daniel P. Berrange <berrange@redhat.com>
2015-08-26 11:28:30 +01:00
Erik Skultety
834c5720e4 tools: Introduce new client generic module vsh
In order to share as much virsh' logic as possible with upcomming
virt-admin client we need to split virsh logic into virsh specific and
client generic features.

Since majority of virsh methods should be generic enough to be used by
other clients, it's much easier to rename virsh specific data to virshX
than doing this vice versa. It moved generic virsh commands (including info
and opts structures) to generic module vsh.c.

Besides renaming methods and structures, this patch also involves introduction
of a client specific control structure being referenced as private data in the
original control structure, introduction of a new global vsh Initializer,
which currently doesn't do much, but there is a potential for added
functionality in the future.
Lastly it introduced client hooks which are especially necessary during
client connecting phase.
2015-08-14 15:45:44 +02:00
Andrea Bolognani
ef770f0160 cpu: Rename {powerpc,ppc} => ppc64 (filesystem)
The driver only supports VIR_ARCH_PPC64 and VIR_ARCH_PPC64LE.

Just shuffling files around and updating the build system
accordingly. No functional changes.
2015-08-05 13:30:16 +02:00
Daniel Veillard
bcfdd8e836 Release of libvirt-1.2.18
* docs/news.html.in libvirt.spec.in: update for release
* po/*.po*: regenerated
2015-08-03 17:36:39 +08:00
Daniel Veillard
845184b2fd Release of libvirt-1.2.17
* docs/news.html.in libvirt.spec.in: updated for the release
* po/*po*: regenerated
2015-07-02 13:22:30 +08:00
Jiri Denemark
4172b96a3e qemu: Use domain condition for synchronous block jobs
By switching block jobs to use domain conditions, we can drop some
pretty complicated code in NBD storage migration.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-06-19 15:15:10 +02:00
Maxim Nestratov
e6d180f07f parallels: rename all parallels files and driver directory to vz
This patch moves all src/parallels/parallels* files to vz/vz*
and fixes build accordingly.
No functional changes.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-06-17 15:07:55 +03:00
Martin Kletzander
2cc6c652cf Revert "admin: Add virAdmHello function"
This reverts commit 5792fabb7b.

I mistakenly pushed it along with the Admin API series.
2015-06-16 14:08:59 +02:00
Martin Kletzander
5792fabb7b admin: Add virAdmHello function
Just one of the simplest functions that returns string "Clients: X"
where X is the number of connected clients to daemon's first
subserver (the original one), so it can be tested using virsh, ipython,
etc.

The subserver is gathered by incrementing its reference
counter (similarly to getting qemu capabilities), so there is no
deadlock with admin subserver in this API.

Here you can see how functions should be named in the client (virAdm*)
and server (adm*).

There is also a parameter @flags that must be 0, which helps testing
proper error propagation into the client.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-06-16 13:46:21 +02:00
Martin Kletzander
d5f4241bbc Add support for admin API in libvirt daemon
For this to pe properly separated from other protocols used by the
server, there is second server added which allows access to the whole
virNetDaemon to its clients.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-06-16 13:46:21 +02:00
Martin Kletzander
55e0c840af Add libvirt-admin library
Initial scratch of the admin library.  It has its own virAdmConnectPtr
that inherits from virAbstractConnectPtr and thus trivially supports
error reporting.

There's pkg-config file added and spec-file adjusted as well.

Since the library should be "minimalistic" and not depend on any other
library, the list of files is especially crafted for it.  Most of them
could've been put to it's own sub-libraries that would be LIBADD'd to
libvirt_util, libvirt_net_rpc and libvirt_setuid_rpc_client to minimize
the number of object files being built, but that's a refactoring that
isn't the orginal aim of this commit.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-06-16 13:46:20 +02:00
Martin Kletzander
fa14207368 Move daemon-related parts of virNetServer to virNetDaemon
This allows to have more servers in one daemon which helps isolating
some resources.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-06-16 13:46:19 +02:00
Daniel Veillard
77fd04aaae Release of libvirt-1.2.16
- docs/news.html.in libvirt.spec.in: update for the release
- po/*.po*: regenerate
2015-06-01 10:30:29 +08:00
Daniel Veillard
b978b85b24 Release of libvirt-1.2.15
- docs/news.html.in libvirt.spec.in: update for the release
- po/*.po*: regenerated
2015-05-04 11:43:04 +08:00
Michael Chapman
89a5e25d05 qemuBlockJobSync*: introduce sync block job helpers
qemuBlockJobSyncBegin and qemuBlockJobSyncEnd delimit a region of code
where block job events are processed "synchronously".
qemuBlockJobSyncWait and qemuBlockJobSyncWaitWithTimeout wait for an
event generated by a block job.

The Wait* functions may be called multiple times while the synchronous
block job is active. Any pending block job event will be processed by
only when Wait* or End is called.  disk->blockJobStatus is reset by
these functions, so if it is needed a pointer to a
virConnectDomainEventBlockJobStatus variable should be passed as the
last argument. It is safe to pass NULL if you do not care about the
block job status.

All functions assume the VM object is locked. The Wait* functions will
unlock the object for as long as they are waiting. They will return -1
and report an error if the domain exits before an event is received.

Typical use is as follows:

  virQEMUDriverPtr driver;
  virDomainObjPtr vm; /* locked */
  virDomainDiskDefPtr disk;
  virConnectDomainEventBlockJobStatus status;

  qemuBlockJobSyncBegin(disk);

  ... start block job ...

  if (qemuBlockJobSyncWait(driver, vm, disk, &status) < 0) {
      /* domain died while waiting for event */
      ret = -1;
      goto error;
  }

  ... possibly start other block jobs
      or wait for further events ...

  qemuBlockJobSyncEnd(driver, vm, disk, NULL);

To perform other tasks periodically while waiting for an event:

  virQEMUDriverPtr driver;
  virDomainObjPtr vm; /* locked */
  virDomainDiskDefPtr disk;
  virConnectDomainEventBlockJobStatus status;
  unsigned long long timeout = 500 * 1000ull; /* milliseconds */

  qemuBlockJobSyncBegin(disk);

  ... start block job ...

  do {
      ... do other task ...

      if (qemuBlockJobSyncWaitWithTimeout(driver, vm, disk,
                                          timeout, &status) < 0) {
          /* domain died while waiting for event */
          ret = -1;
          goto error;
      }
  } while (status == -1);

  qemuBlockJobSyncEnd(driver, vm, disk, NULL);

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
2015-04-29 13:11:42 +02:00
Daniel Veillard
ecb9a5319a Release of libvirt-1.2.14
- docs/news.html.in libvirt.spec.in: update for the release
- po/*.po*: regenerated localization
2015-04-02 15:48:08 +08:00
Jiri Denemark
956953884e Add support for tracking thread jobs
Each thread can use a thread local variable to keep the name of a job
which is currently running in the job.

The virThreadJobSetWorker API is supposed to be called once by any
thread which is used as a worker, i.e., it is waiting in a pool, woken
up to do a job, and returned back to the pool.

The virThreadJobSet/virThreadJobClear APIs are to be called at the
beginning/end of each job.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-03-25 10:00:53 +01:00
Jiri Denemark
61dda4f9ab POTFILES.in: Sort
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-03-25 10:00:53 +01:00
Antoni Segura Puimedon
e1f6485694 util: functions to support binding/unbinding midonet virtualports
Adds the port type definitions and methods that will be used to bind
interfaces to the Midonet virtual ports.

virtnetdevmidonet.c adds the way to bind and unbind the ports by
calling into the Midonet Host Agent control command line (installed
with the midolman package).

Signed-off-by: Antoni Segura Puimedon <toni+libvirt@midokura.com>
2015-03-17 12:56:37 -04:00
Daniel P. Berrange
d196444c49 Refresh translations from Zanata
Delete .po files which contain zero translated strings. Refresh
the .pot file and pull down latest translations from Zanata.

When refreshing the libvirt.pot, it can be pushed to zanata
and .po files resynchonized using

 # cd po
 # rm libvirt.pot
 # make libvirt.pot
 # zanata-cli push
 # zanata-cli pull

Note there is no need for 'make update-po', as long as you do
a zanata push, immediately followed by zanata pull, as the
Zanata server will ensure the .po files downloaded match the
just pushed .pot file.

Note at time of writing, it is strongly recommended to only
use the zanata Java client binary (zanata-cli), and not the
python client binary (zanata). This is because the moderately
large size of the libvirt pot file is causing errors when the
python client tries to push, which have been known to result
in the loss of all translations on the server, as well as also
preventing uploading of .po files themselves :-(
2015-03-06 13:15:28 +00:00
Daniel Veillard
1723cad6e7 Release of libvirt-1.2.13 2015-03-02 11:40:05 +08:00
Daniel P. Berrange
4989d41b67 po: Add config file for zanata
Add configuration file for use with https://fedora.zanata.org
translation system
2015-02-23 09:45:02 +00:00
Peter Krempa
fcee64e73c conf: Move numatune_conf to numa_conf
For a while now there are two places that gather information about NUMA
related guest configuration. While the XML can't be changed we can at
least store the data in one place in the definition.

Rename the numatune_conf.[ch] files to numa_conf as later patches will
move the rest of the definitions from the cpu definition to this one.
2015-02-20 17:43:03 +01:00
Daniel Veillard
fd596a4583 Release of libvirt-1.2.12
* docs/news.html.in libvirt.spec.in: updated for the release
* po/*.po*: regenerated the po
2015-01-27 16:01:12 +08:00
Daniel P. Berrange
d13b586a91 systemd: fix build without dbus
The virDBusMethodCall method has a DBusError as one of its
parameters. If the caller wants to pass a non-NULL value
for this, it immediately makes the calling code require
DBus at build time. This has led to breakage of non-DBus
builds several times. It is desirable that only the virdbus.c
file should need WITH_DBUS conditionals, so we must ideally
remove the DBusError parameter from the method.

We can't simply raise a libvirt error, since the whole point
of this parameter is to give the callers a way to check if
the error is one they want to ignore, without having the logs
polluted with an error message. So, we add a virErrorPtr
parameter which the caller can then either ignore or raise
using the new virReportErrorObject method.

This new method is distinct from virSetError in that it
ensures the logging hooks are run.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-01-26 09:14:04 +00:00
Cédric Bosdonnat
ca481a6f8f Move code related to network routes to networkcommon_conf.[ch]
Moving code for parsing and formatting network routes to
networkcommon_conf helps reusing those routes for domains. The route
definition has been hidden to help reducing the number of unnecessary
checks in the format function.
2015-01-16 10:14:03 +01:00
Daniel P. Berrange
318df5a05f Add support for systemd-machined CreateMachineWithNetwork
systemd-machined introduced a new method CreateMachineWithNetwork
that obsoletes CreateMachine. It expects to be given a list of
VETH/TAP device indexes for the host side device(s) associated
with a container/machine.

This falls back to the old CreateMachine method when the new
one is not supported.
2015-01-15 11:07:07 +00:00
Jim Fehlig
4689cdf779 Introduce support for parsing/formatting Xen xl config format
Introduce a parser/formatter for the xl config format.  Since the
deprecation of xm/xend, the VM config file format has diverged as
new features are added to libxl.  This patch adds support for parsing
and formating the xl config format.  It supports the existing xm config
format, plus adds support for spice graphics and xl disk config syntax.

Disk config is specified a bit differently in xl as compared to xm.  In
xl, disk config consists of comma-separated positional parameters and
keyword/value pairs separated by commas. Positional parameters are
specified as follows

   target, format, vdev, access

Supported keys for key=value options are

  devtype, backendtype

The positional paramters can also be specified in key/value form.  For
example the following xl disk config are equivalent

    /dev/vg/guest-volume,,hda
    /dev/vg/guest-volume,raw,hda,rw
    format=raw, vdev=hda, access=rw, target=/dev/vg/guest-volume

See $xen_sources/docs/misc/xl-disk-configuration.txt for more details.

xl disk config is parsed with the help of xlu_disk_parse() from
libxlutil, libxl's utility library.  Although the library exists
in all Xen versions supported by the libxl virt driver, only
recently has the corresponding header file been included.  A check
for the header is done in configure.ac.  If not found, xlu_disk_parse()
is declared externally.

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-01-14 08:28:50 -07:00
Jim Fehlig
f7a30375bd Revert "src/xenconfig: Xen-xl parser"
This reverts commit 2c78051a14.

Conflicts:
	src/Makefile.am

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-01-12 10:15:13 -07:00
Kiarie Kahurani
2c78051a14 src/xenconfig: Xen-xl parser
Introduce a Xen xl parser

This parser allows for users to convert the new xl disk format and
spice graphics config to libvirt xml format and vice versa. Regarding
the spice graphics config, the code is pretty much straight forward.
For the disk {formating, parsing}, this parser takes care of the new
xl format which include positional parameters and key/value parameters.
In xl format disk config a <diskspec> consists of parameters separated by
commas. If the parameters do not contain an '=' they are automatically
assigned to certain options following the order below

   target, format, vdev, access

The above are the only mandatory parameters in the <diskspec> but there
are many more disk config options. These options can be specified as
key=value pairs. This takes care of the rest of the options such as

  devtype, backend, backendtype, script, direct-io-safe,

The positional paramters can also be specified in key/value form
for example

    /dev/vg/guest-volume,,hda
    /dev/vg/guest-volume,raw,hda,rw
    format=raw, vdev=hda, access=rw, target=/dev/vg/guest-volume

are interpleted to one config.

In xm format, the above diskspec would be written as

phy:/dev/vg/guest-volume,hda,w

The disk parser is based on the same parser used successfully by
the Xen project for several years now.  Ian Jackson authored the
scanner, which is used by this commit with mimimal changes.  Only
the PREFIX option is changed, to produce function and file names
more consistent with libvirt's convention.

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-01-03 22:41:07 -07:00
Daniel Veillard
d171cac6a5 Release of libvirt-1.2.11
- docs/news.html.in libvirt.spec.in: update for release
- po/*.po*: updated localization and regenerated
2014-12-13 10:43:56 +08:00
Conrad Meyer
ab6bd57b07 drvbhyve: Automatically tear down guest domains on shutdown
Reboot requires more sophistication and is left as a future work item --
but at least part of the plumbing is in place.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-12-04 11:03:13 +01:00
Cédric Bosdonnat
4039e22e46 Transform VIR_ERROR into VIR_WARN in detect_scsi_host_caps
If detect_scsi_host_caps reports errors but keeps libvirtd going on
startup, the user is misled by the error messages. Transforming them
into warning still shows the problems, but indicates this is not fatal.
2014-11-07 16:44:48 +01:00
Daniel Veillard
2e87e0aa8c Release of libvirt-1.2.10
- docs/news.html.in libvirt.spec.in: update for release
- po/*.po*: fetched loclalization and regenerated
2014-11-03 14:32:39 +08:00
Taowei Luo
ce381d3764 vbox: Rewrite vboxStoragePoolNumOfVolumes
We use typedef IMedium IHardDisk to make IHardDisk hierachy from
IMedium (Actually it did on vbox 2.2 and 3.0's C++ API).
So when calling
    VBOX_MEDIUM_FUNC_ARG*(IHardDisk, func, args)
we can directly replace it to
    gVBoxAPI.UIMedium.func(IHardDisk, args)

When dealing with this two types, we get some rules from it's
hierachy relationship.

When using IHardDisk and IMedium as input, we can't transfer a
IMedium to IHardDisk. Like:
    gVBoxAPI.UIHardDisk.func(IHardDisk *hardDisk, args)
    Here, we can't put a *IMedium as a argument.

When using IHardDisk and IMedium as output, we can't transfer a
IHardDisk to IMedium. Like:
    gVBoxAPI.UIMachine.GetMedium(IMedium **out)
    Here, we can't put a **IHardDisk as a argument. If this case
    do happen, we either change the API to GetHardDisk or write a
    new one.
2014-10-29 01:21:39 +01:00
Daniel P. Berrange
0399b188ac Move virConnect/virNode related APIs out of libvirt.c
Introduce a src/libvirt-host.c file to hold all the
methods related to the virConnect type.
2014-10-24 16:59:58 +01:00