Merge "deal with flake8 errors in core code"
This commit is contained in:
commit
e47d63d508
@ -135,7 +135,7 @@ def file_2_list(f, cluster_list):
|
||||
cluster_ids = f.readlines()
|
||||
for cluster_id in cluster_ids:
|
||||
cluster_list.append(cluster_id.strip("\n"))
|
||||
|
||||
|
||||
|
||||
def cluster_list_add(cluster_id):
|
||||
cluster_list = []
|
||||
@ -726,7 +726,7 @@ def update_db_host_status(req, host_id, host_status, version_id=None,
|
||||
host_meta['os_status'] = host_status['os_status']
|
||||
if host_status.get('messages', None):
|
||||
host_meta['messages'] = host_status['messages']
|
||||
if host_status.has_key('tecs_version_id'):
|
||||
if host_status.get('tecs_version_id', None):
|
||||
host_meta['tecs_version_id'] = host_status['tecs_version_id']
|
||||
if version_id:
|
||||
host_meta['os_version_id'] = version_id
|
||||
@ -804,9 +804,9 @@ def get_management_ip(host_detail, is_throw_exception=True):
|
||||
if ('assigned_networks' in interface and
|
||||
interface['assigned_networks']):
|
||||
for as_network in interface['assigned_networks']:
|
||||
if ((as_network.get('name', '') == 'MANAGEMENT'
|
||||
or as_network.get('network_type', '') == 'MANAGEMENT')
|
||||
and 'ip' in as_network):
|
||||
if ((as_network.get('name', '') == 'MANAGEMENT' or
|
||||
as_network.get('network_type', '') == 'MANAGEMENT') and
|
||||
'ip' in as_network):
|
||||
host_management_ip = as_network['ip']
|
||||
|
||||
if not host_management_ip and is_throw_exception:
|
||||
@ -913,12 +913,12 @@ def add_ssh_host_to_cluster_and_assigned_network(req, cluster_id, host_id):
|
||||
father_vlan_list = []
|
||||
discover_successful = 0
|
||||
host_info = get_host_detail(req, host_id)
|
||||
host_status = host_info.get('status',None)
|
||||
host_status = host_info.get('status', None)
|
||||
if host_status != 'init':
|
||||
interfac_meta_list=host_info.get('interfaces',None)
|
||||
interfac_meta_list = host_info.get('interfaces', None)
|
||||
for interface_info in interfac_meta_list:
|
||||
assigned_networks = interface_info.get\
|
||||
('assigned_networks', None)
|
||||
assigned_networks = \
|
||||
interface_info.get('assigned_networks', None)
|
||||
if assigned_networks:
|
||||
discover_successful = 1
|
||||
if not discover_successful:
|
||||
@ -928,10 +928,15 @@ def add_ssh_host_to_cluster_and_assigned_network(req, cluster_id, host_id):
|
||||
params = {'filters': {'cluster_id': cluster_id}}
|
||||
networks = registry.get_networks_detail(req.context,
|
||||
cluster_id, **params)
|
||||
father_vlan_list=check_vlan_nic_and_join_vlan_network\
|
||||
(req, cluster_id, host_list, networks)
|
||||
check_bond_or_ether_nic_and_join_network\
|
||||
(req, cluster_id, host_list, networks, father_vlan_list)
|
||||
father_vlan_list = check_vlan_nic_and_join_vlan_network(req,
|
||||
cluster_id,
|
||||
host_list,
|
||||
networks)
|
||||
check_bond_or_ether_nic_and_join_network(req,
|
||||
cluster_id,
|
||||
host_list,
|
||||
networks,
|
||||
father_vlan_list)
|
||||
|
||||
|
||||
def check_vlan_nic_and_join_vlan_network(req, cluster_id,
|
||||
@ -939,10 +944,10 @@ def check_vlan_nic_and_join_vlan_network(req, cluster_id,
|
||||
father_vlan_list = []
|
||||
for host_id in host_list:
|
||||
host_meta_detail = get_host_detail(req, host_id)
|
||||
if host_meta_detail.has_key('interfaces'):
|
||||
interfac_list = host_meta_detail.get('interfaces',None)
|
||||
if host_meta_detail.get('interfaces', None):
|
||||
interfac_list = host_meta_detail.get('interfaces', None)
|
||||
for interface_info in interfac_list:
|
||||
host_ip = interface_info.get('ip',None)
|
||||
host_ip = interface_info.get('ip', None)
|
||||
if interface_info['type'] == 'vlan' and host_ip:
|
||||
check_ip_if_valid = \
|
||||
_checker_the_ip_or_hostname_valid(host_ip)
|
||||
@ -1002,15 +1007,19 @@ def _checker_the_ip_or_hostname_valid(ip_str):
|
||||
return False
|
||||
|
||||
|
||||
def check_bond_or_ether_nic_and_join_network(req, cluster_id, host_list, networks, father_vlan_list):
|
||||
def check_bond_or_ether_nic_and_join_network(req,
|
||||
cluster_id,
|
||||
host_list,
|
||||
networks,
|
||||
father_vlan_list):
|
||||
for host_id in host_list:
|
||||
host_info = get_host_detail(req, host_id)
|
||||
if host_info.has_key('interfaces'):
|
||||
if host_info.get('interfaces', None):
|
||||
update_host_interface = 0
|
||||
interfac_meta_list = host_info.get('interfaces',None)
|
||||
interfac_meta_list = host_info.get('interfaces', None)
|
||||
for interface_info in interfac_meta_list:
|
||||
update_flag = 0
|
||||
host_info_ip = interface_info.get('ip',None)
|
||||
host_info_ip = interface_info.get('ip', None)
|
||||
if interface_info['type'] != 'vlan':
|
||||
nic_name = interface_info['name']
|
||||
for nic in father_vlan_list:
|
||||
@ -1034,8 +1043,9 @@ def check_bond_or_ether_nic_and_join_network(req, cluster_id, host_list, network
|
||||
'EXTERNAL']:
|
||||
continue
|
||||
if network.get('cidr', None):
|
||||
ip_in_cidr = utils.is_ip_in_cidr\
|
||||
(host_info_ip, network['cidr'])
|
||||
ip_in_cidr = utils.is_ip_in_cidr(
|
||||
host_info_ip,
|
||||
network['cidr'])
|
||||
if ip_in_cidr:
|
||||
vlan_id = network['vlan_id']
|
||||
if not vlan_id:
|
||||
@ -1066,15 +1076,15 @@ def check_bond_or_ether_nic_and_join_network(req, cluster_id, host_list, network
|
||||
raise HTTPForbidden(explanation=msg)
|
||||
|
||||
if update_host_interface:
|
||||
host_meta={}
|
||||
host_meta = {}
|
||||
host_meta['cluster'] = cluster_id
|
||||
host_meta['interfaces'] = str(interfac_meta_list)
|
||||
host_meta = registry.update_host_metadata(req.context,
|
||||
host_id,
|
||||
host_meta)
|
||||
host_id,
|
||||
host_meta)
|
||||
LOG.info("add the host %s join the cluster %s and"
|
||||
" assigned_network successful" %
|
||||
(host_id, cluster_id))
|
||||
" assigned_network successful" %
|
||||
(host_id, cluster_id))
|
||||
|
||||
|
||||
def build_pxe_server(eth_name, ip_address, build_pxe, net_mask,
|
||||
|
@ -292,7 +292,6 @@ def _rm_ipmi_failed_host(req, install_hosts):
|
||||
return install_hosts
|
||||
|
||||
|
||||
|
||||
def get_host_location_of_cisco(host_detail):
|
||||
LOG.info(_("Get location for host %s" % host_detail['id']))
|
||||
try:
|
||||
@ -340,7 +339,8 @@ def set_reboot_of_cisco(host_detail):
|
||||
'sshpass -p%s ssh -o StrictHostKeyChecking=no '
|
||||
'%s@10.10.100.254 "scope service-profile server %s;'
|
||||
'reboot;commit-buffer"' % (host_detail.get('ipmi_passwd'),
|
||||
host_detail.get('ipmi_user'), host_detail.get('location')),
|
||||
host_detail.get('ipmi_user'),
|
||||
host_detail.get('location')),
|
||||
shell=True, stderr=subprocess.STDOUT)
|
||||
except subprocess.CalledProcessError as e:
|
||||
LOG.info(_("restart for %s failed!" % host_detail['id']))
|
||||
@ -414,14 +414,14 @@ class OSInstall():
|
||||
"%s times by ironic" % (
|
||||
addr, action, count + 1)}
|
||||
daisy_cmn.update_db_host_status(self.req, host_detail['id'],
|
||||
host_status)
|
||||
host_status)
|
||||
# make user know set successfull
|
||||
time.sleep(1)
|
||||
host_status = {
|
||||
'messages': 'Preparing for OS installation',
|
||||
'os_progress': 0}
|
||||
daisy_cmn.update_db_host_status(self.req, host_detail['id'],
|
||||
host_status)
|
||||
host_status)
|
||||
|
||||
# One host set 'disk' return success, but it still 'pxe'
|
||||
# mode in German site. If we have a method to confirm,
|
||||
@ -439,7 +439,7 @@ class OSInstall():
|
||||
"%s times by ironic" % (
|
||||
addr, action, count + 1)}
|
||||
daisy_cmn.update_db_host_status(self.req, host_detail['id'],
|
||||
host_status)
|
||||
host_status)
|
||||
time.sleep(count * 2)
|
||||
if count >= repeat_times:
|
||||
ipmi_result_flag = False
|
||||
@ -458,7 +458,7 @@ class OSInstall():
|
||||
"controller host,can't go on playing" % (
|
||||
addr, action)}
|
||||
daisy_cmn.update_db_host_status(self.req, host_detail['id'],
|
||||
host_status)
|
||||
host_status)
|
||||
message = "set %s to '%s' failed for 10 mins,is controller" \
|
||||
" host,can't go on playing" % (addr, action)
|
||||
raise exception.IMPIOprationFailed(message=message)
|
||||
@ -473,7 +473,7 @@ class OSInstall():
|
||||
"controller host or no role ,go on playing"
|
||||
% (addr, action)}
|
||||
daisy_cmn.update_db_host_status(self.req, host_detail['id'],
|
||||
host_status)
|
||||
host_status)
|
||||
|
||||
return ipmi_result_flag
|
||||
|
||||
@ -483,8 +483,9 @@ class OSInstall():
|
||||
if host_detail.get('os_version_file', None):
|
||||
os_version_file = host_detail['os_version_file']
|
||||
if host_detail.get('os_version_id', None):
|
||||
version_info = registry.get_version_metadata(self.req.context,
|
||||
host_detail['os_version_id'])
|
||||
version_info = registry.get_version_metadata(
|
||||
self.req.context,
|
||||
host_detail['os_version_id'])
|
||||
if version_info:
|
||||
os_version = version_info['name']
|
||||
os_version_file = "/var/lib/daisy/" + os_version
|
||||
@ -571,8 +572,9 @@ class OSInstall():
|
||||
if (not host_detail['ipmi_user'] or
|
||||
not host_detail['ipmi_passwd'] or
|
||||
not host_detail['ipmi_addr']):
|
||||
self.message = "Invalid ipmi information configed for host %s" \
|
||||
% host_detail['id']
|
||||
self.message = \
|
||||
"Invalid ipmi information configed for host %s" \
|
||||
% host_detail['id']
|
||||
raise exception.NotFound(message=self.message)
|
||||
|
||||
ipmi_result_flag = self._set_boot_or_power_state(host_detail,
|
||||
@ -638,7 +640,8 @@ class OSInstall():
|
||||
host_status = {'os_status': host_os_status['INSTALL_FAILED'],
|
||||
'os_progress': 0,
|
||||
'messages': error}
|
||||
daisy_cmn.update_db_host_status(self.req, host_detail['id'], host_status)
|
||||
daisy_cmn.update_db_host_status(self.req, host_detail['id'],
|
||||
host_status)
|
||||
msg = "ironic install os return failed for host %s" % \
|
||||
host_detail['id']
|
||||
raise exception.OSInstallFailed(message=msg)
|
||||
@ -839,8 +842,8 @@ class OSInstall():
|
||||
total_time_cost = str(
|
||||
round((time.time() - daisy_cmn.os_install_start_time) / 60, 2))
|
||||
if daisy_cmn.in_cluster_list(self.cluster_id):
|
||||
daisy_cmn.cluster_list_delete(self.cluster_id)
|
||||
LOG.info("Clear install global variables")
|
||||
daisy_cmn.cluster_list_delete(self.cluster_id)
|
||||
LOG.info("Clear install global variables")
|
||||
LOG.info(
|
||||
_("It totally takes %s min for all host to install os"
|
||||
% total_time_cost))
|
||||
|
2
code/daisy/daisy/api/v1/backend_types.py
Executable file → Normal file
2
code/daisy/daisy/api/v1/backend_types.py
Executable file → Normal file
@ -75,7 +75,7 @@ class Controller(controller.BaseController):
|
||||
msg = "/home/daisy_intall/daisy.conf is not exist"
|
||||
LOG.error(msg)
|
||||
raise HTTPForbidden(explanation=msg, request=req,
|
||||
content_type="text/plain")
|
||||
content_type="text/plain")
|
||||
|
||||
|
||||
class BackendTypesDeserializer(wsgi.JSONRequestDeserializer):
|
||||
|
@ -494,7 +494,7 @@ class BaseController(object):
|
||||
|
||||
def get_template_service_meta_or_404(self, request, template_service_id):
|
||||
"""
|
||||
Grabs the template_service metadata for
|
||||
Grabs the template_service metadata for
|
||||
an template_service with a supplied
|
||||
identifier or raises an HTTPNotFound (404) response
|
||||
|
||||
|
@ -529,7 +529,7 @@ class Controller(controller.BaseController):
|
||||
interface_match_flag += 1
|
||||
host_template_interface['mac'] =\
|
||||
orig_host_interface['mac']
|
||||
if host_template_interface.has_key('ip') and\
|
||||
if host_template_interface.get('ip', None) and\
|
||||
ssh_host_flag:
|
||||
host_template_interface['ip'] =\
|
||||
orig_host_interface['ip']
|
||||
@ -552,8 +552,8 @@ class Controller(controller.BaseController):
|
||||
interface_key, None) and ssh_host_flag:
|
||||
host_template_interface[interface_key]\
|
||||
= orig_host_interface[interface_key]
|
||||
if host_template_interface.has_key('ip')\
|
||||
and not ssh_host_flag:
|
||||
if host_template_interface.get(
|
||||
'ip', None) and not ssh_host_flag:
|
||||
host_template_interface.pop('ip')
|
||||
if orig_host_interface.get('assigned_networks',
|
||||
None) and ssh_host_flag:
|
||||
|
@ -999,11 +999,11 @@ class Controller(controller.BaseController):
|
||||
if host_meta.get('os_version', None) and utils.is_uuid_like(
|
||||
host_meta['os_version']):
|
||||
os_version = host_meta['os_version']
|
||||
if not host_meta.get('os_version', None) and orig_host_meta[
|
||||
'os_version_file']:
|
||||
if not host_meta.get('os_version', None) and \
|
||||
orig_host_meta['os_version_file']:
|
||||
os_version = orig_host_meta['os_version_file']
|
||||
if not host_meta.get('os_version', None) and orig_host_meta[
|
||||
'os_version_id']:
|
||||
if not host_meta.get('os_version', None) and \
|
||||
orig_host_meta['os_version_id']:
|
||||
os_version = orig_host_meta['os_version_id']
|
||||
return os_version
|
||||
|
||||
@ -1034,7 +1034,8 @@ class Controller(controller.BaseController):
|
||||
return os_version_type
|
||||
# else:
|
||||
# params = {}
|
||||
# version_list = registry.list_version_metadata(req.context, **params)
|
||||
# version_list = registry.list_version_metadata(req.context,
|
||||
# **params)
|
||||
# for version in version_list:
|
||||
# if version['name'] == os_version.split("/")[-1]:
|
||||
# return version['type']
|
||||
@ -1060,7 +1061,7 @@ class Controller(controller.BaseController):
|
||||
version_list = registry.list_version_metadata(req.context, **params)
|
||||
if utils.is_uuid_like(os_version):
|
||||
version_id_list = [version['id'] for version in version_list]
|
||||
if not os_version in version_id_list:
|
||||
if os_version not in version_id_list:
|
||||
msg = _("os version %s does not exist") % os_version
|
||||
raise HTTPForbidden(explanation=msg)
|
||||
# else:
|
||||
@ -1369,8 +1370,8 @@ class Controller(controller.BaseController):
|
||||
find("mpath") != -1 \
|
||||
or orig_host_meta['disks'][key]['name'].\
|
||||
find("spath") != -1 \
|
||||
or orig_host_meta['disks'][key]['removable'] \
|
||||
== 'removable':
|
||||
or orig_host_meta['disks'][key]['removable'] == \
|
||||
'removable':
|
||||
continue
|
||||
stroage_size_str = orig_host_meta['disks'][key]['size']
|
||||
stroage_size_b_int = int(
|
||||
@ -1746,8 +1747,9 @@ class Controller(controller.BaseController):
|
||||
"when os status is active if "
|
||||
"you don't want to install os") % host_meta['name']
|
||||
raise HTTPForbidden(explanation=msg)
|
||||
if host_meta.get('group_list', None) and host_meta[
|
||||
'group_list'] != orig_host_meta['group_list']:
|
||||
if host_meta.get('group_list', None) and \
|
||||
host_meta['group_list'] != \
|
||||
orig_host_meta['group_list']:
|
||||
msg = _("Forbidden to update group list of %s "
|
||||
"when os status is active if "
|
||||
"you don't want to install os") % host_meta['name']
|
||||
@ -1865,8 +1867,9 @@ class Controller(controller.BaseController):
|
||||
params = {'filters': {'cluster_id': cluster_id}}
|
||||
networks = registry.get_networks_detail(req.context,
|
||||
cluster_id, **params)
|
||||
father_vlan_list = daisy_cmn.check_vlan_nic_and_join_vlan_network(
|
||||
req, cluster_id, host_list, networks)
|
||||
father_vlan_list = \
|
||||
daisy_cmn.check_vlan_nic_and_join_vlan_network(
|
||||
req, cluster_id, host_list, networks)
|
||||
daisy_cmn.check_bond_or_ether_nic_and_join_network(
|
||||
req, cluster_id, host_list, networks, father_vlan_list)
|
||||
|
||||
@ -1900,7 +1903,8 @@ class Controller(controller.BaseController):
|
||||
with open(var_log_path, "w+") as fp:
|
||||
for backend in backends:
|
||||
backend_driver = driver.load_deployment_dirver(backend)
|
||||
backend_driver.prepare_ssh_discovered_node(req, fp, discover_host_meta)
|
||||
backend_driver.prepare_ssh_discovered_node(req, fp,
|
||||
discover_host_meta)
|
||||
try:
|
||||
exc_result = subprocess.check_output(
|
||||
'clush -S -w %s /home/daisy/discover_host/getnodeinfo.sh'
|
||||
@ -2444,7 +2448,7 @@ class Controller(controller.BaseController):
|
||||
if not i.values()[0]:
|
||||
ipmi_check_result['ipmi_check_result'] = \
|
||||
"No %s configed for host %s, please " \
|
||||
"check" % (i.keys()[0],orig_host_meta['name'])
|
||||
"check" % (i.keys()[0], orig_host_meta['name'])
|
||||
return {'check_result': ipmi_check_result}
|
||||
cmd = 'ipmitool -I lanplus -H %s -U %s -P %s chassis ' \
|
||||
'power status' % (ipmi_ip, ipmi_user, ipmi_password)
|
||||
|
@ -20,11 +20,8 @@
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from webob.exc import HTTPBadRequest
|
||||
from webob.exc import HTTPConflict
|
||||
from webob.exc import HTTPForbidden
|
||||
from webob.exc import HTTPNotFound
|
||||
from webob import Response
|
||||
import copy
|
||||
import json
|
||||
|
||||
from daisy.api import policy
|
||||
@ -170,7 +167,6 @@ class Controller(controller.BaseController):
|
||||
cluster_id
|
||||
raise HTTPNotFound(msg)
|
||||
|
||||
|
||||
@utils.mutating
|
||||
def get_template_config(self, req, id):
|
||||
"""
|
||||
@ -180,7 +176,8 @@ class Controller(controller.BaseController):
|
||||
:param req: The WSGI/Webob Request object
|
||||
:param id: The opaque template_config identifier
|
||||
|
||||
:raises HTTPNotFound if template_config metadata is not available to user
|
||||
:raises HTTPNotFound if template_config metadata is not
|
||||
available to user
|
||||
"""
|
||||
self._enforce(req, 'get_template_config')
|
||||
template_config_meta = self.get_template_config_meta_or_404(req, id)
|
||||
|
@ -20,11 +20,7 @@
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from webob.exc import HTTPBadRequest
|
||||
from webob.exc import HTTPConflict
|
||||
from webob.exc import HTTPForbidden
|
||||
from webob.exc import HTTPNotFound
|
||||
from webob import Response
|
||||
import copy
|
||||
import json
|
||||
|
||||
from daisy.api import policy
|
||||
@ -153,7 +149,7 @@ class Controller(controller.BaseController):
|
||||
|
||||
if template_func_meta.get('cluster_id'):
|
||||
params['filters'].update({'cluster_id':
|
||||
template_func_meta['cluster_id']})
|
||||
template_func_meta['cluster_id']})
|
||||
template_func_meta = self.get_template_func_meta_or_404(req, id,
|
||||
**params)
|
||||
return {'template_func_meta': template_func_meta}
|
||||
|
@ -20,12 +20,7 @@
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from webob.exc import HTTPBadRequest
|
||||
from webob.exc import HTTPConflict
|
||||
from webob.exc import HTTPForbidden
|
||||
from webob.exc import HTTPNotFound
|
||||
from webob import Response
|
||||
import copy
|
||||
import json
|
||||
|
||||
from daisy.api import policy
|
||||
import daisy.api.v1
|
||||
@ -125,7 +120,6 @@ class Controller(controller.BaseController):
|
||||
params[PARAM] = req.params.get(PARAM)
|
||||
return params
|
||||
|
||||
|
||||
@utils.mutating
|
||||
def get_template_service(self, req, id):
|
||||
"""
|
||||
@ -135,7 +129,8 @@ class Controller(controller.BaseController):
|
||||
:param req: The WSGI/Webob Request object
|
||||
:param id: The opaque template_service identifier
|
||||
|
||||
:raises HTTPNotFound if template_service metadata is not available to user
|
||||
:raises HTTPNotFound if template_service metadata is not
|
||||
available to user
|
||||
"""
|
||||
self._enforce(req, 'get_template_service')
|
||||
template_service_meta = self.get_template_service_meta_or_404(req, id)
|
||||
|
2
code/daisy/daisy/common/utils.py
Executable file → Normal file
2
code/daisy/daisy/common/utils.py
Executable file → Normal file
@ -47,7 +47,6 @@ from oslo_utils import netutils
|
||||
from oslo_utils import strutils
|
||||
import six
|
||||
from webob import exc
|
||||
import ConfigParser
|
||||
|
||||
from daisy.common import exception
|
||||
from daisy import i18n
|
||||
@ -1203,4 +1202,3 @@ def get_numa_node_from_cpus(numa, str_cpus):
|
||||
numa_nodes = list(set(numa_nodes))
|
||||
numa_nodes.sort()
|
||||
return numa_nodes
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
from sqlalchemy import MetaData, Table, Column
|
||||
from daisy.db.sqlalchemy.migrate_repo.schema import Text
|
||||
|
||||
|
||||
group_list = Column('group_list', Text())
|
||||
|
||||
|
||||
@ -25,4 +25,3 @@ def upgrade(migrate_engine):
|
||||
|
||||
hosts = Table('hosts', meta, autoload=True)
|
||||
hosts.create_column(group_list)
|
||||
|
||||
|
@ -27,4 +27,3 @@ def upgrade(migrate_engine):
|
||||
cinder_volumes = Table('cinder_volumes', meta, autoload=True)
|
||||
cinder_volumes.create_column(root_pwd)
|
||||
cinder_volumes.create_column(resource_pools)
|
||||
|
||||
|
@ -49,4 +49,3 @@ def upgrade(migrate_engine):
|
||||
meta.bind = migrate_engine
|
||||
tables = [define_optical_switchs_table(meta), ]
|
||||
create_tables(tables)
|
||||
|
||||
|
@ -4,9 +4,9 @@ meta = MetaData()
|
||||
outband_vip = Column('outband_vip', String(255))
|
||||
provider_public_vip = Column('provider_public_vip', String(255))
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
meta.bind = migrate_engine
|
||||
role = Table('roles', meta, autoload=True)
|
||||
role.create_column(outband_vip)
|
||||
role.create_column(provider_public_vip)
|
||||
|
||||
|
@ -8,4 +8,3 @@ def upgrade(migrate_engine):
|
||||
meta.bind = migrate_engine
|
||||
clusters = Table('clusters', meta, autoload=True)
|
||||
clusters.create_column(use_provider_ha)
|
||||
|
||||
|
@ -8,4 +8,3 @@ def upgrade(migrate_engine):
|
||||
meta.bind = migrate_engine
|
||||
networks = Table('networks', meta, autoload=True)
|
||||
networks.create_column(custom_name)
|
||||
|
||||
|
3
code/daisy/daisy/orchestration/manager.py
Executable file → Normal file
3
code/daisy/daisy/orchestration/manager.py
Executable file → Normal file
@ -19,12 +19,9 @@
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from webob.exc import HTTPNotFound
|
||||
|
||||
from daisy.common import exception
|
||||
from daisy.common import utils
|
||||
from daisyclient.v1.client import Client
|
||||
import ConfigParser
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
CONF = cfg.CONF
|
||||
|
@ -323,8 +323,11 @@ class Controller(object):
|
||||
req.context, id)
|
||||
config = []
|
||||
for config_item in config_items:
|
||||
config_inf = self.db_api.config_get(req.context, config_item['config_id'])
|
||||
config_file = self.db_api.config_file_get(req.context, config_inf['config_file_id'])
|
||||
config_inf = self.db_api.config_get(req.context,
|
||||
config_item['config_id'])
|
||||
config_file = self.db_api.config_file_get(
|
||||
req.context,
|
||||
config_inf['config_file_id'])
|
||||
if config_file:
|
||||
config_inf['config_file_name'] = config_file['name']
|
||||
config.append(config_inf)
|
||||
|
@ -582,7 +582,7 @@ class Controller(object):
|
||||
"""Get cinder_volumes, wrapping in exception if necessary."""
|
||||
try:
|
||||
return self.db_api.optical_switch_list(context, filters=filters,
|
||||
**params)
|
||||
**params)
|
||||
except exception.NotFound:
|
||||
LOG.warn(_LW("Invalid marker. optical switch %(id)s "
|
||||
"could not be found.") %
|
||||
|
@ -232,19 +232,23 @@ class Controller(object):
|
||||
:param req: wsgi Request object
|
||||
:param body: Dictionary of information about the template config
|
||||
|
||||
:retval Returns the newly-created template function information as a mapping,
|
||||
which will include the newly-created template function's internal id
|
||||
:retval Returns the newly-created template function
|
||||
information as a mapping,
|
||||
which will include the newly-created template
|
||||
function's internal id
|
||||
in the 'id' field
|
||||
"""
|
||||
|
||||
template_config_data = body["template_config_metadata"]
|
||||
|
||||
try:
|
||||
template_config_data = self.db_api.template_config_import(req.context, template_config_data)
|
||||
template_config_data = self.db_api.template_config_import(
|
||||
req.context, template_config_data)
|
||||
msg = (_LI("Successfully import template function %s") %
|
||||
template_config_data)
|
||||
LOG.info(msg)
|
||||
template_config_data = dict(template_config_metadata=template_config_data)
|
||||
template_config_data = dict(
|
||||
template_config_metadata=template_config_data)
|
||||
return template_config_data
|
||||
except exception.Duplicate:
|
||||
msg = (_("template function with identifier %s already exists!") %
|
||||
@ -296,18 +300,22 @@ class Controller(object):
|
||||
LOG.info(msg)
|
||||
return exc.HTTPNotFound()
|
||||
except Exception:
|
||||
LOG.exception(_LE("Unable to delete template_config_id %s") % template_config_id)
|
||||
LOG.exception(_LE("Unable to delete template_config_id %s")
|
||||
% template_config_id)
|
||||
raise
|
||||
|
||||
@utils.mutating
|
||||
def get_template_config(self, req, template_config_id):
|
||||
"""Return data about the given template config id."""
|
||||
try:
|
||||
template_config_data = self.db_api.template_config_get(req.context, template_config_id)
|
||||
msg = "Successfully retrieved template config %(id)s" % {'id': template_config_id}
|
||||
template_config_data = self.db_api.template_config_get(
|
||||
req.context, template_config_id)
|
||||
msg = "Successfully retrieved template config %(id)s" \
|
||||
% {'id': template_config_id}
|
||||
LOG.debug(msg)
|
||||
except exception.NotFound:
|
||||
msg = _LI("template_config %(id)s not found") % {'id': template_config_id}
|
||||
msg = _LI("template_config %(id)s not found") \
|
||||
% {'id': template_config_id}
|
||||
LOG.info(msg)
|
||||
raise exc.HTTPNotFound()
|
||||
except exception.Forbidden:
|
||||
@ -318,7 +326,8 @@ class Controller(object):
|
||||
LOG.info(msg)
|
||||
raise exc.HTTPNotFound()
|
||||
except Exception:
|
||||
LOG.exception(_LE("Unable to show template_config %s") % template_config_id)
|
||||
LOG.exception(_LE("Unable to show template_config %s")
|
||||
% template_config_id)
|
||||
raise
|
||||
template_config = dict(template_config=template_config_data)
|
||||
return template_config
|
||||
|
@ -39,7 +39,7 @@ _LW = i18n._LW
|
||||
CONF = cfg.CONF
|
||||
|
||||
DISPLAY_FIELDS_IN_INDEX = ['id', 'func_name', 'ch_desc', 'en_desc',
|
||||
'data_type','data_check_script']
|
||||
'data_type', 'data_check_script']
|
||||
|
||||
SUPPORTED_FILTERS = ['id', 'func_name', 'cluster_id']
|
||||
|
||||
@ -58,8 +58,8 @@ class Controller(object):
|
||||
"""Get template functions, wrapping in exception if necessary."""
|
||||
try:
|
||||
return self.db_api.template_func_get_all(context,
|
||||
filters=filters,
|
||||
**params)
|
||||
filters=filters,
|
||||
**params)
|
||||
except exception.NotFound:
|
||||
LOG.warn(_LW("Invalid marker. template function %(id)s could not "
|
||||
"be found.") % {'id': params.get('marker')})
|
||||
@ -254,7 +254,7 @@ class Controller(object):
|
||||
|
||||
try:
|
||||
template_func_data = self.db_api.template_func_import(
|
||||
req.context,template_func_data)
|
||||
req.context, template_func_data)
|
||||
msg = (_LI("Successfully import template function %s") %
|
||||
template_func_data)
|
||||
LOG.info(msg)
|
||||
|
@ -215,11 +215,14 @@ class Controller(object):
|
||||
def get_template_service(self, req, template_service_id):
|
||||
"""Return data about the given template function id."""
|
||||
try:
|
||||
template_service_data = self.db_api.template_service_get(req.context, template_service_id)
|
||||
msg = "Successfully retrieved template function %(id)s" % {'id': template_service_id}
|
||||
template_service_data = self.db_api.template_service_get(
|
||||
req.context, template_service_id)
|
||||
msg = "Successfully retrieved template function %(id)s" \
|
||||
% {'id': template_service_id}
|
||||
LOG.debug(msg)
|
||||
except exception.NotFound:
|
||||
msg = _LI("template_service %(id)s not found") % {'id': template_service_id}
|
||||
msg = _LI("template_service %(id)s not found") % \
|
||||
{'id': template_service_id}
|
||||
LOG.info(msg)
|
||||
raise exc.HTTPNotFound()
|
||||
except exception.Forbidden:
|
||||
@ -230,7 +233,8 @@ class Controller(object):
|
||||
LOG.info(msg)
|
||||
raise exc.HTTPNotFound()
|
||||
except Exception:
|
||||
LOG.exception(_LE("Unable to show template_service %s") % template_service_id)
|
||||
LOG.exception(_LE("Unable to show template_service %s")
|
||||
% template_service_id)
|
||||
raise
|
||||
template_service = dict(template_service=template_service_data)
|
||||
return template_service
|
||||
|
13
code/daisy/daisy/registry/client/v1/client.py
Executable file → Normal file
13
code/daisy/daisy/registry/client/v1/client.py
Executable file → Normal file
@ -23,7 +23,6 @@ from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from daisy.common.client import BaseClient
|
||||
from daisy.common import crypt
|
||||
from daisy import i18n
|
||||
from daisy.registry.api.v1 import hosts
|
||||
from daisy.registry.api.v1 import config_files
|
||||
@ -1486,7 +1485,8 @@ class RegistryClient(BaseClient):
|
||||
}
|
||||
|
||||
if 'template_func_metadata' not in template_func_metadata:
|
||||
template_func_metadata = dict(template_func_metadata=template_func_metadata)
|
||||
template_func_metadata = dict(
|
||||
template_func_metadata=template_func_metadata)
|
||||
|
||||
body = jsonutils.dumps(template_func_metadata)
|
||||
|
||||
@ -1501,7 +1501,8 @@ class RegistryClient(BaseClient):
|
||||
|
||||
def get_template_service(self, template_service_id):
|
||||
"""Return a list of template function associations from Registry."""
|
||||
res = self.do_request("GET", "/template_services/%s" % template_service_id)
|
||||
res = self.do_request("GET", "/template_services/%s"
|
||||
% template_service_id)
|
||||
data = jsonutils.loads(res.read())['template_service']
|
||||
return data
|
||||
|
||||
@ -1509,7 +1510,9 @@ class RegistryClient(BaseClient):
|
||||
"""
|
||||
Returns a list of template function data mappings from Registry
|
||||
"""
|
||||
params = self._extract_params(kwargs, template_services.SUPPORTED_PARAMS)
|
||||
params = self._extract_params(kwargs,
|
||||
template_services.SUPPORTED_PARAMS)
|
||||
res = self.do_request("GET", "/template_services/list", params=params)
|
||||
template_service_list = jsonutils.loads(res.read())['template_services']
|
||||
template_service_list = jsonutils.loads(res.read())[
|
||||
'template_services']
|
||||
return template_service_list
|
||||
|
@ -47,8 +47,8 @@ CREATE_PARAMS = ('id', 'name', 'description', 'resource_type', 'dmi_uuid',
|
||||
'vcpu_pin_set', 'dvs_high_cpuset', 'pci_high_cpuset',
|
||||
'os_cpus', 'dvs_cpus', 'config_set_id', 'root_disk',
|
||||
'version_patch_id', 'tecs_version_id', 'dvs_config_type',
|
||||
'discover_mode', 'system', 'cpu', 'memory', 'disks', 'devices',
|
||||
'pci')
|
||||
'discover_mode', 'system', 'cpu',
|
||||
'memory', 'disks', 'devices', 'pci')
|
||||
|
||||
DEFAULT_PAGE_SIZE = 200
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user