diff options
| author | Ewan Mellor <ewan.mellor@citrix.com> | 2011-08-29 17:11:41 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-08-29 17:11:41 +0000 |
| commit | cff35e4bc169d3d011aa3b32f3812ec21455b365 (patch) | |
| tree | f6876cd650f38de2eb3d2abaa83545621dc74e39 | |
| parent | e103b1c471d1f507075542b795d8620a89132de9 (diff) | |
| parent | c35086ca2d2ac1a519442217bf89c0572b28053b (diff) | |
In the XenAPI simulator, set VM.domid, when creating the instance initially,
and when starting the VM.
This shows up in the logs for Bug #831599, but this fix doesn't actually
fix the hang.
| -rw-r--r-- | nova/tests/xenapi/stubs.py | 4 | ||||
| -rw-r--r-- | nova/virt/xenapi/fake.py | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/nova/tests/xenapi/stubs.py b/nova/tests/xenapi/stubs.py index a6a1febd6..647a4c1df 100644 --- a/nova/tests/xenapi/stubs.py +++ b/nova/tests/xenapi/stubs.py @@ -18,6 +18,8 @@ import eventlet import json +import random + from nova.virt import xenapi_conn from nova.virt.xenapi import fake from nova.virt.xenapi import volume_utils @@ -191,6 +193,7 @@ class FakeSessionForVMTests(fake.SessionBase): vm['power_state'] = 'Running' vm['is_a_template'] = False vm['is_control_domain'] = False + vm['domid'] = random.randrange(1, 1 << 16) def VM_snapshot(self, session_ref, vm_ref, label): status = "Running" @@ -290,6 +293,7 @@ class FakeSessionForMigrationTests(fake.SessionBase): vm['power_state'] = 'Running' vm['is_a_template'] = False vm['is_control_domain'] = False + vm['domid'] = random.randrange(1, 1 << 16) def stub_out_migration_methods(stubs): diff --git a/nova/virt/xenapi/fake.py b/nova/virt/xenapi/fake.py index 7c91aa9b9..97dfd9fa9 100644 --- a/nova/virt/xenapi/fake.py +++ b/nova/virt/xenapi/fake.py @@ -51,6 +51,7 @@ A fake XenAPI SDK. """ +import random import uuid from pprint import pformat @@ -103,8 +104,10 @@ def create_network(name_label, bridge): def create_vm(name_label, status, is_a_template=False, is_control_domain=False): + domid = status == 'Running' and random.randrange(1, 1 << 16) or -1 return _create_object('VM', {'name_label': name_label, + 'domid': domid, 'power-state': status, 'is_a_template': is_a_template, 'is_control_domain': is_control_domain}) |
