Change Service Type vmha to ha
This patch changed service type vmha to ha. Change-Id: I23645a349d05e9e9172a4e36894cdd5aaa5cce3b Closes-Bug: #1642213
This commit is contained in:
parent
2dd88c3ace
commit
3b01ed458e
|
@ -64,7 +64,7 @@ class ListHost(command.Lister):
|
|||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
masakari_client = self.app.client_manager.vmha
|
||||
masakari_client = self.app.client_manager.ha
|
||||
columns = ['uuid', 'name', 'type', 'control_attributes', 'reserved',
|
||||
'on_maintenance', 'failover_segment_id']
|
||||
queries = {
|
||||
|
@ -103,7 +103,7 @@ class ShowHost(command.ShowOne):
|
|||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
masakari_client = self.app.client_manager.vmha
|
||||
masakari_client = self.app.client_manager.ha
|
||||
return _show_host(masakari_client,
|
||||
parsed_args.segment_id,
|
||||
parsed_args.host)
|
||||
|
@ -147,7 +147,7 @@ class CreateHost(command.ShowOne):
|
|||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
masakari_client = self.app.client_manager.vmha
|
||||
masakari_client = self.app.client_manager.ha
|
||||
attrs = {
|
||||
'name': parsed_args.name,
|
||||
'type': parsed_args.type,
|
||||
|
@ -208,7 +208,7 @@ class UpdateHost(command.ShowOne):
|
|||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
masakari_client = self.app.client_manager.vmha
|
||||
masakari_client = self.app.client_manager.ha
|
||||
attrs = {
|
||||
'name': parsed_args.name,
|
||||
'type': parsed_args.type,
|
||||
|
@ -245,7 +245,7 @@ class DeleteHost(command.ShowOne):
|
|||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
masakari_client = self.app.client_manager.vmha
|
||||
masakari_client = self.app.client_manager.ha
|
||||
masakari_client.delete_host(parsed_args.segment_id,
|
||||
parsed_args.host)
|
||||
print('Host deleted: %s' % parsed_args.host)
|
||||
|
|
|
@ -60,7 +60,7 @@ class ListNotification(command.Lister):
|
|||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
masakari_client = self.app.client_manager.vmha
|
||||
masakari_client = self.app.client_manager.ha
|
||||
columns = ['notification_uuid', 'generated_time', 'status',
|
||||
'type', 'source_host_uuid', 'payload']
|
||||
queries = {
|
||||
|
@ -94,7 +94,7 @@ class ShowNotification(command.ShowOne):
|
|||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
masakari_client = self.app.client_manager.vmha
|
||||
masakari_client = self.app.client_manager.ha
|
||||
return _show_notification(masakari_client,
|
||||
notification_uuid=parsed_args.notification)
|
||||
|
||||
|
@ -127,7 +127,7 @@ class CreateNotification(command.ShowOne):
|
|||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
masakari_client = self.app.client_manager.vmha
|
||||
masakari_client = self.app.client_manager.ha
|
||||
payload = jsonutils.loads(parsed_args.payload)
|
||||
attrs = {
|
||||
'type': parsed_args.type,
|
||||
|
|
|
@ -58,7 +58,7 @@ class ListSegment(command.Lister):
|
|||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
masakari_client = self.app.client_manager.vmha
|
||||
masakari_client = self.app.client_manager.ha
|
||||
columns = ['uuid', 'name', 'description', 'service_type',
|
||||
'recovery_method']
|
||||
queries = {
|
||||
|
@ -92,7 +92,7 @@ class ShowSegment(command.ShowOne):
|
|||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
masakari_client = self.app.client_manager.vmha
|
||||
masakari_client = self.app.client_manager.ha
|
||||
return _show_segment(masakari_client,
|
||||
segment_uuid=parsed_args.segment)
|
||||
|
||||
|
@ -125,7 +125,7 @@ class CreateSegment(command.ShowOne):
|
|||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
masakari_client = self.app.client_manager.vmha
|
||||
masakari_client = self.app.client_manager.ha
|
||||
attrs = {
|
||||
'name': parsed_args.name,
|
||||
'description': parsed_args.description,
|
||||
|
@ -173,7 +173,7 @@ class UpdateSegment(command.ShowOne):
|
|||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
masakari_client = self.app.client_manager.vmha
|
||||
masakari_client = self.app.client_manager.ha
|
||||
attrs = {
|
||||
'name': parsed_args.name,
|
||||
'description': parsed_args.description,
|
||||
|
@ -203,7 +203,7 @@ class DeleteSegment(command.Command):
|
|||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
masakari_client = self.app.client_manager.vmha
|
||||
masakari_client = self.app.client_manager.ha
|
||||
|
||||
for sid in parsed_args.segment:
|
||||
try:
|
||||
|
|
|
@ -18,23 +18,23 @@ from openstack import connection
|
|||
from openstack import profile
|
||||
from osc_lib import utils
|
||||
|
||||
from masakariclient.sdk.vmha import vmha_service
|
||||
from masakariclient.sdk.ha import ha_service
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
DEFAULT_VMHA_API_VERSION = '1'
|
||||
API_VERSION_OPTION = 'os_vmha_api_version'
|
||||
API_NAME = 'vmha'
|
||||
DEFAULT_HA_API_VERSION = '1'
|
||||
API_VERSION_OPTION = 'os_ha_api_version'
|
||||
API_NAME = 'ha'
|
||||
API_VERSIONS = {
|
||||
'1': 'masakariclient.client.Client',
|
||||
}
|
||||
|
||||
|
||||
def make_client(instance):
|
||||
"""Returns a vmha proxy"""
|
||||
"""Returns a ha proxy"""
|
||||
prof = profile.Profile()
|
||||
prof._add_service(vmha_service.VMHAService(version="v1"))
|
||||
prof._add_service(ha_service.HAService(version="v1"))
|
||||
prof.set_region(API_NAME, instance.region_name)
|
||||
prof.set_version(API_NAME, instance._api_version[API_NAME])
|
||||
prof.set_interface(API_NAME, instance.interface)
|
||||
|
@ -43,19 +43,19 @@ def make_client(instance):
|
|||
cert=instance.session.cert,
|
||||
profile=prof)
|
||||
LOG.debug('Connection: %s', conn)
|
||||
LOG.debug('masakari client initialized: %s', conn.vmha)
|
||||
return conn.vmha
|
||||
LOG.debug('masakari client initialized: %s', conn.ha)
|
||||
return conn.ha
|
||||
|
||||
|
||||
def build_option_parser(parser):
|
||||
"""Hook to add global options"""
|
||||
parser.add_argument(
|
||||
'--os-vmha-api-version',
|
||||
metavar='<vmha-api-version>',
|
||||
'--os-ha-api-version',
|
||||
metavar='<ha-api-version>',
|
||||
default=utils.env(
|
||||
'OS_VMHA_API_VERSION',
|
||||
default=DEFAULT_VMHA_API_VERSION),
|
||||
help='vmha API version, default=' +
|
||||
DEFAULT_VMHA_API_VERSION +
|
||||
' (Env: OS_VMHA_API_VERSION)')
|
||||
'OS_HA_API_VERSION',
|
||||
default=DEFAULT_HA_API_VERSION),
|
||||
help='ha API version, default=' +
|
||||
DEFAULT_HA_API_VERSION +
|
||||
' (Env: OS_HA_API_VERSION)')
|
||||
return parser
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
from openstack import connection
|
||||
from openstack import profile
|
||||
|
||||
from masakariclient.sdk.vmha import vmha_service
|
||||
from masakariclient.sdk.ha import ha_service
|
||||
|
||||
|
||||
def create_connection(prof=None, user_agent=None, **kwargs):
|
||||
|
@ -24,15 +24,15 @@ def create_connection(prof=None, user_agent=None, **kwargs):
|
|||
if not prof:
|
||||
prof = profile.Profile()
|
||||
|
||||
prof._add_service(vmha_service.VMHAService(version="v1"))
|
||||
prof._add_service(ha_service.HAService(version="v1"))
|
||||
interface = kwargs.pop('interface', None)
|
||||
region_name = kwargs.pop('region_name', None)
|
||||
if interface:
|
||||
prof.set_interface('vmha', interface)
|
||||
prof.set_interface('ha', interface)
|
||||
if region_name:
|
||||
prof.set_region('vmha', region_name)
|
||||
prof.set_region('ha', region_name)
|
||||
|
||||
prof.set_api_version('vmha', '1')
|
||||
prof.set_api_version('ha', '1')
|
||||
|
||||
try:
|
||||
conn = connection.Connection(profile=prof, user_agent=user_agent,
|
|
@ -15,12 +15,12 @@
|
|||
from openstack import service_filter
|
||||
|
||||
|
||||
class VMHAService(service_filter.ServiceFilter):
|
||||
"""The VMHA service."""
|
||||
class HAService(service_filter.ServiceFilter):
|
||||
"""The HA service."""
|
||||
|
||||
valid_versions = [service_filter.ValidVersion('v1')]
|
||||
|
||||
def __init__(self, version=None):
|
||||
"""Create an vmha service."""
|
||||
super(VMHAService, self).__init__(service_type='vmha',
|
||||
version=version)
|
||||
"""Create an ha service."""
|
||||
super(HAService, self).__init__(service_type='ha',
|
||||
version=version)
|
|
@ -15,13 +15,13 @@
|
|||
from openstack import proxy2
|
||||
from openstack import resource2
|
||||
|
||||
from masakariclient.sdk.vmha.v1 import host as _host
|
||||
from masakariclient.sdk.vmha.v1 import notification as _notification
|
||||
from masakariclient.sdk.vmha.v1 import segment as _segment
|
||||
from masakariclient.sdk.ha.v1 import host as _host
|
||||
from masakariclient.sdk.ha.v1 import notification as _notification
|
||||
from masakariclient.sdk.ha.v1 import segment as _segment
|
||||
|
||||
|
||||
class Proxy(proxy2.BaseProxy):
|
||||
"""Proxy class for vmha resource handling.
|
||||
"""Proxy class for ha resource handling.
|
||||
|
||||
Create method for each action of each API.
|
||||
"""
|
||||
|
@ -40,9 +40,9 @@ class Proxy(proxy2.BaseProxy):
|
|||
|
||||
:param notification: The value can be the ID of a notification or a
|
||||
:class:
|
||||
`~masakariclient.sdk.vmha.v1
|
||||
`~masakariclient.sdk.ha.v1
|
||||
.notification.Notification` instance.
|
||||
:returns: One :class:`~masakariclient.sdk.vmha.v1
|
||||
:returns: One :class:`~masakariclient.sdk.ha.v1
|
||||
.notification.Notification`
|
||||
:raises: :class:`~openstack.exceptions.ResourceNotFound`
|
||||
when no resource can be found.
|
||||
|
@ -54,12 +54,12 @@ class Proxy(proxy2.BaseProxy):
|
|||
|
||||
:param dict attrs: Keyword arguments which will be used to create
|
||||
a :class:
|
||||
`masakariclient.sdk.vmha.v1
|
||||
`masakariclient.sdk.ha.v1
|
||||
.notification.Notification`,
|
||||
comprised of the propoerties on the Notification
|
||||
class.
|
||||
:returns: The result of notification creation
|
||||
:rtype: :class: `masakariclient.sdk.vmha.v1
|
||||
:rtype: :class: `masakariclient.sdk.ha.v1
|
||||
.notification.Notification`
|
||||
"""
|
||||
return self._create(_notification.Notification, **attrs)
|
||||
|
@ -78,8 +78,8 @@ class Proxy(proxy2.BaseProxy):
|
|||
|
||||
:param segment: The value can be the ID of a segment or a
|
||||
:class:
|
||||
`~masakariclient.sdk.vmha.v1.segment.Segment` instance.
|
||||
:returns: One :class:`~masakariclient.sdk.vmha.v1.segment.Segment`
|
||||
`~masakariclient.sdk.ha.v1.segment.Segment` instance.
|
||||
:returns: One :class:`~masakariclient.sdk.ha.v1.segment.Segment`
|
||||
:raises: :class:`~openstack.exceptions.ResourceNotFound`
|
||||
when no resource can be found.
|
||||
"""
|
||||
|
@ -90,10 +90,10 @@ class Proxy(proxy2.BaseProxy):
|
|||
|
||||
:param dict attrs: Keyword arguments which will be used to create
|
||||
a :class:
|
||||
`masakariclient.sdk.vmha.v1.segment.Segment`,
|
||||
`masakariclient.sdk.ha.v1.segment.Segment`,
|
||||
comprised of the propoerties on the Segment class.
|
||||
:returns: The result of segment creation
|
||||
:rtype: :class: `masakariclient.sdk.vmha.v1.segment.Segment`
|
||||
:rtype: :class: `masakariclient.sdk.ha.v1.segment.Segment`
|
||||
"""
|
||||
return self._create(_segment.Segment, **attrs)
|
||||
|
||||
|
@ -102,13 +102,13 @@ class Proxy(proxy2.BaseProxy):
|
|||
|
||||
:param segment: The value can be the ID of a segment or a
|
||||
:class:
|
||||
`~masakariclient.sdk.vmha.v1.segment.Segment` instance.
|
||||
`~masakariclient.sdk.ha.v1.segment.Segment` instance.
|
||||
:param dict attrs: Keyword arguments which will be used to update
|
||||
a :class:
|
||||
`masakariclient.sdk.vmha.v1.segment.Segment`,
|
||||
`masakariclient.sdk.ha.v1.segment.Segment`,
|
||||
comprised of the propoerties on the Segment class.
|
||||
:returns: The updated segment.
|
||||
:rtype: :class: `masakariclient.sdk.vmha.v1.segment.Segment`
|
||||
:rtype: :class: `masakariclient.sdk.ha.v1.segment.Segment`
|
||||
"""
|
||||
return self._update(_segment.Segment, segment, **attrs)
|
||||
|
||||
|
@ -117,7 +117,7 @@ class Proxy(proxy2.BaseProxy):
|
|||
|
||||
:param segment:
|
||||
The value can be either the ID of a segment or a
|
||||
:class:`~masakariclient.sdk.vmha.v1.segment.Segment` instance.
|
||||
:class:`~masakariclient.sdk.ha.v1.segment.Segment` instance.
|
||||
:param bool ignore_missing: When set to ``False``
|
||||
:class:`~openstack.exceptions.ResourceNotFound` will be
|
||||
raised when the segment does not exist.
|
||||
|
@ -145,7 +145,7 @@ class Proxy(proxy2.BaseProxy):
|
|||
|
||||
:param segment_id: The ID of a failover segment.
|
||||
:param dict attrs: Keyword arguments which will be used to create
|
||||
a :class: `masakariclient.sdk.vmha.v1.host.Host`,
|
||||
a :class: `masakariclient.sdk.ha.v1.host.Host`,
|
||||
comprised of the propoerties on the Host class.
|
||||
|
||||
:returns: The results of host creation
|
||||
|
@ -157,9 +157,9 @@ class Proxy(proxy2.BaseProxy):
|
|||
|
||||
:param segment_id: The ID of a failover segment.
|
||||
:param host: The value can be the ID of a host or a :class:
|
||||
`~masakariclient.sdk.vmha.v1.host.Host` instance.
|
||||
`~masakariclient.sdk.ha.v1.host.Host` instance.
|
||||
|
||||
:returns: One :class:`~masakariclient.sdk.vmha.v1.host.Host`
|
||||
:returns: One :class:`~masakariclient.sdk.ha.v1.host.Host`
|
||||
:raises: :class:`~openstack.exceptions.ResourceNotFound`
|
||||
when no resource can be found.
|
||||
"""
|
||||
|
@ -171,7 +171,7 @@ class Proxy(proxy2.BaseProxy):
|
|||
|
||||
:param segment_id: The ID of a failover segment.
|
||||
:param host: The value can be the ID of a host or a :class:
|
||||
`~masakariclient.sdk.vmha.v1.host.Host` instance.
|
||||
`~masakariclient.sdk.ha.v1.host.Host` instance.
|
||||
:param dict attrs: The attributes to update on the host represented.
|
||||
|
||||
:returns: The updated host
|
||||
|
@ -185,7 +185,7 @@ class Proxy(proxy2.BaseProxy):
|
|||
|
||||
:param segment_id: The ID of a failover segment.
|
||||
:param host: The value can be the ID of a host or a :class:
|
||||
`~masakariclient.sdk.vmha.v1.host.Host` instance.
|
||||
`~masakariclient.sdk.ha.v1.host.Host` instance.
|
||||
:param bool ignore_missing: When set to ``False``
|
||||
:class:`~openstack.exceptions.ResourceNotFound` will be
|
||||
raised when the host does not exist.
|
|
@ -14,14 +14,14 @@
|
|||
|
||||
from openstack import resource2
|
||||
|
||||
from masakariclient.sdk.vmha import vmha_service
|
||||
from masakariclient.sdk.ha import ha_service
|
||||
|
||||
|
||||
class Host(resource2.Resource):
|
||||
resource_key = "host"
|
||||
resources_key = "hosts"
|
||||
base_path = "/segments/%(segment_id)s/hosts"
|
||||
service = vmha_service.VMHAService()
|
||||
service = ha_service.HAService()
|
||||
|
||||
# capabilities
|
||||
# 1] GET /v1/segments/<segment_uuid>/hosts
|
|
@ -14,14 +14,14 @@
|
|||
|
||||
from openstack import resource2
|
||||
|
||||
from masakariclient.sdk.vmha import vmha_service
|
||||
from masakariclient.sdk.ha import ha_service
|
||||
|
||||
|
||||
class Notification(resource2.Resource):
|
||||
resource_key = "notification"
|
||||
resources_key = "notifications"
|
||||
base_path = "/notifications"
|
||||
service = vmha_service.VMHAService()
|
||||
service = ha_service.HAService()
|
||||
|
||||
# capabilities
|
||||
# 1] GET /v1/notifications
|
|
@ -14,14 +14,14 @@
|
|||
|
||||
from openstack import resource2
|
||||
|
||||
from masakariclient.sdk.vmha import vmha_service
|
||||
from masakariclient.sdk.ha import ha_service
|
||||
|
||||
|
||||
class Segment(resource2.Resource):
|
||||
resource_key = "segment"
|
||||
resources_key = "segments"
|
||||
base_path = "/segments"
|
||||
service = vmha_service.VMHAService()
|
||||
service = ha_service.HAService()
|
||||
|
||||
# capabilities
|
||||
# 1] GET /v1/segments
|
|
@ -12,7 +12,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from masakariclient.sdk.vmha import connection
|
||||
from masakariclient.sdk.ha import connection
|
||||
|
||||
|
||||
class Client(object):
|
||||
|
@ -20,4 +20,4 @@ class Client(object):
|
|||
def __init__(self, prof=None, user_agent=None, **kwargs):
|
||||
self.con = connection.create_connection(
|
||||
prof=prof, user_agent=user_agent, **kwargs)
|
||||
self.service = self.con.vmha
|
||||
self.service = self.con.ha
|
||||
|
|
|
@ -28,9 +28,9 @@ console_scripts =
|
|||
masakari = masakariclient.shell:main
|
||||
|
||||
openstack.cli.extension =
|
||||
vmha = masakariclient.plugin
|
||||
ha = masakariclient.plugin
|
||||
|
||||
openstack.vmha.v1 =
|
||||
openstack.ha.v1 =
|
||||
notification_create = masakariclient.osc.v1.notification:CreateNotification
|
||||
notification_show = masakariclient.osc.v1.notification:ShowNotification
|
||||
notification_list = masakariclient.osc.v1.notification:ListNotification
|
||||
|
|
Loading…
Reference in New Issue