Files
ironic/ironic/drivers/pxe.py
Devananda van der Veen 59d5bea14a Restructuring driver API and inheritance.
Based on discussions during and after the Ironic team meeting on June
03, regarding support for substantially different driver work flows,
this is a re-working of the internal driver API.

tl;dr: The strict separation of "control" and "deploy" driver was an
       artefact of the ipmi + pxe implementation used in nova-baremetal,
       and does not map on to all drivers. Furthermore, the prior
       implementation did not accurately represent the separation of
       "core", "standard", and "vendor-specific" driver functionality.

These changes impact the v1 API structure, but since that is largely not
implemented yet, this change does not attempt to affect the public API
itself.

Highlights:
- No more deploy + control driver; nodes have one and only one driver.
  This drops the deploy_driver and deploy_info parameters,
  and renames control_driver -> driver, and control_info -> driver_info.
- Interfaces for core, standard, and vendor functionality now clearly
  defined in the driver API.
- Improve Fake driver to demonstrate use of interfaces.
- Convert IPMI and SSH driver classes into interfaces, and move to
  drivers/modules/ directory.
- Stub for the pxe interfaces.
- Stub implementations of pxe+ipmi and pxe+ssh drivers.
- driver_info field uses more standard names, but requires
  driver-specific data to be in a nested object. Examples in
  tests/db/utils.py as before.

A separate doc change will follow this to update the API v1 spec.

Also includes some cosmetic cleanup of test_ssh.py and test_ipmi.py.

Change-Id: I057ede8e07b1b57010e81ef58415debe0ba8b934
2013-06-11 17:12:21 -07:00

60 lines
2.0 KiB
Python

# vim: tabstop=4 shiftwidth=4 softtabstop=4
# -*- encoding: utf-8 -*-
#
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
PXE Driver and supporting meta-classes.
"""
from ironic.drivers import base
from ironic.drivers.modules import ipmi
from ironic.drivers.modules import pxe
from ironic.drivers.modules import ssh
class PXEAndIPMIDriver(base.BaseDriver):
"""PXE + IPMI driver.
This driver implements the `core` functionality, combinding
:class:ironic.drivers.ipmi.IPMI for power on/off and reboot with
:class:ironic.driver.pxe.PXE for image deployment. Implementations are in
those respective classes; this class is merely the glue between them.
"""
def __init__(self):
self.power = ipmi.IPMIPower()
self.deploy = pxe.PXEDeploy()
self.rescue = self.deploy
self.vendor = pxe.IPMIVendorPassthru()
class PXEAndSSHDriver(base.BaseDriver):
"""PXE + SSH driver.
NOTE: This driver is meant only for testing environments.
This driver implements the `core` functionality, combinding
:class:ironic.drivers.ssh.SSH for power on/off and reboot of virtual
machines tunneled over SSH, with :class:ironic.driver.pxe.PXE for image
deployment. Implementations are in those respective classes; this class is
merely the glue between them.
"""
def __init__(self):
self.power = ssh.SSHPower()
self.deploy = pxe.PXEDeploy()
self.rescue = self.deploy
self.vendor = None