]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agoqemu: support setting host-side IP addresses/routes
Laine Stump [Tue, 21 Jun 2016 16:00:45 +0000 (12:00 -0400)]
qemu: support setting host-side IP addresses/routes

For type='ethernet' interfaces only.

(This patch had been pushed earlier in
commit 0b4645a7e061abc8a4be71fe89865cf248ce6e56, but was reverted in
commit 84d47a3cce71175bc1d8af596f835f66f38a190c because it had been
accidentally pushed during the freeze for release 2.0.0)

8 years agolxc: support setting host-side IP addresses/routes
Laine Stump [Fri, 17 Jun 2016 18:52:48 +0000 (14:52 -0400)]
lxc: support setting host-side IP addresses/routes

(This patch had been pushed earlier in
commit cd5c9f21ded4f8e6216eba02b8795f70503ab404, but was reverted in
commit 1549f16832ca23918b651fb4985a2e9f257cd429 because it had been
accidentally pushed during the freeze for release 2.0.0)

8 years agoutil: support setting peer for virNetDevIPInfo addresses
Laine Stump [Fri, 10 Jun 2016 16:37:37 +0000 (12:37 -0400)]
util: support setting peer for virNetDevIPInfo addresses

This will apply to any IP address setting that uses
virNetDevIPInfoAddToDev() (which so far is only the guest-side of LXC
type='ethernet' interfaces).

(This patch had been pushed earlier in
commit cb20f989df393ec97ba65afb06089d0ab87af484, but was reverted in
commit cba06aea8d500d4ea7e2f40272be484027dd3e4a because it had been
accidentally pushed during the freeze for release 2.0.0)

8 years agoconf: support host-side IP/route information in <interface>
Laine Stump [Thu, 9 Jun 2016 19:35:08 +0000 (15:35 -0400)]
conf: support host-side IP/route information in <interface>

This is place as a sub-element of <source>, where other aspects of the
host-side connection to the network device are located (network or
bridge name, udp listen port, etc). It's a bit odd that the interface
we're configuring with this info is itself named in <target dev='x'/>,
but that ship sailed long ago:

    <interface type='ethernet'>
      <mac address='00:16:3e:0f:ef:8a'/>
      <source>
        <ip address='192.168.122.12' family='ipv4'
            prefix='24' peer='192.168.122.1'/>
        <ip address='192.168.122.13' family='ipv4' prefix='24'/>
        <route family='ipv4' address='0.0.0.0'
               gateway='192.168.122.1'/>
        <route family='ipv4' address='192.168.124.0' prefix='24'
               gateway='192.168.124.1'/>
      </source>
    </interface>

In practice, this will likely only be useful for type='ethernet', so
its presence in any other type of interface is currently forbidden in
the generic device Validate function (but it's been put into the
general population of virDomainNetDef rather than the
ethernet-specific union member so that 1) we can more easily add the
capability to other types if needed, and 2) we can retain the info
when set to an invalid interface type all the way through to
validation and report a proper error, rather than just ignoring it
(which is currently what happens for many other type-specific
settings).

(NB: The already-existing configuration of IP info for the guest-side
of interfaces is in subelements directly under <interface>, and the
name of the guest-side interface (when configurable) is in <guest
dev='x'/>).

(This patch had been pushed earlier in
commit fe6a77898a38f491403a70cc49925a584101daee, but was reverted in
commit d658456530c1010a49f45865613ed361a0fcc5b4 because it had been
accidentally pushed during the freeze for release 2.0.0)

8 years agoconf: allow setting peer address in <ip> element of <interface>
Vasiliy Tolstov [Mon, 4 Apr 2016 21:00:03 +0000 (21:00 +0000)]
conf: allow setting peer address in <ip> element of <interface>

The peer attribute is used to set the property of the same name in the
interface IP info:

  <interface type='ethernet'>
    ...
    <ip family='ipv4' address='192.168.122.5'
        prefix='32' peer='192.168.122.6'/>
    ...
  </interface>

Note that this element is used to set the IP information on the
*guest* side interface, not the host side interface - that will be
supported in an upcoming patch.

(This patch now has quite a history: it was originally pushed in
commit 690969af, which was subsequently reverted in commit 1d14b13f,
then reworked and pushed (along with a lot of other related/supporting
patches) in commit 93135abf1; however *that* commit had been
accidentally pushed during dev. freeze for release 2.0.0, so it was
again reverted in commit f6acf039f0).

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
Signed-off-by: Laine Stump <laine@laine.org>
8 years agoutil: new function virNetDevIPInfoAddToDev
Laine Stump [Thu, 16 Jun 2016 16:22:07 +0000 (12:22 -0400)]
util: new function virNetDevIPInfoAddToDev

This patch takes the code out of
lxcContainerRenameAndEnableInterfaces() that adds all IP addresses and
IP routes to the interface, and puts it into a utility function
virNetDevIPInfoAddToDev() in virnetdevip.c so that it can be used by
anyone.

One small change in functionality -
lxcContainerRenameAndEnableInterfaces() previously would add all IP
addresses to the interface while it was still offline, then set the
interface online, and then add the routes. Because I don't want the
utility function to set the interface online, I've moved this up so
the interface is first set online, then IP addresses and routes are
added. This is the same order that the network service from
initscripts (in ifup-ether) does it, so it shouldn't pose any problem
(and hasn't, in the tests that I've run).

(This patch had been pushed earlier in commit
f1e0d0da11c473905470c28a6488bf57d9d0ae6e, but was reverted in commit
05eab47559950403aa67d18b098273269ae6916e because it had been
accidentally pushed during the freeze for release 2.0.0)

8 years agoqemu: Introduce helper qemuDomainSecretDiskCapable
John Ferlan [Fri, 24 Jun 2016 19:47:09 +0000 (15:47 -0400)]
qemu: Introduce helper qemuDomainSecretDiskCapable

Introduce a helper to help determine if a disk src could be possibly used
for a disk secret... Going to need this for hot unplug.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoencryption: Add <cipher> and <ivgen> to encryption
John Ferlan [Wed, 1 Jun 2016 23:21:26 +0000 (19:21 -0400)]
encryption: Add <cipher> and <ivgen> to encryption

For a luks device, allow the configuration of a specific cipher to be
used for encrypting the volume.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoencryption: Add luks parsing for storageencryption
John Ferlan [Wed, 1 Jun 2016 19:01:31 +0000 (15:01 -0400)]
encryption: Add luks parsing for storageencryption

