From: Ondrej Lichtner olichtne@redhat.com
The Machine object now includes the security information of the machine that was parsed from the Slave Machine XML file. To complete the security information it also includes the Controller identification information to the dictionary holding the security information.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- lnst/Controller/Machine.py | 8 +++++++- lnst/Controller/SlavePool.py | 9 ++++++--- 2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py index 9897580..62393b8 100644 --- a/lnst/Controller/Machine.py +++ b/lnst/Controller/Machine.py @@ -42,13 +42,19 @@ class Machine(object): deconfiguration, and running commands. """
- def __init__(self, m_id, hostname=None, libvirt_domain=None, rpcport=None): + def __init__(self, m_id, hostname=None, libvirt_domain=None, rpcport=None, + security=None): self._id = m_id self._hostname = hostname self._slave_desc = None self._connection = None self._configured = False self._system_config = {} + self._security = security + self._security["identity"] = lnst_config.get_option("security", + "identity") + self._security["privkey"] = lnst_config.get_option("security", + "privkey")
self._domain_ctl = None self._network_bridges = None diff --git a/lnst/Controller/SlavePool.py b/lnst/Controller/SlavePool.py index 87bc850..24a21d8 100644 --- a/lnst/Controller/SlavePool.py +++ b/lnst/Controller/SlavePool.py @@ -167,7 +167,7 @@ class SlavePool: return (None, None)
def _process_machine_xml_data(self, m_id, machine_xml_data): - machine_spec = {"interfaces": {}, "params":{}} + machine_spec = {"interfaces": {}, "params":{}, "security": {}}
# process parameters if "params" in machine_xml_data: @@ -205,6 +205,8 @@ class SlavePool: % m_id raise SlaveMachineError(msg, machine_xml_data)
+ machine_spec["security"] = machine_xml_data["security"] + return machine_spec
def _process_iface_xml_data(self, m_id, iface): @@ -304,7 +306,7 @@ class SlavePool: if "rpc_port" in pm["params"]: rpcport = pm["params"]["rpc_port"]
- machine = Machine(tm_id, hostname, None, rpcport) + machine = Machine(tm_id, hostname, None, rpcport, pm["security"])
used = [] if_map = self._map["machines"][tm_id]["interfaces"] @@ -340,7 +342,8 @@ class SlavePool: if "rpc_port" in pm["params"]: rpcport = pm["params"]["rpc_port"]
- machine = Machine(tm_id, hostname, libvirt_domain, rpcport) + machine = Machine(tm_id, hostname, libvirt_domain, rpcport, + pm["security"])
# make all the existing unused for if_id, if_data in pm["interfaces"].iteritems():