Merge "Add host support for hwsettle"
This commit is contained in:
commit
9ac56b95f4
|
@ -35,6 +35,7 @@ IHOST = {'id': 123,
|
|||
'location': {'City': 'Ottawa'},
|
||||
'boot_device': 'sda',
|
||||
'rootfs_device': 'sda',
|
||||
'hw_settle': '0',
|
||||
'install_output': "text",
|
||||
'console': 'ttyS0,115200',
|
||||
'tboot': ''}
|
||||
|
|
|
@ -28,15 +28,16 @@ def _print_ihost_show(ihost, columns=None, output_format=None):
|
|||
else:
|
||||
fields = ['id', 'uuid', 'personality', 'hostname', 'invprovision',
|
||||
'administrative', 'operational', 'availability', 'task',
|
||||
'action', 'mgmt_mac', 'mgmt_ip', 'serialid',
|
||||
'capabilities', 'bm_type', 'bm_username', 'bm_ip',
|
||||
'config_applied', 'config_target', 'config_status',
|
||||
'location', 'uptime', 'reserved', 'created_at', 'updated_at',
|
||||
'boot_device', 'rootfs_device', 'install_output', 'console',
|
||||
'action', 'mgmt_mac', 'mgmt_ip', 'serialid', 'capabilities',
|
||||
'bm_type', 'bm_username', 'bm_ip', 'config_applied',
|
||||
'config_target', 'config_status', 'location', 'uptime',
|
||||
'reserved', 'created_at', 'updated_at', 'boot_device',
|
||||
'rootfs_device', 'hw_settle', 'install_output', 'console',
|
||||
'tboot', 'vim_progress_status', 'software_load',
|
||||
'install_state', 'install_state_info', 'inv_state',
|
||||
'clock_synchronization', 'device_image_update',
|
||||
'reboot_needed', 'max_cpu_mhz_configured', 'max_cpu_mhz_allowed', 'apparmor']
|
||||
'reboot_needed', 'max_cpu_mhz_configured',
|
||||
'max_cpu_mhz_allowed', 'apparmor']
|
||||
optional_fields = ['vsc_controllers', 'ttys_dcd']
|
||||
if ihost.subfunctions != ihost.personality:
|
||||
fields.append('subfunctions')
|
||||
|
@ -191,6 +192,10 @@ def do_kube_host_upgrade_list(cc, args):
|
|||
@utils.arg('-r', '--rootfs_device',
|
||||
metavar='<rootfs_device>',
|
||||
help='Device for rootfs partition, relative to /dev. Default: sda')
|
||||
@utils.arg('-R', '--hw_settle',
|
||||
metavar='<hw_settle>',
|
||||
help='Delay at the start of init to allow hardware to become '
|
||||
'available. Default: 0')
|
||||
@utils.arg('-o', '--install_output',
|
||||
metavar='<install_output>',
|
||||
choices=['text', 'graphical'],
|
||||
|
@ -213,12 +218,11 @@ def do_kube_host_upgrade_list(cc, args):
|
|||
help='Clock synchronization, ntp or ptp. Default: ntp')
|
||||
def do_host_add(cc, args):
|
||||
"""Add a new host."""
|
||||
field_list = ['hostname', 'personality', 'subfunctions',
|
||||
'mgmt_mac', 'mgmt_ip',
|
||||
'bm_ip', 'bm_type', 'bm_username', 'bm_password',
|
||||
'boot_device', 'rootfs_device', 'install_output', 'console',
|
||||
'vsc_controllers', 'location', 'ttys_dcd',
|
||||
'clock_synchronization']
|
||||
field_list = ['hostname', 'personality', 'subfunctions', 'mgmt_mac',
|
||||
'mgmt_ip', 'bm_ip', 'bm_type', 'bm_username', 'bm_password',
|
||||
'boot_device', 'rootfs_device', 'hw_settle',
|
||||
'install_output', 'console', 'vsc_controllers', 'location',
|
||||
'ttys_dcd', 'clock_synchronization']
|
||||
fields = dict((k, v) for (k, v) in vars(args).items()
|
||||
if k in field_list and not (v is None))
|
||||
|
||||
|
|
|
@ -13,11 +13,10 @@ from cgtsclient import exc
|
|||
from cgtsclient.v1 import icpu
|
||||
|
||||
|
||||
CREATION_ATTRIBUTES = ['hostname', 'personality', 'subfunctions',
|
||||
'mgmt_mac', 'mgmt_ip',
|
||||
'bm_ip', 'bm_type', 'bm_username',
|
||||
'bm_password', 'serialid', 'location',
|
||||
'boot_device', 'rootfs_device', 'install_output',
|
||||
CREATION_ATTRIBUTES = ['hostname', 'personality', 'subfunctions', 'mgmt_mac',
|
||||
'mgmt_ip', 'bm_ip', 'bm_type', 'bm_username',
|
||||
'bm_password', 'serialid', 'location', 'boot_device',
|
||||
'rootfs_device', 'hw_settle', 'install_output',
|
||||
'console', 'tboot', 'vsc_controllers', 'ttys_dcd',
|
||||
'administrative', 'operational', 'availability',
|
||||
'invprovision', 'clock_synchronization']
|
||||
|
|
|
@ -102,12 +102,11 @@ from sysinv.openstack.common.rpc import common as rpc_common
|
|||
LOG = log.getLogger(__name__)
|
||||
KEYRING_BM_SERVICE = "BM"
|
||||
ERR_CODE_LOCK_SOLE_SERVICE_PROVIDER = "-1003"
|
||||
HOST_XML_ATTRIBUTES = ['hostname', 'personality', 'subfunctions',
|
||||
'mgmt_mac', 'mgmt_ip',
|
||||
'bm_ip', 'bm_type', 'bm_username',
|
||||
HOST_XML_ATTRIBUTES = ['hostname', 'personality', 'subfunctions', 'mgmt_mac',
|
||||
'mgmt_ip', 'bm_ip', 'bm_type', 'bm_username',
|
||||
'bm_password', 'boot_device', 'rootfs_device',
|
||||
'install_output', 'console', 'vsc_controllers',
|
||||
'power_on', 'location', 'apparmor']
|
||||
'hw_settle', 'install_output', 'console',
|
||||
'vsc_controllers', 'power_on', 'location', 'apparmor']
|
||||
|
||||
|
||||
def _get_controller_address(hostname):
|
||||
|
@ -528,6 +527,7 @@ class Host(base.APIBase):
|
|||
|
||||
boot_device = wtypes.text
|
||||
rootfs_device = wtypes.text
|
||||
hw_settle = wtypes.text
|
||||
install_output = wtypes.text
|
||||
console = wtypes.text
|
||||
tboot = wtypes.text
|
||||
|
@ -578,25 +578,22 @@ class Host(base.APIBase):
|
|||
|
||||
@classmethod
|
||||
def convert_with_links(cls, rpc_ihost, expand=True):
|
||||
minimum_fields = ['id', 'uuid', 'hostname',
|
||||
'personality', 'subfunctions',
|
||||
'subfunction_oper', 'subfunction_avail',
|
||||
'administrative', 'operational', 'availability',
|
||||
'invprovision',
|
||||
'task', 'mtce_info', 'action', 'uptime', 'reserved',
|
||||
'ihost_action', 'vim_progress_status',
|
||||
'mgmt_mac', 'mgmt_ip', 'location',
|
||||
'bm_ip', 'bm_type', 'bm_username',
|
||||
minimum_fields = ['id', 'uuid', 'hostname', 'personality',
|
||||
'subfunctions', 'subfunction_oper',
|
||||
'subfunction_avail', 'administrative', 'operational',
|
||||
'availability', 'invprovision', 'task', 'mtce_info',
|
||||
'action', 'uptime', 'reserved', 'ihost_action',
|
||||
'vim_progress_status', 'mgmt_mac', 'mgmt_ip',
|
||||
'location', 'bm_ip', 'bm_type', 'bm_username',
|
||||
'isystem_uuid', 'capabilities', 'serialid',
|
||||
'config_status', 'config_applied', 'config_target',
|
||||
'created_at', 'updated_at', 'boot_device',
|
||||
'rootfs_device', 'install_output', 'console',
|
||||
'tboot', 'vsc_controllers', 'ttys_dcd',
|
||||
'rootfs_device', 'hw_settle', 'install_output',
|
||||
'console', 'tboot', 'vsc_controllers', 'ttys_dcd',
|
||||
'software_load', 'target_load', 'peers', 'peer_id',
|
||||
'install_state', 'install_state_info',
|
||||
'iscsi_initiator_name',
|
||||
'device_image_update', 'reboot_needed',
|
||||
'inv_state', 'clock_synchronization',
|
||||
'iscsi_initiator_name', 'device_image_update',
|
||||
'reboot_needed', 'inv_state', 'clock_synchronization',
|
||||
'max_cpu_mhz_configured', 'max_cpu_mhz_allowed',
|
||||
'apparmor']
|
||||
|
||||
|
@ -5228,7 +5225,8 @@ class HostController(rest.RestController):
|
|||
hostupdate.ihost_orig['hostname']))
|
||||
|
||||
# Check whether any configurable installation parameters are updated
|
||||
install_parms = ['boot_device', 'rootfs_device', 'install_output', 'console', 'tboot']
|
||||
install_parms = ['boot_device', 'rootfs_device', 'hw_settle',
|
||||
'install_output', 'console', 'tboot']
|
||||
if any(p in install_parms for p in delta):
|
||||
# Disallow changes if the node is not locked
|
||||
if ihost['administrative'] != constants.ADMIN_LOCKED:
|
||||
|
@ -7396,6 +7394,7 @@ def _create_node(host, xml_node, personality, is_dynamic_ip):
|
|||
|
||||
et.SubElement(host_node, 'boot_device').text = host.boot_device
|
||||
et.SubElement(host_node, 'rootfs_device').text = host.rootfs_device
|
||||
et.SubElement(host_node, 'hw_settle').text = host.hw_settle
|
||||
et.SubElement(host_node, 'install_output').text = host.install_output
|
||||
if host.vsc_controllers is not None:
|
||||
et.SubElement(host_node, 'vsc_controllers').text = host.vsc_controllers
|
||||
|
|
|
@ -1274,6 +1274,10 @@ class ConductorManager(service.PeriodicService):
|
|||
rootfs_device = host.get('rootfs_device') or "/dev/sda"
|
||||
install_opts += ['-r', rootfs_device]
|
||||
|
||||
hw_settle = host.get('hw_settle') or "0"
|
||||
if hw_settle != "0":
|
||||
install_opts += ['-H', hw_settle]
|
||||
|
||||
if cutils.get_os_target(sw_version) == constants.OS_DEBIAN:
|
||||
install_opts += ['-d']
|
||||
else:
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
#
|
||||
# Copyright (c) 2023 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
from sqlalchemy import Column, MetaData, Table
|
||||
from sqlalchemy import String
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
meta = MetaData()
|
||||
meta.bind = migrate_engine
|
||||
migrate_engine.connect()
|
||||
i_host = Table('i_host', meta, autoload=True)
|
||||
i_host.create_column(Column('hw_settle', String(4), default="0"))
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
meta = MetaData()
|
||||
meta.bind = migrate_engine
|
||||
raise NotImplementedError('SysInv databse downgrade is unsupported.')
|
|
@ -232,6 +232,7 @@ class ihost(Base):
|
|||
|
||||
boot_device = Column(String(255), default="/dev/sda")
|
||||
rootfs_device = Column(String(255), default="/dev/sda")
|
||||
hw_settle = Column(String(4), default="0")
|
||||
install_output = Column(String(255), default="text")
|
||||
console = Column(String(255), default="ttyS0,115200")
|
||||
tboot = Column(String(64), default="")
|
||||
|
|
|
@ -90,6 +90,7 @@ class Host(base.SysinvObject):
|
|||
|
||||
'boot_device': utils.str_or_none,
|
||||
'rootfs_device': utils.str_or_none,
|
||||
'hw_settle': utils.str_or_none,
|
||||
'install_output': utils.str_or_none,
|
||||
'console': utils.str_or_none,
|
||||
'tboot': utils.str_or_none,
|
||||
|
|
|
@ -1743,6 +1743,7 @@ class TestListHosts(TestHost):
|
|||
self.assertEqual(ndict['serialid'], result['serialid'])
|
||||
self.assertEqual(ndict['boot_device'], result['boot_device'])
|
||||
self.assertEqual(ndict['rootfs_device'], result['rootfs_device'])
|
||||
self.assertEqual(ndict['hw_settle'], result['hw_settle'])
|
||||
self.assertEqual(ndict['install_output'], result['install_output'])
|
||||
self.assertEqual(ndict['console'], result['console'])
|
||||
self.assertEqual(ndict['tboot'], result['tboot'])
|
||||
|
|
|
@ -534,6 +534,7 @@ class ManagerTestCase(base.DbTestCase):
|
|||
'serialid': '1234567890abc',
|
||||
'boot_device': 'sda',
|
||||
'rootfs_device': 'sda',
|
||||
'hw_settle': '0',
|
||||
'install_output': 'text',
|
||||
'console': 'ttyS0,115200',
|
||||
'tboot': ''
|
||||
|
@ -559,6 +560,7 @@ class ManagerTestCase(base.DbTestCase):
|
|||
ihost['serialid'] = '1234567890abc'
|
||||
ihost['boot_device'] = 'sda'
|
||||
ihost['rootfs_device'] = 'sda'
|
||||
ihost['hw_settle'] = '0'
|
||||
ihost['install_output'] = 'text'
|
||||
ihost['console'] = 'ttyS0,115200'
|
||||
|
||||
|
@ -575,6 +577,7 @@ class ManagerTestCase(base.DbTestCase):
|
|||
self.assertEqual(res['serialid'], '1234567890abc')
|
||||
self.assertEqual(res['boot_device'], 'sda')
|
||||
self.assertEqual(res['rootfs_device'], 'sda')
|
||||
self.assertEqual(res['hw_settle'], '0')
|
||||
self.assertEqual(res['install_output'], 'text')
|
||||
self.assertEqual(res['console'], 'ttyS0,115200')
|
||||
|
||||
|
@ -618,6 +621,7 @@ class ManagerTestCase(base.DbTestCase):
|
|||
ihost['serialid'] = '1234567890abc'
|
||||
ihost['boot_device'] = 'sda'
|
||||
ihost['rootfs_device'] = 'sda'
|
||||
ihost['hw_settle'] = '0'
|
||||
ihost['install_output'] = 'text'
|
||||
ihost['console'] = 'ttyS0,115200'
|
||||
|
||||
|
@ -654,6 +658,7 @@ class ManagerTestCase(base.DbTestCase):
|
|||
ihost['serialid'] = '1234567890abc'
|
||||
ihost['boot_device'] = 'sda'
|
||||
ihost['rootfs_device'] = 'sda'
|
||||
ihost['hw_settle'] = '0'
|
||||
ihost['install_output'] = 'text'
|
||||
ihost['console'] = 'ttyS0,115200'
|
||||
|
||||
|
@ -1702,6 +1707,7 @@ class ManagerTestCase(base.DbTestCase):
|
|||
ihost['serialid'] = '1234567890abc'
|
||||
ihost['boot_device'] = 'sda'
|
||||
ihost['rootfs_device'] = 'sda'
|
||||
ihost['hw_settle'] = '0'
|
||||
ihost['install_output'] = 'text'
|
||||
ihost['console'] = 'ttyS0,115200'
|
||||
|
||||
|
|
|
@ -154,6 +154,7 @@ def get_test_ihost(**kw):
|
|||
'location': kw.get('location', {}),
|
||||
'boot_device': kw.get('boot_device', 'sda'),
|
||||
'rootfs_device': kw.get('rootfs_device', 'sda'),
|
||||
'hw_settle': kw.get('hw_settle', '0'),
|
||||
'install_output': kw.get('install_output', 'text'),
|
||||
'console': kw.get('console', 'ttyS0,115200'),
|
||||
'tboot': kw.get('tboot', ''),
|
||||
|
|
Loading…
Reference in New Issue