34 Commits

Author SHA1 Message Date
Abraham Arce
03b3f990ea openSUSE: Runtime Dependencies
Resolve runtime dependencies for the following service manager
components:

- sm-client
- sm-tools
- sm-api

High availability OBS workspace has been moved to xe1gyq home
project [0], adding repository
Cloud_StarlingX_2.0_openSUSE_Leap_15.1 [1] in order to:

- allow all succesfull packages appear under xe1gyq
  repository [2].
- automatically include other flock dependencies
  (e.g. mtce-devel).

Refer to the following OBS workspaces to verify all service
management packages have built successfully under repository
Cloud_StarlingX_2.0_openSUSE_Leap_15.1:

- https://build.opensuse.org/package/show/home:xe1gyq/sm-db
- https://build.opensuse.org/package/show/home:xe1gyq/sm-common
- https://build.opensuse.org/package/show/home:xe1gyq/sm
- https://build.opensuse.org/package/show/home:xe1gyq/sm-client
- https://build.opensuse.org/package/show/home:xe1gyq/sm-tools
- https://build.opensuse.org/package/show/home:xe1gyq/sm-api

[0] https://build.opensuse.org/project/show/home:xe1gyq
[1] https://build.opensuse.org/repositories/home:xe1gyq
[2] https://download.opensuse.org/repositories/home:/xe1gyq/

Depends-On: https://review.opendev.org/#/c/679686

Story: 2006684
Task: 36968
Task: 36969
Task: 36970

Change-Id: I0a21652fff83b5da8acdfb0191df87165b88389e
Signed-off-by: Abraham Arce <abraham.arce.moreno@intel.com>
2019-10-09 10:05:54 -05:00
Abraham Arce
f38de3f45f openSUSE: Open Build Service Artifacts
OBS is a generic system to build and distribute binary packages
from sources [0], StarlingX OBS Project:

- Cloud:StarlingX:2.0 [1]

Build Service Management uses Open Build Service (OBS) with the
following base artifacts under Service Management repository:

- Specfiles
- Changelogs
- Rpmlintrcs

The following components are included and succesfully building,
(with their source OBS repository):

- sm        [2]
- sm-common [3]
- sm-db     [4]
- sm-api    [5]
- sm-client [6]
- sm-tools  [7]

The following considerations are taken for Gerrit files:

- Added %changelog directive to all specfiles

The following considerations are taken for OBS _service files:

- Added parameter "extract" to get spec, changes and rpmlintrc files.
- All component version standardized to 1.0.0

[0] openbuildservice.org
[1] https://build.opensuse.org/project/show/Cloud:StarlingX:2.0
[2] https://build.opensuse.org/package/show/home:xe1gyq:branches:Cloud:StarlingX:2.0/sm
[3] https://build.opensuse.org/package/show/home:xe1gyq:branches:Cloud:StarlingX:2.0/sm-common
[4] https://build.opensuse.org/package/show/home:xe1gyq:branches:Cloud:StarlingX:2.0/sm-db
[5] https://build.opensuse.org/package/show/home:xe1gyq:branches:Cloud:StarlingX:2.0/sm-api
[6] https://build.opensuse.org/package/show/home:xe1gyq:branches:Cloud:StarlingX:2.0/sm-client
[7] https://build.opensuse.org/package/show/home:xe1gyq:branches:Cloud:StarlingX:2.0/sm-tools

Story: 2006508
Task: 36495
Task: 36496
Task: 36497
Task: 36498
Task: 36534
Task: 36794

Change-Id: I06a7e132de4892b846d99977ff1bfc5bf240ade4
Co-authored-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
Signed-off-by: Abraham Arce <abraham.arce.moreno@intel.com>
2019-10-09 10:05:20 -05:00
Zuul
c6748557ef Merge "Fix Flake8 Bugbear Errors" 2019-04-23 18:42:01 +00:00
Tyler Smith
160ef92b44 Rename config entry to work with newest stein oslo utils package
Renaming a config entry as it causes a name conflict with
the latest version of oslo utils introduced during the stein rebase

Change-Id: Idc581b7dc389b00863461f2b30b7f6ae283ffdc5
Story: 2004765
Task: 28883
Signed-off-by: Tyler Smith <tyler.smith@windriver.com>
2019-04-17 15:24:55 +00:00
Eric Barrett
24c42133f8 Fix Flake8 Bugbear Errors
Flake8 is failing due to bugbear updating with new error codes:
B009: Do not call getattr with a constant attribute value
B010: Do not call setattr with a constant attribute value
Fix these errors by using normal property access instead

Change-Id: Ib857d229ae86e88cb5dbf69e826b25d6018c8547
Signed-off-by: Eric Barrett <eric.barrett@windriver.com>
2019-04-15 17:06:14 -04:00
Eric Barrett
687ed8c747 Enable Do not use Mutable Default Args Error
Flake8 currently ignores do not use mutable default arguments error
Enable B006 for more thorough testing of code

