~rlane/nova/ldapimprovements

« back to all changes in this revision

Viewing changes to nova/virt/fake.py

  • Committer: Ryan Lane
  • Date: 2010-11-24 15:46:32 UTC
  • mfrom: (382.48.1 trunk)
  • Revision ID: laner@controller-20101124154632-zh7kwjuyyd02a2lh
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#    under the License.
19
19
 
20
20
"""
21
 
A fake (in-memory) hypervisor+api. Allows nova testing w/o a hypervisor.
22
 
This module also documents the semantics of real hypervisor connections.
 
21
A fake (in-memory) hypervisor+api.
 
22
 
 
23
Allows nova testing w/o a hypervisor.  This module also documents the
 
24
semantics of real hypervisor connections.
 
25
 
23
26
"""
24
27
 
25
 
import logging
26
 
 
27
28
from twisted.internet import defer
28
29
 
 
30
from nova import exception
29
31
from nova.compute import power_state
30
32
 
31
33
 
119
121
        """
120
122
        return defer.succeed(None)
121
123
 
 
124
    def rescue(self, instance):
 
125
        """
 
126
        Rescue the specified instance.
 
127
        """
 
128
        return defer.succeed(None)
 
129
 
 
130
    def unrescue(self, instance):
 
131
        """
 
132
        Unrescue the specified instance.
 
133
        """
 
134
        return defer.succeed(None)
 
135
 
122
136
    def destroy(self, instance):
123
137
        """
124
138
        Destroy (shutdown and delete) the specified instance.
148
162
        current memory the instance has, in KiB, 'num_cpu': The current number
149
163
        of virtual CPUs the instance has, 'cpu_time': The total CPU time used
150
164
        by the instance, in nanoseconds.
 
165
 
 
166
        This method should raise exception.NotFound if the hypervisor has no
 
167
        knowledge of the instance
151
168
        """
 
169
        if instance_name not in self.instances:
 
170
            raise exception.NotFound("Instance %s Not Found" % instance_name)
152
171
        i = self.instances[instance_name]
153
172
        return {'state': i._state,
154
173
                'max_mem': 0,