diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-06-13 01:17:59 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-06-13 01:17:59 +0000 |
| commit | ba876e2a110f39270a5cf57c5197083088736d32 (patch) | |
| tree | 055ae95d125302ab6f1f76e6c69c1b2433c872c6 | |
| parent | 6a550ad22a271b736c61664f23a1e2fe5b387831 (diff) | |
| parent | d431218f6aaae4541bd75e1a04a83e06f43e15bd (diff) | |
Merge "Make xenapi use Instance object for host_maintenance_mode()"
| -rw-r--r-- | nova/virt/xenapi/host.py | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/nova/virt/xenapi/host.py b/nova/virt/xenapi/host.py index 5fa2b55db..31854696f 100644 --- a/nova/virt/xenapi/host.py +++ b/nova/virt/xenapi/host.py @@ -72,7 +72,7 @@ class Host(object): ' ping migration to a new host') LOG.info(msg % locals()) continue - instance = self._virtapi.instance_get_by_uuid(ctxt, uuid) + instance = instance_obj.Instance.get_by_uuid(ctxt, uuid) vm_counter = vm_counter + 1 aggregate = self._virtapi.aggregate_get_by_host( @@ -84,27 +84,24 @@ class Host(object): dest = _host_find(ctxt, self._session, aggregate[0], host_ref) - self._virtapi.instance_update( - ctxt, instance['uuid'], - {'host': dest, - 'task_state': task_states.MIGRATING}) + instance.host = dest + instance.task_state = task_states.MIGRATING + instance.save() self._session.call_xenapi('VM.pool_migrate', vm_ref, host_ref, {}) migrations_counter = migrations_counter + 1 - self._virtapi.instance_update( - ctxt, instance['uuid'], - {'vm_state': vm_states.ACTIVE}) + instance.vm_state = vm_states.ACTIVE + instance.save() break except self._session.XenAPI.Failure: LOG.exception(_('Unable to migrate VM %(vm_ref)s' 'from %(host)s') % locals()) - self._virtapi.instance_update( - ctxt, instance['uuid'], - {'host': host, - 'vm_state': vm_states.ACTIVE}) + instance.host = host + instance.vm_state = vm_states.ACTIVE + instance.save() if vm_counter == migrations_counter: return 'on_maintenance' |
