sampling: a quick fix to make vdsm run again

commit c506391442bc was merged too quickly, leaving a process that fails
to start due to
    AttributeError: 'HostStatsThread' object has no a ttribute 'nics'

Change-Id: Idc993a6b1284345805455a63e3926bc2893d5874
Signed-off-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/13902
Reviewed-by: Mark Wu <wudxw@linux.vnet.ibm.com>
Tested-by: Daniel Erez <derez@redhat.com>
Reviewed-by: Daniel Erez <derez@redhat.com>
vdsmd: do not swallow libvirt error

Recently I've seen multiple cases of vdsm not starting up with a vague
error "Failed to define network filters on libvirt", when the underlying
issue was that libvirt has crashed.

It's better to have a line or two of log noise, in order to see that
libvirt could not have been reached.

Change-Id: I6a91061f52ec4eff24dd1e10f525fd3fed9185ef
Signed-off-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/13909
Reviewed-by: Moti Asayag <masayag@redhat.com>
Reviewed-by: Zhou Zheng Sheng <zhshzhou@linux.vnet.ibm.com>
Tested-by: Zhou Zheng Sheng <zhshzhou@linux.vnet.ibm.com>
Use 'ip link' to get different kinds of interfaces

It's a little faster than listing the dir '/sys/class/net'

Change-Id: Iecc2300963fe1834defb99f5be92b25c0218cf00
Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/13668
Reviewed-by: Antoni Segura Puimedon <asegurap@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Bond destroying

If there is deleted network with bond other than bond[0-4] and no
other network is using that bond, the bond is destroyed. bond[0-4]
must be kept for backward compatibility, but we don't want to accumulate
any other bond.

Because we need same set of bondings in load_needed_modules.py.in, set of
bondings was added to netinfo and imported from there. The path to
bonding masters now also comes from netinfo.BONDING_MASTERS.

Change-Id: I0cd27f1ff9a62e202c3513e54df5481d1b72ed7c
Bug-Url: https://bugzilla.redhat.com/928442
Signed-off-by: Petr Sebek <psebek@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/13752
Reviewed-by: Antoni Segura Puimedon <asegurap@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Remove fileUtils.safeUnlink().

safeUnlink() usage replaced by utils.rmFile() calls.

Change-Id: I8d6531bdf43aa9ed74dff5a54a54bb476500298e
Signed-off-by: Eduardo <ewarszaw@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/11424
Reviewed-by: Yeela Kaplan <ykaplan@redhat.com>
Tested-by: Daniel Paikov <paikov@gmail.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Remove fileUtils.cleanupfiles().

Racy, redundant, named out of convention, ...

Change-Id: I2dbb22ea97b1a6b2d572d21a5c4267fe78759e7f
Signed-off-by: Eduardo <ewarszaw@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/11425
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
image: update the volume permissions when needed

Volumes leaves created in 2.2 did not have the group writeable bit
set. In order to be able to start VMs from old NFS volumes we need
to check (and eventually fix) the group permissions during the volume
preparation.

The code to address this issue was already present but commit 5a0b2c9
reintroduced the problem substituting the prepareVolume calls with
prepareImage.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=911417
Change-Id: I516d8240840e3aa32bd8074420e331b8dc4e6da7
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/13331
Reviewed-by: Allon Mureinik <amureini@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Add forceLink() which replaces a link if it already exists.

Reduce the number of fileUtils.safeUnlink() callers.
safeUnlink() will be removed, using rmFiles() instead.

Change-Id: Idea4ab66cc2954fdb11606daa4a73ad3edb0c7ef
Signed-off-by: Eduardo <ewarszaw@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/11423
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
vdsm: Delay desktop lock until we are sure it was a disconnect

This is a hack to mitigate the issue of spice-gtk not respecting the
configured secure channels [1]. Spice-gtk is always connecting first to
a non-secure channel and the server tells the client then to connect
to a secure channel. However as a result of this we're getting events
of false positive disconnects and we need to ensure that we're really
having a disconnected client
This timer is supposed to delay the call to lock the desktop of the
guest. And only lock it, if it there was no new connect.
This is detected by the clientIp being set or not.

[1]: https://bugzilla.redhat.com/show_bug.cgi?id=879352

Change-Id: I6af5cf868dc9caaa07134b2b296d985f06cf15f2
Bug-Url: https://bugzilla.redhat.com/905930
Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/13798
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
vdsm: Try to reconnect on vmchannel after errors

Currently the vm channel listener is not handling any errors. If an error
occurred we would not try to reconnect and the connection to the guest is lost
for the lifetime of the guest or until VDSM gets restarted.

To handle this situation this patch introduces a mechanism to reconnect to the
channel. Once an error occurred the setup callback is called, which gives the
handled client the chance to recreate the socket and prepare it for a connect.
After that callback was called, the errornous connection will be moved into the
unconnected items dict where it will be handled by the event loop.

