avoid reading ifcfg files in netinfo

getting runtime network information is better via quering
more standard netinfo api's rather than reading ifcfg configuration
files which is more error prone.

We need to confine reading ifcfg files only in the context of
dealing with the ifcfg configurator.

Change-Id: I28e2084a15e1f6cc0cb4f20e83d7751fd8ffe37f
Signed-off-by: ibarkan <ibarkan@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/35043
Reviewed-by: Ondřej Svoboda <osvoboda@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Add missing version comment in onlineCpus

The onlineCpus property of the capabilities command was missing a
comment reporting in which version it was introduced.

Change-Id: I2c544a2c8674461b13aa0ac58abd4d2c768ade0f
Signed-off-by: Vitor de Lima <vdelima@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/35100
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
tests: Add and use assertRuleExists and assertRuleDoesntExist

DHCPv6-enabled testSetupNetworksAddDelDhcp needs a better diagnosis.

Change-Id: Icc292135482da28065d0d59fc3a67cddc3a2f2f9
Signed-off-by: Ondřej Svoboda <osvoboda@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/34991
Reviewed-by: Ido Barkan <ibarkan@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
lvm: Disable chown hack for EL6

Testing EL6 revealed that the new vdsm lvm udev rules required for EL7
introduced a race which causes createVolume to fail randomly on some
machines.

Since commit 9240b8c5782 (lvm: Do not use udev to set permissions on
vdsm images), devices are created with default permissions - root:disk.
Then udev run chown which set the permissions to vdsm:qemu.  Because of
udev "watch" feature, this permission dance happens twice when creating
a logical volume:

    root:disk -> vdsm:qemu -> root:disk -> vdsm:qemu

Typically when lvcreate returns the permissions changes are done, but
sometimes it may return while the events are processed. Then when we run
qemu-img, it fail because the disk permissions are not vdsm:qemu.

On EL6 we don't need to use the chown hack; We used it because it looked
like a simple solution that works everywhere. So now we use the old udev
rules format on EL6, and the new format (chown hack) on EL7 and Fedora.

By default, we build the old udev format. To enable the new format,
configure with --enable-chown-hack. The spec enables the chown hack
on EL7 and Fedora trough configure.

To create a different rule depending on the configuration, the udev rule
is generated now by a python script.

On EL7 using our chown hack, the race does not exist. We also verified
that using a script creating 600 disks, and using automated QE tests.

Change-Id: I7d84c986511d9cfc7695a79ef5944edf70050934
Bug-Url: https://bugzilla.redhat.com/1160620
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/35440
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
tests: Fix API change in sourceroute.py

Fix signature change introduced in http://gerrit.ovirt.org/#/c/34067

Change-Id: I4ba3b2a140f4bba82e40f8268dd40a6d90acc7bf
Signed-off-by: Dima Kuznetsov <dkuznets@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/35478
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
tests: Add sourceroutingTests and qosTests to make check

Change-Id: I8cc5a628516b59723575e0cfcf569a1aa99b6602
Signed-off-by: Dima Kuznetsov <dkuznets@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/35479
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Instruct MOM to ignore ballooning when guest agent is not running

This makes use of the new MOM feature (valid function) and
associated guest memory collector (GuestMemoryOptional).

The ballooning part of the policy will be ignored when guest agent
is not running while the rest of the policy is still evaluated.

The most notable change is that MOM used to ignore the whole
policy when guest agent was not available.

Change-Id: I20f636cd9290340022d42210cbb5ba6c3b009dd9
Signed-off-by: Martin Sivak <msivak@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/35407
Reviewed-by: Doron Fediuck <dfediuck@redhat.com>
Reviewed-by: Adam Litke <alitke@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
virt: sampling: factor numa stats in a method

This patch moves the NUMA stats collection into
an helper method, to make the code more consistent
and a bit tidier.
No functional changes.

Change-Id: Ifd78ed5637e21cf321c88ddcfe0801fd8d1e90d5
Signed-off-by: Francesco Romani <fromani@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/33782
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
vm: log exceptional monitor unresponsive case

In past ages we added an explicit case to mark
monitor unresponsive.

This case may be no long relevant. In order
to gather evidence against or supporting
this hypotesis, add an explicit log line
when this case is applied.

Also, extract the relevant code in a helper
method, and add a couple of unit tests.

Change-Id: I04b88513d319d3f4530aa6d9f1b4a1c783b33347
Signed-off-by: Francesco Romani <fromani@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/33870
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
sampling: rename variables to make code nicer

Rename internal variables of SampleWindow
methods to make the code nicer and easier
to read.

No changes in behaviour.

Change-Id: I14caeb163552a659d1e7fcc103ac7fc9f1697bad
Signed-off-by: Francesco Romani <fromani@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/34390
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
utils: add monotonic_time function

We currently use time.time() to get timestamp
with (near) second precision.
We we just need the difference between two instants
in time, os.times() provide safer alternative
because it is more resilient with respect to
system clock adjustments, and can never go
backwards.

