build-sys: Remove unused libstoragemgmt references

The daemon does not need libstoragemgmt, so we don't need to reference
libstoragemgmt.la or its CFLAGS in daemon/Makefile.am
daemon: Use per-target CFLAGS

Currently, CPPFLAGS are set globally for both lsmd and lsm_restd through
the use of AM_CPPFLAGS. However, lsmd does not need any such flags, they
are only needed by lsm_restd. This commit moves the global AM_CPPFLAGS
to lsm_restd_CFLAGS. It also removes LIBGLIB_CFLAGS as glib is not used
here.
c_binding: Remove unused Makefile.am variable

DEPS is not the name of an automake variable (closest name would be
DEPENDENCIES, see
https://www.gnu.org/software/automake/manual/html_node/Variable-Index.html#Variable-Index
). Moreover nothing uses DEPS in the Makefile.am or in other build
system files so it can be removed.
build-sys: Use automake 'subdir-objects' options

c_binding/Makefile.am references some files from the util/ subdirectory.
This causes warning with newer automakes unless 'subdir-objects' is
used:

c_binding/Makefile.am:12: warning: source file 'util/qparams.c' is in a subdirectory,
c_binding/Makefile.am:12: but option 'subdir-objects' is disabled
automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the 'subdir-objects'
automake: automake option hasn't been enabled.  For now, the corresponding output
automake: object file(s) will be placed in the top-level directory.  However,
automake: this behaviour will change in future Automake versions: they will
automake: unconditionally cause object files to be placed in the same subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option throughout your
automake: project, to avoid future incompatibilities.
c_binding: Fix small typo in API doc

"fils system" -> "file system"
daemon: Don't use deprecated json_object_object_get

This causes a warning on fedora 21 as this has been deprecated.
This commit switches to the recommended json_object_object_get_ex
replacement.
This function has been available since at least json-c 0.10 which is
the minimum version we require, so we don't need a fallback
version of that function.
daemon: Remove obsolete build comments

The compilation instructions are no longer needed as the rest daemon
build is integrated in the main autotools-based build system.
daemon: Remove unused #define

The MHD_PLATFORM_H #define needs to be set before including
microhttpd.h, so it had no effect where it was placed.
This #define is useful when building on systems where the standard
headers defining uint64_t, size_t, ... are not available.
As we are building on reasonably standard platforms, we can rely let
microhttpd.h use the standard headers.
daemon: Mark internal functions as 'static'
SMI-S Plugin: Fix MegaRAID disk type detection.

 * Previous code will treat SSD SAS as Disk.TYPE_SAS.
   This patch use vendor specific way for detecting MegaRAID disk type:
    LSIESG_DiskDrive['MediaType'] determine the HDD or SSD
    LSIESG_DiskDrive['Type'] determine the connection: SAS, SATA, SCSI, etc

 * Tested against SAS, SATA and SSD disks.

Signed-off-by: Gris Ge <fge@redhat.com>
RPM SPEC: Add OpenSuSE support.

 * This is based on rpm SPEC provided by Nick Wang <nwang@suse.com>.

 * Use %if 0%{?suse_version} to use SuSE only setting.

 * Replaced '/bin/systemctl' command with %systemd_xxx macros which was
   provided by /usr/lib/rpm/macros.d/macros.systemd by systemd rpm.
   # For SuSE, they use %service_xxx instead.

 * Removed command "systemctl enable libstoragemgmt.service".
   We should use systemd.preset instead.
   For RHEL 7 and Fedora, systemd.preset enabled libstoragemgmt.service.
   So nothing actual changed.

 * Add %post script to libstoragemgmt-rest package.

 * Make sure all folder is owned by certain rpm package by add lines like:
        %dir %{python_sitelib}/lsm/plugin/sim

 * Move 'libstoragemgmt-rest.service' systemd file to libstoragemgmt-rest
   package. (Old RPM SPEC was including it in libstoragemgmt.rpm)

 * On openSuSE, the package name has been changed due to their share lib naming
   policy[1]:
    libstoragemgmt-devel
    libstoragemgmt-udev
    libstoragemgmt1
    libstoragemgmt1-python
    libstoragemgmt1-smis-plugin
    libstoragemgmt1-netapp-plugin
    libstoragemgmt1-targetd-plugin
    libstoragemgmt1-nstor-plugin
    libstoragemgmt1-rest

 * Run fdupes on OpenSuSE to create soft link against duplicated
   python .pyo and .pyc files.
   For Fedora, it will conflict with brp-python-bytecompile.
   For RHEL, fdupes is in EPEL repo.

 * Move '/var/run/lsm' folder creation to %pre script as a rpm package should
   not own a ghost file in /var/run which might be mounted as tmpfs.

 * Add %post and %postun scripts into plugin package to 'try-restart'
   the libstoragemgmt.service when new install or package removal.
   This is only for systemd as RHEL 6 does not have 'try-restart' feature yet.

 * On openSuSE, use 'LGPL-2.1+' string due to openSuSE requirements.

 * Compile pass on OBS for Fedora 19/20, RHEL 6/7, OpenSuSE 13.1/13.2

 * Manually tested via 'lsmcli lp' against simulator C and python plugin,
   smispy plugin, ontap plugin and targetd plugin on these OS:
    * RHEL 6.5 x86_64
    * RHEL 7.0 x86_64
    * Fedora 20 x86_64
    * OpenSuSE 13.1 x86_64

[1] https://en.opensuse.org/openSUSE:Shared_library_packaging_policy

Changes in V2:
 * Removed unneeded _libexecdir for openSuSE as suggested by Nick Wang.

Changes in V3:
 * Removed the "don't commit" comments.

Signed-off-by: Gris Ge <fge@redhat.com>
LSM REST Daemon: Fix memory leak.

 * This patch was inspired by a patch from Christophe Fergeau and coverity
   scan report from Tony Asleson.

 * Fixed all valgrind reported memory leak except one possibly leak:
   # RHEL 7 libmicrohttpd-0.9.33-2.el7.x86_64, valgrind-3.9.0-6.el7.x86_64
    ==17008== 272 bytes in 1 blocks are possibly lost in loss record 58 of 83
    ==17008==    at 0x4C2A1D4: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==17008==    by 0x4011EB4: _dl_allocate_tls (dl-tls.c:318)
    ==17008==    by 0x631B9A0: pthread_create@@GLIBC_2.2.5 (allocatestack.c:570)
    ==17008==    by 0x4E3A13F: create_thread (daemon.c:979)
    ==17008==    by 0x4E3F258: MHD_start_daemon_va (daemon.c:3628)
    ==17008==    by 0x4E3FC6C: MHD_start_daemon (daemon.c:2666)
    ==17008==    by 0x401429: main (lsm_rest.c:513)

Signed-off-by: Gris Ge <fge@redhat.com>