netconf: Simplify addSourceRoute arguments

Change-Id: I1bf06f865abbed8cf1fdcca909cbf78c6e5f66f4
Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/18168
Reviewed-by: Antoni Segura Puimedon <asegurap@redhat.com>
Reviewed-by: Giuseppe Vallarelli <gvallare@redhat.com>
Reviewed-by: Assaf Muller <amuller@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
refactoring: replacing ifcfg dependency to storage with one from lib.

Ifcfg is using execCmd from storage.misc module, this patch replaces it
with its equivalent from utils module.

Change-Id: I43b0552e30351c6ae8c3765ab863d1abad750f45
Signed-off-by: Giuseppe Vallarelli <gvallare@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/18217
Reviewed-by: Antoni Segura Puimedon <asegurap@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
mom: add mom balloon functional tests for running vms

The balloon functional test includes the grow and shrink tests.
It uses diverse policies to triger grow and shrink operation.

Change-Id: I922568233dc769d83e2fdffe1c24439d13d03d7e
Signed-off-by: MeiLiu <liumbj@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/13156
Reviewed-by: Mark Wu <wudxw@linux.vnet.ibm.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
[1/3] Fix getVlanID() and getVlanDevice().

Previous implementations work only under root privileges.
This patch reimplements both functions to use "ip" tool.

Change-Id: Ieab0f44cf4c4f6f16f81435cb732ccacf57b0767
Signed-off-by: Amador Pahim <apahim@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/18180
Reviewed-by: Antoni Segura Puimedon <asegurap@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
libvirt configure: use "ed" instead of "sed --copy -i"

"sed -i" generates a temp file for output, then renames the temp file to
the targeted file. Renaming a file means just changing the content of
the directory entry, and the edited file has different inode index from
the original version. So the sed edited file is a different file though
with the same file name as the original version. To use sed on
ovirt-node on bind-mounted files, we need "--copy" to copy the temp file
into targeted file instead of renaming. Unfortunately, "--copy" is
provided by a patch that is specific to the RPM packaged sed on Red Hat
family distros. The "--copy" option is neither in GNU sed [1] nor in
Single Unix Specification sed [2].

In this patch we use "ed" instead of "sed -i --copy". "ed" edits the
file in-place, by buffering the edited contents in memory and flushing
to the file at last.

[1] http://www.gnu.org/software/sed/manual/sed.html
[2] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html

Change-Id: Ic265df1a5abca0104d044f8c3048cf0643547c70
Signed-off-by: Zhou Zheng Sheng <zhshzhou@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/17813
Reviewed-by: Antoni Segura Puimedon <asegurap@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
tests: adding missing cleanupNet and refined testQosNetwork.

Some additional cleanupNet were necessary on some tests
which might, on possible failure, make the env dirty.
Added the deletion of network created in the testQosNetwork.

Change-Id: I2fa9619a38acdfcc19f889329d375f868a3e921e
Signed-off-by: Giuseppe Vallarelli <gvallare@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/17941
Reviewed-by: Antoni Segura Puimedon <asegurap@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
define.py: remove %s from imageErr

imageErr untypically has an %s in the error message.
To make things worse, most flows do not fill it, producing messages
which are difficult to understand.

This patch removes the aforementioned %s.

Change-Id: Ia2b8534c34e8efb9d4af3c438a0a0ecc99cf16f0
Bug-Url: https://bugzilla.redhat.com/960635
Signed-off-by: Allon Mureinik <amureini@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/18230
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
tests: setupNetworks add net bond breaking and resizing.

Added 3 functional tests to cover cases of new networks
on top of a bond after resizing/breaking and behaviour
of setup networks which should keep a network when
resizing a bond.

List of added functional tests:

* testSetupNetworksAddNetworkToNicAfterBondResizing
* testSetupNetworksAddNetworkToNicAfterBondBreaking
* testSetupNetworksKeepNetworkOnBondAfterBondResizing

