Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
Commits on Jul 29, 2013
vineetht PR-1291: Initial Commit for OCFS2 SR Offering bddcb4b
Commits on Jul 30, 2013
@tmakatos tmakatos CP-4526: Fix SR.scan. 2924c00
Commits on Jul 31, 2013
@chandrikas chandrikas CP-4523: Storage Thin Provisioning: Handle OCFS2 failure
Added new OCFS specific errors and covered all error paths in OCFS operations.
84295d7
Commits on Aug 08, 2013
vineetht CA-113313: Limiting the OCFS SR offering to OCFSoHBA and OCFSoISCSI. c0c4ba1
vineetht CA-113314: Fixed OCFSoHBA scan error, added 3rd unused arg to vdi(),
ref. FileSR
1331bca
Commits on Aug 09, 2013
vineetht CA-113315: Zeroing out is not needed as we allow destroy only when there
are no vdis.
329bd5c
vineetht CA-113316: Added snapshot and clone attributes to CAPABILITIES df19481
vineetht CA-113315: zeroout the filesystem metadata to override existing FS check c59ea29
vineetht CA-113313: Add OCFS pluggin in Makefile to pick OCFSSR.py file ebb98f6
Commits on Aug 12, 2013
vineetht CA-113317: Add multipath functionality to ocfsohba 95bf467
vineetht CA-113313: Removed OCFSSR after the link creation that happens in loop 1b1bbef
Commits on Aug 13, 2013
vineetht PR-1291: Added ocfsoiscsi and ohba to mpath, to store path details in
PBD. Also added a dummy probe mechanism in OCFSSR
c14afb3
Commits on Aug 15, 2013
vineetht PR-1291: addressed review comments 8ae773d
Commits on Aug 19, 2013
@tmakatos tmakatos Merge git://hg.uk.xensource.com/carbon/pr-1291/sm into PR-1291 af2096b
@tmakatos tmakatos Merge pull request #22 from tmakatos/master
Merge PR-1291 (OCFS SR tech preview) into upstream.
501dfad
@tmakatos tmakatos CP-4614: Fix syntax error. ef3180c
@tmakatos tmakatos Merge pull request #23 from tmakatos/master
CP-4614: Fix syntax error.
b3681d3
Commits on Aug 22, 2013
@Sisimon Sisimon CA-107572: Ignore UUID not found exception during SR scan
VM migration failed because XAPI throw VDI UUID not found exception.
The VDI was already removed, the fix will catch the exception and discard it.

Signed-off-by: Sisimon Soman <sisimon.soman@citrix.com>
Acked-by: Thanos Makatos <thanos.makatos@citrix.com

GitHub: closes #17 on xapi-project/sm
d410004
@tmakatos tmakatos CA-102329: VDI.delete: avoid duplicate GC restarts
In VDI.delete, there is a race condition where two threads attempt to
re-start a running GC/coalesce daemon, because re-starting the
GC/coalesce is done by blindly writing a value to a file (see IPC.py).
If one thread finds that there is re-start pending, there's no need to
issue another GC/coalesce re-start.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Acked-by: Zheng Li <zheng.li@citrix.com>

GitHub: closes #8 on xapi-project/sm
f25f96b
Commits on Aug 23, 2013
@germanop germanop CA-105130: udev does not automatically refresh dev/disk/by-id
udev maintains symlinks into /dev/disk/by-id refreshing to
the latest available path to the same disk.
When the last added path is removed, the link is removed as
well, instead of being just updated to the previous path.

Recent versions of udev (e.g. in CentOS 6.4) do not show
this behaviour but our current version (095) needs to be triggered.

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Acked-by: Thanos Makatos <thanos.makatos@citrix.com>

GitHub: closes #19 on xapi-project/sm
d72d676
Commits on Aug 30, 2013
@freddy77 CP-5330: Start iSCSI properly.
Recent iSCSI package (iscsi-initiator-utils) has a different way to start
(there is no more the open-iscsi script). Also use service to start
the service properly.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Reviewed-by: Zheng Li <zheng.li@citrix.com>
4ed4109
@germanop germanop CP-5330: Settle udev with proper command
The old udevsettle has been replaced with 'udevadm settle'.
This makes it backward compatible.
Moreover, the try block is very big and we do not handle specific
exceptions but we need to log them, at least.

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Reviewed-by: Zheng Li <zheng.li@citrix.com>
af40e46
@germanop germanop CP-5330: Ignore innocuous errors from iscsiadm
When asked for open sessions, recent versions of iscsiadm return a code
different than 0 if list is empty.
Our function exn_on_failure raises an exception if return code is not
zero, so we must trap the exception and continue because an empty list
is fine.

The exception could be handled in a better way but our
exception system needs to be made better.