Change-Id: I5b08a56f945158c3b3c23574c048363e59da6001
Story: 2004515
Task: 30172
Signed-off-by: Eric Barrett <eric.barrett@windriver.com>
2019-04-15 12:53:36 -04:00
Sun Austin
da53f143ee Fix flake8 errors and disable ignore case
below issures are removed from ignore cases:
    E114 indentation is not a multiple of four (comment)
    E116 unexpected indentation (comment)
    E121 continuation line under-indented for hanging indent
    E122 continuation line missing indentation or outdented
    E123 closing bracket does not match indentation of opening bracket's line
    E124 closing bracket does not match visual indentation
    E125 continuation line with same indent as next logical line
    E126 continuation line over-indented for hanging indent
    E127 continuation line over-indented for visual indent
    E128 continuation line under-indented for visual indent
    E129 visually indented line with same indent as next logical line
    E131 continuation line unaligned for hanging indent
    E201 whitespace after '('
    E228 missing whitespace around modulo operator
    E231 missing whitespace after ','
    E241 multiple spaces after ':'
    E251 unexpected spaces around keyword / parameter equals
    E265 block comment should start with '#'
    E271 multiple spaces after keyword
    E302 expected 2 blank lines, found 1
    E303 too many blank lines
    E305 expected 2 blank lines after class or function definition, found 1
    E704 multiple statements on one line (def)
    E713 test for membership should be 'not in'
    E714 test for object identity should be 'is not'
    E722 do not use bare except'
    E731 do not assign a lambda expression, use a def
    E999 SyntaxError: invalid syntax (this is likely python3)
    F401 <foo> imported but unused
    F841 local variable 'foo' is assigned to but never used
    H201: no 'except:'
    H233: Python 3.x incompatible use of print operator
    B001 Do not use bare `except:`
    B004 Using `hasattr(x, '__call__')` to test
         if `x` is callable is unreliable.
    B305 `.next()` is not a thing on Python 3. Use the `next()` builtin.
    B306 `BaseException.message` has been deprecated as of Python 2.6
          and is removed in Python 3.
    B007 Loop control variable 'key' not used within the loop body.
remain below issues in ignores:
    E402 module level import not at top of file
    ./service-mgmt-api/sm-api/sm_api/cmd/__init__.py:25

    Hxxx since which are related with document format

    F811 redefinition of unused '<foo>' from line <x>
    ./service-mgmt-tools/sm-tools/sm_tools/sm_configure.py:18

    F821 undefined name 'e'
    ./service-mgmt-api/sm-api/sm_api/common/utils.py:448

    B006 Do not use mutable data structures for argument defaults.
    ./service-mgmt-api/sm-api/sm_api/common/service.py:59

    B008 Do not perform calls in argument defaults.
    ./service-mgmt-api/sm-api/sm_api/openstack/common/timeutils.py:117

Test have been done:Build,Deploy,some smc command,such as smc service-list,
smc service-show, sm-dump, etc

Story: 2003430
Task: 26524

Change-Id: I3e2a4a31f87e3ff66cfce86f54285e830ee1c3dc
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-11-07 08:12:37 +08:00
Sun Austin
ec02214db7 Fix: others issues for Python 2/3 compatible code.
Fix: "reduce" issue in
   service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_zmq.py
     - from functools import reduce to support python 3
Fix: "long" issue in
   service-mgmt-api/sm-api/sm_api/openstack/common/jsonutils.py
     -  remove long type if for python 3
     -  change to six.integer_types
Fix: "funcattrs" issue in
   service-mgmt-api/sm-api/sm_api/openstack/common/db/sqlalchemy/session.py
     - change f.func_name to f.__name__
Fix: "zip" and "methodattrs" issues in
   service-mgmt-api/sm-api/sm_api/common/safe_utils.py
     - change zip() to list(zip())
     - change function.im_self to function.__self__
Fix: "itertools" issue in
   service-mgmt-api/sm-api/sm_api/openstack/common/log.py
     - from six import moves and use moves.filter

Story: 2003430
Task: 26523

Change-Id: I37b47a12a24ef05fb4d57823b2a91086b6ca537f
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-10-27 09:30:19 +08:00
Sun Austin
6753274b28 Fix: "metaclass" issues for Python 2/3 compatible code.
remove "__metaclass__ = abc.ABCMeta"
and adding decorator "@six.add_metaclass(abc.ABCMeta)" on class

and removing pep8 ignore case

Story: 2003430
Task: 27476

Change-Id: If60b8d5662d9a87b217a9b1d48a2c3e9b037884b
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-10-26 11:49:16 +08:00
Sun Austin
d9c7f0bc2f Fix types issue for Python 2/3 compatible code.
replace types.NoneType  with type(None)
replace types.DictType with dict

