~tr3buchet/nova/lock

« back to all changes in this revision

Viewing changes to nova/scheduler/simple.py

  • Committer: Vishvananda Ishaya
  • Date: 2010-12-22 20:59:53 UTC
  • mto: This revision was merged to the branch mainline in revision 482.
  • Revision ID: vishvananda@gmail.com-20101222205953-j2j5t0qjwlcd0t2s
merge trunk and upgrade to cheetah templating

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
        for result in results:
48
48
            (service, instance_cores) = result
49
49
            if instance_cores + instance_ref['vcpus'] > FLAGS.max_cores:
50
 
                raise driver.NoValidHost("All hosts have too many cores")
 
50
                raise driver.NoValidHost(_("All hosts have too many cores"))
51
51
            if self.service_is_up(service):
52
52
                # NOTE(vish): this probably belongs in the manager, if we
53
53
                #             can generalize this somehow
57
57
                                   {'host': service['host'],
58
58
                                    'scheduled_at': now})
59
59
                return service['host']
60
 
        raise driver.NoValidHost("No hosts found")
 
60
        raise driver.NoValidHost(_("No hosts found"))
61
61
 
62
62
    def schedule_create_volume(self, context, volume_id, *_args, **_kwargs):
63
63
        """Picks a host that is up and has the fewest volumes."""
66
66
        for result in results:
67
67
            (service, volume_gigabytes) = result
68
68
            if volume_gigabytes + volume_ref['size'] > FLAGS.max_gigabytes:
69
 
                raise driver.NoValidHost("All hosts have too many gigabytes")
 
69
                raise driver.NoValidHost(_("All hosts have too many "
 
70
                                           "gigabytes"))
70
71
            if self.service_is_up(service):
71
72
                # NOTE(vish): this probably belongs in the manager, if we
72
73
                #             can generalize this somehow
76
77
                                 {'host': service['host'],
77
78
                                  'scheduled_at': now})
78
79
                return service['host']
79
 
        raise driver.NoValidHost("No hosts found")
 
80
        raise driver.NoValidHost(_("No hosts found"))
80
81
 
81
82
    def schedule_set_network_host(self, context, *_args, **_kwargs):
82
83
        """Picks a host that is up and has the fewest networks."""
85
86
        for result in results:
86
87
            (service, instance_count) = result
87
88
            if instance_count >= FLAGS.max_networks:
88
 
                raise driver.NoValidHost("All hosts have too many networks")
 
89
                raise driver.NoValidHost(_("All hosts have too many networks"))
89
90
            if self.service_is_up(service):
90
91
                return service['host']
91
 
        raise driver.NoValidHost("No hosts found")
 
92
        raise driver.NoValidHost(_("No hosts found"))