Add parse and format of the luks/passphrase secret including tests for
volume XML parsing.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoutil: Add 'usage' for encryption
John Ferlan [Mon, 30 May 2016 11:47:46 +0000 (07:47 -0400)]
util: Add 'usage' for encryption

In order to use more common code and set up for a future type, modify the
encryption secret to allow the "usage" attribute or the "uuid" attribute
to define the secret. The "usage" in the case of a volume secret would be
the path to the volume as dictated by the backwards compatibility brought
on by virStorageGenerateQcowEncryption where it set up the usage field as
the vol->target.path and didn't allow someone to provide it. This carries
into virSecretObjListFindByUsageLocked which takes the secret usage attribute
value from from the domain disk definition and compares it against the
usage type from the secret definition. Since none of the code dealing
with qcow/qcow2 encryption secrets uses usage for lookup, it's a mostly
cosmetic change. The real usage comes in a future path where the encryption
is expanded to be a luks volume and the secret will allow definition of
the usage field.

This code will make use of the virSecretLookup{Parse|Format}Secret common code.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoconf: Add new secret type "passphrase"
John Ferlan [Wed, 1 Jun 2016 19:00:57 +0000 (15:00 -0400)]
conf: Add new secret type "passphrase"

Add a new secret type known as "passphrase" - it will handle adding the
secret objects that need a passphrase without a specific username.

The format is:

   <secret ...>
     <uuid>...</uuid>
     ...
     <usage type='passphrase'>
       <name>mumblyfratz</name>
     </usage>
   </secret>

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoconf: No need to check for usage fields during Format
John Ferlan [Fri, 24 Jun 2016 14:25:15 +0000 (10:25 -0400)]
conf: No need to check for usage fields during Format

Since the virSecretDefParseUsage ensures each of the fields is present,
no need to check during virSecretDefFormatUsage (also virBufferEscapeString
is a no-op with a NULL argument).

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoAllow custom metadata in network configuration XML
Brandon Bennett [Wed, 22 Jun 2016 22:05:50 +0000 (16:05 -0600)]
Allow custom metadata in network configuration XML

    This replicates the metadata field found in the domain configuration
    and adds it to the network configuration XML.

8 years agoutil: new function virXMLNodeSanitizeNamespaces()
Laine Stump [Fri, 24 Jun 2016 15:19:35 +0000 (11:19 -0400)]
util: new function virXMLNodeSanitizeNamespaces()

This is a generic version of virDomainDefMetadataSanitize() - the same
functionality is now needed for network metadata.

8 years agodocs: remove outdated suggestion to make patches with "diff -urp"/"git diff"
Laine Stump [Wed, 29 Jun 2016 19:36:31 +0000 (15:36 -0400)]
docs: remove outdated suggestion to make patches with "diff -urp"/"git diff"

I can't think of any good reason to do either of those, and having the
examples there will just lead to unusable patch emails from people who
can't be bothered to read the entire page.

8 years agoutil: hostcpu: Only define /dev/kvm path once
Andrea Bolognani [Fri, 24 Jun 2016 17:34:38 +0000 (19:34 +0200)]
util: hostcpu: Only define /dev/kvm path once

Remove the local kvmpath variable from
virHostCPUGetThreadsPerSubcore() and use the file-global
KVM_DEVICE define instead.

8 years agoexamples: check asprintf return value in client_info.c
Ján Tomko [Fri, 1 Jul 2016 12:57:43 +0000 (14:57 +0200)]
examples: check asprintf return value in client_info.c

On error, asprintf returns -1 and the contents of the string
pointer is undefined. In the rest of the libvirt code,
the virAsprintf wrapper takes care of that.

Check the return value and report a generic error, since we
purposefully avoid linking to virutil.

8 years agomingw-libvirt.spec.in: add perl + perl(Getopt::Long) BRs
Daniel P. Berrange [Fri, 1 Jul 2016 13:11:15 +0000 (14:11 +0100)]
mingw-libvirt.spec.in: add perl + perl(Getopt::Long) BRs

The default Fedora build roots for f25 and newer no longer
include perl. We must thus explicitly ask for it as the
RPC gendispatch.pl program needs it, and the Getopt::Long
module. Do this unconditionally since it isn't harmful for
older Fedora

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agomingw-libvirt.spec.in: fix packaging of admin API and other bugs
Daniel P. Berrange [Fri, 1 Jul 2016 11:41:32 +0000 (12:41 +0100)]
mingw-libvirt.spec.in: fix packaging of admin API and other bugs

When the admin API was enabled no entries were added to the
file list.

The virt-host-validate binary is also no longer built on
win32

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoevents: Rename argument uuid->key
Cole Robinson [Thu, 23 Jun 2016 16:14:23 +0000 (12:14 -0400)]
events: Rename argument uuid->key

Since it's not strictly a uuid anymore

8 years agoevents: Add explicit lookup 'key' value
Cole Robinson [Thu, 23 Jun 2016 16:06:39 +0000 (12:06 -0400)]
events: Add explicit lookup 'key' value

This allows event implementations to match on something other
than an object's uuid, like nodedev or interface objects which
don't have a uuid.

8 years agoevents: Pass in UUID as a string
Cole Robinson [Thu, 23 Jun 2016 15:50:05 +0000 (11:50 -0400)]
events: Pass in UUID as a string

This should not have any functional difference, it's just a step
towards matching on non-uuid string keys

8 years agoevents: Cleanup callback variable name
Cole Robinson [Thu, 23 Jun 2016 15:43:24 +0000 (11:43 -0400)]
events: Cleanup callback variable name

In every other instance virObjectEventCallbackPtr is named 'cb',
and in other code 'event' usually means a virObjectEventPtr

8 years agoevents: Add virObjectEventCallbackFree
Cole Robinson [Thu, 23 Jun 2016 15:40:53 +0000 (11:40 -0400)]
events: Add virObjectEventCallbackFree

8 years agoevents: Privatize virObjectEventCallback
Cole Robinson [Thu, 23 Jun 2016 15:29:50 +0000 (11:29 -0400)]
events: Privatize virObjectEventCallback

It's only used in object_event.c, so remove it from the header. We
need to move the _virObjectEventCallback definition earlier as a
result.

8 years agoIntroduce virDomainUSBDeviceDefForeach
Ján Tomko [Thu, 23 Jun 2016 03:04:48 +0000 (05:04 +0200)]
Introduce virDomainUSBDeviceDefForeach

A helper that will execute a callback on every USB device
in the domain definition.

With an ability to skip USB hubs, since we will want to treat
them differently in some cases.

