pool: ignore refreshStoragePool calls on the SPM

The refreshStoragePool command is an HSM command and should not be
issued (and executed) on the SPM. At the moment we just ignore it
for legacy reasons but in the future vdsm could raise an exception.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=882958
Change-Id: I2c275bfb15e4948c2e28ea21fac787c36bb48e97
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/10450
Reviewed-by: Allon Mureinik <amureini@redhat.com>
Reviewed-by: Vered Volansky <vvolansk@redhat.com>
Reviewed-by: Saggi Mizrahi <smizrahi@redhat.com>
Tested-by: Daniel Paikov <paikov@gmail.com>
If attachSD fails - rescan for new vgs not visible from spm

Change-Id: I7cb26397d8a38215aaec0287e7882751471a6d61
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=883390
Signed-off-by: Yeela Kaplan <ykaplan@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/10495
Tested-by: Daniel Paikov <paikov@gmail.com>
Reviewed-by: Eduardo <ewarszaw@redhat.com>
Reviewed-by: Ayal Baron <abaron@redhat.com>
Improve the readability of define.py

Maintain pep8 compatibility but improve the readability by
recovering some space (reducing indentation).

Change-Id: If7649694b2dd215ae0c3279c61c1c6a3a86e5178
Signed-off-by: Antoni S. Puimedon <asegurap@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/12514
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Fix sslTests import bug

ImportError for SecureXMLRPCServer is triggered when the test runns in
installed directory.
It should be imported from vdsm folder in python library.

Change-Id: Ia1742e8428dacaf4c56c52e88f29d6fb1625b833
Signed-off-by: MeiLiu <liumbj@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/12467
Reviewed-by: Zhou Zheng Sheng <zhshzhou@linux.vnet.ibm.com>
Tested-by: Zhou Zheng Sheng <zhshzhou@linux.vnet.ibm.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
network: reuse netinfo.ports()

Change-Id: I77e542cb0982e792e29d092f9e911cf74d910d36
Signed-off-by: huntxu <mhuntxu@gmail.com>
Reviewed-on: http://gerrit.ovirt.org/12503
Reviewed-by: Antoni Segura Puimedon <asegurap@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
configNetwork: improve assertBridgeClean

Change-Id: I44b28e16d20e993c84d0569db7c661e18d432ce7
Signed-off-by: huntxu <mhuntxu@gmail.com>
Reviewed-on: http://gerrit.ovirt.org/12504
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Introduce getLocalPathBase for MountConnection

Introduce getLocalPathBase in MountConnection so that
class re-using it can override it to present their own
path base.

Change-Id: I9985cb00b8ae7dc4a0ac840d3eb3adadf902d61b
Signed-off-by: Deepak C Shetty <deepakcs@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/12126
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Override getLocalPathBase in GlusterFSConnection

Override getLocalPathBase in GlusterFSConnection as a better
way to specify mount point for GlusterSD

Change-Id: I8d7d0980b0a863f8d47d61936b2d8fdab71a6a0c
Signed-off-by: Deepak C Shetty <deepakcs@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/12127
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
hsm: always check validateNotSPM when disconnecting from a pool

At the moment of this writing vdsm doesn't have a valid flow to
disconnect from a pool if the host is the SPM; the side effect
of calling _disconnectPool (e.g. a failed refreshStoragePool) is
that the SPM resource will remain locked.

If we want to introduce a change to allow the disconnection from
the pool even if the host is the SPM we should do it explicitly
with a specific patch that stops the SPM.

Change-Id: I066d018eb9e5d61422c5d1ab264208cd89b0f951
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/12271
Reviewed-by: Allon Mureinik <amureini@redhat.com>
Reviewed-by: Vered Volansky <vvolansk@redhat.com>
Reviewed-by: Saggi Mizrahi <smizrahi@redhat.com>
Ignore postZero flag when deleting an image on a fileSD.

Ignoring parameters is very bad but we will continue to do that
because fixing the engine is very hard.

Bug-url: https://bugzilla.redhat.com/show_bug.cgi?id=911209

Change-Id: Ief50d6174fd20e16f2fdf48a6cd512d20b9f407d
Signed-off-by: Eduardo <ewarszaw@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/12404
Reviewed-by: Yeela Kaplan <ykaplan@redhat.com>
Reviewed-by: Ayal Baron <abaron@redhat.com>
Tested-by: Daniel Paikov <paikov@gmail.com>
build: add load_needed_modules.py.in to EXTRA_DIST

