CA-113840: Add support for the Adaptec Raid Driver

Signed-off-by: Robert Breker <robert.breker@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>

Github closes: #21 on xapi-projects/sm
CA-115712: Add support for the Cisco fnic FCoE driver

Signed-off-by: Robert Breker <robert.breker@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>

Github closes: #32 on xapi-projects/sm
CA-113322: avoid using realpath wrt the new devmapper convention

Due to the change on dev mapper linking/naming conventions, we should
avoid using realpath to chase to the final path. Also, we can now
rely on vhd-util itself to canonicalize the path.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>

GitHub: closes #20 on xapi-project/sm
CA-116958: "VM.copy locking failed" error observed on build - 75698

Override slave mode lvm.conf for lvchange --refresh command on slaves

Signed-off-by: Chandrikas Srinivasan <chandrika.srinivasan@citrix.com>
Acked-by: Germano Percossi <germano.percossi@citrix.com>

GitHub: closes #36 on xapi-project/sm
Revert "CA-116958: "VM.copy locking failed" .."

This reverts commit f3899834a557d61989fa3a59dfed23b77ec0b204.

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Revert all "Productise removal of lvm2.."

Reverts:
35754c0be5e8a985695aead8af02383a9a3db875.
e603b0a268f8e8140d44ceff6ecec85adf990099.
185e24fc3f219d1101b56ce79996015139227d9e.
71289160b71f3a24b51bd94ebd1f6b3a57164975.
CP-6167: Fix a bug reported by pylint

There is no variable 'uuid' in scope.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-6167: Fix some bad practice reported by pylint

We conditionally assign a variable with either an object or a string.
Though this might not cause problems at runtime if we can guarantee
that we'll always branch by inspecting the runtime value, it is a
dangerous practice nonetheless.

Pylint complained with the following error: "Instance of 'str' has no
'xenapi' member".

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-6167: Fix an issue reported by pylint

Inside util module, we do not need to reference SMlog as util.SMlog.

Though this is not strictly a bug.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-6167: Work around an issue pylint isn't clever to understand

This is not a bug, it's because pylint can't figure out magics
like runtime types based dispatching with isinstance etc. and
will issue an E1103 error.

We don't want to disable E1103 all together, as this could shadow
some real issues later on, so we work around the issue here. We'd
better refactor our code to implement the same functionality
differently.

Another way to work around this is to annotate the specific
occurrence in the source code with the pylint ignore tag.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-6167: Fix an issue reported by pylint

Abstract class VDI referenced undefined property self.path. We
rely on subclasses to always instantiate this property but there
is no guarantee. Better to use Abstract Base Class module when we
move to Python 2.6.

With this change, the unusual instantiation order in ISOVDI class
was exposed (as it caused us some trouble). we resorted the order
to normal and solved the issue.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-6167: Work around a pylint bug

This is a known bug that pylint misunderstands the return types
of 'stdout'/'stderr' of 'subprocess.Popen.communicate' as lists
(instead of strings). This is because these variables were initially
used as lists inside the function and only being converted to strings
at the end.

The python 3.x lib code doesn't cause this confusion for pylint.
Here we introduce this work around for the time being.

Usually the proper way to workaround pylint limitation is to add
pylint ignore tag around a piece of probmatic code, but in this
circumstance, it would demand us to tag all the callers (lots of)
rather than a single callee here.

[1] http://www.logilab.org/ticket/46273

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-6167: Fix an issue reported by pylint

The 'stat' module was imported but not used. Moreover, later on in
this source file, we define a function with the same name 'stat',
so that the imported module is then shadowed.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-6167: Fix a bug reported by pylint

There was no MAX_TIMEOUT defined in scope, but the 'attach' method
referenes it later on.

It's probably better fixed by doing some code restruction, but here
we stick to the simple fix for now.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-6167: Fix an issue reported by pylint

The original code overwrite the 'add'/'remove' functions with
internal ones. This is considered as a bad practice as definitions
could be shadowed accidentally. Rename them to _add/_remove.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-6167: Fix an issue reported by pylint

Abstract class FcntlLockBase referenced undefined property
self.LOCK_TYPE. We rely on subclasses to always instantiate this
property but there is no guarantee. Better to use Abstract Base
Class module when we move to Python 2.6.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-6167: Fix an issue reported by pylint

Abstract class MetadataHandler referenced undefined property
self.VDI_INFO_SIZE_IN_SECTORS and method self.spaceAvailableForVdis.
We rely on subclasses to always instantiate the property and
method but there is no guarantee. Better to use Abstract Base Class
module when we move to Python 2.6.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-6167: Fix a bug reported by pylint

The 'diff' variable is referenced in the else clause but was not
defined anywhere.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-6167: Fix a bug reported by pylint

from_tapdisk is a classmethod, it doesn't have access to 'self'.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-6167: Fix a bug reported by pylint

The function xapi_vfs_stats uses util.SMException, but util module
is not in scope.

We add a local import (instead of a global one), to follow the
same convention we saw in this file (probably for the purpose of
avoiding name collision?).

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>