Story: 2003430
Task: 27481

Change-Id: I835b1c086267b05bedb454a0d2eaaeef58254dae
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-10-26 11:49:16 +08:00
Don Penney
b4049622ec Add hooks for python wheel generation
This update adds hooks to the spec files for the following packages
to generate wheels for the python modules:
- sm-api
- sm-client
- sm-tools

Change-Id: If6ebbdaaad5ee7623cbbaa07b48d216461a16dec
Story: 2003907
Task: 27527
Signed-off-by: Don Penney <don.penney@windriver.com>
2018-10-24 17:13:06 +00:00
Sun Austin
de91fb2ac1 Fix urllib import issue for Python2/3 compatible code.
change urlparse to 'from six.moves.urllib.parse import urlparse'
and remove obsolete code

Story:2003430
Task:27479

Change-Id: I38e75f5faa55046517f1e479b18ebcef0304e471
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-10-24 08:39:08 +08:00
Sun Austin
1477d25d55 Fix: "raise" issues for Python 2/3 compatible code.
use from six import reraise as raise_
to re-implement raise

Story:2003430
Task:27478

Change-Id: I34373ce7f233f7f908da3d92bcc000a9e924375d
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-10-24 08:39:08 +08:00
Sun Austin
4fe73f515d Fix: "except" issues for Python 2/3 compatible code.
change "except ValueError, e:"
to "except ValueError as e:"

and remove tox H231 from ignore for pep8 check
Story:2003430
Task: 26522

Change-Id: I06c7646c375ada7f8f06f870a7bdb0d7fc282e5a
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-10-22 11:49:35 +08:00
Sun Austin
f2a6d355a9 Fix next issue for Python 2/3 compatible code.
change x.next() to next(x)
and
add __next__() for class

Story: 2003430
Task: 26519

Change-Id: I4cda6f1d679e05b7f533b94840e0eb561213aa76
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-10-22 09:51:19 +08:00
Sun Austin
7816995e87 Fix filter issue for Python 2/3 compatible code.
Change-Id: I5894ed2a2be0ca7fc14004be3059033df7281791
Story: 2003430
Task: 26520
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-10-15 13:00:51 +08:00
Sun Austin
481b44f8a7 Fix unicode issue for Python 2/3 compatible code.
replace unicode with six.text_type

Story: 2003430
Task: 26517

Change-Id: I43db85ad34defeb708da1ad6c6c1ccce730818eb
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-10-10 11:07:12 +08:00
Sun Austin
f21e0c13d7 Fix basestring issue for Python 2/3 compatible code.
replace basestring with six.string_types
need python-six module

Story: 2003430
Task: 26518

Change-Id: If8864a1af26274211d8d0e125071794d18dfed01
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-10-08 19:11:28 +08:00
Erich Cordoba
54f4802bb1 Unsupress pylint warnings.
The W291,W292,W391,W503,W601 warnings were fixed and
tox.ini updated accordingly.

Story: 2002803
Task: 26911

Change-Id: I1e5f0b1f72b06ad8b5cac07921e9d14171623ba0
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
2018-10-04 14:19:31 -05:00
Al Bailey
6c5b844111 Adding pylint target to stx-ha
The voting linters job will now run pylint on the python code.
All failing pylint codes are currently suppressed.
Further tasks will be created to cleanup those failing tests.

The only code changes were comments which perform inline suppression
of pylint warnings. Those lines are not meant to be fixed since those
imports cannot succeed in a tox env.

Story: 2002803
Task: 26883
Change-Id: I4a25599fb60f58b168dbec001d3f2d24e0e2c235
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
2018-10-04 09:20:06 -05:00
Zuul
81060ae8ff Merge "Python 3 compatibility: convert ConfigParser to configparser." 2018-10-02 17:03:46 +00:00
Zuul
fc4fa1c048 Merge "Fix dict related issues for Python 2/3 compatible code" 2018-10-02 15:54:30 +00:00
Bin Qian
a2e8b67fc8 Add logging when a sm-api request received
Add logging when a service sm-api request is received.

Change-Id: Ifaf38eeeeeb44110a700976fedc247e30b0c7206
Related-Bug: #1791381
Signed-off-by: Bin Qian <bin.qian@windriver.com>
2018-09-27 16:11:56 +00:00
Sun Austin
5c0dcd6e4c Fix dict related issues for Python 2/3 compatible code
Story: 2003430
Task: 26353

Change-Id: Ic673136ece7f0a16177cc6a96377456d127e55bf
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-09-26 11:27:54 +08:00
melissaml
3ee0e68559 Fix a typo
Change-Id: I3505857116a0b85e3d6427e010d7eb94acf6841c
2018-09-23 01:53:28 +08:00
Jim Gauld
0ae072e1ad Decouple Guest-server/agent from stx-metal
This decouples the build and packaging of guest-server, guest-agent from
mtce, by splitting guest component into stx-nfv repo.

