~midokura/nova/midostack-oneiric

« back to all changes in this revision

Viewing changes to nova/scheduler/driver.py

  • Committer: Tarmac
  • Author(s): Yuriy Taraday
  • Date: 2011-06-30 15:37:58 UTC
  • mfrom: (1188.4.5 hostname-fix)
  • Revision ID: tarmac-20110630153758-anvaapptx9f8ygan
Theese changes eliminate dependancy between hostname and ec2-id.
As I understand, there already were no such dependancy, but still we had confusing names in code.
Also I added more sophisticated generation of default hostname to give user possibility to set the custom one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
        # Checking instance is running.
130
130
        if (power_state.RUNNING != instance_ref['state'] or \
131
131
           'running' != instance_ref['state_description']):
132
 
            ec2_id = instance_ref['hostname']
133
 
            raise exception.InstanceNotRunning(instance_id=ec2_id)
 
132
            raise exception.InstanceNotRunning(instance_id=instance_ref['id'])
134
133
 
135
134
        # Checing volume node is running when any volumes are mounted
136
135
        # to the instance.
168
167
        # and dest is not same.
169
168
        src = instance_ref['host']
170
169
        if dest == src:
171
 
            ec2_id = instance_ref['hostname']
172
 
            raise exception.UnableToMigrateToSelf(instance_id=ec2_id,
173
 
                                                  host=dest)
 
170
            raise exception.UnableToMigrateToSelf(
 
171
                    instance_id=instance_ref['id'],
 
172
                    host=dest)
174
173
 
175
174
        # Checking dst host still has enough capacities.
176
175
        self.assert_compute_node_has_enough_resources(context,
245
244
        """
246
245
 
247
246
        # Getting instance information
248
 
        ec2_id = instance_ref['hostname']
 
247
        hostname = instance_ref['hostname']
249
248
 
250
249
        # Getting host information
251
250
        service_refs = db.service_get_all_compute_by_host(context, dest)
256
255
        mem_avail = mem_total - mem_used
257
256
        mem_inst = instance_ref['memory_mb']
258
257
        if mem_avail <= mem_inst:
259
 
            reason = _("Unable to migrate %(ec2_id)s to destination: %(dest)s "
260
 
                       "(host:%(mem_avail)s <= instance:%(mem_inst)s)")
 
258
            reason = _("Unable to migrate %(hostname)s to destination: "
 
259
                       "%(dest)s (host:%(mem_avail)s <= instance:"
 
260
                       "%(mem_inst)s)")
261
261
            raise exception.MigrationError(reason=reason % locals())
262
262
 
263
263
    def mounted_on_same_shared_storage(self, context, instance_ref, dest):