Limit rootfs size constraints to controller nodes

Previously rootfs size restrictions were limited to controller nodes.
Return to this model to better support lab and virtual installs.

Closes-Bug: 1915215
Change-Id: I6dd53f74de54c971c59c5d821ec33a33c7e152f5
Signed-off-by: David Sullivan <david.sullivan@windriver.com>
This commit is contained in:
David Sullivan 2021-02-11 10:01:52 -06:00
parent 97bcbb7c51
commit 063d9f8448
2 changed files with 34 additions and 52 deletions

View File

@ -1130,39 +1130,43 @@ class AgentManager(service.PeriodicService):
disk_size = utils.get_disk_capacity_mib(self._ihost_rootfs_device)
disk_size = int(disk_size / 1024)
if disk_size > constants.DEFAULT_SMALL_DISK_SIZE:
LOG.info("Disk size for %s: %s ... large disk defaults" %
(self._ihost_rootfs_device, disk_size))
if self._ihost_personality == constants.CONTROLLER:
if disk_size > constants.DEFAULT_SMALL_DISK_SIZE:
LOG.info("Disk size for %s: %s ... large disk defaults" %
(self._ihost_rootfs_device, disk_size))
backup_lv_size = \
constants.DEFAULT_DATABASE_STOR_SIZE + \
constants.DEFAULT_PLATFORM_STOR_SIZE + \
constants.BACKUP_OVERHEAD
backup_lv_size = \
constants.DEFAULT_DATABASE_STOR_SIZE + \
constants.DEFAULT_PLATFORM_STOR_SIZE + \
constants.BACKUP_OVERHEAD
elif disk_size >= constants.MINIMUM_SMALL_DISK_SIZE:
LOG.info("Disk size for %s : %s ... small disk defaults" %
(self._ihost_rootfs_device, disk_size))
elif disk_size >= constants.MINIMUM_SMALL_DISK_SIZE:
LOG.info("Disk size for %s : %s ... small disk defaults" %
(self._ihost_rootfs_device, disk_size))
# Due to the small size of the disk we can't provide the
# proper amount of backup space which is (database + platform_lv
# + BACKUP_OVERHEAD) so we are using a smaller default.
backup_lv_size = constants.DEFAULT_SMALL_BACKUP_STOR_SIZE
# Due to the small size of the disk we can't provide the
# proper amount of backup space which is (database +
# platform_lv + BACKUP_OVERHEAD) so we are using a smaller
# default.
backup_lv_size = constants.DEFAULT_SMALL_BACKUP_STOR_SIZE
elif (disk_size >= constants.MINIMUM_TINY_DISK_SIZE and
rpcapi.is_virtual_system_config(icontext) and
tsc.system_type == constants.TIS_AIO_BUILD):
# Supports StarlingX running in QEMU/KVM VM with a tiny disk(AIO only)
LOG.info("Disk size for %s : %s ... tiny disk defaults "
"for virtual system configuration" %
(self._ihost_rootfs_device, disk_size))
kubelet_lv_size = constants.TINY_KUBELET_STOR_SIZE
docker_lv_size = constants.TINY_KUBERNETES_DOCKER_STOR_SIZE
backup_lv_size = constants.DEFAULT_TINY_BACKUP_STOR_SIZE
elif (disk_size >= constants.MINIMUM_TINY_DISK_SIZE and
rpcapi.is_virtual_system_config(icontext) and
tsc.system_type == constants.TIS_AIO_BUILD):
# Supports StarlingX running in QEMU/KVM VM with a tiny
# disk (AIO only)
LOG.info("Disk size for %s : %s ... tiny disk defaults "
"for virtual system configuration" %
(self._ihost_rootfs_device, disk_size))
kubelet_lv_size = constants.TINY_KUBELET_STOR_SIZE
docker_lv_size = constants.TINY_KUBERNETES_DOCKER_STOR_SIZE
backup_lv_size = constants.DEFAULT_TINY_BACKUP_STOR_SIZE
else:
LOG.info("Disk size for %s : %s ... disk too small" %
(self._ihost_rootfs_device, disk_size))
raise exception.SysinvException("Disk size requirements not met.")
else:
LOG.info("Disk size for %s : %s ... disk too small" %
(self._ihost_rootfs_device, disk_size))
raise exception.SysinvException(
"Disk size requirements not met.")
# check if the scratch fs is supported for current host
if utils.is_filesystem_supported(constants.FILESYSTEM_NAME_SCRATCH,

View File

@ -197,10 +197,8 @@ class TestAgentManager(base.TestCase):
def test_create_host_filesystems_worker_tiny(self):
self.skipTest("Skipping because code fix required - LP1915215")
self.agent_manager._ihost_personality = constants.WORKER
self.mock_get_disk_capacity.return_value = 60 * 1024
self.mock_get_disk_capacity.return_value = 80 * 1024
self.fake_conductor_api.is_virtual_system_config_result = True
self.agent_manager._create_host_filesystems(self.fake_conductor_api,
@ -218,15 +216,6 @@ class TestAgentManager(base.TestCase):
expected_filesystems)
self.assertEqual(self.agent_manager._prev_fs, expected_filesystems)
def test_create_host_filesystems_worker_too_small_fail(self):
self.agent_manager._ihost_personality = constants.WORKER
self.mock_get_disk_capacity.return_value = 59 * 1024
# Verify filesystems were not created
self.fake_conductor_api.create_host_filesystems.assert_not_called()
self.assertEqual(self.agent_manager._prev_fs, None)
def test_create_host_filesystems_storage_large(self):
self.agent_manager._ihost_personality = constants.STORAGE
@ -269,10 +258,8 @@ class TestAgentManager(base.TestCase):
def test_create_host_filesystems_storage_tiny(self):
self.skipTest("Skipping because code fix required - LP1915215")
self.agent_manager._ihost_personality = constants.STORAGE
self.mock_get_disk_capacity.return_value = 60 * 1024
self.mock_get_disk_capacity.return_value = 80 * 1024
self.fake_conductor_api.is_virtual_system_config_result = True
self.agent_manager._create_host_filesystems(self.fake_conductor_api,
@ -289,12 +276,3 @@ class TestAgentManager(base.TestCase):
self.agent_manager._ihost_uuid,
expected_filesystems)
self.assertEqual(self.agent_manager._prev_fs, expected_filesystems)
def test_create_host_filesystems_storage_too_small_fail(self):
self.agent_manager._ihost_personality = constants.STORAGE
self.mock_get_disk_capacity.return_value = 59 * 1024
# Verify filesystems were not created
self.fake_conductor_api.create_host_filesystems.assert_not_called()
self.assertEqual(self.agent_manager._prev_fs, None)