Reduce number of image push threads for virtual system
The number of image push threads is set to 1 if the Linux
system is virtual. This change is to accommodate testing parallel
upgrade of a large number of virtual subclouds on the same
subcloud host.
The commit also contains some cosmetic changes.
Test plan:
- Set up a distributed cloud system that has a large number of
virtual subclouds for upgrade.
- Prestage the virtual subclouds.
- Perform upgrade orchestration of both physical and virtual
subclouds.
Story: 2009725
Task: 45644
Change-Id: Iecabb412a3ca6426e74f4b2a34b796d701881af4
Signed-off-by: Tee Ngo <tee.ngo@windriver.com>
This commit is contained in:
@@ -65,12 +65,12 @@
|
||||
when: mode == 'bootstrap'
|
||||
|
||||
- block:
|
||||
- name: restore /etc/hosts file
|
||||
- name: Restore /etc/hosts file
|
||||
command: tar -C /etc -xpf {{ restore_data_file }} --transform='s,.*/,,' etc/hosts
|
||||
args:
|
||||
warn: false
|
||||
|
||||
- name: restore hosts in config permdir
|
||||
- name: Restore hosts in config permdir
|
||||
command: >-
|
||||
tar -C {{ config_permdir }} -xpf {{ restore_data_file }} --transform='s,.*/,,'
|
||||
{{ archive_config_permdir }}/hosts
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
path: "{{ last_kubernetes_extra_config_file }}"
|
||||
state: absent
|
||||
|
||||
- name: persist extraArgs and extraVolumes configuration file
|
||||
- name: Persist extraArgs and extraVolumes configuration file
|
||||
command: >
|
||||
mv -f {{ tmp_kubernetes_extra_config_file }}
|
||||
{{ last_kubernetes_extra_config_file }}
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# Copyright (c) 2021 Wind River Systems, Inc.
|
||||
# Copyright (c) 2021-2022 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# This script is used to push images that were previously
|
||||
# imported from local image archive(s) to the local registry.
|
||||
|
||||
import docker
|
||||
import eventlet
|
||||
import keyring
|
||||
import sys
|
||||
import time
|
||||
|
||||
eventlet.monkey_patch(os=False)
|
||||
from eventlet import greenpool # noqa: E402
|
||||
|
||||
import docker # noqa: E402
|
||||
import time # noqa: E402
|
||||
import keyring # noqa: E402
|
||||
|
||||
MAX_PUSH_THREAD = 5
|
||||
REGISTRY_PATTERNS = ['.io', 'docker.elastic.co']
|
||||
@@ -119,6 +121,11 @@ def push_images(images):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) == 2:
|
||||
if sys.argv[1] != 'physical':
|
||||
MAX_PUSH_THREAD = 1
|
||||
print("Subcloud is virtual. MAX_PUSH_THREAD is set to %d" % MAX_PUSH_THREAD)
|
||||
|
||||
image_list = get_list_of_imported_images()
|
||||
print("List of imported images: {}".format(image_list))
|
||||
start = time.time()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
#
|
||||
# Copyright (c) 2019-2021 Wind River Systems, Inc.
|
||||
# Copyright (c) 2019-2022 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
@@ -138,8 +138,12 @@
|
||||
download_images_task_name: "Download images and push to local registry"
|
||||
|
||||
- block:
|
||||
- name: Retrieve system virtual info
|
||||
command: facter virtual
|
||||
register: virtual_type
|
||||
|
||||
- name: Push imported images to local registry
|
||||
script: push_imported_images_to_local_registry.py
|
||||
script: push_imported_images_to_local_registry.py {{ virtual_type.stdout|lower }}
|
||||
register: push_imported_images_output
|
||||
|
||||
- set_fact:
|
||||
|
||||
Reference in New Issue
Block a user