~ubuntu-branches/ubuntu/raring/nova/raring-proposed

« back to all changes in this revision

Viewing changes to nova/virt/baremetal/base.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2013-01-11 13:06:56 UTC
  • mto: This revision was merged to the branch mainline in revision 96.
  • Revision ID: package-import@ubuntu.com-20130111130656-z9mceux6qpkqomma
Tags: upstream-2013.1~g2
ImportĀ upstreamĀ versionĀ 2013.1~g2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
 
2
 
 
3
# Copyright (c) 2012 NTT DOCOMO, INC.
 
4
# Copyright (c) 2011 University of Southern California / ISI
 
5
# All Rights Reserved.
 
6
#
 
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
 
10
#
 
11
#         http://www.apache.org/licenses/LICENSE-2.0
 
12
#
 
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
 
17
#    under the License.
 
18
 
 
19
from nova.virt.baremetal import baremetal_states
 
20
 
 
21
 
 
22
class NodeDriver(object):
 
23
 
 
24
    def __init__(self):
 
25
        pass
 
26
 
 
27
    def cache_images(self, context, node, instance, **kwargs):
 
28
        raise NotImplementedError()
 
29
 
 
30
    def destroy_images(self, context, node, instance):
 
31
        raise NotImplementedError()
 
32
 
 
33
    def activate_bootloader(self, context, node, instance):
 
34
        raise NotImplementedError()
 
35
 
 
36
    def deactivate_bootloader(self, context, node, instance):
 
37
        raise NotImplementedError()
 
38
 
 
39
    def activate_node(self, context, node, instance):
 
40
        """For operations after power on."""
 
41
        raise NotImplementedError()
 
42
 
 
43
    def deactivate_node(self, context, node, instance):
 
44
        """For operations before power off."""
 
45
        raise NotImplementedError()
 
46
 
 
47
    def get_console_output(self, node, instance):
 
48
        raise NotImplementedError()
 
49
 
 
50
 
 
51
class PowerManager(object):
 
52
 
 
53
    def __init__(self, **kwargs):
 
54
        self.state = baremetal_states.DELETED
 
55
        pass
 
56
 
 
57
    def activate_node(self):
 
58
        self.state = baremetal_states.ACTIVE
 
59
        return self.state
 
60
 
 
61
    def reboot_node(self):
 
62
        self.state = baremetal_states.ACTIVE
 
63
        return self.state
 
64
 
 
65
    def deactivate_node(self):
 
66
        self.state = baremetal_states.DELETED
 
67
        return self.state
 
68
 
 
69
    def is_power_on(self):
 
70
        """Returns True or False according as the node's power state"""
 
71
        return True
 
72
 
 
73
    # TODO(NTTdocomo): split out console methods to its own class
 
74
    def start_console(self):
 
75
        pass
 
76
 
 
77
    def stop_console(self):
 
78
        pass