https://codereview.appspot.com/6421053/diff/1/juju/providers/common/instance_type.py#newcode25
juju/providers/common/instance_type.py:25: def _solve(self,
constraints):
Not that it really matters given the small number of flavors generally,
but all this faffing around with filters seems complicated given these
constraints have order, and sort/bisect would work just as well.
https://codereview.appspot.com/6421053/diff/1/juju/providers/openstack/provider.py#newcode67
juju/providers/openstack/provider.py:67: # Fetch provider defined
instance types (just names)
I'd prefer if this created a provider instance shared store of flavor
information, that launch then accessed to resolve its constraints. Would
mean one list_flavor_detail call rather than one or two per launch, and
would also tie flavor business into a single class.
Generic whine about mixing imports rearrangement into a code change that
needs review, could easily have been a separate branch to make life
easier.
https:/ /codereview. appspot. com/6421053/ diff/1/ juju/providers/ common/ instance_ type.py common/ instance_ type.py (right):
File juju/providers/
https:/ /codereview. appspot. com/6421053/ diff/1/ juju/providers/ common/ instance_ type.py# newcode25 common/ instance_ type.py: 25: def _solve(self,
juju/providers/
constraints):
Not that it really matters given the small number of flavors generally,
but all this faffing around with filters seems complicated given these
constraints have order, and sort/bisect would work just as well.
https:/ /codereview. appspot. com/6421053/ diff/1/ juju/providers/ common/ instance_ type.py# newcode35 common/ instance_ type.py: 35: key=lambda x: types[x] .cpu)[0] types.sort( ); return possible_types[0]` which
juju/providers/
self._instance_
Instead just do `possible_
would give a deterministic result for instances with same cpu but
different mem as well?
https:/ /codereview. appspot. com/6421053/ diff/1/ juju/providers/ openstack/ client. py openstack/ client. py (right):
File juju/providers/
https:/ /codereview. appspot. com/6421053/ diff/1/ juju/providers/ openstack/ client. py#newcode321 openstack/ client. py:321: def list_flavors_ details( self):
juju/providers/
Rename to list_flavor_detail so it's the same form as the others and the
url.
https:/ /codereview. appspot. com/6421053/ diff/1/ juju/providers/ openstack/ launch. py openstack/ launch. py (right):
File juju/providers/
https:/ /codereview. appspot. com/6421053/ diff/1/ juju/providers/ openstack/ launch. py#newcode84 openstack/ launch. py:84: flavors = yield nova.list_ flavors_ details( ) details -> list_flavors_ detail.
juju/providers/
self._provider.
Rename list_flavors_
https:/ /codereview. appspot. com/6421053/ diff/1/ juju/providers/ openstack/ launch. py#newcode120 openstack/ launch. py:120: def _solve_flavor(self,
juju/providers/
flavor_name, flavors):
Private helper isn't related to launch and doesn't use self. I'd make it
a function rather than a method if we're not going down the route of an
interface on the provider.
https:/ /codereview. appspot. com/6421053/ diff/1/ juju/providers/ openstack/ provider. py openstack/ provider. py (right):
File juju/providers/
https:/ /codereview. appspot. com/6421053/ diff/1/ juju/providers/ openstack/ provider. py#newcode67 openstack/ provider. py:67: # Fetch provider defined
juju/providers/
instance types (just names)
I'd prefer if this created a provider instance shared store of flavor
information, that launch then accessed to resolve its constraints. Would
mean one list_flavor_detail call rather than one or two per launch, and
would also tie flavor business into a single class.
https:/ /codereview. appspot. com/6421053/ diff/1/ juju/providers/ openstack/ tests/test_ launch. py openstack/ tests/test_ launch. py (right):
File juju/providers/
https:/ /codereview. appspot. com/6421053/ diff/1/ juju/providers/ openstack/ tests/test_ launch. py#newcode30 openstack/ tests/test_ launch. py:30: list_flavors_ details( ) details -> list_flavors_ detail.
juju/providers/
self.nova.
Rename list_flavors_
https:/ /codereview. appspot. com/6421053/