If there have been 5 or more unsuccessful attempts made the reconnect rate will
be slowed down to the same time as specified for the 'read timeout'.
The items which are slowed down are moved into the 'reconnect_cooldown' dict.

Change-Id: I8b9b9418e39558d45c97e9545bc9ecc4935f004e
Bug-Url: https://bugzilla.redhat.com/871616
Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/11977
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
vdsm: Fix check for connection issues with libvirt

There has been a made a mistake by mixing domain codes
with error codes of libvirt.
Additionally libvirt is reporting VIR_ERR_INTERNAL_ERROR
if libvirtd gets restarted or stopped somehow (e.g. after a crash)
This fix takes care to cleanup the mixup and adds the missing
error code.

Change-Id: I051d007529e22b0c4ca703042ce1601b4b2817e0
Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com>
Bug-Url: https://bugzilla.redhat.com/852956
Reviewed-on: http://gerrit.ovirt.org/13990
Reviewed-by: Saggi Mizrahi <smizrahi@redhat.com>
Reviewed-by: Michal Skrivanek <michal.skrivanek@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
agent: XML Character filtering improvement

The filtering of invalid characters for XML documents must not be
performed on unicode strings but on the encoded utf-8 string.
If we do not do this we'll be missing out on filtering everything
what would destroy the XML documents.
If there has been found an invalid character in the UTF-8 string
it _may_ cause the message to be discarded due to UTF-8 decoding
errors. However we don't want invalid strings to come through any
way.

Updated the unit tests for reflecting the changes.

Change-Id: I21b970c8552b3f238c6bfe9271c5c5a37d40ea4d
Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/13809
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Vered Volansky <vvolansk@redhat.com>
Fix StorageDomainDoesNotExist raise messages.

Change-Id: I8ab8cb6050090f4eb7efdcff0bef77f694c6c191
Signed-off-by: Eduardo <ewarszaw@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/14008
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Yeela Kaplan <ykaplan@redhat.com>
Tested-by: Daniel Paikov <paikov@gmail.com>
Initializing libvirt connectivity in external thread to clientIF

Getting libvirt connection as part of startup can take long under high
load. Until clientIF is ready to serve API requests, the host state is
non-responsive. To avoid that, we make the connection in external
thread, and until all recover process is ready the host reports the its
on initialization state.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=949192
Change-Id: Id3e849db7685f80995ee56989f0bed405602e550
Signed-off-by: Yaniv Bronhaim <ybronhei@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/14018
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
Reviewed-by: Saggi Mizrahi <smizrahi@redhat.com>
engine.py.in: adding note about setting password

Users should be warn that if they set password to be able to add
oVirt Node from oVirt Engine it will enable SSH daemon.

Change-Id: Ibb0d6e590188165d7cb92aaa5a73b7713f3b522b
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=746582
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/13267
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
spec: bump libvirt version for el6

resolves libvirt stability issues (e.g. BZ #922063)

Change-Id: Icbd9c1a6885b9b7ce9ea58b8be2915bf3bc4f1c6
Signed-off-by: Michal Skrivanek <michal.skrivanek@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/14120
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
Fix getPools comment.

Change-Id: Iadfcf0c5d3fb53f3fb0c7aa48f43052bb4a618c9
Signed-off-by: Eduardo <ewarszaw@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/14014
Reviewed-by: Vered Volansky <vvolansk@redhat.com>
Tested-by: Daniel Paikov <paikov@gmail.com>
Reviewed-by: Ayal Baron <abaron@redhat.com>
Prefetch domains when connecting a storage server.

When a storage server is connected is searched for domains.
A uuid:findDomain method dictionary is saved for accelerate
further produces.

Related to BZ#891074

Change-Id: I8f2b19a566c659bac30a318d17cef929e0b2575b
Signed-off-by: Eduardo <ewarszaw@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/12869
Reviewed-by: Ayal Baron <abaron@redhat.com>
Tested-by: Ayal Baron <abaron@redhat.com>
Revert "Use 'ip link' to get different kinds of interfaces"

This reverts commit 8febe0e40650983d809abaa10be983bc1953ef1e.

The netlink support for bridge is only available on kernel 3.0+.
Please see the following commit for details.
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=bb900b27a2f49b37bc38c08e656ea13048fee13b

Add netlink support for bond is also added after kernel 2.6.32.
So this solution doesn't work on RHEL6 system. We have to revert
it.

Change-Id: I9d3f037a9e837fd97cb8808b7bf4b72026ec77c5
Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/14157
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
fix access to watchdog event actions

The data structure 'actionEnum' is a a list, but it was accessed as
function.

Change-Id: I3f64b6c6508c23285b9a4a159be7a16cdf64ae9c
Signed-off-by: Laszlo Hornyak <lhornyak@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/14134
Reviewed-by: Doron Fediuck <dfediuck@redhat.com>
Reviewed-by: Martin Sivák <msivak@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>