8 years agoAdd USB addresses to qemuhotplug test cases
Ján Tomko [Thu, 23 Jun 2016 05:28:34 +0000 (07:28 +0200)]
Add USB addresses to qemuhotplug test cases

This test assumes the XML will be the same after formatting.
Add USB addresses to it to keep it working when we autoassign them.

8 years agoqemu: Avoid needless copies of static strings
Jiri Denemark [Wed, 29 Jun 2016 15:14:52 +0000 (17:14 +0200)]
qemu: Avoid needless copies of static strings

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Drop emitBootindex parameter
Jiri Denemark [Tue, 28 Jun 2016 21:13:17 +0000 (23:13 +0200)]
qemu: Drop emitBootindex parameter

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Use bootindex whenever possible
Jiri Denemark [Tue, 28 Jun 2016 20:15:25 +0000 (22:15 +0200)]
qemu: Use bootindex whenever possible

I'm not sure why our code claimed "-boot menu=on" cannot be used in
combination with per-device bootindex, but it was proved wrong about
four years ago by commit 8c952908. Let's always use bootindex when QEMU
supports it.

https://bugzilla.redhat.com/show_bug.cgi?id=1323085

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Remove redundant parameter in virQEMUCapsFillDomainCaps
Jiri Denemark [Mon, 27 Jun 2016 13:12:34 +0000 (15:12 +0200)]
qemu: Remove redundant parameter in virQEMUCapsFillDomainCaps

virttype is already included in domCaps, no need to pass it separately.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agodomaincapstest: Don't read data from host
Jiri Denemark [Mon, 27 Jun 2016 13:40:31 +0000 (15:40 +0200)]
domaincapstest: Don't read data from host

virQEMUCapsFillDomainCaps would use virHostCPUGetKVMMaxVCPUs for KVM
domains.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Drop NR_DRIVERS macro
Jiri Denemark [Fri, 24 Jun 2016 16:43:19 +0000 (18:43 +0200)]
cpu: Drop NR_DRIVERS macro

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Drop generic driver
Jiri Denemark [Fri, 24 Jun 2016 16:42:31 +0000 (18:42 +0200)]
cpu: Drop generic driver

Pretending (partial) support for something we don't understand is risky.
Reporting a failure is much better.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoPost-release version bump to 2.1.0
Jiri Denemark [Fri, 1 Jul 2016 10:20:03 +0000 (12:20 +0200)]
Post-release version bump to 2.1.0

8 years agoLibvirt 2.0.0 release
Daniel Veillard [Fri, 1 Jul 2016 08:59:30 +0000 (10:59 +0200)]
Libvirt 2.0.0 release

