Deprecate bash ramdisks
Ironic has deprecated these for a while, so we should be notifying our users of that fact. This change also makes us stop using those old ramdisks by default so we don't have to build an extra image during CI runs. Change-Id: I68d726bf73ba0aa10803a5fd8f523323d1fdd70e Co-Authored-By: Dan Prince <dprince@redhat.com>changes/88/247088/2
parent
0925b0300e
commit
2d7017ab71
|
@ -51,7 +51,6 @@ class TestOvercloudImageBuild(TestPluginV1):
|
|||
mock_linux_distribution.return_value = ['CentOS Fake Release']
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.assertEqual(1, self.mock_ramdisk_image_create.call_count)
|
||||
self.assertEqual(2, self.mock_disk_image_create.call_count)
|
||||
|
||||
@mock.patch('platform.linux_distribution')
|
||||
|
@ -134,12 +133,14 @@ class TestOvercloudImageBuild(TestPluginV1):
|
|||
"pip-and-virtualenv-override --min-tmpfs 5 2>&1 | "
|
||||
"tee dib-overcloud-full.log")
|
||||
|
||||
@mock.patch('time.sleep')
|
||||
@mock.patch('platform.linux_distribution')
|
||||
@mock.patch('os.path.isfile', autospec=True)
|
||||
def test_overcloud_image_build_deploy_ramdisk(
|
||||
self,
|
||||
mock_os_path_isfile,
|
||||
mock_linux_distribution):
|
||||
mock_linux_distribution,
|
||||
mock_sleep):
|
||||
arglist = ['--type', 'deploy-ramdisk']
|
||||
verifylist = [('image_types', ['deploy-ramdisk'])]
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import six
|
|||
import stat
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
from cliff import command
|
||||
from openstackclient.common import exceptions
|
||||
|
@ -40,7 +41,10 @@ class ImageBuilder(object):
|
|||
|
||||
@abc.abstractmethod
|
||||
def build_ramdisk(self, parsed_args, ramdisk_type):
|
||||
"""Build a ramdisk"""
|
||||
"""Build a ramdisk
|
||||
|
||||
DEPRECATED: Use build_ramdisk_agent instead.
|
||||
"""
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
|
@ -69,6 +73,15 @@ class DibImageBuilder(ImageBuilder):
|
|||
shell=True)
|
||||
|
||||
def build_ramdisk(self, parsed_args, ramdisk_type):
|
||||
deprecation_message = (
|
||||
'DEPRECATED: The old bash-based ramdisks are no longer '
|
||||
'supported. You should move to the agent-based ramdisk as '
|
||||
'soon as possible.'
|
||||
)
|
||||
print(deprecation_message)
|
||||
# Give users time to see this message before we spam the console
|
||||
# with image build output.
|
||||
time.sleep(10)
|
||||
image_name = vars(parsed_args)["%s_name" % ramdisk_type]
|
||||
args = ("-a %(arch)s -o %(name)s "
|
||||
"--ramdisk-element dracut-ramdisk %(node_dist)s "
|
||||
|
@ -87,6 +100,8 @@ class DibImageBuilder(ImageBuilder):
|
|||
})
|
||||
os.environ.update(parsed_args.dib_env_vars)
|
||||
self._ramdisk_image_create(args)
|
||||
# Print it again so users have another chance to see it.
|
||||
print(deprecation_message)
|
||||
|
||||
def build_ramdisk_agent(self, parsed_args):
|
||||
# The ironic-agent element builds the ramdisk internally,
|
||||
|
@ -314,13 +329,17 @@ class BuildOvercloudImage(command.Command):
|
|||
"--deploy-name",
|
||||
dest="deploy_name",
|
||||
default=os.environ.get('DEPLOY_NAME', 'deploy-ramdisk-ironic'),
|
||||
help="Name of deployment ramdisk image",
|
||||
help=("DEPRECATED: Name of deployment ramdisk image. This image "
|
||||
"has been replaced by the Ironic Python Agent ramdisk, so "
|
||||
"you should switch to that as soon as possible."),
|
||||
)
|
||||
parser.add_argument(
|
||||
"--discovery-name",
|
||||
dest="discovery_name",
|
||||
default=os.environ.get('DISCOVERY_NAME', 'discovery-ramdisk'),
|
||||
help="Name of discovery ramdisk image",
|
||||
help=("DEPRECATED: Name of discovery ramdisk image. This image "
|
||||
"has been replaced by the Ironic Python Agent ramdisk, so "
|
||||
"you should switch to that as soon as possible."),
|
||||
)
|
||||
parser.add_argument(
|
||||
"--agent-image-element",
|
||||
|
@ -449,7 +468,7 @@ class BuildOvercloudImage(command.Command):
|
|||
def _build_image_ramdisk_agent(self, parsed_args):
|
||||
image_name = vars(parsed_args)["agent_name"]
|
||||
if (not os.path.isfile("%s.initramfs" % image_name) or
|
||||
not os.path.isfile("%s.vmlinuz" % image_name)):
|
||||
not os.path.isfile("%s.kernel" % image_name)):
|
||||
parsed_args._builder.build_ramdisk_agent(parsed_args)
|
||||
|
||||
def _build_image_ramdisk_deploy(self, parsed_args):
|
||||
|
@ -505,7 +524,6 @@ class BuildOvercloudImage(command.Command):
|
|||
self.log.debug("Environment: %s" % parsed_args.dib_env_vars)
|
||||
|
||||
if parsed_args.all:
|
||||
self._build_image_ramdisk_deploy(parsed_args)
|
||||
self._build_image_ramdisk_agent(parsed_args)
|
||||
self._build_image_overcloud_full(parsed_args)
|
||||
else:
|
||||
|
@ -652,14 +670,11 @@ class UploadOvercloudImage(command.Command):
|
|||
def take_action(self, parsed_args):
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
|
||||
self._env_variable_or_set('DEPLOY_NAME', 'deploy-ramdisk-ironic')
|
||||
self._env_variable_or_set('AGENT_NAME', 'ironic-python-agent')
|
||||
|
||||
self.log.debug("checking if image files exist")
|
||||
|
||||
image_files = [
|
||||
'%s.initramfs' % os.environ['DEPLOY_NAME'],
|
||||
'%s.kernel' % os.environ['DEPLOY_NAME'],
|
||||
'%s.initramfs' % os.environ['AGENT_NAME'],
|
||||
'%s.kernel' % os.environ['AGENT_NAME'],
|
||||
parsed_args.os_image
|
||||
|
@ -724,7 +739,7 @@ class UploadOvercloudImage(command.Command):
|
|||
self.log.debug("uploading bm images to glance")
|
||||
|
||||
deploy_kernel_name = 'bm-deploy-kernel'
|
||||
deploy_kernel_file = '%s.kernel' % os.environ['DEPLOY_NAME']
|
||||
deploy_kernel_file = '%s.kernel' % os.environ['AGENT_NAME']
|
||||
self._image_try_update(deploy_kernel_name, deploy_kernel_file,
|
||||
parsed_args) or self._upload_image(
|
||||
name=deploy_kernel_name,
|
||||
|
@ -736,7 +751,7 @@ class UploadOvercloudImage(command.Command):
|
|||
)
|
||||
|
||||
deploy_ramdisk_name = 'bm-deploy-ramdisk'
|
||||
deploy_ramdisk_file = '%s.initramfs' % os.environ['DEPLOY_NAME']
|
||||
deploy_ramdisk_file = '%s.initramfs' % os.environ['AGENT_NAME']
|
||||
self._image_try_update(deploy_ramdisk_name, deploy_ramdisk_file,
|
||||
parsed_args) or self._upload_image(
|
||||
name=deploy_ramdisk_name,
|
||||
|
|
Loading…
Reference in New Issue