This patch does not affect old iscsiadm behaviour

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Reviewed-by: Zheng Li <zheng.li@citrix.com>
3af8a6e
@germanop germanop CP-5330: Update scsi_id call
Because scsi_id call syntax has changed, now we use the new syntax and,
if failed, fallback to the old syntax.
Another failure raises an exception.

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Reviewed-by: Zheng Li <zheng.li@citrix.com>
eec518e
@germanop germanop Merge changes for CP-5330
GitHub: closes #18 on xapi-project/sm
90cce8b
Commits on Sep 04, 2013
@zli zli CP-5330: Replace open-iscsi-auth.patch with discoverydb solution
This is part of the CP-5330 work to get rid of our customized patches
against open-iscsi and to use the stock version open-iscsi of upstream.
This changset replace open-iscsi-auth.patch with the mechanics provided
by the discoverydb mode, to allow CHAP authentication while doing iscsi
targets discovery.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
Suggested-by: Robert Breker <robert.breker@citrix.com>
Reviewed-by: Germano Percossi <germano.percossi@citrix.com>
b196cbc
@zli zli CP-5330: Remove dependencies on iscsid-mpath.conf/iscsid-default.conf
This is part of the CP-5330 work to get rid of our customized patches
against open-iscsi and to use the stock version open-iscsi of upstream.

Previously we ship two customized versions of /etc/iscsi.conf only for
the purpose of switching one single configuration variable:
"replacement_timeout" (depending on whether multipath is enabled or not).

This is overkilled, and demand us to ship a customized build of open-iscsi.
As suggested by @robertbreker, the same effect can be possibly archived
by tweaking timeouts in the multipath layer, namely dev_loss_cmo etc.,
which we've already done in our multipath package.

This is a patch to remove SM's dependency on iscsi-mpath.conf and
iscsi-default.conf. One can still make use of them optionally by
manually creating these two files. This is useful if a customer still
needs a customized setting for some reason or for debugging purpose,
and the code is also backward compatible this way.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
Suggested-by: Robert Breker <robert.breker@citrix.com>
Reviewed-by: Germano Percossi <germano.percossi@citrix.com>
e922439
@zli zli CP-5330: Dynamic set replacement_timeout during iscsi session establi…
…shment

Instead of linking/patching iscsid.conf statically, we now set
replacement_timeout dynamically whenever we establish a new iscsi session. As
part of the CP-5330 effort, this helps us to avoid monkey patching the upstream
open-iscsi.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
Suggested-by: Robert Breker <robert.breker@citrix.com>
Reviewed-by: Germano Percossi <germano.percossi@citrix.com>
f79046a
@germanop germanop Merge changes for CP-5330
GitHub: closes #25 on xapi-project/sm
b31b1a4
@chandrikas chandrikas CP-5817: Productise removal of lvm2-environment-device.patch
Part of the change for rolling back lvm2-environment-device.patch. Removed code
that exports special environment variable to direct LVM to look for an
abbreviated device cache.

The second part of the change (actual removal of lvm patch) is under
guest-packages.

Signed-off-by: Chandrikas Srinivasan <chandrika.srinivasan@citrix.com>
Reviewed-by: Zheng Li <zheng.li@eu.citrix.com>

Github: close #28 on xapi-project/sm
7128916
Commits on Sep 06, 2013
@chandrikas chandrikas CP-5831: Productise removal of lvm2-lvchange-idempotent.patch
Part of changes required to remove lvm2-lvchange-idempotent.patch. LVM throws
an error if an LV that is already RO is set to RO again or an RW lv is set to
RW. Added additional check on XS side to check LV status before changing access
permissions.

Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>

GitHub: closes #26 on xapi-project/sm
185e24f
Commits on Sep 10, 2013
@chandrikas chandrikas CP-5830: Productise removal of lvm2-master-mode.patch
Removed the --master switch from lvm commands. We now use two separate lvm
conf files for master and slave nodes. Appropriate conf file is chosen
through an environment variable.

Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>

GitHub: closes #29 on xapi-project/sm
e603b0a
Commits on Sep 13, 2013
@chandrikas chandrikas CP-5818: Productise removal of lvm2-lvcreate-inactive-flag.patch
Snapshot creation process uses a temp file with all snapshot information in
the name of the file. Since this name is too long and not liked my mapper,
the file is created in an inactive mode. Changed the logic to create a file
with shorter name and all informaton is written inside the file. Inactive flag
for lvcreate is no longer required.

Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>

GitHub: closes #31 on xapi-project/sm
35754c0
Commits on Sep 24, 2013
@robertbreker robertbreker 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
dde7e4c
@robertbreker robertbreker 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
41bf849
Commits on Sep 30, 2013
@zli zli 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
eda9a0c
@chandrikas chandrikas 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
f389983
Commits on Oct 01, 2013
@germanop germanop Revert "CA-116958: "VM.copy locking failed" .."
This reverts commit f389983.

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
7a8c988
@germanop germanop Revert all "Productise removal of lvm2.." 42951c0
Commits on Oct 02, 2013
@zli zli 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>
a29015e
@zli zli 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>
4fb5595
@zli zli 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>
01abdba
@zli zli 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>
4b18470
@zli zli 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>
7ac4873
@zli zli 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>
7034070
@zli zli 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>
2270af5
@zli zli 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>
1c9207d
@zli zli 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>
8176bd2
@zli zli 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>
43bb7b2
@zli zli 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>
16dec1d
@zli zli 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>
997335e
@zli zli 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>
38d9efa
@zli zli 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>
6bed582
@zli zli CP-6167: Fix a bug reported by pylint
The function _fast_find_tapdisks references errno.ENOENT, but the
errno module is not in scope.

