1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
3
# Copyright (c) 2012 NTT DOCOMO, INC.
4
# Copyright (c) 2011 University of Southern California / ISI
7
# Licensed under the Apache License, Version 2.0 (the "License"); you may
8
# not use this file except in compliance with the License. You may obtain
9
# a copy of the License at
11
# http://www.apache.org/licenses/LICENSE-2.0
13
# Unless required by applicable law or agreed to in writing, software
14
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
# License for the specific language governing permissions and limitations
19
from nova.virt.baremetal import baremetal_states
22
class NodeDriver(object):
27
def cache_images(self, context, node, instance, **kwargs):
28
raise NotImplementedError()
30
def destroy_images(self, context, node, instance):
31
raise NotImplementedError()
33
def activate_bootloader(self, context, node, instance):
34
raise NotImplementedError()
36
def deactivate_bootloader(self, context, node, instance):
37
raise NotImplementedError()
39
def activate_node(self, context, node, instance):
40
"""For operations after power on."""
41
raise NotImplementedError()
43
def deactivate_node(self, context, node, instance):
44
"""For operations before power off."""
45
raise NotImplementedError()
47
def get_console_output(self, node, instance):
48
raise NotImplementedError()
51
class PowerManager(object):
53
def __init__(self, **kwargs):
54
self.state = baremetal_states.DELETED
57
def activate_node(self):
58
self.state = baremetal_states.ACTIVE
61
def reboot_node(self):
62
self.state = baremetal_states.ACTIVE
65
def deactivate_node(self):
66
self.state = baremetal_states.DELETED
69
def is_power_on(self):
70
"""Returns True or False according as the node's power state"""
73
# TODO(NTTdocomo): split out console methods to its own class
74
def start_console(self):
77
def stop_console(self):