Improve Ubuntu server boot performance
Because booting Ubuntu servers is taking long time on upstream CI test_curl often fails after waiting for a long time for cloud-init makes its job. This bypasses depending on cloud init execution by moving the logic to write host ID file on the first boot script defined in the customised cloud image. Change-Id: Ibd89354646b27684ed140471b6482ea77addd8a3
This commit is contained in:
parent
3e8d8f12a8
commit
8f6242edcb
|
@ -13,12 +13,14 @@
|
|||
# under the License.
|
||||
from __future__ import absolute_import
|
||||
|
||||
import typing
|
||||
|
||||
import tobiko
|
||||
from tobiko import config
|
||||
from tobiko.openstack import glance
|
||||
from tobiko.openstack import nova
|
||||
from tobiko.openstack.stacks import _nova
|
||||
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
UBUNTU_IMAGE_VERSION = 'focal'
|
||||
|
@ -49,12 +51,26 @@ class UbuntuImageFixture(UbuntuMinimalImageFixture,
|
|||
The server has additional commands compared to the minimal one:
|
||||
iperf3
|
||||
ping
|
||||
ncat
|
||||
nginx
|
||||
|
||||
The image will also have a running HTTPD server listening on
|
||||
TCP port 80
|
||||
"""
|
||||
|
||||
install_packages = ['iperf3',
|
||||
'iputils-ping',
|
||||
'ncat',
|
||||
'nginx']
|
||||
@property
|
||||
def firstboot_commands(self) -> typing.List[str]:
|
||||
return super().firstboot_commands + [
|
||||
'sh -c "hostname > /var/www/html/id"']
|
||||
|
||||
@property
|
||||
def install_packages(self) -> typing.List[str]:
|
||||
return super().install_packages + ['iperf3',
|
||||
'iputils-ping',
|
||||
'ncat',
|
||||
'nginx']
|
||||
|
||||
http_port = 80
|
||||
|
||||
|
||||
class UbuntuFlavorStackFixture(_nova.FlavorStackFixture):
|
||||
|
@ -83,13 +99,9 @@ class UbuntuServerStackFixture(UbuntuMinimalServerStackFixture):
|
|||
image_fixture = tobiko.required_setup_fixture(UbuntuImageFixture)
|
||||
|
||||
# port of running HTTP server
|
||||
http_port = 80
|
||||
|
||||
@property
|
||||
def cloud_config(self):
|
||||
return nova.cloud_config(
|
||||
super().cloud_config,
|
||||
runcmd=["sh -c 'hostname > /var/www/html/id'"])
|
||||
def http_port(self) -> int:
|
||||
return self.image_fixture.http_port
|
||||
|
||||
|
||||
class UbuntuExternalServerStackFixture(UbuntuServerStackFixture,
|
||||
|
|
|
@ -23,10 +23,11 @@ import testtools
|
|||
import tobiko
|
||||
from tobiko.shell import curl
|
||||
from tobiko.shell import ssh
|
||||
from tobiko.openstack import keystone
|
||||
from tobiko.openstack import stacks
|
||||
|
||||
|
||||
@tobiko.skip("Flaky test case")
|
||||
@keystone.skip_unless_has_keystone_credentials()
|
||||
class TestCurl(testtools.TestCase):
|
||||
|
||||
stack = tobiko.required_setup_fixture(stacks.UbuntuServerStackFixture)
|
||||
|
|
Loading…
Reference in New Issue