We add a local import (instead of a global one), to follow the same
convention we saw on many other instances in this module.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
5e0f41c
@zli zli CP-6167: Fix a bug reported by pylint
Functions in the time module were referenced (e.g. time.sleep),
but the module was not in scope.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
683936f
@zli zli CP-6167: Fix a bug reported by pylint
Undefined variable "blockdevice" was referenced in the code. It
should be "self.blockdevice".

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
8733e37
@zli zli CP-6167: Fix a bug reported by pylint
LVHDVDI class doesn't have a 'ty' property, it should probably be 'type.'

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
96e56bf
@zli zli CP-6167: Fix a bug reported by pylint
Undefined variables sr_ref and host_ref. They should be self.sr_ref and
self.host_ref.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
f93a545
@zli zli 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>
3dacfb5
@zli zli CP-6167: Fix an issue reported by pylint
Abstract class 'Attribute' referenced the undefined property
self.SYSFS_NODENAME. 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>
3f0dbb7
@zli zli CP-6167: Fix an issue reported by pylint
Abstract class 'KObject' referenced undefined property
'self.SYSFS_CLASSTYPE' and method 'sysfs_devname'. We rely on
subclasseses to always instantiate them 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>
953bef2
@zli zli CP-6167: Fix an issue reported by pylint
Abstract class 'Link' referenced undefined property self.BASEDIR
and methods 'self._mklink' and 'self._equals'. We rely on subclasses
to always instantiate them 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>
0fd8bb9
@zli zli CP-6167: Fix a bug reported by pylint
_mklink is not a class method hence shouldn't have referenced 'cls'.
Use 'self' instead.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
75b2c92
@zli zli CP-6167: Fix an issue reported by pylint
Abstract classes BusDevice(XenbusDevice) referenced undefined
property self.SYSFS_BUSTYPE. 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>
ba5de08
@zli zli CP-6167: Fix an issue reported by pylint
Abstract classes XenbusDevice(XenBackendDevice) referenced undefined
property self.XENBUS_DEVTYPE. 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>
f204d28
@zli zli CP-6167: Fix an issue reported by pylint
Abstract class XenstoreValueError referenced undefined property
self.KEY. 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>
abb5c0e
@zli zli CP-6167: Fix an issue reported by pylint
SR method _pathrefresh referenced the undefined member 'SCSIid'
(which is not necessarily provided by any SR subclass).

The current workaround is kind of hackish. The better solution
would be refactoring the code to move _pathrefresh to places like
ISCSISR class and HBASR class (and hence their subclasses too),
where a SCSIid member always makes sense.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
17c9cc1
@zli zli CP-6167: Add pylint configuraton files
 * test/pylintrc is the configuration file. For now we only care
   about error level issues.

 * test/pylintrc-0.13.1 is the default config file generated
   by the pylint-0.13.1 in our build environment. We keep it
   here as a backup. So when we upgrade to the next version of
   pylint, we can do a 3-way diff to port our customizations
   to the new config file and also find out what has been
   changed/added on the configuration defaults of the new
   pylint.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