This function add a simple monotonic_time() function
based on os.times().

The drawback of this function is lower resolution.
The actual resolution depend on the kernel configuration,
but a commonly found value is ten milliseconds.

Change-Id: I65c7d6041ed89fc8c497115b2d70341e82936b26
Signed-off-by: Francesco Romani <fromani@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/35350
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
gluster: proper check in gfapi.py to avoid segfault in libgfapi

This patch adds proper checks in gfapi.py to avoid
segmentation fault in libgfapi.

Change-Id: Ie32cdc723a78a30a4efc0c2e75e1b308fc756bf3
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1162640
Signed-off-by: ndarshan <dnarayan@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/35256
Reviewed-by: Bala.FA <barumuga@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Arranging format of configure flags to avoid conflicts later

Change-Id: I8deb5b4f32a8c0ef002758be714d15f8514a205b
Signed-off-by: Yaniv Bronhaim <ybronhei@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/35578
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Nir Soffer <nsoffer@redhat.com>
tests: split SampleWindow tests

Reorganize and rationalize the unit tests after
the introduction of SampleWindow class.

Change-Id: I74f0005eae5466e083002f0d871bcf1fbec54fef
Signed-off-by: Francesco Romani <fromani@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/34512
Reviewed-by: Nir Soffer <nsoffer@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
hba: Rescan using SCSI layer

Since commit b6a27493a4 (Rescan SAN devices before rebuilding multipath
bindings) in Jan 2009, we perform scsi scan during multiapth rescan flow.

In Sep 2013, commit 66c24c1996 (iscsi: Iscsi rescan cleanup) removed scsi scan,
assuming that iscsiadm --rescan was good enough.  iscsiadm do perform scsi
scan, but only for scsi_host with iscsi connection.  Since this change, new
LUNs created on FC storage server are not discovered by hosts.

In commit 674337d8f9 (multipath: Rescan also FC devices), we tried to fix HBA
rescanning by using issue_lip.  But issue_lip was proved to be disruptive, (see
bug 1157681) and was disabled in commit 48fa75287e (multiapth: Disable hba
rescanning 22 by default).

This patch restores the missing scsi scan for fc_hosts, enabling discovery of
new FC LUNs in the multiapth rescan flow.

Since scsi scan is a blocking operation, we perform the scan using external
command line tool, ensuring that vdsm cannot get stuck. This tool can be also
useful outside of vdsm.

In the fc-scan tool, we perform the scan in parallel, so blocking on
unresponsive fc_host will not prevent discovery of new devices on other
fc_hosts.

Change-Id: I7deb3047f1b75c4c65d59602b908835515290993
Bug-Url: https://bugzilla.redhat.com/1159839
Relates-To: https://bugzilla.redhat.com/1123637
Relates-To: https://bugzilla.redhat.com/1157681
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/34245
Reviewed-by: Adam Litke <alitke@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
Remove unused proxyLock member from SuperVdsmProxy

The usage was removed in 812fe75

Change-Id: Ie86d50ab1ad41dbba34c051e00b0863b2b1067a8
Signed-off-by: ibarkan <ibarkan@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/35445
Reviewed-by: Yaniv Bronhaim <ybronhei@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
live merge: fix usage of getLastSample

In commit 359c7b60b6125cae0ac47b64dfcffde1dd91c9b7
I forgot to update the sampleVmJobs code to make
use of the new getLastSample() API.

This broke live merge, and this patch fixes that.

Change-Id: Idbdd3ac44e9341888a80154293c22c6882dd420e
Signed-off-by: Francesco Romani <fromani@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/35620
Reviewed-by: Adam Litke <alitke@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
caps: Do not memoize CPU topology

This patch prevents the CPU topology from being memoized, this is
needed in order to support host CPU hotplugging, to avoid using
disabled logical CPUs and to rescan for topology changes in ppc64.

Change-Id: Ia0e87b50d4fe882240c93a0a1600e3a0cb98d443
Signed-off-by: Vitor de Lima <vdelima@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/34189
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
sosreport: use service status instead of initd script

Using initd script obviously fails on el7...

Change-Id: Id05fdc9212f175bdffc29d084659ab3609d175c6
Signed-off-by: Yeela Kaplan <ykaplan@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/35504
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-by: Sandro Bonazzola <sbonazzo@redhat.com>
netinfo: Displays active slave for the bond in getVdsCaps
vdsmapi-schema: Adding Active slave support
networkTests: Test to check if active slave exists

Adding active slave field for the bond in the getVdsCaps
Adding active slave in vdsmapi-schema.json
Displays an active slave if exists or displays '' when there is no active slave

Change-Id: Ib6c40755c361523a28cbd68af110e3b20cb9ae25
Signed-off-by: Genadi Chereshnya <gcheresh@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/32915
Reviewed-by: Piotr Kliczewski <piotr.kliczewski@gmail.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>