Change-Id: Ie8e3fd1f8a6b3ce5c96dbb4cde5e61f3d2cba4d9
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/12507
Reviewed-by: Kiril Nesenko <knesenko@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Fix the broken PYTHONPATH

@builddir@/vdsm is a non-exsiting path

Change-Id: I438936a7eb98206426a15aa0a751a22060b9c895
Signed-off-by: Shu Ming <shuming@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/12509
Reviewed-by: Zhou Zheng Sheng <zhshzhou@linux.vnet.ibm.com>
Tested-by: Zhou Zheng Sheng <zhshzhou@linux.vnet.ibm.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Catch libvirt timeout and return an error on setVmTicket

Return an errCode instead of an exception libvirt timeout in setVmTicket
verb and setting the 'message' to be the exception string representation
so upper layers would have more info about what went wrong.

Change-Id: Ibb48a1baff1e059f48f71f600f4bf5d9f40a7d11
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=878064
Signed-off-by: Roy Golan <rgolan@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/10285
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Don't crash on libvirt network re-definition.

This patch is aimed to solve the libvirt syncing bug described in
bugurl. In short, the vdsmd restart scenario is solved by the
previous patch (30c63c5).

This one solves the case when the interface backing a bridge/network
has disappeared (and thus is not reported by netinfo to the engine)
and then the engine sends a new setupnetwork that attempts to
recreate the partially defined network. Up until now, libvirt would
report an exception. Now we make a best-effort to remove the network
before trying to add it again, by adding a control case in the
setupNetworks logic where networks to be removed are usually removed.

Bug-Url: https://bugzilla.redhat.com/861701
Change-Id: I76d95e20b7aa99280e604abdb1663c6c5c7dd32e
Signed-off-by: Antoni S. Puimedon <asegurap@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/10901
Tested-by: oVirt Jenkins CI Server
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
engine.py: replace sed to setVdsConf

Use the standard way to write into vdsm-reg.conf.

Change-Id: I16a0889843feba29abbfb02f3d81293df7f2f3fc
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=890572
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/12299
Reviewed-by: Joey Boggs <jboggs@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
engine.py: return False on cert error screen

If we cannot download the engine certificate we should
only show the error screen and return.

Change-Id: I3e3f03365e77244c5521a11d92041371088b4362
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=895912
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/12244
Reviewed-by: Joey Boggs <jboggs@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
fix a PEP 8 issue in vdsm/configNetwork.py

Change-Id: Idc05505b84197fdebc919e4647ef757b295f52a2
Signed-off-by: Zhou Zheng Sheng <zhshzhou@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/12744
Tested-by: oVirt Jenkins CI Server
Reviewed-by: Antoni Segura Puimedon <asegurap@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
hooks: Add disk hot plug/unplug hooks

Added four hook points named:
1. before_disk_hotplug
2. after_disk_hotplug
3. before_disk_hotunplug
4. after_disk_hotunplug

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=908656
Change-Id: I10b689964fad3a1118974f7ba7b91e795cbffd1f
Signed-off-by: Vered Volansky <vvolansk@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/12479
Reviewed-by: Allon Mureinik <amureini@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
gluster: Handling Attribute error in Python 2.6

xml.etree.cElementTree in Python 2.6 doesn't have the attribute
ParseError(Introduced in Python 2.7). VDSM gluster/cli.py tries
to capture etree.ParseError when gluster cli returns incompatible
xml output.

Change-Id: I63c33b34ce11473636365ea094e267c5424c7255
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/12752
Tested-by: oVirt Jenkins CI Server
Reviewed-by: Vinzenz Feenstra <vfeenstr@redhat.com>
Reviewed-by: Bala.FA <barumuga@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
vdsm.spec: Adding with_systemd macro

This patch adds the macro with_systemd which can be used
to validate if the system uses Systemd.

Change-Id: Ibcd8567868e16453ed6633f143a6b1fff8e9c454
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/12086
Tested-by: oVirt Jenkins CI Server
Reviewed-by: Vinzenz Feenstra <vfeenstr@redhat.com>
Reviewed-by: Yaniv Bronhaim <ybronhei@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>