Upload new packages before rebuilding bootstrap

Packages assembled from CR were uploaded after cluster
creation in step #9, so bootstrap image was built with
old package. Now test uploads fresh packages before
rebuilding bootstrap image.

Also moved the step with package version verification
before the step with cluster deployment and added
possibility to remove old packages from target
repository while uploading new files.

Change-Id: Id768b87980fa112c1dbb82f886f390798ce4d8b0
Closes-bug: #1574591
(cherry picked from commit 86dfc2d009)
This commit is contained in:
Artem Panchenko 2016-04-25 17:10:59 +03:00
parent 0cbd590e78
commit c51c39282b
3 changed files with 37 additions and 22 deletions

View File

@ -260,7 +260,7 @@ class AdminActions(BaseActions):
@logwrap @logwrap
def upload_packages(self, local_packages_dir, centos_repo_path, def upload_packages(self, local_packages_dir, centos_repo_path,
ubuntu_repo_path): ubuntu_repo_path, clean_target=False):
logger.info("Upload fuel's packages from directory {0}." logger.info("Upload fuel's packages from directory {0}."
.format(local_packages_dir)) .format(local_packages_dir))
@ -272,7 +272,8 @@ class AdminActions(BaseActions):
ip=self.admin_ip, ip=self.admin_ip,
source=local_packages_dir, source=local_packages_dir,
target=os.path.join(centos_repo_path, 'Packages'), target=os.path.join(centos_repo_path, 'Packages'),
condition="(?i).*\.rpm$" condition="(?i).*\.rpm$",
clean_target=clean_target
) )
if centos_files_count > 0: if centos_files_count > 0:
regenerate_centos_repo(centos_repo_path) regenerate_centos_repo(centos_repo_path)
@ -282,7 +283,8 @@ class AdminActions(BaseActions):
ip=self.admin_ip, ip=self.admin_ip,
source=local_packages_dir, source=local_packages_dir,
target=os.path.join(ubuntu_repo_path, 'pool/main'), target=os.path.join(ubuntu_repo_path, 'pool/main'),
condition="(?i).*\.deb$" condition="(?i).*\.deb$",
clean_target=clean_target
) )
if ubuntu_files_count > 0: if ubuntu_files_count > 0:
regenerate_ubuntu_repo(ubuntu_repo_path) regenerate_ubuntu_repo(ubuntu_repo_path)

View File

@ -269,7 +269,8 @@ class SSHManager(object):
remote = self._get_remote(ip=ip, port=port) remote = self._get_remote(ip=ip, port=port)
return remote.rm_rf(path) return remote.rm_rf(path)
def cond_upload(self, ip, source, target, port=22, condition=''): def cond_upload(self, ip, source, target, port=22, condition='',
clean_target=False):
""" Upload files only if condition in regexp matches filenames """ Upload files only if condition in regexp matches filenames
:param ip: host ip :param ip: host ip
@ -286,6 +287,10 @@ class SSHManager(object):
if self.isdir_on_remote(ip=ip, port=port, path=target): if self.isdir_on_remote(ip=ip, port=port, path=target):
target = posixpath.join(target, os.path.basename(source)) target = posixpath.join(target, os.path.basename(source))
if clean_target:
self.rm_rf_on_remote(ip=ip, port=port, path=target)
self.mkdir_on_remote(ip=ip, port=port, path=target)
source = os.path.expanduser(source) source = os.path.expanduser(source)
if not os.path.isdir(source): if not os.path.isdir(source):
if re.match(condition, source): if re.match(condition, source):

View File