This leaves existing C++ code, scripts, and resource files untouched,
so there is no functional change. Code refactoring is beyond the scope
of this update.

Makefiles were modified to include devel headers directories
/usr/include/mtce-common and /usr/include/mtce-daemon.
This ensures there is no contamination with other system headers.

The cgts-mtce-common package is renamed and split into:
- repo stx-metal: mtce-common, mtce-common-dev
- repo stx-metal: mtce
- repo stx-nfv: mtce-guest
- repo stx-ha: updates package dependencies to mtce-pmon for
  service-mgmt, sm, and sm-api

mtce-common:
- contains common and daemon shared source utility code

mtce-common-dev:
- based on mtce-common, contains devel package required to build
  mtce-guest and mtce
- contains common library archives and headers

mtce:
- contains components: alarm, fsmon, fsync, heartbeat, hostw, hwmon,
  maintenance, mtclog, pmon, public, rmon

mtce-guest:
- contains guest component guest-server, guest-agent

Story: 2002829
Task: 22748

Depends-On: https://review.openstack.org/603435

Change-Id: I1a66c28bfa592d8034074a18e2328f69122da89b
Signed-off-by: Jim Gauld <james.gauld@windriver.com>
2018-09-18 12:53:12 -04:00
zhangyangyang
b90a7c9a4a Python 3 compatibility: convert ConfigParser to configparser.
The ConfigParser module in python 2 has been renamed to configparser
in Python 3.

Story: 2003430
Task: 26335

Change-Id: Ie4b29c44f90cc4feaf7f66f2a855fde3a222e058
Signed-off-by: zhangyangyang <zhangyangyang@unionpay.com>
2018-09-07 14:18:45 +00:00
zhangyangyang
321b24eb7e Python 3 compatibility: fix xrange/range issues
xrange is not defined in python3.
Rename xrange() to range().

Story: 2003430

Task: 25738

Change-Id: I267864d9b0ff9134fadc0864bee7f9d7095eb621
Signed-off-by: zhangyangyang <zhangyangyang@unionpay.com>
2018-09-01 17:31:11 +08:00
zhangyangyang
75b8c70d9d Python 3 compatibility: use print as a function.
In Python 3 print is a function.
Especially for multiple string print, need to import
print_function from __future__.

Story: 2003430

Task: 24915

Signed-off: zhangyangyang <zhangyangyang@unionpay.com>

Change-Id: I40ae72b8efb7b342489ad2191ad02b0a5fb2898f
2018-08-31 15:42:43 +00:00
Bin Qian
4fb1c66ab6 delay sm-api to provide service until sm starts
sm-api relys on sm service to provide service.
This change ensure sm-api start provide service after sm runtime
db is created.

Story: 2002988
Task: 23002

Change-Id: I3f1a970d5a5b8d7b77e6014008af39d36c55d6af
Signed-off-by: Bin Qian <bin.qian@windriver.com>
2018-08-15 15:13:18 -04:00
Bin Qian
045a37c672 Create independent sm-api client
1. use sm-api.conf for sm-api configuration
2. create sm-api client code and command line entry
3. add keystone authentication for accessing sm-api
4. removed dead sm-api client code

Story: 2002827
Task: 22744

Depends-On: I743f6b0f09c06325d3c9dc6e11902420882e7931
Change-Id: I861a6fa144494e135f6eb67d96e874d25f4db5d4
Signed-off-by: Bin Qian <bin.qian@windriver.com>
2018-08-13 14:16:57 -04:00
Bin Qian
d31c03457b Add server class for ipv6 binding for sm_api
This fixes the issue of unrecoverable sm-api process failure leading to
constant controller degrade in ipv6 system.

Story: 2002838
Task: 22757

Change-Id: If5381e583174cce63cb2734a46e094f401d5172b
Signed-off-by: Jack Ding <jack.ding@windriver.com>
2018-07-23 12:15:39 -04:00
Bin Qian
7de45afb19 Controller Services swact/failover time reduction
Add full support for Active/Active redudancy model
1. services could have enable dependency to services in other service groups
   (standby group)
2. An active/active service failure will degraded the service group it is in
3. A failure of active/active service would not prevent a swact
4. Locking a controller that is sole active/active service
provider will be rejected. But lock with force option will still proceed
to lock the node.
5. sm-api bind to port 7777 on mgmt interface. (was localhost:7777)

Change-Id: I6f0354e1e8fc606c6f3b8b33e3ab862b47824232
Signed-off-by: Jack Ding <jack.ding@windriver.com>
2018-06-28 15:43:19 -04:00
Dean Troyer
17c909ec83 StarlingX open source release updates
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-05-31 07:36:26 -07:00