add target_systems of kolla

this bug will cause we can't find roles
when we establish cluster

Change-Id: Ibcd11034767905df9bf261b6c72cd1ce54953f11
This commit is contained in:
Zhou Ya 2016-11-26 18:10:22 +08:00 committed by Zhijiang Hu
parent a4b45e9cb7
commit 689833f2d5
4 changed files with 90 additions and 2 deletions

View File

@ -0,0 +1,74 @@
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import copy
import six
from daisyclient.common import utils
from daisyclient.openstack.common.apiclient import base
BACKEND_TYPES_PARAMS = ()
OS_REQ_ID_HDR = 'x-openstack-request-id'
class BackendTypes(base.Resource):
def __repr__(self):
return "<BackendTypes %s>" % self._info
def update(self, **fields):
self.manager.update(self, **fields)
def delete(self, **kwargs):
return self.manager.delete(self)
def data(self, **kwargs):
return self.manager.data(self, **kwargs)
class BackendTypesManager(base.ManagerWithFind):
resource_class = BackendTypes
def _get_meta_to_headers(self, fields):
headers = {}
fields_copy = copy.deepcopy(fields)
# NOTE(flaper87): Convert to str, headers
# that are not instance of basestring. All
# headers will be encoded later, before the
# request is sent.
for key, value in six.iteritems(fields_copy):
headers['%s' % key] = utils.to_str(value)
return headers
def list(self, **kwargs):
pass
def get(self, **kwargs):
"""
get backend types
"""
fields = {}
for field in kwargs:
if field in BACKEND_TYPES_PARAMS:
fields[field] = kwargs[field]
else:
msg = 'get() got an unexpected keyword argument \'%s\''
raise TypeError(msg % field)
url = '/v1/backend_types'
hdrs = self._get_meta_to_headers(fields)
resp, body = self.client.post(url, headers=None, data=hdrs)
return BackendTypes(self, body)

View File

@ -33,6 +33,7 @@ from daisyclient.v1.update import UpdateManager
from daisyclient.v1.disk_array import DiskArrayManager
from daisyclient.v1.template import TemplateManager
from daisyclient.v1.backup_restore import BackupRestoreManager
from daisyclient.v1.backend_types import BackendTypesManager
class Client(object):
@ -68,3 +69,4 @@ class Client(object):
self.disk_array = DiskArrayManager(self.http_client)
self.template = TemplateManager(self.http_client)
self.backup_restore = BackupRestoreManager(self.http_client)
self.backend_types = BackendTypesManager(self.http_client)

View File

@ -28,7 +28,8 @@ UPDATE_PARAMS = (
'dns_nameservers', 'net_l23_provider', 'base_mac', 'internal_gateway',
'internal_cidr', 'external_cidr', 'gre_id_range', 'vlan_range',
'vni_range', 'segmentation_type', 'public_vip', 'logic_networks',
'networking_parameters', 'routers', 'auto_scale', 'use_dns'
'networking_parameters', 'routers', 'auto_scale', 'use_dns',
'target_systems'
)
CREATE_PARAMS = (
@ -36,7 +37,8 @@ CREATE_PARAMS = (
'dns_nameservers', 'net_l23_provider', 'base_mac', 'internal_gateway',
'internal_cidr', 'external_cidr', 'gre_id_range', 'vlan_range',
'vni_range', 'segmentation_type', 'public_vip', 'logic_networks',
'networking_parameters', 'routers', 'auto_scale', 'use_dns'
'networking_parameters', 'routers', 'auto_scale', 'use_dns',
'target_systems'
)
DEFAULT_PAGE_SIZE = 20

View File

@ -2365,3 +2365,13 @@ def do_version(dc, args):
fields = dict(filter(lambda x: x[0] in VERSION_PARAMS, fields.items()))
version = dc.backup_restore.version(**fields)
_daisy_show(version)
def do_backend_types_get(dc, args):
"""Get backend_types of daisy."""
fields = dict(filter(lambda x: x[1] is not None, vars(args).items()))
BACKEND_TYPES_PARAMS = daisyclient.v1.backend_types.BACKEND_TYPES_PARAMS
fields = dict(filter(lambda x: x[0] in BACKEND_TYPES_PARAMS,
fields.items()))
backend_types_get = dc.backend_types.get(**fields)
_daisy_show(backend_types_get)