From 49aacd62348d7edf91c5b9bbd40d31708610e1e5 Mon Sep 17 00:00:00 2001 From: Szilard Cserey Date: Tue, 18 Aug 2015 19:47:50 +0200 Subject: Autodeployer support for ODL Plugin installation + Fuel 6.1 - Opendaylight plugin installation - Adapting Autodeployer to Fuel 6.1 - restarting blades that couldn't be discovered Fuel in time BGS-87 Autodeployment restarts blade if that has not been discovered by Fuel BGS-90 Fuel 6.1 and Opendaylight Fuel plugin install support for Autodeployer Change-Id: I83aab3f8caf368a70fd3f2b67c7ba1b6191993c6 Signed-off-by: Szilard Cserey --- fuel/deploy/environments/libvirt_environment.py | 30 ++++++++++++++++++------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'fuel/deploy/environments/libvirt_environment.py') diff --git a/fuel/deploy/environments/libvirt_environment.py b/fuel/deploy/environments/libvirt_environment.py index e156fd2..785eeca 100644 --- a/fuel/deploy/environments/libvirt_environment.py +++ b/fuel/deploy/environments/libvirt_environment.py @@ -1,3 +1,13 @@ +############################################################################### +# Copyright (c) 2015 Ericsson AB and others. +# szilard.cserey@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################### + + from lxml import etree import glob @@ -11,7 +21,6 @@ check_dir_exists = common.check_dir_exists check_file_exists = common.check_file_exists check_if_root = common.check_if_root -NET_DIR = 'libvirt/networks' class LibvirtEnvironment(ExecutionEnvironment): @@ -19,17 +28,18 @@ class LibvirtEnvironment(ExecutionEnvironment): super(LibvirtEnvironment, self).__init__( storage_dir, dha_file, root_dir) self.dea = dea - self.network_dir = '%s/%s' % (self.root_dir, NET_DIR) + self.network_dir = '%s/%s' % (self.root_dir, + self.dha.get_virt_net_conf_dir()) self.node_ids = self.dha.get_all_node_ids() self.net_names = self.collect_net_names() def create_storage(self, node_id, disk_path, disk_sizes): if node_id == self.fuel_node_id: - disk_size = disk_sizes['fuel'] + disk_size = disk_sizes['fuel'] else: - roles = self.dea.get_node_role(node_id) - role = 'controller' if 'controller' in roles else 'compute' - disk_size = disk_sizes[role] + roles = self.dea.get_node_role(node_id) + role = 'controller' if 'controller' in roles else 'compute' + disk_size = disk_sizes[role] exec_cmd('fallocate -l %s %s' % (disk_size, disk_path)) def create_vms(self): @@ -48,6 +58,10 @@ class LibvirtEnvironment(ExecutionEnvironment): self.define_vm(vm_name, temp_vm_file, disk_path) exec_cmd('rm -fr %s' % temp_dir) + def start_vms(self): + for node_id in self.node_ids: + self.dha.node_power_on(node_id) + def create_networks(self): for net_file in glob.glob('%s/*' % self.network_dir): exec_cmd('virsh net-define %s' % net_file) @@ -82,11 +96,11 @@ class LibvirtEnvironment(ExecutionEnvironment): self.delete_vm(node_id) def setup_environment(self): - check_if_root() check_dir_exists(self.network_dir) self.cleanup_environment() - self.create_vms() self.create_networks() + self.create_vms() + self.start_vms() def cleanup_environment(self): self.delete_vms() -- cgit 1.2.3-korg