@ -59,16 +59,17 @@ class Gate(TestIronicDeploy):
2. Update fuel-agent, fuel-bootstrap-cli on master node 2. Update fuel-agent, fuel-bootstrap-cli on master node
3. Update fuel_bootstrap_cli.yaml 3. Update fuel_bootstrap_cli.yaml
4. Rebuild bootstrap 4. Rebuild bootstrap
5. Bootstrap 5 slaves 5. Verify fuel-agent version in ubuntu bootstrap image
6. Verify Ubuntu bootstrap on slaves 6. Bootstrap 5 slaves
7. Add 1 node with controller 7. Verify Ubuntu bootstrap on slaves
8. Add 1 node ironic role 8. Add 1 node with controller
9. Deploy the cluster 9. Add 1 node ironic role
10. Verify fuel-agent version in ubuntu and ironic-bootstrap 10. Deploy the cluster
11. Upload image to glance 11. Verify fuel-agent version in ironic-bootstrap
12. Enroll Ironic nodes 12. Upload image to glance
13. Boot nova instance 13. Enroll Ironic nodes
14. Check Nova instance status 14. Boot nova instance
15. Check Nova instance status
Snapshot review_fuel_agent_ironic_deploy Snapshot review_fuel_agent_ironic_deploy
""" """
@ -86,6 +87,12 @@ class Gate(TestIronicDeploy):
self.update_bootstrap_cli_yaml() self.update_bootstrap_cli_yaml()
self.show_step(4) self.show_step(4)
if settings.UPDATE_FUEL:
self.env.admin_actions.upload_packages(
local_packages_dir=settings.UPDATE_FUEL_PATH,
centos_repo_path=None,
ubuntu_repo_path=settings.LOCAL_MIRROR_UBUNTU,
clean_target=True)
uuid, bootstrap_location = \ uuid, bootstrap_location = \
self.env.fuel_bootstrap_actions.build_bootstrap_image() self.env.fuel_bootstrap_actions.build_bootstrap_image()
self.env.fuel_bootstrap_actions. \ self.env.fuel_bootstrap_actions. \
@ -94,10 +101,13 @@ class Gate(TestIronicDeploy):
activate_bootstrap_image(uuid) activate_bootstrap_image(uuid)
self.show_step(5) self.show_step(5)
check_package_version_injected_in_bootstraps("fuel-agent")
self.show_step(6)
self.env.bootstrap_nodes( self.env.bootstrap_nodes(
self.env.d_env.nodes().slaves[:2]) self.env.d_env.nodes().slaves[:2])
self.show_step(6) self.show_step(7)
for node in self.env.d_env.nodes().slaves[:2]: for node in self.env.d_env.nodes().slaves[:2]:
_ip = self.fuel_web.get_nailgun_node_by_devops_node(node)['ip'] _ip = self.fuel_web.get_nailgun_node_by_devops_node(node)['ip']
verify_bootstrap_on_node(_ip, os_type="ubuntu", uuid=uuid) verify_bootstrap_on_node(_ip, os_type="ubuntu", uuid=uuid)
@ -111,30 +121,28 @@ class Gate(TestIronicDeploy):
'slave-01': ['controller'], 'slave-01': ['controller'],
'slave-02': ['ironic']} 'slave-02': ['ironic']}
self.show_step(7)
self.show_step(8) self.show_step(8)
self.show_step(9) self.show_step(9)
self.show_step(10)
cluster_id = self._deploy_ironic_cluster(settings=data, nodes=nodes) cluster_id = self._deploy_ironic_cluster(settings=data, nodes=nodes)
ironic_conn = ironic_actions.IronicActions( ironic_conn = ironic_actions.IronicActions(
self.fuel_web.get_public_vip(cluster_id)) self.fuel_web.get_public_vip(cluster_id))
self.show_step(10) self.show_step(11)
check_package_version_injected_in_bootstraps("fuel-agent")
check_package_version_injected_in_bootstraps("fuel-agent", check_package_version_injected_in_bootstraps("fuel-agent",
cluster_id=cluster_id, cluster_id=cluster_id,
ironic=True) ironic=True)
self.show_step(11)
self.show_step(12) self.show_step(12)
self.show_step(13)
self._create_os_resources(ironic_conn) self._create_os_resources(ironic_conn)
self.show_step(13) self.show_step(14)
self._boot_nova_instances(ironic_conn) self._boot_nova_instances(ironic_conn)
self.show_step(14) self.show_step(15)
ironic_conn.wait_for_vms(ironic_conn) ironic_conn.wait_for_vms(ironic_conn)
ironic_conn.verify_vms_connection(ironic_conn) ironic_conn.verify_vms_connection(ironic_conn)