* docs/news.html.in: update documentation
* po/*.po*: regenerate

8 years agodist: Speed up distribution compression
Martin Kletzander [Thu, 30 Jun 2016 14:05:24 +0000 (16:05 +0200)]
dist: Speed up distribution compression

This almost reverts b7200d723648.  The size is increased from 11M to 13M
and the compression is sped up from 2 minutes to 17 seconds.  The
compression level is removed because -9 doesn't allow multiple threads
to be spawned.  Effectively speeds up distcheck as well.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoconf: Don't free the constructed string in virDomainGetBlkioParametersAssignFromDef
Peter Krempa [Thu, 30 Jun 2016 12:33:24 +0000 (14:33 +0200)]
conf: Don't free the constructed string in virDomainGetBlkioParametersAssignFromDef

virTypedParameterAssign steals the string rather than copying it into
the typed parameter and thus freeing it leads to a crash when attempting
to serialize the results.

This was introduced in commit 9f50f6e2 and later made an universal
helper in 32e6339c.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1351473

8 years agoconf: def: Avoid unnecessary allocation of 'perf' events definition
Peter Krempa [Tue, 28 Jun 2016 12:37:29 +0000 (14:37 +0200)]
conf: def: Avoid unnecessary allocation of 'perf' events definition

Some code paths already assume that it is allocated since it was always
allocated by virDomainPerfDefParseXML. Make it member of virDomainDef
directly so that we don't have to allocate it all the time.

This fixes crash when attempting to connect to an existing process via
virDomainQemuAttach since we would not allocate it in that code path.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1350688

8 years agodocs: Warn against locked memory limit too high
Jiri Denemark [Tue, 28 Jun 2016 12:00:03 +0000 (14:00 +0200)]
docs: Warn against locked memory limit too high

https://bugzilla.redhat.com/show_bug.cgi?id=1046833

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add test cases for SCSI disk hot-plug with QEMU
Marc Hartmayer [Mon, 27 Jun 2016 14:43:48 +0000 (16:43 +0200)]
tests: Add test cases for SCSI disk hot-plug with QEMU

Verify that SCSI controllers get created automatically when a SCSI disk
is hot-plugged to a domain that doesn't have a matching SCSI controller
defined already.

Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
8 years agoqemu: SCSI hostdev hot-plug: Fix automatic creation of SCSI controllers
Marc Hartmayer [Mon, 27 Jun 2016 14:43:47 +0000 (16:43 +0200)]
qemu: SCSI hostdev hot-plug: Fix automatic creation of SCSI controllers

Ensure that the given controller and all controllers with a smaller
index exist; there must not be any missing index in between.

Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
8 years agoqemu: hot-plug: Fix broken SCSI disk hot-plug
Marc Hartmayer [Mon, 27 Jun 2016 14:43:46 +0000 (16:43 +0200)]
qemu: hot-plug: Fix broken SCSI disk hot-plug

The commit "qemu: hot-plug: Assume support for -device in
qemuDomainAttachSCSIDisk" dropped the code for the automatic SCSI
controller creation used in SCSI disk hot-plugging. If we are
hot-plugging a SCSI disk to a domain and there is no proper SCSI
controller defined, it results in an "error: internal error: Could not
find scsi controller with index X required for device" error.

For that reason reverting a hunk of the commit
d4d32005d6e8b2cc0a2f26b483ca1de10171db6d.

This patch also adds an extra comment to the code to clarify the
loop.

Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
8 years agoqemu: Let empty default VNC password work as documented
Jiri Denemark [Tue, 28 Jun 2016 12:39:58 +0000 (14:39 +0200)]
qemu: Let empty default VNC password work as documented

CVE-2016-5008

Setting an empty graphics password is documented as a way to disable
VNC/SPICE access, but QEMU does not always behaves like that. VNC would
happily accept the empty password. Let's enforce the behavior by setting
password expiration to "now".

https://bugzilla.redhat.com/show_bug.cgi?id=1180092

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Use proper async job to refresh virtio channels
Jiri Denemark [Wed, 29 Jun 2016 13:52:49 +0000 (15:52 +0200)]
qemu: Use proper async job to refresh virtio channels

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agolibvirt.spec.in: Use libnl-devel for RHEL-6
Jean-Marc Liger [Wed, 29 Jun 2016 16:37:28 +0000 (17:37 +0100)]
libvirt.spec.in: Use libnl-devel for RHEL-6

RHEL-6 still needs to use libnl instead of libnl3, so re-add
the spec conditional mistakenly removed in

  commit 3694e038fd12825042cca6204f7aa7322e2ed9c9
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Wed May 4 15:43:08 2016 +0100

    libvirt.spec.in: drop Fedora < 20 and RHEL < 6

8 years agoadmin: fix virt-admin startup crash by calling virAdmInitialize
Erik Skultety [Wed, 29 Jun 2016 14:12:58 +0000 (16:12 +0200)]
admin: fix virt-admin startup crash by calling virAdmInitialize

Similarly to what virsh virt-login-shell do, call virAdmInitialize prior to
initializing an event loop and initializing the error handler. Commit 97973ebb7
described and fixed an identical issue for libvirt_lxc.
Since virAdmInitialize becomes a public API after applying this patch,
the symbol is also added to public syms and the doc string of the method is
slightly enhanced analogically to virInitialize.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoFix possible invalid read in adminClientGetInfo
Ján Tomko [Wed, 29 Jun 2016 05:03:13 +0000 (07:03 +0200)]
Fix possible invalid read in adminClientGetInfo

virNetServerClientGetInfo returns the client's remote address
as a string, which is a part of the client object.

Use VIR_STRDUP to make a copy which can be freely accessed
even after the virNetServerClient object is unlocked.

To reproduce, put a sleep between virObjectUnlock in
virNetServerClientGetInfo and virTypedParamsAddString in
adminClientGetInfo, then close the queried connection during
that sleep.

8 years agovirStorageTranslateDiskSourcePool: Avoid double free
Michal Privoznik [Tue, 28 Jun 2016 12:44:57 +0000 (14:44 +0200)]
virStorageTranslateDiskSourcePool: Avoid double free

https://bugzilla.redhat.com/show_bug.cgi?id=1316370

Consider the following disk for a domain:

    <disk type='volume' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <auth username='libvirt'>
        <secret type='iscsi' usage='libvirtiscsi'/>
      </auth>
      <source pool='iscsi-secret-pool' volume='unit:0:0:0' mode='direct' startupPolicy='optional'/>
      <target dev='sda' bus='scsi'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

Now, startupPolicy is currently not allowed for iscsi disks, so
one would expect an error message to be thrown. But what a
surprise is waiting for users if they try to start up such
domain:

==15724== Invalid free() / delete / delete[] / realloc()
==15724==    at 0x4C2B1F0: free (vg_replace_malloc.c:473)
==15724==    by 0x54B7A69: virFree (viralloc.c:582)
==15724==    by 0x552DC90: virStorageAuthDefFree (virstoragefile.c:1549)
==15724==    by 0x552F023: virStorageSourceClear (virstoragefile.c:2055)
==15724==    by 0x552F054: virStorageSourceFree (virstoragefile.c:2067)
==15724==    by 0x55556AA: virDomainDiskDefFree (domain_conf.c:1562)
==15724==    by 0x5557ABE: virDomainDefFree (domain_conf.c:2547)
==15724==    by 0x1B43CC42: qemuProcessStop (qemu_process.c:5918)
==15724==    by 0x1B43BA2E: qemuProcessStart (qemu_process.c:5511)
==15724==    by 0x1B48993E: qemuDomainObjStart (qemu_driver.c:7050)
==15724==    by 0x1B489B9A: qemuDomainCreateWithFlags (qemu_driver.c:7104)
==15724==    by 0x1B489C01: qemuDomainCreate (qemu_driver.c:7122)
==15724==  Address 0x21cfbb90 is 0 bytes inside a block of size 48 free'd
==15724==    at 0x4C2B1F0: free (vg_replace_malloc.c:473)
==15724==    by 0x54B7A69: virFree (viralloc.c:582)
==15724==    by 0x552DC90: virStorageAuthDefFree (virstoragefile.c:1549)
==15724==    by 0x12D1C8D4: virStorageTranslateDiskSourcePool (storage_driver.c:3475)
==15724==    by 0x1B4396E4: qemuProcessPrepareDomain (qemu_process.c:4896)
==15724==    by 0x1B43B880: qemuProcessStart (qemu_process.c:5466)
==15724==    by 0x1B48993E: qemuDomainObjStart (qemu_driver.c:7050)
==15724==    by 0x1B489B9A: qemuDomainCreateWithFlags (qemu_driver.c:7104)
==15724==    by 0x1B489C01: qemuDomainCreate (qemu_driver.c:7122)
==15724==    by 0x561CA97: virDomainCreate (libvirt-domain.c:6787)
==15724==    by 0x12B6FD: remoteDispatchDomainCreate (remote_dispatch.h:4116)
==15724==    by 0x12B61A: remoteDispatchDomainCreateHelper (remote_dispatch.h:4092)

The problem is, in virStorageTranslateDiskSourcePool disk
def->src->auth is freed, but the pointer is not set to NULL. So
later, when qemuProcessStop starts to free the domain definition,
virStorageAuthDefFree() tries to free the memory again, instead
of jumping out immediately.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agologging: fixing log level initialization from cmdline
Jaroslav Suchanek [Tue, 28 Jun 2016 11:05:30 +0000 (13:05 +0200)]
logging: fixing log level initialization from cmdline

Reorder code for setting default log level from cmdline prior
initialization of log outputs. Thus the --verbose option is reflected.

This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1325072

8 years agoqemuDomainDeviceDefValidate: Drop unused qemuCaps
Jiri Denemark [Mon, 27 Jun 2016 15:44:52 +0000 (17:44 +0200)]
qemuDomainDeviceDefValidate: Drop unused qemuCaps

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agovz: Fix indentation in prlsdkGetNetAddresses()
Andrea Bolognani [Tue, 28 Jun 2016 08:09:52 +0000 (10:09 +0200)]
vz: Fix indentation in prlsdkGetNetAddresses()

8 years agovz: fix build for virNetDev* changes
Olga Krishtal [Mon, 27 Jun 2016 18:23:11 +0000 (21:23 +0300)]
vz: fix build for virNetDev* changes

Patch fixes vz build after changes in IP-related netdev functions(cf0568b0fbc1843d).

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
8 years agoRevert "util: new function virNetDevIPInfoAddToDev"
Ján Tomko [Mon, 27 Jun 2016 09:56:17 +0000 (11:56 +0200)]
Revert "util: new function virNetDevIPInfoAddToDev"

This reverts commit f1e0d0da11c473905470c28a6488bf57d9d0ae6e.

This feature was accidentally pushed in the feature freeze.

8 years agoRevert "conf: allow setting peer address in <ip> element of <interface>"
Ján Tomko [Mon, 27 Jun 2016 09:56:17 +0000 (11:56 +0200)]
Revert "conf: allow setting peer address in <ip> element of <interface>"

This reverts commit 93135abf1454d8a1c8542e8c951ed615305ffa24.

This feature was accidentally pushed in the feature freeze.

8 years agoRevert "conf: support host-side IP/route information in <interface>"
Ján Tomko [Mon, 27 Jun 2016 09:56:17 +0000 (11:56 +0200)]
Revert "conf: support host-side IP/route information in <interface>"

This reverts commit fe6a77898a38f491403a70cc49925a584101daee.

This feature was accidentally pushed in the feature freeze.

8 years agoRevert "util: support setting peer for virNetDevIPInfo addresses"
Ján Tomko [Mon, 27 Jun 2016 09:56:17 +0000 (11:56 +0200)]
Revert "util: support setting peer for virNetDevIPInfo addresses"

This reverts commit cb20f989df393ec97ba65afb06089d0ab87af484.

This feature was accidentally pushed in the feature freeze.

8 years agoRevert "lxc: support setting host-side IP addresses/routes"
Ján Tomko [Mon, 27 Jun 2016 09:56:17 +0000 (11:56 +0200)]
Revert "lxc: support setting host-side IP addresses/routes"

This reverts commit cd5c9f21ded4f8e6216eba02b8795f70503ab404.

This feature was accidentally pushed in the feature freeze.

8 years agoRevert "qemu: support setting host-side IP addresses/routes"
Ján Tomko [Mon, 27 Jun 2016 09:56:16 +0000 (11:56 +0200)]
Revert "qemu: support setting host-side IP addresses/routes"

This reverts commit 0b4645a7e061abc8a4be71fe89865cf248ce6e56.

This feature was accidentally pushed in the feature freeze.

8 years agoClean up after virNetDevIP creation
Andrea Bolognani [Mon, 27 Jun 2016 10:17:59 +0000 (12:17 +0200)]
Clean up after virNetDevIP creation

Commit cf0568b0af4e moved a bunch of functions from virNetDev
to the more specific virNetDevIP; however, not all of the
existing uses were moved properly, causing build failures on
FreeBSD.

Complete the transition to the new names and drop the
obsolete declarations from the header file while at it.

8 years agoutil: netdevip: Include vircommand.h
Andrea Bolognani [Mon, 27 Jun 2016 08:33:00 +0000 (10:33 +0200)]
util: netdevip: Include vircommand.h

Not including the header causes

  util/virnetdevip.c:520:5: error:
  unknown type name 'virCommandPtr'; did you mean 'virCondPtr'?
    virCommandPtr cmd = NULL;
    ^~~~~~~~~~~~~

and plenty more similar failures when compiling on FreeBSD.

8 years agolibvirtd.conf: Fix invalid default of max_anonymous_clients
Michal Privoznik [Sun, 26 Jun 2016 07:44:41 +0000 (09:44 +0200)]
libvirtd.conf: Fix invalid default of max_anonymous_clients

https://bugzilla.redhat.com/show_bug.cgi?id=1343442

When a client connects, it is placed into a queue. As soon as it
authenticate, it is taken out of that queue and placed into a
different one. Now, we have a setting in the daemon config file
that allows users to control the length of the queue of yet not
authenticated clients. By default, it has a value 20 but in the
description to the config knob we clam it's zero.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: support setting host-side IP addresses/routes
Laine Stump [Tue, 21 Jun 2016 16:00:45 +0000 (12:00 -0400)]
qemu: support setting host-side IP addresses/routes

For type='ethernet' interfaces only.

8 years agolxc: support setting host-side IP addresses/routes
Laine Stump [Fri, 17 Jun 2016 18:52:48 +0000 (14:52 -0400)]
lxc: support setting host-side IP addresses/routes

8 years agoutil: support setting peer for virNetDevIPInfo addresses
Laine Stump [Fri, 10 Jun 2016 16:37:37 +0000 (12:37 -0400)]
util: support setting peer for virNetDevIPInfo addresses

This will apply to any IP address setting that uses
virNetDevIPInfoAddToDev() (which so far is only the guest-side of LXC
type='ethernet' interfaces).

8 years agoconf: support host-side IP/route information in <interface>
Laine Stump [Thu, 9 Jun 2016 19:35:08 +0000 (15:35 -0400)]
conf: support host-side IP/route information in <interface>

This is place as a sub-element of <source>, where other aspects of the
host-side connection to the network device are located (network or
bridge name, udp listen port, etc). It's a bit odd that the interface
we're configuring with this info is itself named in <target dev='x'/>,
but that ship sailed long ago:

    <interface type='ethernet'>
      <mac address='00:16:3e:0f:ef:8a'/>
      <source>
        <ip address='192.168.122.12' family='ipv4'
            prefix='24' peer='192.168.122.1'/>
        <ip address='192.168.122.13' family='ipv4' prefix='24'/>
        <route family='ipv4' address='0.0.0.0'
               gateway='192.168.122.1'/>
        <route family='ipv4' address='192.168.124.0' prefix='24'
               gateway='192.168.124.1'/>
      </source>
    </interface>

In practice, this will likely only be useful for type='ethernet', so
its presence in any other type of interface is currently forbidden in
the generic device Validate function (but it's been put into the
general population of virDomainNetDef rather than the
ethernet-specific union member so that 1) we can more easily add the
capability to other types, and 2) we can retain the info when set to
an invalid interface type all the way through to validation and report
a proper error, rather than just ignoring it (which is currently what
happens for many other type-specific settings).

(NB: The already-existing configuration of IP info for the guest-side
of interfaces is in subelements directly under <interface>, and the
name of the guest-side interface (when configurable) is in <guest
dev='x'/>).

8 years agoconf: allow setting peer address in <ip> element of <interface>
Vasiliy Tolstov [Mon, 4 Apr 2016 21:00:03 +0000 (21:00 +0000)]
conf: allow setting peer address in <ip> element of <interface>

The peer attribute is used to set the property of the same name in the
interface IP info:

  <interface type='ethernet'>
    ...
    <ip family='ipv4' address='192.168.122.5'
        prefix='32' peer='192.168.122.6'/>
    ...
  </interface>

Note that this element is used to set the IP information on the
*guest* side interface, not the host side interface - that will be
supported in an upcoming patch.

(This is an updated *re*-commit of commit 690969af, which was
subsequently reverted in commit 1d14b13f).

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
Signed-off-by: Laine Stump <laine@laine.org>
8 years agoutil: new function virNetDevIPInfoAddToDev
Laine Stump [Thu, 16 Jun 2016 16:22:07 +0000 (12:22 -0400)]
util: new function virNetDevIPInfoAddToDev

This patch takes the code out of
lxcContainerRenameAndEnableInterfaces() that adds all IP addresses and
IP routes to the interface, and puts it into a utility function
virNetDevIPInfoAddToDev() in virnetdevip.c so that it can be used by
anyone.

One small change in functionality -
lxcContainerRenameAndEnableInterfaces() previously would add all IP
addresses to the interface while it was still offline, then set the
interface online, and then add the routes. Because I don't want the
utility function to set the interface online, I've moved this up so
the interface is first set online, then IP addresses and routes are
added. This is the same order that the network service from
initscripts (in ifup-ether) does it, so it shouldn't pose any problem
(and hasn't, in the tests that I've run).

8 years agolxc: move debug/error log when adding IP addresses to virNetDevIPAddrAdd
Laine Stump [Wed, 15 Jun 2016 19:27:47 +0000 (15:27 -0400)]
lxc: move debug/error log when adding IP addresses to virNetDevIPAddrAdd

It makes more sense to have the logging at the lower level so other
callers can share the goodness.

While removing so much stuff from / touching so many lines in
lxcContainerRenameAndEnableInterfaces() (which used to have this
debug/error logging), label names were changed and it was updated to
use the now-more-common method of initializing ret to -1 (failure),
then setting to 0 right before the cleanup label.

8 years agoconf: clean up after adding calls to virNetDevIPInfo helpers
Laine Stump [Thu, 9 Jun 2016 01:08:31 +0000 (21:08 -0400)]
conf: clean up after adding calls to virNetDevIPInfo helpers

virDomainNetIPInfoParseXML() and virDomainNetIPInfoFormat() are no
longer "unused", so we can now remove the "ATTRIBUTE_UNUSED" from
their definitions, since virDomainNetIPInfoFormat() is now the only
caller of virDomainNetIPsFormat() and virDomainNetRoutesFormat(),
those two functions can simply be subsumed into
virDomainNetIPInfoFormat().

8 years agoqemu: forbid setting guest-side IP address/route info of <interface>
Laine Stump [Tue, 21 Jun 2016 15:59:37 +0000 (11:59 -0400)]
qemu: forbid setting guest-side IP address/route info of <interface>

libvirt's qemu driver doesn't have direct access to the config on the
guest side of a network interface, and currently doesn't have any
method in place to even inform the guest of the desired config. In the
future, an unenforceable attempt to set the guest-side IP info could
be made by adding a static host entry to the appropriate dnsmasq
configuration (or changing the default dhcp client address on the qemu
commandline for type='user' interfaces), or enhancing the guest agent
to allow setting an IP address, but for now it can't have any effect,
and we don't want to give the illusion that it does.

To prevent the "disappearance" of any existing configs with ip
address/route info (due to parser failure), this check is added in the
newly implemented qemuDomainDeviceDefValidate(), which is only called
when a domain is defined or started, *not* when it is reread from disk
at libvirtd startup.

8 years agoconf: use virNetDevIPInfo for guest-side <interface> config
Laine Stump [Tue, 7 Jun 2016 15:39:34 +0000 (11:39 -0400)]
conf: use virNetDevIPInfo for guest-side <interface> config

All the same information was already there, just in slightly different
places in the virDomainNetDef.

8 years agoconf: use virNetDevIPInfo in virDomainHostdevCaps
Laine Stump [Mon, 6 Jun 2016 19:44:15 +0000 (15:44 -0400)]
conf: use virNetDevIPInfo in virDomainHostdevCaps

a.k.a. <hostdev mode='capabilities' type='net'>.

This replaces the existing nips, ips, nroutes, and routes with a
single virNetDevIPInfo, and simplifies the code by calling that
object's parse/format/clear functions instead of open coding.

8 years agoconf: single object containing list of IP addresses, list of routes
Laine Stump [Mon, 6 Jun 2016 19:19:23 +0000 (15:19 -0400)]
conf: single object containing list of IP addresses, list of routes

There are currently two places in the domain where this combination is
used, and there is about to be another. This patch puts them together
for brevity and uniformity.

As with the newly-renamed virNetDevIPAddr and virNetDevIPRoute
objects, the new virNetDevIPInfo object will need to be accessed by a
utility function that calls low level Netlink functions (so we don't
want it to be in the conf directory) and will be called from multiple
hypervisor drivers (so it can't be in any hypervisor directory); the
most appropriate place is thus once again the util directory.

The parse and format functions are in conf/domain_conf.c because only
the domain XML (i.e. *not* the network XML) has this exact combination
of IP addresses plus routes. Note that virDomainNetIPInfoFormat() will
end up being the only caller to virDomainNetRoutesFormat() and
virDomainNetIPsFormat(), so it will just subsume those functions in a
later patch, but we can't do that until they are no longer called.

(It would have been nice to include the interface name within the
virNetDevIPInfo object (with a slight name change), but that can't
be done cleanly, because in each case the interface name is provided
in a different place in the XML relative to the routes and IP
addresses, so putting it in this object would actually make the code
more confused rather than simpler).

8 years agoutil: move IP route & address object-related functions to virnetdevip.c
Laine Stump [Tue, 14 Jun 2016 17:40:04 +0000 (13:40 -0400)]
util: move IP route & address object-related functions to virnetdevip.c

These functions all need to be called from a utility function that
must be located in the util directory, so we move them all into
util/virnetdevip.[ch] now that it exists.

Function and struct names were appropriately changed for the new
location, but all code is unchanged aside from motion and renaming.

8 years agoutil: new files virnetdevip.[ch] for IP-related netdev functions
Laine Stump [Mon, 13 Jun 2016 21:01:27 +0000 (17:01 -0400)]
util: new files virnetdevip.[ch] for IP-related netdev functions

This patch splits virnetdev.[ch] into multiple files, with the new
virnetdevip.[ch] containing all the functions related to setting and
retrieving IP-related info for a device (both addresses and routes).

8 years agoconf/openvz: eliminate incorrect/undocumented use of <source dev='blah'/>
Laine Stump [Tue, 21 Jun 2016 19:20:57 +0000 (15:20 -0400)]
conf/openvz: eliminate incorrect/undocumented use of <source dev='blah'/>

When support for <interface type='ethernet'> was added in commit
9a4b705f back in 2010, it erroneously looked at <source dev='blah'/>
for a user-specified guest-side interface name. This was never
documented though. (that attribute already existed at the time in the
data.ethernet union member of virDomainNetDef, but apparently had no
practical use - it was only used as a storage place for a NetDef's
bridge name during qemuDomainXMLToNative(), but even then that was
never used for anything).

When support for similar guest-side device naming was added to the lxc
driver several years later, it was put in a new subelement <guest
dev='blah'/>.

In the intervening years, since there was no validation that
ethernet.dev was NULL in the other drivers that didn't actually use
it, innocent souls who were adding other features assuming they needed
to account for non-NULL ethernet.dev when really they didn't, so
little bits of the usual pointless cargo-cult code showed up.

This patch not only switches the openvz driver to use the documented
<guest dev='blah'/> notation for naming the guest-side device (just in
case anyone is still using the openvz driver), and logs an error if
anyone tries to set <source dev='blah'/> for a type='ethernet'
interface, it also removes the cargo-cult uses of ethernet.dev and
<source dev='blah'/>, and eliminates if from the RNG and from
virDomainNetDef.

NB: I decided on this course of action after mentioning the
inconsistency here:

  https://www.redhat.com/archives/libvir-list/2016-May/msg02038.html

and getting encouragement do eliminate it in a later IRC discussion
with danpb.

8 years agoqemu: eliminate memory leaks when converting NetDefs to type='ethernet'
Laine Stump [Tue, 21 Jun 2016 18:29:17 +0000 (14:29 -0400)]
qemu: eliminate memory leaks when converting NetDefs to type='ethernet'

in qemuConnectDomainXMLToNative. This function was only accounting for
about 1/10 of all the allocated items in the NetDef prior to memseting
it to all 0's. On top of that, it was going to great pains to learn
the name of the bridge device, but then never doing anything useful
with it (just putting it into data.ethernet.dev, which is *never* used
when building a qemu commandline). (I think this again all started off
as code with good intentions, but it was never completed, and instead
was just Frankensteinically cargo-culted into the odd mish mash we
have today).

The resulting code is much simpler, produces exactly the same output,
and doesn't leak memory.

8 years agoqemu: don't set/clear NetDef IP addresses in qemuConnectDomainXMLToNative()
Laine Stump [Tue, 7 Jun 2016 23:59:10 +0000 (19:59 -0400)]
qemu: don't set/clear NetDef IP addresses in qemuConnectDomainXMLToNative()

This patch removes the expanded and duplicated code that all sprung
out of two well-intentioned-but-useless settings of
net->data.(bridge|ethernet).ipaddr.

qemu has never supported even a single IP address in the interface
config, much less a list of them. All of the instances of "clearing
out the IP addresses" that are now in this function originated with
commit d8dbd6 "Basic domain XML conversions for Xen/QEMU drivers" in
May 2009, but even then the single "ipaddr" in the struct for
type='ethernet' and type='bridge' wasn't used in the qemu driver (only
in xen and openvz). Since then anyone who added a new interface type
also tacked on another unnecessary clearing of ipaddr, and when it was
made into a list of IPs (so far supported only by the LXC driver) this
simple setting was turned into a loop (well, multiple loops) to clear
them all.

8 years agoconf: new function virDomainNetDefClear
Laine Stump [Tue, 21 Jun 2016 18:22:15 +0000 (14:22 -0400)]
conf: new function virDomainNetDefClear

We need to clear these out without freeing the object completely.

8 years agolxc: use correct prefix when setting veth IP address
Laine Stump [Tue, 26 Apr 2016 18:27:08 +0000 (14:27 -0400)]
lxc: use correct prefix when setting veth IP address

Commit c9a641 (first appearred in 1.2.12) added support for setting
the guest-side IP address of veth devices in lxc domains.
Unfortunately, it hardcoded the assumption that the proper prefix for
any IP address with no explicit prefix in the config should be "24";
that is only correct for class C IPv4 addresses, but not for any other
IPv4 address, nor for any IPv6 address.

The good news is that there is already a function in libvirt that will
determine the proper default prefix for any IP address. This patch
replaces the use of the ill-fated VIR_SOCKET_ADDR_DEFAULT_PREFIX with
calls to virSocketAddrGetIPPrefix().

8 years agolxc: eliminate extraneous free of netDef->ifname_guest
Laine Stump [Wed, 15 Jun 2016 19:17:53 +0000 (15:17 -0400)]
lxc: eliminate extraneous free of netDef->ifname_guest

lxcContainerRenameAndEnableInterfaces() isn't making a copy of the
interface's ifname_guest (into newname), it's just copying the pointer
to it. This means that when it later calls VIR_FREE(newname), it's
actually freeing up (and fortunately NULLing out, so at least we don't
try to access free'd memory) netDef->ifname_guest.

8 years agoutil: allow calling virSocketAddrGetIPPrefix with NULL netmask or address
Laine Stump [Tue, 26 Apr 2016 18:55:12 +0000 (14:55 -0400)]
util: allow calling virSocketAddrGetIPPrefix with NULL netmask or address

There are times when we don't have a netmask pointer to give to
virSocketAddrGetIPPrefix() (e.g. the IP addresses in domain interfaces
only have a prefix, no netmask), but it would have caused a segv if we
called it with NULL instead of a pointer to a netmask. This patch
qualifies the code that would use the netmask or address pointers to
check for NULL first.

8 years agotests: mock virNetDevSetIPAddress
Laine Stump [Tue, 26 Apr 2016 16:49:48 +0000 (12:49 -0400)]
tests: mock virNetDevSetIPAddress

Now that we can include <interface type='ethernet'> in tests, we could
almost test XML that has an <ip> element in an interface. Except that
the test fails when it tries to actually set the IP address for the
interface's tap device. This patch mocks virNetDevSetIPAddress() to
just return success.

8 years agoconf: clean up virDomainNetIPParseXML()
Laine Stump [Tue, 26 Apr 2016 16:18:53 +0000 (12:18 -0400)]
conf: clean up virDomainNetIPParseXML()

Rearrange this function to be better organized and more correct:

* the error codes were changed from the incorrect INVALID_ARG to
  XML_ERROR

* prefix still isn't required, but if present it must be valid or an
  error will be logged.

* don't emit a debug log just because prefix is missing - this
  is valid.

* group everything related to setting prefix in one place rather than
  scattered through the function.

8 years agoglobal: consistently use IP rather than Ip in identifiers
Laine Stump [Wed, 8 Jun 2016 16:48:50 +0000 (12:48 -0400)]
global: consistently use IP rather than Ip in identifiers

I'm tired of mistyping this all the time, so let's do it the same all
the time (similar to how we changed all "Pci" to "PCI" awhile back).

(NB: I've left alone some things in the esx and vbox drivers because
I'm unable to compile them and they weren't obviously *not* a part of
some API. I also didn't change a couple of variables named,
e.g. "somethingIptables", because they were derived from the name of
the "iptables" command)

8 years agoutil: move virInterface(State|Link)/virNetDevFeature from conf to util
Laine Stump [Mon, 13 Jun 2016 17:06:15 +0000 (13:06 -0400)]
util: move virInterface(State|Link)/virNetDevFeature from conf to util

These had been declared in conf/device_conf.h, but then used in
util/virnetdev.c, meaning that we had to #include conf/device_conf.h
in virnetdev.c (which we have for a long time said shouldn't be done.

This caused a bigger problem when I tried to #include util/virnetdev.h
in a file in src/conf (which is allowed) - for some reason the
"device_conf.h: File not found" error.

The solution is to move the data types and functions used in util
sources from conf to util. Some names were adjusted during the move
("virInterface" --> "virNetDevIf", and "VIR_INTERFACE" -->
"VIR_NETDEV_IF")

8 years agoutil: move virNetDevLinkDump to virnetlink.c
Laine Stump [Mon, 13 Jun 2016 11:59:12 +0000 (07:59 -0400)]
util: move virNetDevLinkDump to virnetlink.c

virNetDevLinkDump should have been in virnetlink.c, but that file
didn't exist yet when the function was created. It didn't really
matter until now - I found that having virnetlink.h included by
virnetdev.h caused build problems when trying to #include virnetdev.h
in a .c file in src/conf (due to missing directory in -I). Rather than
fix that to further institutionalize the incorrect placement of this
one function, this patch moves the function.

8 years agospec: distribute admin API within libvirt-client package
Erik Skultety [Fri, 24 Jun 2016 17:50:10 +0000 (19:50 +0200)]
spec: distribute admin API within libvirt-client package

With respect to to the following thread
https://www.redhat.com/archives/libvir-list/2016-June/msg01822.html, until we
introduce a new rpm package '-libs' that would allow us to drop daemon's
dependency on the client package, distribute admin API related stuff within
the client package (since it's the best analogy to the virsh client).

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoexamples: admin: Add some examples for the new admin APIs
Erik Skultety [Sun, 15 May 2016 14:04:51 +0000 (16:04 +0200)]
examples: admin: Add some examples for the new admin APIs

Some of the examples make use of asprintf and strtol functions (to keep
things simple) which are prohibited to use within our code (enforced by
syntax-check). Therefore besides adding some examples, this patch also updates
cfg.mk to exclude examples directory from asprintf and strtol rules, as well as
updates .gitignore to exclude all the new admin binaries created in the
'examples' dir.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoadmin: enable both admin API functionality and tarball distribution
Erik Skultety [Fri, 24 Jun 2016 17:27:09 +0000 (19:27 +0200)]
admin: enable both admin API functionality and tarball distribution

This patch enables admin socket creation in daemon's code, bumps the library
version in libvirt_admin_public.syms, and performs all necessary modifications
to our makefiles so that admin API can finally be included in the tarball,
and eventually become part of an rpm package (a patch later in this series).

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovz: always pass graphics address to sdk
Nikolay Shirokovskiy [Wed, 20 Apr 2016 14:05:45 +0000 (17:05 +0300)]
vz: always pass graphics address to sdk

We need this because apply graphics functions is used on
update too. Also in case of NULL address resolve it to default
instead of error.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: support vnc password
Nikolay Shirokovskiy [Wed, 20 Apr 2016 14:05:44 +0000 (17:05 +0300)]
vz: support vnc password

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: remove exlicitly setting zeros in dumping graphics
Nikolay Shirokovskiy [Wed, 20 Apr 2016 14:05:43 +0000 (17:05 +0300)]
vz: remove exlicitly setting zeros in dumping graphics

Allocation will do this job. Also we don't use the explicit setting
in other places.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: support attach/detach/update/ of graphics device
Nikolay Shirokovskiy [Wed, 20 Apr 2016 14:05:42 +0000 (17:05 +0300)]
vz: support attach/detach/update/ of graphics device

Move graphic device config to post parse. This way we
detect error on early stage and leverage checking on detach too.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: move getting container video devices out from vnc code
Nikolay Shirokovskiy [Wed, 20 Apr 2016 14:05:41 +0000 (17:05 +0300)]
vz: move getting container video devices out from vnc code

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: trustGuestRxFilters fixes
Nikolay Shirokovskiy [Wed, 20 Apr 2016 14:05:40 +0000 (17:05 +0300)]
vz: trustGuestRxFilters fixes

First we need to always set value to vz sdk parameter so
we can leverage setting code for device updates. This patch
resolves tristate default to off implicitly. This is easier
then extract default value from vz sdk itself. First current
default is off too, second this approach is already taken
for 'net->linkstate'.

Second dump this option in domain xml.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: fix minor type safey issues with net union usage
Nikolay Shirokovskiy [Wed, 20 Apr 2016 14:05:39 +0000 (17:05 +0300)]
vz: fix minor type safey issues with net union usage

Fix net->data usage accordingly to type field.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: fix updating to no gateways
Nikolay Shirokovskiy [Wed, 20 Apr 2016 14:05:38 +0000 (17:05 +0300)]
vz: fix updating to no gateways

Current code that pass gateways to vz sdk is not suitable for
updates. If update has no gateways while we had them before
we need to pass "" for vz sdk gateways to reset old value.

The code definitely deserves its own function.

Drop checks that skip setting gateways if network address
is not set. Such a configuration is possible in vz sdk.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: dump route info in domain xml
Nikolay Shirokovskiy [Wed, 20 Apr 2016 14:05:37 +0000 (17:05 +0300)]
vz: dump route info in domain xml

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>