libvirt: add migration flag VIR_MIGRATE_PERSIST_DEST
This commit adds in the default migration flags
VIR_MIGRATE_PERSIST_DEST which ensures that the domain XML migrated is
going to be set in libvird on destination node.
Don't parse PCI whitelist every time neutron ports are created
The neutronv2 API is calling the method get_pci_device_devspec()
everytime a neutron port is created in order to get a PciDeviceSpec for a given
PCI device. This method creates a new Whitelist (based on the config
CONF.pci_passthrough_whitelist) and parses it every time it is called. This
is not a huge overhead but this is obvioulsy not needed and a waste of cycles.
Since only neutronv2 API uses get_pci_device_devspec(), this commit removes
the method in favor of using the Whitelist object directly (like it is done
in the PciDevTracker).
Jay Pipes [Fri, 14 Oct 2016 19:53:25 +0000 (15:53 -0400)]
placement: add ResourceClass and ResourceClassList
In preparation for the placement REST API getting CRUD operations on
resource classes, create ResourceClass and ResourceClassList objects.
In this patch, we only add a ResourceClassList.get_all() method that
merges the standardized resource classes with any custom resource
classes that might have been added to the resource_classes table.
Followup patches will add the create(), delete() and save() methods and
then finally the REST API changes.
Jay Pipes [Sun, 23 Oct 2016 08:58:25 +0000 (10:58 +0200)]
placement: raise exc when resource class not found
The ResourceProvider.set_inventory() method was not raising NotFound
when an Inventory object in the supplied InventoryList object was using
a resource class that did not exist in the resource class cache. This
patch fixes that by having the string_from_id() and id_from_string()
methods of the resource class cache raise ResourceClassNotFound instead
of returning None. We raise specific ResourceClassNotFound and
InventoryWithResourceClassNotFound exception subclasses to differentiate
in the inventory API handler between an unknown resource class and a
known resource class that doesn't exist in a given resource provider's
inventory.
We return a 400 Not Found when InventoryWithResourceClassNotFound is
raised on updating a single inventory, but return a 409 Conflict when
InventoryWithResourceClassNotFound is raised on updating a set of
inventory records since in the latter scenario, it represents a race
condition that frankly should not occur.
Jay Pipes [Thu, 3 Nov 2016 15:31:49 +0000 (11:31 -0400)]
fix connection context manager in rc cache
This patch changes the context manager call in the _refresh_from_db()
method from this:
with ctx.session.connection() as conn:
to this:
with db_api.api_context_manager.reader.connection.using(ctx):
This is necessary to prevent errors about using a closed connection that
surfaced when writing a functional test case that tested that deleting a
custom resource class when inventory is associated with that custom
resource class.
Moshe Levi [Tue, 13 Sep 2016 06:30:59 +0000 (09:30 +0300)]
pci: remove pci device from claims and allocations when freeing it
In drop_move_claim we call free pci device when we need to drop a
specific device from the src/dest node. This is done by calling
pci manager free_device. The current code just update the device
status to available in database but doesn't remove it from the
pci manager claims and allocations lists. This patch adds the
removal as well.
Ludovic Beliveau [Wed, 31 Aug 2016 18:27:43 +0000 (14:27 -0400)]
PCI: Fix PCI with fully qualified address
Specifying a PF passthrough device in the pci_passthrough_whitelist using its
fully qualified PCI address (no wildcard) causes the device to not be
properly loaded. The PCI device is then not available to be assigned to any
guest.
In this case, the hypervisor reports the PF device without a 'parent_addr'.
But in the PciAddress, match() is using it when doing the comparison to its
own address.
This commit changes the logic of the address matching method in PciDevSpec to
only try to match the address with a physical function device when a
'parent_addr' is reported by the hypervisor.
ChangBo Guo(gcb) [Fri, 12 Aug 2016 05:05:01 +0000 (13:05 +0800)]
Log warning when user set improper config option value
User may set wrong values for live migration related config options,
log warning when setting with wrong values, will use parameter min
of IntOpt to enforce these config options' values in Pike.
libvirt: fix incorrect host cpus giving to emulator threads when RT
Realtime guarantees in certain operating systems require that the
thread that is running the QEMU emulator is pinned to a physical CPU
that is *not* the same as any physical CPU that the vCPUs for a
realtime guest are pinned to. This patch ensures that the value of the
hw:cpu_realtime_mask flavor extraspec property is respected when
creating the libvirt configuration XML and sets emulatorpin values to
a physical CPU matching the hw:cpu_realtime_mask value.
Matt Riedemann [Tue, 1 Nov 2016 21:39:17 +0000 (17:39 -0400)]
api-ref: document the power_state enum values
The OS-EXT-STS:power_state attribute in a server GET response
is enum values which are meaningless unless you look at the
nova/compute/power_states.py code. This change adds a mapping
to the description on that field in the api-ref.
Note there are gaps in the sequence, those are for unused values
as seen in the nova.objects.fields.InstancePowerState class.
Matthew Booth [Tue, 1 Nov 2016 16:25:01 +0000 (16:25 +0000)]
libvirt: Pass Host instead of Driver to volume drivers
We were initialising libvirt volume drivers by passing the
LibvirtDriver object. However, this is only ever used to fetch the
Host. We update the interface to pass the Host instead. This is
cleaner, but also better represents the intent of the interface. They
should not be able to access arbitrary attributes of the LibvirtDriver
object.
dineshbhor [Tue, 1 Nov 2016 11:37:50 +0000 (17:07 +0530)]
Remove unreachable code
If the host list from database is empty compute_node_get_all_by_host()
db api itself raises ComputeHostNotFound exception. There is no need to
check for empty list and raise ComputeHostNotFound exception explicitly.
Diana Clarke [Fri, 28 Oct 2016 14:56:17 +0000 (10:56 -0400)]
Fix database poison warnings, part 24
The following warning appears in the unit test logs a number of times.
"UserWarning: This test uses methods that set internal oslo_db
state, but it does not claim to use the database. This will conflict
with the setup of tests that do use the database and cause failures
later."
This patch fixes all the warnings (7 new ones) from:
unit.compute.test_compute_mgr.py
Note that this warning is only emitted once per unit test worker, so new
offenders will show up in the logs each time you fix a test until they
are all gone.
Diana Clarke [Fri, 28 Oct 2016 13:31:13 +0000 (09:31 -0400)]
Fix database poison warnings, part 23
The following warning appears in the unit test logs a number of times.
"UserWarning: This test uses methods that set internal oslo_db
state, but it does not claim to use the database. This will conflict
with the setup of tests that do use the database and cause failures
later."
This patch fixes all the warnings (12 new ones) from:
nova.tests.unit.virt.ironic.test_driver.py
Note that this warning is only emitted once per unit test worker, so new
offenders will show up in the logs each time you fix a test until they
are all gone.
Matt Riedemann [Wed, 26 Oct 2016 10:23:42 +0000 (06:23 -0400)]
Make build_requests.instance MediumText
The build_requests.instance column is a serialized
instance object, and the instances.user_data column
is MediumText, so the build_requests.instance column
itself needs to be at least MediumText in size for MySQL.
The instance.resume.start and instance.resume.end notifications
are transformed to the versioned framework using the generic
InstanceActionNotification and InstanceActionPayload class.
Implements: bp versioned-notification-transformation-ocata
Diana Clarke [Mon, 24 Oct 2016 17:23:14 +0000 (13:23 -0400)]
Fix exception raised in exception wrapper
In some cases the exception wrapper can't find the module name for a
traceback (like lxml c extensions), resulting in an exception from
inspect.getmodule(). Just set the module name to 'unknown' in these
cases.
Dan Smith [Sun, 23 Oct 2016 06:20:49 +0000 (23:20 -0700)]
Add missing compat routine for Usage object
We added a v1.1 to Usage without a compat routine to go with it. It's not really
a big deal as we're not sending this over RPC anywhere yet that I know of, but
we should have this for the sake of completeness.
Balazs Gibizer [Fri, 14 Oct 2016 14:52:17 +0000 (16:52 +0200)]
Pre-add instance actions to avoid merge conflicts
NotificationAction enum values for instance actions are added in a
single commit to avoid merge conflicts when it is added one by one
during the notification transformation.
Also the notification samples added as comments for the same reason.
Change-Id: Idfe41af8718bf5e81ea1608f4c6d00d7cf60cd13
Implements: bp versioned-notification-transformation-ocata