Change-Id: I9e031599ac4457cc24cb9d142110e1781325912f
Signed-off-by: Giuseppe Vallarelli <gvallare@redhat.com>
Signed-off-by: Antoni S. Puimedon <asegurap@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/17634
Reviewed-by: Mark Wu <wudxw@linux.vnet.ibm.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Introducing hidden_vlans configurable.

Change-Id: Id4340936fb998c5ab9ee46e16a16ae15461176f2
Signed-off-by: Amador Pahim <apahim@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/18082
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
modify mom functional test to use VdsProxy

This patch puts vdscli APIs in VdsProxy in utils. It modifies mom functional
test to use it instead of direct calling. It resembles the way network
functional test uses.

Change-Id: I874d527e3919c1beff328183eb12f332f2399b95
Signed-off-by: MeiLiu <liumbj@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/18271
Reviewed-by: Antoni Segura Puimedon <asegurap@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
macspoof hooks: new hook script to enable macspoof filtering per vnic.

Puropose of this patch is to add a new hook script which is
almost equal to the existing one except that is applied on
a per vnic basis. This hook script uses a different custom
property ifacemacspoof to avoid conflicts with the macspoof
one which operates for all VM's interfaces.

* Patchset-1 first implmentation.
* Patchset-2 Removing for loop cycling through ifaces,
             the xml is only related to a specific iface.
* Patchset-3 Cherrypicked on top of fix broken storage test.
* Patchset-4 Changed custom property name from macspoofperdevice
             to ifacemacspoof, small fixes to README.
* Patchset-5 Updated implementation, fixed small issue
             related to the parsing code.
* Patchset-6 Updated README key is now part of CustomDeviceProperties.
* Patchset-7 Added before_nic_hotplug hook script.
* Patchset-8 Changed script name to macspoof_vnic and used it
             for 2 events instead of having two equal scripts.
             Updated Makefile and added docstring on top of the script.
* Patchset-9 Inlined removeFilter function, changed assignment 'style'.

Change-Id: Ifb3e7bec7ce400dddc6f4e649b7d21dfe5010631
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=908704
Signed-off-by: Giuseppe Vallarelli <gvallare@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/17678
Reviewed-by: Antoni Segura Puimedon <asegurap@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
After exception on _recoverExistingVms thread we should try again

Currently we fail the process on exception and gets stuck on recovery.
This might be because libvirt exception during first connect. Anyhow, we
should continue try to recover to start serving vdsm requests.

Change-Id: I80745e04c7cce50e4cd8ce12628131b76d0659a7
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=991091
Signed-off-by: Yaniv Bronhaim <ybronhei@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/17617
Reviewed-by: Michal Skrivanek <michal.skrivanek@redhat.com>
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
vdsmapi-schema: optional/required params fix

- VideoDevice specParams field 'vram' is required according to
current dom getXML
- Smartcard device was previously missing required parameters
mode and type
- Type is actually required only for passthrough mode, fixed in code and
  definition

Change-Id: Ia4f9e123da73b0a326ce0762702e5ab7a3a0a583
Signed-off-by: Martin Polednik <mpoledni@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/18056
Reviewed-by: Antoni Segura Puimedon <asegurap@redhat.com>
Reviewed-by: Michal Skrivanek <michal.skrivanek@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Fix the 'MTU' option in networkTests

The 'mtu' option should be in lower case. It doesn't fail with ifcfg
configurator, because the 'MTU=1234' passes through to the ifcfg file
as an extra option.

Change-Id: Ic09a5dd6e8f760eda5dece19bc7e0da2e49611e0
Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/18409
Reviewed-by: Giuseppe Vallarelli <gvallare@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
[2/3] Add "vlanid" to VLAN information

Currently vdsm does not report vlan id as an idependent field. ovirt-engine
is deducting vlan id by parsing vlan name, not reasonable as vlans can be
made with any name.
This patch adds the 'vlanid' information for vlans to be consumed by
ovirt-engine:

