diff options
Diffstat (limited to 'fuel/deploy/dha.py')
-rw-r--r-- | fuel/deploy/dha.py | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/fuel/deploy/dha.py b/fuel/deploy/dha.py index f78686b..87ac6e2 100644 --- a/fuel/deploy/dha.py +++ b/fuel/deploy/dha.py @@ -1,26 +1,36 @@ +from hardware_adapters.hp.hp_adapter import HpAdapter class DeploymentHardwareAdapter(object): - def __new__(cls, server_type): + def __new__(cls, server_type, *args): if cls is DeploymentHardwareAdapter: - if server_type == 'esxi': return EsxiAdapter() - if server_type == 'hp': return HpAdapter() - if server_type == 'dell': return DellAdapter() - if server_type == 'libvirt': return LibvirtAdapter() + if server_type == 'esxi': return EsxiAdapter(*args) + if server_type == 'hp': return HpAdapter(*args) + if server_type == 'dell': return DellAdapter(*args) + if server_type == 'libvirt': return LibvirtAdapter(*args) return super(DeploymentHardwareAdapter, cls).__new__(cls) class HardwareAdapter(object): - def power_off_blades(self): + def power_off_blades(self, shelf, blade_list): raise NotImplementedError - def power_on_blades(self): + def power_off_blade(self, shelf, blade): + raise NotImplementedError + + def power_on_blades(self, shelf, blade_list): + raise NotImplementedError + + def power_on_blade(self, shelf, blade): raise NotImplementedError def power_cycle_blade(self): raise NotImplementedError - def set_boot_order(self): + def set_boot_order_blades(self, shelf, blade_list): + raise NotImplementedError + + def set_boot_order_blade(self, shelf, blade): raise NotImplementedError def reset_to_factory_defaults(self): @@ -29,20 +39,23 @@ class HardwareAdapter(object): def configure_networking(self): raise NotImplementedError - def get_blade_mac_addresses(self, shelf_id, blade_id): + def get_blade_mac_addresses(self, shelf, blade): raise NotImplementedError - def get_blade_hardware_info(self, shelf_id, blade_id): + def get_hardware_info(self, shelf, blade): raise NotImplementedError class EsxiAdapter(HardwareAdapter): - pass -class LibvirtAdapter(HardwareAdapter): - pass + def __init__(self): + self.environment = {1: {1: {'mac': ['00:50:56:8c:05:85']}, + 2: {'mac': ['00:50:56:8c:21:92']}}} -class HpAdapter(HardwareAdapter): + def get_blade_mac_addresses(self, shelf, blade): + return self.environment[shelf][blade]['mac'] + +class LibvirtAdapter(HardwareAdapter): pass class DellAdapter(HardwareAdapter): |