summaryrefslogtreecommitdiffstats
path: root/fuel/deploy/setup_execution_environment.py
diff options
context:
space:
mode:
authorSzilard Cserey <szilard.cserey@ericsson.com>2015-05-21 15:57:35 +0200
committerSzilard Cserey <szilard.cserey@ericsson.com>2015-06-17 12:09:30 +0200
commit2654b0628e30f54b0b8e89208ab04204858cfae5 (patch)
treeba385d757efb92f7c8f8b13d55ae6a7c483e9dc4 /fuel/deploy/setup_execution_environment.py
parent321aff98523fbe442af7ca4d935c83e2196eacee (diff)
Fuel Config Reap + Additional Refactoring for Autodeployment
1. Refactor the whole autodeployment code in such a way that the preparation of Fuel VM + networking and the autodeployment itself can be executed all at once 2. Functionality added that allows reaping of Fuel configuration from an existing environment and create DHA and DEA configuration files from it JIRA: [BGS-2] Create Fuel deployment script Change-Id: I7101295ac4becfc5fa10eda757cec0c2ad127940 Signed-off-by: Szilard Cserey <szilard.cserey@ericsson.com>
Diffstat (limited to 'fuel/deploy/setup_execution_environment.py')
-rw-r--r--fuel/deploy/setup_execution_environment.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/fuel/deploy/setup_execution_environment.py b/fuel/deploy/setup_execution_environment.py
new file mode 100644
index 0000000..d97fcde
--- /dev/null
+++ b/fuel/deploy/setup_execution_environment.py
@@ -0,0 +1,36 @@
+import yaml
+import io
+import sys
+import os
+
+import common
+from environments.libvirt_environment import LibvirtEnvironment
+from environments.virtual_fuel import VirtualFuel
+from dea import DeploymentEnvironmentAdapter
+
+exec_cmd = common.exec_cmd
+err = common.err
+log = common.log
+check_dir_exists = common.check_dir_exists
+check_file_exists = common.check_file_exists
+check_if_root = common.check_if_root
+ArgParser = common.ArgParser
+
+class ExecutionEnvironment(object):
+ def __new__(cls, storage_dir, pxe_bridge, dha_path, dea):
+
+ with io.open(dha_path) as yaml_file:
+ dha_struct = yaml.load(yaml_file)
+
+ type = dha_struct['adapter']
+
+ root_dir = os.path.dirname(os.path.realpath(__file__))
+
+ if cls is ExecutionEnvironment:
+ if type == 'libvirt':
+ return LibvirtEnvironment(storage_dir, dha_path, dea, root_dir)
+
+ if type == 'ipmi' or type == 'hp':
+ return VirtualFuel(storage_dir, pxe_bridge, dha_path, root_dir)
+
+ return super(ExecutionEnvironment, cls).__new__(cls)