blueprint host-aggregates: improvements and clean-up

This changeset addresses a number of issues found during testing:

- avoid name conflicts during aggregate creation (see db/* changes)
- avoid masking of XenAPI.Failure if pool-join fails (see plugins/* changes)
- preserve VM placement decisions made during scheduling (see xenapi/vmops.py)
- ensure plugins are called on the right hosts in XS pools (see xenapi_con.py)
- stores master uuid in aggregate metadata for use in VM live migration and
  raise InvalidAction rather than Aggregate error if we attempt to remove
  a mster (see xenapi/pool.py and compute/manager.py)
- clean-up of unit tests

Change-Id: I881a94d87efe1e81bd4f86667e75f5cbee50ce91
This commit is contained in:
Armando Migliaccio
2012-02-15 21:17:06 +00:00
parent ae99fe81f5
commit 424de7eea2
10 changed files with 119 additions and 37 deletions

View File

@@ -202,6 +202,12 @@ class FakeSessionForVMTests(fake.SessionBase):
vm['is_a_template'] = False
vm['is_control_domain'] = False
vm['domid'] = random.randrange(1, 1 << 16)
return vm
def VM_start_on(self, _1, vm_ref, host_ref, _2, _3):
vm_rec = self.VM_start(_1, vm_ref, _2, _3)
host_rec = fake.get_record('host', host_ref)
vm_rec['resident_on'] = host_rec['uuid']
def VM_snapshot(self, session_ref, vm_ref, label):
status = "Running"
@@ -334,7 +340,7 @@ class FakeSessionForVolumeFailedTests(FakeSessionForVolumeTests):
pass
class FakeSessionForMigrationTests(fake.SessionBase):
class FakeSessionForMigrationTests(FakeSessionForVMTests):
"""Stubs out a XenAPISession for Migration tests"""
def __init__(self, uri):
super(FakeSessionForMigrationTests, self).__init__(uri)
@@ -342,16 +348,6 @@ class FakeSessionForMigrationTests(fake.SessionBase):
def VDI_get_by_uuid(self, *args):
return 'hurr'
def VM_start(self, _1, ref, _2, _3):
vm = fake.get_record('VM', ref)
if vm['power_state'] != 'Halted':
raise fake.Failure(['VM_BAD_POWER_STATE', ref, 'Halted',
vm['power_state']])
vm['power_state'] = 'Running'
vm['is_a_template'] = False
vm['is_control_domain'] = False
vm['domid'] = random.randrange(1, 1 << 16)
def VM_set_name_label(self, *args):
pass