diff options
| author | Todd Willey <todd@ansolabs.com> | 2011-06-01 19:44:01 -0400 |
|---|---|---|
| committer | Todd Willey <todd@ansolabs.com> | 2011-06-01 19:44:01 -0400 |
| commit | 5c187a17216b76d730c3dcf983f905d2b5ce1bd9 (patch) | |
| tree | 2136b5a09676ab57b67fec842b47757a52c2906e /nova/virt | |
| parent | 2c1dd72060fccbe7f32a6aa08c1ce67476806680 (diff) | |
| parent | 78093e8101d1981fc1fbafc963023bc70ad6b3b6 (diff) | |
Merge trunk.
Diffstat (limited to 'nova/virt')
| -rw-r--r-- | nova/virt/fake.py | 23 | ||||
| -rw-r--r-- | nova/virt/libvirt/connection.py | 16 |
2 files changed, 35 insertions, 4 deletions
diff --git a/nova/virt/fake.py b/nova/virt/fake.py index 970434c6c..7d12e3d7b 100644 --- a/nova/virt/fake.py +++ b/nova/virt/fake.py @@ -82,6 +82,21 @@ class FakeConnection(driver.ComputeDriver): def __init__(self): self.instances = {} + self.host_status = { + 'host_name-description': 'Fake Host', + 'host_hostname': 'fake-mini', + 'host_memory_total': 8000000000, + 'host_memory_overhead': 10000000, + 'host_memory_free': 7900000000, + 'host_memory_free_computed': 7900000000, + 'host_other_config': {}, + 'host_ip_address': '192.168.1.109', + 'host_cpu_info': {}, + 'disk_available': 500000000000, + 'disk_total': 600000000000, + 'disk_used': 100000000000, + 'host_uuid': 'cedb9b39-9388-41df-8891-c5c9a0c0fe5f', + 'host_name_label': 'fake-mini'} @classmethod def instance(cls): @@ -472,3 +487,11 @@ class FakeConnection(driver.ComputeDriver): def test_remove_vm(self, instance_name): """ Removes the named VM, as if it crashed. For testing""" self.instances.pop(instance_name) + + def update_host_status(self): + """Return fake Host Status of ram, disk, network.""" + return self.host_status + + def get_host_stats(self, refresh=False): + """Return fake Host Status of ram, disk, network.""" + return self.host_status diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py index 178ea0048..3d9a488a1 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py @@ -488,19 +488,27 @@ class LibvirtConnection(driver.ComputeDriver): @exception.wrap_exception def pause(self, instance, callback): - raise exception.ApiError("pause not supported for libvirt.") + """Pause VM instance""" + dom = self._lookup_by_name(instance.name) + dom.suspend() @exception.wrap_exception def unpause(self, instance, callback): - raise exception.ApiError("unpause not supported for libvirt.") + """Unpause paused VM instance""" + dom = self._lookup_by_name(instance.name) + dom.resume() @exception.wrap_exception def suspend(self, instance, callback): - raise exception.ApiError("suspend not supported for libvirt") + """Suspend the specified instance""" + dom = self._lookup_by_name(instance.name) + dom.managedSave(0) @exception.wrap_exception def resume(self, instance, callback): - raise exception.ApiError("resume not supported for libvirt") + """resume the specified instance""" + dom = self._lookup_by_name(instance.name) + dom.create() @exception.wrap_exception def rescue(self, instance): |
