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>
Imported-by: Vineeth Thampi Raveendran <vineeth.thampi@citrix.com>

(cherry picked from commit bc1da0cf34b3213b455523109e402da106a9bc65)

GitHub: closes #139 on xapi-project/sm
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>
Imported-by: Vineeth Raveendran <vineeth.thampi@citrix.com>

(cherry picked from commit 9dbd30cde957ad19ef5ba0e950d15712946975e8)

GitHub: closes #140 on xapi-project/sm
CP-8580: Add pylint configuration file.

Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>

GitHub: closes #137 on xapi-project/sm
CP-8580: Add MAX_TIMEOUT to LUNperVDI.py

Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>

GitHub: closes #137 on xapi-project/sm
CP-8580: Fix undefined variables in RawHBASR.py

- Variables sr_ref and host_ref are undefined in '_add_pbd_other_config'.
  Use self.sr_ref and self.host_ref instead.

Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>

GitHub: closes #137 on xapi-project/sm
CP-8580: Fix method issues with blktap2.py

- '_mklink' is not a class method. Hence use 'self' instead of 'cls'.

Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>

GitHub: closes #137 on xapi-project/sm
CP-8580: Fix method issues with lcache.py

- 'from_tapdisk' is a class method. Hence use 'cls' instead of 'self'.

Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>

GitHub: closes #137 on xapi-project/sm
CP-8580: Fix method issues with mpathcount.py

- The original code overwrites 'add'/'remove' methods with internal
ones. Rename them to '_add'/'_remove' to prevent accidental shadowing.

Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>

GitHub: closes #137 on xapi-project/sm
CP-8580: Fix incorrect log print by adding '%'.

Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>

GitHub: closes #137 on xapi-project/sm
CP-8580: Fix undefined variable in srmetadata.py

- Undefined variable 'diff' was referenced in the else cause.
Fix dangling reference by adding the variable.

Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>

GitHub: closes #137 on xapi-project/sm
CP-8580: Don't import unused 'stat' module.

- The 'stat' module was imported but unused. Also, we define a function
 with the same name which causes the module to be shadowed.

Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>

GitHub: closes #137 on xapi-project/sm
CP-8629: Direct PPA install

A build system behind a firewall cannot use apt-add-repository directly.
To workaround the problem, including the public key and adding the
repository directly as part of
install_prerequisites_for_python_unittests.sh script.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Acked-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>

GitHub: closes #141 on xapi-project/sm
CP-8629: Install to temporary directory

While making snapwatchd, the binaries are also installed. If DESTDIR is
not set, it means that the binaries will be installed to the /
directory. Create a temporary directory, and set that as DESTDIR to
avoid polluting the root directory.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Acked-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>

GitHub: closes #141 on xapi-project/sm
CP-8629: Install coverage

Install coverage package, so unit test coverage could be measured.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Acked-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>

GitHub: closes #141 on xapi-project/sm
CP-8629: Run unittests with coverage

Run unittests with coverage and report both unit test results and
coverage in computer consumable format.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Acked-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>

GitHub: closes #141 on xapi-project/sm