XenServer has released os-xenapi lib on pypi, this patch is to
use os-xenapi in nova project. In this patch, we only change
the usage of XenAPI to os-xenapi and fix unit tests. In the next
patch, we will delete those unused files.
Partially-Implements: blueprint add-os-xenapi-library
Depends-On: Ic327135b893a77672fd42af919f47f181e932773
Change-Id: I424dfcd507c4b7fbeea5245cc1c234dec01d5781
This also mocks out CellMapping.get_by_uuid() as well as the hostmapping
to fool the compute api changes (and any others) that come later.
Change-Id: Id94c0ed0913d0ce6d8ff598c670af4da0e58e968
The hypervisors sample tests hard code the service id in the templates,
which can vary (and will in a subsequent patch). This makes it parameterized
so that it doesn't obsess over the actual value.
Change-Id: I28ae3eb14aa1630deaf6f943c9ad78dc3c36c7b3
A compute node record is created in the database from the
_init_compute_node method in the resource tracker in the
nova-compute service. It is created without the updated_at
or free_disk_gb fields being set.
Shortly after it's created, update_resource_stats() is called
on the scheduler report client which calls compute_node.save()
which calls the update_compute_node() method in the DB API which
*always* updates the updated_at field even if nothing else
was changed.
So at this point, we have a compute node with updated_at set
but not free_disk_gb. The free_disk_gb field gets set by the
_update_usage_from_instances() method in the resource tracker
and then that value is later saved off when the compute node
is updated in the database on a second call to the
update_resource_stats() method in the scheduler report client.
At that point the free_disk_gb field is set on the compute
node record.
There is a race in between the compute node create and initial
update but before free_disk_gb is set where the scheduler host
manager can be attempting to update the HostState object from
the same compute node when selecting host destinations during
a server build. If that picks up the compute node before its
free_disk_gb field is set it will result in a TypeError when
trying to multiply None * 1024.
Change 36a0ba9c81 was an earlier
attempt at fixing this bug and shortened the race window but
didn't handle the problem where updated_at is set but free_disk_gb
is not yet.
This change builds on that by simply checking for the thing
the scheduler host manager actually cares about, which is the
free_disk_gb field.
Closes-Bug: #1654102
Closes-Bug: #1610679
Change-Id: I37b75dabb3ea7ec2d5678550d9aff30b1a0c29e6
This fixes one of those cases where "visual" indentation results in
legal, but very ugly Python, as it makes the continued line indented to
the same level as the block below it. Indentation has semantic meaning
in Python, so two adjacent lines in different blocks should never be
indented to the same level.
Change-Id: I6014980d3aebcac60979852f6d571146d7b47042
this schema tells us host is required
https://github.com/openstack/nova/blob/master/nova/api/
openstack/compute/schemas/migrate_server.py#L33
and also param say it's required, but the doc says 'if you omit'
will misleading user ,actually, user can't omit it, they need
to input null to let scheduler decide
Implements: blueprint api-ref-in-rst-ocata
Change-Id: I2661c85f32eff8e199856635a4c40a494a5decb6
This test was previously mocking the keystoneauth1
loading code globally which was getting randomly
trampled by other tests that were mocking the
same thing.
This changes the scope on the mock so it should be
isolated from other tests mocking out the same thing.
Change-Id: Id6c35c583edf0938b5d0178ab2cfb54277f0225f
Closes-Bug: #1654393
The typo meant that the intended non global config was not being
used, and instead the config was loaded in the normal way. This
worked because the config loaded by the project name is the same
as the config loaded otherwise.
There's no test coverage of this in unit and functional tests
because the NoAuthMiddleware is always used based on overridden
configuration. The gate tests that turn on placement will exercise
this code.
Change-Id: I9f1b8905fd9d5aadac61718e24c76b1b2f80410d
Closes-Bug: #1645306
In a new 1.3 microversion, the GET /resource_providers handler gains
support for a new query parameter 'member_of' which takes a value of
'in:' and a comma separated list of aggregate uuids, or a single
aggregate uuid.
The response is the list of resource providers that are associated
with any of those aggregates, or an empty list if there are none.
If in an old microversion, the query parameter is not accepted and a
400 is returned.
Change-Id: I82fc2003ce85dcadfecfea506e7d4adb47258c7a
Adds a Compute API microversion that triggers returning an aggregate's UUID
field. This field is necessary for scripts that must populate the placement API
with resource provider to aggregate relationships, which rely on UUIDs for
global identification.
APIImpact
blueprint: return-uuid-from-os-aggregates-api
Change-Id: I4112ccd508eb85403933fec8b52efd468e866772
Closes-bug: #1652642