diff options
| author | Ewan Mellor <ewan.mellor@citrix.com> | 2010-08-17 21:28:25 +0000 |
|---|---|---|
| committer | Tarmac <> | 2010-08-17 21:28:25 +0000 |
| commit | 1d47c190ea90ab34e98e7a76104f919d6bcd5be0 (patch) | |
| tree | 446ee46bef804e968f26cf9f573fd9d6d9eef60e | |
| parent | f87fb14dcbbe6c9e15c19a4ef37da4dc9c67943d (diff) | |
| parent | d1185adcf6f060c125274d31cf11a4f750521d24 (diff) | |
| download | nova-1d47c190ea90ab34e98e7a76104f919d6bcd5be0.tar.gz nova-1d47c190ea90ab34e98e7a76104f919d6bcd5be0.tar.xz nova-1d47c190ea90ab34e98e7a76104f919d6bcd5be0.zip | |
Add documentation to spawn, reboot, and destroy stating that those functions
should return Deferreds. Update the fake implementations to do so (the
libvirt ones already do, and making the xenapi ones do so is the subject of
a current merge request).
| -rw-r--r-- | nova/virt/fake.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/nova/virt/fake.py b/nova/virt/fake.py index 105837181..155833f3f 100644 --- a/nova/virt/fake.py +++ b/nova/virt/fake.py @@ -24,6 +24,8 @@ This module also documents the semantics of real hypervisor connections. import logging +from twisted.internet import defer + from nova.compute import power_state @@ -89,10 +91,13 @@ class FakeConnection(object): This function should use the data there to guide the creation of the new instance. - Once this function successfully completes, the instance should be + The work will be done asynchronously. This function returns a + Deferred that allows the caller to detect when it is complete. + + Once this successfully completes, the instance should be running (power_state.RUNNING). - If this function fails, any partial instance should be completely + If this fails, any partial instance should be completely cleaned up, and the virtualization platform should be in the state that it was before this call began. """ @@ -100,6 +105,7 @@ class FakeConnection(object): fake_instance = FakeInstance() self.instances[instance.name] = fake_instance fake_instance._state = power_state.RUNNING + return defer.succeed(None) def reboot(self, instance): """ @@ -107,8 +113,11 @@ class FakeConnection(object): The given parameter is an instance of nova.compute.service.Instance, and so the instance is being specified as instance.name. + + The work will be done asynchronously. This function returns a + Deferred that allows the caller to detect when it is complete. """ - pass + return defer.succeed(None) def destroy(self, instance): """ @@ -116,8 +125,12 @@ class FakeConnection(object): The given parameter is an instance of nova.compute.service.Instance, and so the instance is being specified as instance.name. + + The work will be done asynchronously. This function returns a + Deferred that allows the caller to detect when it is complete. """ del self.instances[instance.name] + return defer.succeed(None) def get_info(self, instance_id): """ |