046f1cf
@zli zli CP-6167: Integrate pylint to our dev/build environment
The tool can be used in three ways:

 * When doing development, you can, and probably should, manually
   run "make precommit" in the root of SM repository before you
   make any code commits.

   You can do this either in a XenBuilder chroot environment or
   your local environment, in which case it's your responsibility
   to ensure that you have the same or compatible versions of
   pylint and many other libraries installed (e.g. XenAPI.py, xen
   head files, xen python bindings, swig etc.)

   The "make precommit" will only check files with local changes
   that have not been committed yet (either staged or not).

 * Similarly, there is "make precheck" which will check every
   python source files regardless of it's commit status. You
   can manually execute it in the same way as "make precommit"
   but gain more confidence due to the coverage (with the cost
   of waiting time). You should probably do this when integrating
   commits to a branch (e.g. when pushing to github trunk).

 * The "make precheck" command will be executed automatically
   whenever we build the SM repo (in XenBuilder or locally). If
   there is any error caught by pylint, the build process will
   abort intentionally and the whole build will fail. (So please
   make sure you run the "make precheck" before integration.

Our current build environment use a quite old version of pylint.
One notable issue is that the exit code of a pylint process will
remain 0 even if some errors have been spot. That's why I have to
capture the output of pylint in the Makefile target and do some
extra processing, which makes the Makefile command a little bit
more complicated than usual. With newer version of pylint integrated
in the future, this should no longer be an issue.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
4a652ec
vineetht Merged commits for CP-6167
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>

GitHub: closes #34 on xapi-project/sm
b218792
@zli zli CP-6167: The xenbuilder chroot env has no /dev/tty
It seems that the xenbuilder chroot env doesn't have /dev/tty. So in
the build log, we saw "tee: /dev/tty: No such device or address"

This is strangely different from the local chroot testing env I
created using standard xenbuilder command "make sm-chroot" when
doing test.

This quick fix avoids using the "tee /dev/tty" trick and do it in
a plain/verbose way.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
f246e5d
Commits on Oct 04, 2013
@tmakatos tmakatos SCTX-1536: Don't trust the footer
Don't use the primary VHD footer for file-based VHD VDIs that are
attached in R/W mode because it has been erased. Use the back-up one
instead.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Keith Petley <keith.petley@citrix.com>

GitHub: closes #35 on xapi-project/sm
7829f18
Commits on Oct 15, 2013
@germanop germanop [CP-6333][CP-6334]: rm dm-multipath-dm-event, dm-multipath-disable-ud…
…ev-rules

This patch is the counterpart of 2 patches removed in
dm-multipath (formerly dm-multipath in guest-packages.hg):
- dm-multipath-disable-udev-rules
- dm-multipath-dm-event

This patch basically does the following:
- ship and override multipath udev rules from sm RPM
- add rules to invoke mpathcount from udev

Note: for udev to catch the relevant events, the kernel must have
      DM_UEVENT enabled

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>

GitHub: closes #40 on xapi-project/sm
5bdfca0
@germanop germanop CA-111813: race condition setting "iscsi_sessions" in other_conf
This changeset basically reinstate previous code,
backing out "changeset:   1555:ac091775c8ea" in the Mercurial
repository.
To be safe, we remove the key before adding, just in case.

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>

GitHub: closes #41 on xapi-project/sm
b1864c1
Commits on Oct 16, 2013
@tmakatos tmakatos CP-5050: Notify XAPI about critical coalesce errors
The rate XAPI is notified is throttled to avoid spamming (currently
defaults to one message per hour, per SR). This rate can be overridden
by setting the "coalesce-error-rate" key in an SR's other-config.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Suggested-by: Andrei Lifchits <andrei.lifchits@citrix.com>
Reviewed-by: Germano Percossi <germano.percossi@citrix.com>

GitHub: closes #38 on xapi-project/sm
34452aa
@tmakatos tmakatos CA-106886: Don't update vhd-blocks during SR.scan
Don't bother updating the vhd-blocks in the XAPI database as this is
owned by the GC and there's no synchronisation for this.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>

GitHub: closes #37 on xapi-project/sm
083722c
@germanop germanop CP-6335: Removal of dm-multipath-init patch
This functionality has stopped being a patch to upstream
multipath and it is shipped in its own startup script
provided by sm RPM

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>

GitHub: closes #42 on xapi-project/sm
c587694
Commits on Oct 18, 2013
@zli zli CA-118762: Bring self.ty back
My previous pylint change 96e56bf replaced self.ty as it was not defined
anywhere in the VDI object. But this breaks some horrible hack in the
underlying layer, which was probably implementated that way for backward
"compatability" reason by itself.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
7c21ec7
@zli zli CA-118781: Initialize parent class first
Another incompatability issue introduced by my pylint serie. On the
other hand, the root cause was some bad code manifested due by this
change.

In some subclass of VDI.VDI, we set some fields before initializting
the VDI.VDI parent class, so that these fields might be overwritten
during the parent class initialization.

As a common rule of thumb, we should generally do parent class
initialization first and then do overwritten and extention in
the following steps in the children initializor.

And any information essential for parent class initialization should
be defined as a parameter of the parent __init__ method. E.g. uuid
is a predefined parameter of the initialization method in the parent
class (VDI.VDI), but many children classes still don't use this
parameter, and instead do uuid assignment in the children classes
instead and then call the parent initializor. This patchset doesn't
correct these issues for the moment, but we should pay attention to
this, otherwise we might get bitten in the future.

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

GitHub: closes #43 on xapi-project/sm
7018eaa
Commits on Oct 22, 2013
@chandrikas chandrikas CP-5817: Productise removal of lvm2-environment-device.patch
Part of the change for rolling back lvm2-environment-device.patch.
Removed code that exports special environment variable to direct LVM
to look for an abbreviated device cache.

The second part of the change (actual removal of lvm patch) is under
guest-packages.

Signed-off-by: Chandrikas Srinivasan <chandrika.srinivasan@citrix.com>
Reviewed-by: Zheng Li <zheng.li@eu.citrix.com>

GitHub: closes #28 on xapi-project/sm
1c0a152
@chandrikas chandrikas CP-5831: Productise removal of lvm2-lvchange-idempotent.patch
Part of changes required to remove lvm2-lvchange-idempotent.patch.
LVM throws an error if an LV that is already RO is set to RO again
or an RW lv is set to RW. Added additional check on XS side to check
LV status before changing access permissions.

Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>

GitHub: closes #26 on xapi-project/sm
9ef611e
Commits on Oct 23, 2013
@zli zli CA-118781: revert init order changes
Unfortunately we have to revert the previous 7018eaa and 7ac4873 on
the stricter initialization order.

This is due to some spaghetti calling pattern in our code. In VDI class
and its children, we have the following calling stack:

   Child.__init__ -> Parent.__init__ -> Child.load

When Child.load is called, it assumes that some attributes have already
been initialized, but at this point neither Child.__init__ nor
Parent.__init__ has completed their execution. This code pattern
forces us to initialize those particular attributes in the Child class's
__init___ method before ever calling  Parent.__init__.

This is not pretty, but changing this pattern demands many other changes.
To unblock trunk integration, here we reverted the previous changes.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
Reviewed-by: Germano Percossi <germano.percossi@citrix.com>
ba5fd1d
@zli zli CA-118781: Avoid the dangling "path" attribute of class VDI
The self.path attribute is referenced in VDI class's attach
method but it was not defined/initialized anywhere in class.
The correctness then depends on the children classes always do
the right thing (i.e. do not forget to init the path attribute
if they will ever call parent class's attach method directly
or indirectly).

This is considered as a ERRROR level issue by pylint. As a
fix, here we conditionally set self.path in the __init__
method based on whether a uuid argument is passed to the
initializer or not. For VDI classes whose physical
paths/locations have no direct connection with their UUID
string values (e.g. ISOSR, udevSR and SHMSR), they will not
pass any uuid to the parent class's initialiser and will be
responsible for setup the correct self.path/self.location
value by themselves. We want to make sure that their
customized value won't get overwritten here.

Also fixed the indentation suggested by Vinneth.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
Reviewed-by: Germano Percossi <germano.percossi@citrix.com>
1e9381f
@zli zli Merge for CA-116802
GitHub: closes #46 on xapi-project/sm
51cb6c8
@chandrikas chandrikas CA-116160: Python exception in HBA SR create.
len() on dictionary iterkeys is not valid in Python 2.6.
Replaced it with len() directly on the dictionary.

Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>

GitHub: closes #47 on xapi-project/sm
e7720d8
Commits on Oct 24, 2013
@rdobson rdobson CA-118899: Support UTF-8 iSCSI target names.
Signed-off-by: Rob Dobson <rob@rdobson.co.uk>
Acked-by: Thanos Makatos <thanos.makatos@citrix.co.uk>

GitHub: closes #44 on xapi-project/sm
9dbd30c
Commits on Oct 25, 2013
@djs55 djs55 CA-119833: snapwatchd fails to link on some systems
snapwatchd fails to link a shared .so with -shared:

  /usr/bin/ld: xslib.o: relocation R_X86_64_32 against `.rodata.str1.1'
  can not be used when making a shared object
  xslib.o: could not read symbols: Bad value

We need to explicitly compile our objects as position-independent
code with -fPIC

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Acked-by: Germano Percossi <germano.percossi@citrix.com>

GitHub: closes #49 on xapi-project/sm
01be618
Commits on Oct 29, 2013
@tmakatos tmakatos [CA-118876] & [SCTX-1536]: Always use the back-up VHD footer.
Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Keith Petley <keith.petley@citrix.com>

GitHub: closes #51 on xapi-project/sm
de0975d
@chandrikas chandrikas [CP-5830]: Productise removal of lvm2-master-mode.patch
Removed the --master switch from lvm commands. We now use two separate
lvm conf files for master and slave nodes. Appropriate conf file is
chosen through an environment variable.

This changeset includes the fix made for [CA-116958] in addition to the
original work done for patch removal.

Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>

GitHub: closes #48 on xapi-project/sm
ca55c5f
Commits on Nov 01, 2013
vineetht CA-116545: SR detach could fail during a Find Open process check
This could happen if one pid, out of a list of pids, cease to exist.
Ignoring the error helps us move forward through the list checking
for any pid / file handles

    Signed-off-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
    Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>
    GitHub: closes #39 on xapi-project/sm
91c4e20
Commits on Nov 07, 2013
@germanop germanop CP-6336: Removal of dm-multipath-conf
Migration of dm-multipath-conf.patch content from dm-multipath to sm
with basic conf file.
Previously we patched device-mapper-multipath to use a different
configuration file.

Those changes are now integrated into our own configuration file
that is installed using "update-alternatives" with a backup copy
if the original file is a regular file.

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>

GitHub: closes #52 on xapi-project/sm
b0892d4
Commits on Nov 11, 2013
@germanop germanop CP-6337: Added multipath.conf manipulator
This script is a basic multipath.conf to add and remove
WWIDs in the blacklist_exceptions section

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Reviewed-by: Keith Petley <keith.petley@citrix.com>
25115f0
@germanop germanop CP-6337: Added locking mechanism to wwid_conf
Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Reviewed-by: Keith Petley <keith.petley@citrix.com>
0e60a82
@germanop germanop CP-6337: Use reconfigure and wwid utils
This patch ensure the new mechanism for explicit multipath
mapping is active.
The corresponding patch in dm-multipath can be removed.

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Reviewed-by: Keith Petley <keith.petley@citrix.com>
de46a13
@germanop germanop CP-6337: Ensure multipath kernel modules are present
Once started the multipath daemon does not load the needed
kernel modules.
In the past it was not a problem because they are loaded as soon as
a device is added using the CLI.
Now we need some checks before doing this and they fail if this modules
are not loaded.

Loading modules while starting multipath is the standard behaviour in
more recent versions of multipath.
We just ensure this is always true.

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Reviewed-by: Keith Petley <keith.petley@citrix.com>
4d824ef
@germanop germanop Merge changes for CP-6337
Signed-off-by: Germano Percossi <germano.percossi@citrix.com>

GitHub: closes #54 on xapi-project/sm
670946c
vineetht CA-120469: Fail gracefully in case rmdir returns ENOTEMPTY
Parallel vm-suspend operations on vm that has got vdi's in the same SR
could result in reference files, ignoring rmdir error (ENOTEMPTY)
instead of lsdir looks a better option.

Signed-off-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
Reviewed-by:Germano Percossi <germano.percossi@citrix.com>

GitHub: closes #53 on xapi-project/sm
bc1da0c
Commits on Nov 14, 2013
@chandrikas chandrikas CP-5818: Productise removal of lvm2-lvcreate-inactive-flag.patch
Snapshot and leaf coalesce operations use journaling files with
additional info like parent UUID in the name of the file. Since the
resultant file name is too long for LVM, the file was created in an
inactive mode. This patch changes the logic to create a journal file
with a shorter name and writes additional informaton into the file.
Inactive flag for lvcreate is no longer required.

This changeset includes the fix made for ticket [CA-117034].

Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>

GitHub: closes #50 on xapi-project/sm
e1b6bf3
Commits on Nov 18, 2013
@Sisimon Sisimon CA-107356: Fix tapdisk unpause issue in case of VM migration failed.
VDI has driver name set to nbd in case VM migration failed. While
unpause tapdisk, it was always using mirror driver name. In a snapshot
failure scenario, the fix will pass None as driver name to unpause
tapdisk.

Signed-off-by: Sisimon Soman <sisimon.soman@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>

GitHub: closes #27 on xapi-project/sm
f3de367
Commits on Dec 05, 2013
@germanop germanop CA-121481: Ensure root disk is not blacklisted if booting from SAN
By default, every device is blacklisted, unless explicitly managed
by the Storage Manager.
When the root disk is managed by multipath, this happens at boot
time and the initrd must be able to add the device to multipath.
This patch ensures that, if the root disk is multipathed, it is
never blacklisted.

This patch can only guarantee that multipath is not broken for
the root disk but it is not responsible for making it multipathed
in the first place.

To make it working at installation time, dracut or mkinitrd should
call it explicitly.

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
0816c2f
@germanop germanop CA-121481: No need to use the daemon
The script does not need the daemon to get the needed info.
This script is executed both as a standard boot script and
during the installation ensure the root disk is whitelisted.
In the latter case the daemon is not supposed to be running
but the root disk can be managed by the device mapper.

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
3024d5e
@germanop germanop CA-121481: Improved wwid_conf script
Added the following:
- usage message
- command line options
- ability to both add and remove
- force addition or removal

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
a0addd4
@germanop germanop CA-121481: make sure 'stat' follows symlinks
Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
285d47b
@germanop germanop CA-121481: /dev/root does not exist at installation time
sm-multipath was meant to start at run time only.
We use this function to fix boot from SAN at installation time, too.
We cannot rely on /dev/root so we borrowed some utility functions
from dracut with a slight modification

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
3482942
@chandrikas chandrikas Merge changes for CA-121481
Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>

GitHub: closes #56 on xapi-project/sm
5d84ee6
Commits on Dec 06, 2013
@germanop germanop CA-115035: mpath-boot and multipathed host other-config keys missing
Before upgrading to the new kernel, the output of
multipath -k"show maps"
and
echo "show maps" |multipathd -k
were different.

Now they are the same but previous code in mpathcount.py was
relying exclusively on the wrong output in the previous version.

Now it is fixed in both cases

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

GitHub: closes #57 on xapi-project/sm
ede80be
@euanh euanh CA-122445: get_current_initiator_name fails to parse initiatorname.is…
…csi file on Debian

On Debian, the /etc/iscsi/initiatorname.iscsi file has comments telling you
what to do with the InitiatorName parameter;  the previous code would try
to interpret this comment as the InitiatorName setting and fail to parse it.

Signed-off-by: Euan Harris <euan.harris@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com

GitHub: closes #55 on xapi-project/sm
6c45c17
Commits on Dec 09, 2013
@robertbreker robertbreker CA-118742: Drop whitelisting of HBA device drivers from devscan.py
CA-14825 introduced device driver whitelisting when probing HBAs to avoid that
local disks are listed when calling "xe sr-probe type=lvmohba".

Today the use of shared storage using SAS, FC, FCOE and iSCSI is the norm and
it is becoming increasingly difficult to ensure that the whitelisting of device
drivers is current.

Replacing the whitelisting with blacklisting for explicitly local device driver
groups should improve the customer experience, interoperability of SM, reduce
the maintenance effort and at the same time reduce the complexity of the code.

It seems less concerning that users might end up provisioning a local disk, if
it happens to have scsi id, with LVHDoHBA instead of LVHD, than that users end
up not beeing able to provision their shared storage at all. Also the chance of
missing a local device driver appears much lower due to the more consistent
naming.

After all there is the question, whether we should really prevent users from
provisioning local disks using lvhdohba - but changing this is only a 1-line
change, to adapt the blacklist, after this commit.

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

GitHub: closes #45 on xapi-project/sm
267185a
Commits on Dec 24, 2013
@chandrikas chandrikas CA-113323: Wait for multipath links under mapper to be created before…
… proceeding with SR creation.

Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
8b96bb7
@chandrikas chandrikas CA-113323: Do not issue udevadm trigger on SR creation.
Rolled back original fix for CA-105130 which triggers udev events
for all devices in the system when a new SR is created. New events
for existing devices coupled with the ignore_device option in the
event handling rules caused the device to be removed.

The bug addressed in CA-105130 doesn't exist in the new release and
it should be safe to roll back the patch.

Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
c940925
@chandrikas chandrikas CA-113323: Use new udev device links for setting disk scheduler.
Links under /dev/disk/by-scsid have changed for the new kernel.
Setting scheduler for block devices when multipath is enabled
was broken due to reference to the old style of links. Updated
code to reflect corresponding changes in udev.

Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
1df58a0
@tmakatos tmakatos CA-119099: Don't rely on existence of mount point for SR auto-attach
Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
b643275
@freddy77 CA-122566: Fixed boot from multipathed SAN
A bug in Centos 6.4 multipath causes unnecessary delays
in root disk partition creation if detect_prio is set to yes
in multipath.conf(default value) and the device doesn't support
it. Setting detect_prio to no provides a workaround for the problem
and allows boot from a multipathed SAN. Bug is fixed upstream
in Centos 6.5 multipath.

Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>
5f9304a
@chandrikas chandrikas Merge changes for CA-123729
Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
7e313e3
Commits on Jan 02, 2014
@zli zli CP-6697: Add "coalesce" flag to SR other-config
When coalesce=false is set, SR GC will not do any coalesce (including
leaf coalesce) on the given SR. The rational is as follows:

Some times 3rd party user (e.g. CloudStack) need to introduce an
existing storage share (e.g. NFS) as a XenServer SR. These shares
might contain some VDI files. This is all normal. However, these VDI
files might be VHD chains (unlike the VHD "trees" in XenServer
VDI as no snapshot stub node exists). So when the SR is introduced,
XenServer will coalesce the chain automatically. The senario of
VHD chains are considered valid, but the consequence is not what
users normally want.

We already had a other-config:gc flag with which the user can
disable the GC completely. But unfortunately, the basic VDI.destroy
function also depends on GC. When we delete a file or LVM based VHD,
the VHD file is not immediately deleted but only marked as hidden.
It's up to the GC to actually remove the files and do all the
cleanup steps following that. With GC completely disabled, the VHD
file will never be deleted on disk, so the space will never be
freed up.

So we introduced this coalesce flag, if set to false (and gc remains
the default true), only coalescing (including leaf-coalescing) will
be disabled and the normal prune (i.e. hidden -> delete) can still
take place.

Unfortunately, we later on found out that this is not directly
useful for the current installation of CloudStack, because when
CloudStack copies VDI snapshots to the secondary storage, it
does a literal copy using "dd" without doing re-parenting. So
that regardless what this patch does

  * GC always fails scanning their existing secondary storage
  * And if the scan had passed (or if we now let it skip the
error), since the VHD chain/tree can not be established without
correct parenting information and these VHDs all have their "hidden"
flag set to true, these VHD files would have been considered as
orphanced VHD roots which are ready for deletion.

This feature will become useful when CloudStack starts to use
the VDI.copy's new rebase mirror feature and the old installation
being converted or phased out.

Signed-off-by: Zheng Li <zheng.li@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>
3437a41
@zli zli CP-6697: Add "nosubdir" flag for NFSSR
The normal NFSSR creates a sub directory under the NFS directory
given by params "server:serverpath", and use that sub directory
as the SR's working directory.

This patch set add an extra flag "sm-config:nosubdir", which
defaults to false. But when "nosubdir=true", NFSSR will avoid
creating that sub directory. Instead the SR will mount and use
the "serverpath" directory as the working directly.

The purpose of this patch is to provide a behavior compatible
with CloudStack's current NFSSR fork (which always use the
"nosubdir" semantics), so that they can move to the official
NFSSR with the help of this flag.

The reasons for choosing sm-config instead of other key/value
maps are:

  * device-config is RO map, so one can not change it's value
without migrating all VMs away in order to unplug the PBD
and recreate one . This will add considerable burden to CS's
already quite complicated upgrade process from the NFSSR fork
to the new one.

  * other-config is RW map, but it's not a param for sr-create.
So setting nosubdir during sr-create is no-op. One must then
reset the flag and unplug/plug the PBD to make it effective.

This patch also takes care of some corner case when someone
creates both a standard NFSSR and a "nosubdir" NFSSR under the
same serverpath. Ideally, they shouldn't interfere with each
other. This could be useful if CloudStack wants to gradually
moave all their current nosubdir NFSSRs to standard NFSSRs for
their primary storage.

The patch is partially based on a previous version implemented by
Anthony Xu <Xuefei.Xu@citrix.com>.

Signed-off-by: Zheng Li <zheng.li@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>
8eb8126
@zli zli CP-6697: Fix FileSR capability config and param docs
This patch fix the outdated and incorrect configuration of
FileSR capabilities config and param doc. They are registered
by SM with XAPI, which will ultimately reflects on things like
XE tab completion and XE helps etc.

As we can see from the existing FileSR.py implementation, FileSR's
mandatory device-config param is not "path" but "location".

Signed-off-by: Zheng Li <zheng.li@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>
d80fe84
@zli zli CP-6697: Refactor _checkmount to base class FileSR
It's common for all its sub classes, and now we intend to use it
in the base class (FileSR) as well, so we do the refactoring by
moving it to the base class instead.

Note that util.ismount doesn't seem to be very different from the
standard os.path.ismount. It might date back to days when the
os.path.ismount doesn't exist. Here we intentionally keep it
unchanged for backward compatability, in case the code needs to
be backport to earlier releases (though quite unlikely).

Signed-off-by: Zheng Li <zheng.li@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>
691cd97
@zli zli CP-6697: Modernize FileSR as an independent SR type
Currently, almost all the file-based SR types have two paths in
concept and implementation:

  * remotepath: the source path of the storage, e.g. a NFS share's
    address like server:/serverpath

  * path: the local path in /var/run/sr-mount/$sr_uuid, where
    the remotepath is mounted to

However, FileSR, the base class of all file-based SR types, doesn't
follow this convention itself. It doesn't have the  "remotepath"
varible; instead it defines the source path of the storage to be
the "path" (which should, conceptually, be the "remotepath"); it
doesn't have an entry in /var/run/sr-mount like other SRs.

This leads to two disadvantages:

  * When FileSR is used as an independent SR types, many of the
    the library code and utilities doesn't work with it, because
    they assume the existance of both variables or the entry in
    /var/run/sr-mount. E.g., SM GC assumes that all the SRs it
    works with must have a /var/run/sr-mount entry. Issues like
    this haven't been spot before, because FileSR hasn't been
    used as an indepedent SR type for a long time, also some of
    the methods that could potentially tigger these issues were
    shadowed by method overloading in the children classes.

  * This inconsistency also reduces the chance of code sharing.
    Some functions that could have been implemented in the base
    class can't be defined in the base class, because e.g. there
    is no "remotepath" variable defined or the "path" variable
    has a meaning conceptually different from the one in the
    child class. These code would then have to be duplicated into
    each children class and involve on their own, which is
    quite error prone.

A big part of this patch is to address this issue by creating
the same conceptual model for FileSR.

  * The source path of the storage which passed in as
    device-config:location (like before) is defined as the
    "remotepath"

  * There is now a /var/run/sr-mount entry, where the
    "remotepath" is bind mount onto, which is the "path". This
    is conceptually consistent with all other file-based SR types,
    and implementation-wise too.

With these changes, most of the library code will immediately
work with FileSR with no changes required on them (which is our
point). And FileSR then becomes an independent SR type out of box.

A little bit of change is done to attach (and similarly detach):
we now avoid calling super().attach from children classes, because
the attach method in the base class now does more work specific
to FileSR itself.

We haven't done much refactoring as part of this patch itself,
though it should introduce some potentials for code refactoring
and reusing in the future.

Signed-off-by: Zheng Li <zheng.li@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>
34b9bb3
@zli zli CP-6697: normal ismount can not deal with bind mount
This is a known design issue of bind mount on Linux. As we
now use bind mount for FileSR, we need to fix this. Here we
implement a customized version specific to our environment.

Signed-off-by: Zheng Li <zheng.li@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>
eed0ec8
@zli zli Merge CP-6697
Signed-off-by: Zheng Li <zheng.li@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>

GitHub: closes #58 on xapi-project/sm
0f0a480
Commits on Jan 06, 2014
@tmakatos tmakatos CA-122950: Ignore invalid VDI handle exceptions in SR.scan
Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Zheng Li <zheng.log@citrix.com>

GitHub: closes #61 on xapi-project/sm
c75ea33
Commits on Jan 08, 2014
@tmakatos tmakatos CA-122253: Improve error reporting for LVM-based SR snapshots
Return the actual error instead of returning errors that might have
occurred in the error-handling path.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>

GitHub: closes #60 on xapi-project/sm
666f0b5
Commits on Jan 10, 2014
@zli zli CA-125137: sr_ref doesn't always exist
E.g. when doing SR.probe, sr_ref doesn't exist.

Signed-off-by: Zheng Li <zheng.li@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>
f03332c
@zli zli CA-125122: Ensure the existance of remotepath when calling _isbind
Signed-off-by: Zheng Li <zheng.li@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>
6cf9efd
@zli zli Merge CP-6697 fixup
Signed-off-by: Zheng Li <zheng.li@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>

GitHub: closes #63 on xapi-project/sm
2ef774c
@tmakatos tmakatos revert merge 2ef774c
This commit reverts merge 2ef774c,
which contains fixes for regressions introduced by merge
0f0a480 (CP-6697). We are revert this
merge because we don't have time to test it. The commits reverted are:
* 6cf9efd: "CA-125122: Ensure the existance
  of remotepath when calling _isbind"
* f03332c: "CA-125137: sr_ref doesn't always
  exist"

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Germano Percossi <germano.percossi@citrix.com>
dd136aa
@tmakatos tmakatos revert merge 0f0a480
This commit reverts merge 0f0a480
(CP-6697) because that merge introduced significant regressions. The
commits that are reverted are:
 * eed0ec8: "CP-6697: normal ismount can not
   deal with bind mount"
 * 34b9bb3: "CP-6697: Modernize FileSR as an
   independent SR type"
 * 691cd97: "CP-6697: Refactor _checkmount to
   base class FileSR"
 * d80fe84: "CP-6697: Fix FileSR capability
   config and param docs"
 * 8eb8126: "CP-6697: Add "nosubdir" flag for
   NFSSR"
 * 3437a41: "CP-6697: Add "coalesce" flag to
   SR other-config"

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Germano Percossi <germano.percossi@citrix.com>
18347cf
@tmakatos tmakatos Merge pull request #64 from tmakatos/master
revert commits that broke the storage BST and the nightly
b4e409b
@tmakatos tmakatos revert 666f0b5 (CA-122253)
This commit reverts "CA-122253: Improve error reporting for LVM-based SR
snapshots" as it hasn't been tested by a storage BST and the imminent
backout merge from trunk-storage into trunk could introduce regressions.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Germano Percossi <germano.percossi@citrix.com>

GitHub: closes #65 on xapi-project/github
0d2d903