...
        vlans = {'eth0.10': {'addr': '',
                             'cfg': {},
                             'iface': 'eth0',
                             'ipv6addrs': [],
                             'mtu': '1500',
                             'netmask': '',
                             'vlanid': 10},
                 'eth0.myvlan': {'addr': '',
                                 'cfg': {},
                                 'iface': 'eth0',
                                 'ipv6addrs': [],
                                 'mtu': '1500',
                                 'netmask': '',
                                 'vlanid': 20}}

...

Change-Id: I6c83a7639bd4219771df0c7b3dd41b8f9806e9f1
Signed-off-by: Amador Pahim <apahim@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/18181
Reviewed-by: Antoni Segura Puimedon <asegurap@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
[3/3] Use fixed getVlanDevice() and getVlanID().

Change many functions to use getVlanDevice() and getVlanID() as a
split('.') replacement.

Change-Id: I9af01e25e1257c18e6b17c4c3c5cb74dc535947a
Signed-off-by: Amador Pahim <apahim@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/18182
Reviewed-by: Antoni Segura Puimedon <asegurap@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Don't down bonds and nics when adding vlan or resizing

When adding vlans on top of devices, a configure of the underlying
device incurs in ifdown and ifup, which in case of that device
backing other vlans, will cause a network interruption.

This patch makes that nics are only reconfigured (if a vlan is being
put on top of them) when the interface was already down. This works
because any extra config that would need to be applied for the new
action needs only application on the vlan device itself.

For Bonds, we only need to reconfigure in case the bonding options
differ or the slaves don't match, in any other case, it's the same
as with nics.

Change-Id: Id3075a2e65f06416c840c6a98689b77555b22e5d
Bug-Url: https://bugzilla.redhat.com/982632
Signed-off-by: Antoni S. Puimedon <asegurap@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/17491
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
vdsm.spec: BZ 988299: Fix GlusterFS RPM dep to support GlusterFS SD

This patch fixes the GlusterFS RPM dependency needed by VDSM to
support Gluster Storage Domain feature. Recent GlusterFS RPM
re-packaging effort to better separate the client and server side
bits and availability of qemu with libgfapi support mark the
pre-req for this patch. These pre-req are now available in
F18/F19/RHEL6/Centos6 and above in the appropriate distro specific
repos. Also removing F17 dep as its End of life now.

BZ 988299 has more details, with pointers to the community
discussions around these.

Change-Id: If648feec92ed33f24f45550f016ac132a25e6923
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=988299
Signed-off-by: Deepak C Shetty <deepakcs@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/17994
Reviewed-by: Bala.FA <barumuga@redhat.com>
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
fix getVlanID returning an int issues

The fact that getVlanId now returns an int causes issues across
the networking codebase due to the fact that there was a lot of
concatenation of the kind:

    vlanDev = ifacename + '.' + vlanId

which of course causes a TypeError due to trying to concatenate
string and int.

Additionally, there was code like:

if (not) vlan:

which now that vlan is int, will be evaluated as False when we
use vlan with id 0.

Finally, this patch makes all internal dealings with vlan ids
to be converted to integer on reception.

Change-Id: I0221bd6ba573c564052bac468d119c2aaceef6e0
Signed-off-by: Antoni S. Puimedon <asegurap@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/18449
Reviewed-by: Amador Pahim <apahim@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
xmlrpcTests: refactoring

- split xmlrpcTests into storageTests and virtTests to reduce complexity
- use vdsProxy approach for virtTests part

Change-Id: I683c9e056137e7a189815bf6be2eb79ee80994cf
Signed-off-by: Martin Polednik <mpoledni@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/17893
Reviewed-by: Antoni Segura Puimedon <asegurap@redhat.com>
Reviewed-by: Vinzenz Feenstra <vfeenstr@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>