summaryrefslogtreecommitdiff
path: root/nova/tests/unit/objects
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Merge "Parse extended resource request from the port data"Zuul2021-08-311-0/+58
|\ \ \ | |/ /
| * | Parse extended resource request from the port dataBalazs Gibizer2021-08-211-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The format of the value of the resource_request field of the port has been changed by the port-resource-request-groups Neutron API extension. This patch adds a new factory method for RequestGroup to parse the data and create the RequestGroup objects corresponding to the request. Also the neutron interface of nova changed to use the new factory if the new neutron API extension is present. Note that we have to keep the old logic in place to support the scenario when Nova is upgraded first and therefore Neutron is still using the old resource_request format. Also note that some of the so far skipped functional tests started to pass as they are negative tests resulting in an unsuccessful operation due to not related reasons and the code already works good enough to hit those negative code paths. blueprint: qos-minimum-guaranteed-packet-rate Change-Id: If7b80c8725d9a8183d2df05c824461e8ee5f45d0
* | | Merge "Add same_subtree field to RequestLevelParams"Zuul2021-08-312-1/+52
|\ \ \ | |/ /
| * | Add same_subtree field to RequestLevelParamsBalazs Gibizer2021-08-212-1/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend RequestLevelParams o.v.o to store lists of request group name suffixes that later will be used as same_subtree query parameters in the Placement GET /allocation_candidates API calls This patch adds logic to parse the same_subtree field out from the port resource_request as well as additional helpers used later on to combine RequestLevelParams objects coming from different ports. Change-Id: I523737ef88850a4e2646221a52106016c9595847 blueprint: qos-minimum-guaranteed-packet-rate
* | | Prevent deletion of a compute node belonging to another hostMark Goddard2021-08-201-1/+11
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a race condition in nova-compute with the ironic virt driver as nodes get rebalanced. It can lead to compute nodes being removed in the DB and not repopulated. Ultimately this prevents these nodes from being scheduled to. The main race condition involved is in update_available_resources in the compute manager. When the list of compute nodes is queried, there is a compute node belonging to the host that it does not expect to be managing, i.e. it is an orphan. Between that time and deleting the orphan, the real owner of the compute node takes ownership of it ( in the resource tracker). However, the node is still deleted as the first host is unaware of the ownership change. This change prevents this from occurring by filtering on the host when deleting a compute node. If another compute host has taken ownership of a node, it will have updated the host field and this will prevent deletion from occurring. The first host sees this has happened via the ComputeHostNotFound exception, and avoids deleting its resource provider. Co-Authored-By: melanie witt <melwittt@gmail.com> Closes-Bug: #1853009 Related-Bug: #1841481 Change-Id: I260c1fded79a85d4899e94df4d9036a1ee437f02
* | Merge "smartnic support - new vnic type"Zuul2021-08-192-5/+23
|\ \
| * | smartnic support - new vnic typeYongli He2021-08-052-5/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are 2 vnic type added to support smatnic: 'accelerator-direct' and 'accelerator-direct-physical'. arq uuid and port device profile keep in NetworkRequest. Change-Id: I6c9c6d26edfcd4419371282222d128beedf7fa70 Implements: blueprint sriov-smartnic-support
* | | db: Enable auto-generation of migrationsStephen Finucane2021-08-091-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let's take advantage of the features that alembic provides [1]. We use this opportunity to clean up how we do our base model creation and remove the downgrade section from the migration script template, since we don't support downgrades. [1] https://alembic.sqlalchemy.org/en/latest/autogenerate.html Change-Id: I18846a5c7557db45bb63b97c7e8be5c4367e4547 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
* | | db: Post reshuffle cleanupStephen Finucane2021-08-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new 'nova.db.api.api' module to hold API database-specific helpers, plus a generic 'nova.db.utils' module to hold code suitable for both main and API databases. This highlights a level of complexity around connection management that is present for the main database but not for the API database. This is because we need to handle the complexity of cells for the former but not the latter. Change-Id: Ia5304c552ce552ae3c5223a2bfb3a9cd543ec57c Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
* | | db: Move remaining 'nova.db.sqlalchemy' modulesStephen Finucane2021-08-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The two remaining modules, 'api_models' and 'api_migrations', are moved to the new 'nova.db.api' module. Change-Id: I138670fe36b07546db5518f78c657197780c5040 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
* | | db: Unify 'nova.db.api', 'nova.db.sqlalchemy.api'Stephen Finucane2021-08-0926-135/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge these, removing an unnecessary layer of abstraction, and place them in the new 'nova.db.main' directory. The resulting change is huge, but it's mainly the result of 's/sqlalchemy import api/main import api/' and 's/nova.db.api/nova.db.main.api/' with some necessary cleanup. We also need to rework how we do the blocking of API calls since we no longer have a 'DBAPI' object that we can monkey patch as we were doing before. This is now done via a global variable that is set by the 'main' function of 'nova.cmd.compute'. The main impact of this change is that it's no longer possible to set '[database] use_db_reconnect' and have all APIs automatically wrapped in a DB retry. Seeing as this behavior is experimental, isn't applied to any of the API DB methods (which don't use oslo.db's 'DBAPI' helper), and is used explicitly in what would appear to be the critical cases (via the explicit 'oslo_db.api.wrap_db_retry' decorator), this doesn't seem like a huge loss. Change-Id: Iad2e4da4546b80a016e477577d23accb2606a6e4 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
* | | objects: Fix VIFMigrateData.supports_os_vif_delegation setterStephen Finucane2021-06-181-0/+21
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're using a 'profile' getter/setter in the 'VIFMigrateData' object to ensure we transform the JSON encoded string we store in the database to an actual dictionary on load and vice versa on save. However, because the getter is returning a new object (constructed from 'json.loads') rather than a reference to the original data (which is a string), modifying this object doesn't actually change the underlying data in the object. We were relying on this broken behavior to set the 'supports_os_vif_delegation' attribute of the 'VIFMigrateData' object and trigger the delegated port creation introduced in change I11fb5d3ada7f27b39c183157ea73c8b72b4e672e, which means that code isn't actually doing anything yet. Resolve this. Change-Id: I362deb1088c88cdcd8219922da9dc9a01b10a940 Signed-off-by: Stephen Finucane <stephenfin@redhat.com> Related-Bug: #1734320 Related-Bug: #1815989
* | Merge "tests: Merge flavor tests"Zuul2021-06-161-0/+123
|\ \
| * | tests: Merge flavor testsStephen Finucane2021-03-291-0/+123
| |/ | | | | | | | | | | | | | | | | | | The 'test_flavors' and 'test_flavor_extra_specs' tests from the 'nova.tests.unit' module were testing functionality found in each of 'nova.objects.flavor' and 'nova.compute.flavors', both of which have their own tests. Merge these in. Change-Id: Icf813985ef6c4a618ecde437323068c0cb013960 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
* | Merge "Use NotificationFixture for legacy notifications too"Zuul2021-06-092-6/+5
|\ \
| * | Use NotificationFixture for legacy notifications tooBalazs Gibizer2021-05-242-6/+5
| | | | | | | | | | | | Change-Id: Ic16c575c8f36e8a3c50b6e302b9fdf961cb3ed22
* | | Merge "Create a fixture around fake_notifier"Zuul2021-06-091-3/+1
|\ \ \ | |/ /
| * | Create a fixture around fake_notifierBalazs Gibizer2021-05-241-3/+1
| |/ | | | | | | | | | | | | | | | | | | | | The fake_notifier uses module globals and also needs careful stub and reset calls to work properly. This patch wraps the fake_notifier into a proper Fixture that automates the complexity. This is fairly rage patch but it does not change any logic just redirect calls from the fake_notifier to the new NotificationFixture Change-Id: I456f685f480b8de71014cf232a8f08c731605ad8
* | Merge "Fix RequestLevelParams persistence handling in RequestSpec"Zuul2021-06-041-1/+12
|\ \
| * | Fix RequestLevelParams persistence handling in RequestSpecBalazs Gibizer2021-05-281-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The request_level_params field of the RequestSpec are intentionally not persistent and at the same time it is declared as non nullable. The current code handling the persistence of this field actually set the request_level_params field to None breaking the non nullable invariant of the field. So far this is error is not triggered as the request_level_params field was only used lazy loading, which is defaulted the field to a new RequestLevelParam object on the RequestSpec object that was never saved after such lazy load. A later patch will initialize request_level_params field in the RequestSpec.from_components() factory method to handle this parameters from Neutron ports and that triggers a failure when the RequestSpec is saved. There are a set of non nullable, non persisted RequestSpec fields that are handled individually during create / save. This patch applies the same logic to request_level_params as well. Change-Id: I7d11ef8abb30686f9d125cac0e48369eab839b0f
* | | Merge "Replace getargspec with getfullargspec"Zuul2021-06-011-2/+3
|\ \ \ | |/ / |/| |
| * | Replace getargspec with getfullargspeclikui2021-05-121-2/+3
| |/ | | | | | | | | | | | | | | inspect.getargspec() is deprecated since py3 [1] https://docs.python.org/3/library/inspect.html#inspect.getargspec Change-Id: I6fbdf942dd192351e135430997c15ea92e7fb8af
* | image_meta: Provide image_ref as the id when fetching from instanceLee Yarwood2021-05-201-3/+5
|/ | | | | | | | | | | | | | | | | | | At present various users of instance.image_meta expect it to be a fully populated ImageMeta object. However when the instance is pulled from the database the ImageMeta object is only partially populated via instance.system_metadata with a limited set of attributes such as min_ram, min_disk, disk_format and container_format. This can result in NotImplementedErrors being raised by o.vo as seen in bug #1928063 when an attempt is made to access common attributes such as id or name. To avoid this the id is now provided by instance.image_ref when available. The majority of the change is test fallout and ensuring that valid UUIDs are provided as instance.image_ref and used by instance.image_meta. Related-Bug: #1928063 Change-Id: I55d66c3a6cbd50da90065f4a58f77b5cd29ce9ea
* pci: Add vDPA vnic to PCI request mapping and filteringSean Mooney2021-03-161-57/+156
| | | | | | | | | | | | | | This change extend the vnic type to PCI request dev type mapping to support the vDPA vnic type. This change extends the PCI stats module to filter out VDPA 'dev_type' pools if its not explicitly requested. This change explicitly filters out the vDPA dev_type from the pci alias schema since that is not supported. Blueprint: libvirt-vdpa-support Change-Id: I91dd7993395f693c7d26c1caa44fa365f5cbec12
* objects: Add 'VDPA' to 'PciDeviceType'Sean Mooney2021-03-112-1/+19
| | | | | | | | | Add a new PCI device type and update the parent objects to reflect this. The code for handling the '[pci] alias' config option is updated to prevent users specifying this in an alias. Blueprint: libvirt-vdpa-support Change-Id: I7c779ce7ee0648833758a75164e0bc0b54fe9a71
* libvirt: Add support for virtio-based input devicesStephen Finucane2021-03-052-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | The USB-based tablet is often the only USB device in an x86 instance, while the USB-based keyboard is often the only such device in an AArch64 instance (x86 have PS2 keyboards and mice). Replacing these with virtio-based devices can eliminate the need to have a USB host adapter in the instance. Enable just that possibility by adding a new value image metadata property, 'hw_input_bus'. This allows us to specify not only virtio-based pointer and keyboard input devices but also USB equivalents. Note that this also fixes one instance of a particular class of bugs, whereby we have checks for *guest* architecture-specific behavior that are being toggled based on the *host* architecture. In this instance, we were attempting to add a keyboard device on AArch64 guests since they don't have one by default, but we were determining the architecture by looking at the CPU architecture reported in the host capabilities. By replacing this check of the host capabilities with a call to the 'nova.virt.libvirt.utils.get_arch' helper, we correctly handle requests to create non-host architecture guests via the 'hw_architecture' image metadata property. There are many other instances of this bug and those can be resolved separately. Change-Id: If9f3ede3e8449f9a6c8d1da927974c0a73923d51 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
* Merge "tests: Poison os.uname"Zuul2021-03-041-1/+6
|\
| * tests: Poison os.unameStephen Finucane2021-02-201-1/+6
| | | | | | | | | | | | | | | | | | We shouldn't be looking up the architecture of the test node during tests to ensure tests work across nodes with varying architectures. Change-Id: I458b1db091e33c0b835e44b5a86de6c0a08f99a3 Signed-off-by: Stephen Finucane <stephenfin@redhat.com> Co-authored-by: Lee Yarwood <lyarwood@redhat.com>
* | Merge "Remove unused Instance method"Zuul2021-03-031-21/+0
|\ \
| * | Remove unused Instance methodBalazs Gibizer2021-02-111-21/+0
| | | | | | | | | | | | | | | | | | | | | Instance.add_pci_device_and_request become unused so it is removed. Change-Id: Ibf8d4f03fa989b1198ee01b61243cd32f7095e04 blueprint: support-interface-attach-with-qos-ports
* | | objects: Add 'socket' PCI NUMA affinityArtom Lifshitz2021-02-242-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the 'socket' value to the allowed PCI NUMA affinity policies, both to the 'hw:pci_numa_affinity_policy' flavor extra spec, and the 'hw_pci_numa_affinity_policy' image property. For now the new value is a no-op and remains undocumented. It will be wired-in in a subsequent patch. Implements: blueprint pci-socket-affinity Change-Id: I0680d4e21f3e317ac702b55afef4c87e8acbfc3a
* | | libvirt: start tracking NUMACell.socket for hostsArtom Lifshitz2021-02-212-1/+6
| |/ |/| | | | | | | | | | | | | | | | | | | This patch adds a `socket` field to NUMACell, and the libvirt driver starts populating it. For testing, we need to fix how fakelibvirt's HostInfo handled sockets: it previously assumed one or more sockets within a NUMA node, but we want the reverse - one or more NUMA nodes within a socket. Implements: blueprint pci-socket-affinity Change-Id: Ie4deb265f6093558ab86dc69f6ffab9da62ca15d
* | Merge "Rename ensure_network_metadata to amend requested_networks"Zuul2021-02-121-4/+11
|\ \
| * | Rename ensure_network_metadata to amend requested_networksSylvain Bauza2021-02-031-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As we don't persist (fortunately) the requested networks when booting an instance, we need a way to implement the value of the RequestSpec field during any create or move operation so we would know in a later change which port or network was asked. Partially-Implements: blueprint routed-networks-scheduling Change-Id: I0c7e32f6088a8fc1625a0655af824dee2df4a12c
* | | Merge "Add requested_networks field to RequestSpec object"Zuul2021-02-092-3/+38
|\ \ \ | |/ /
| * | Add requested_networks field to RequestSpec objectSylvain Bauza2021-02-032-3/+38
| |/ | | | | | | | | | | | | | | | | Since we want to support routed networks in Nova, we need to provide the needed networks to the scheduler, hence the new field which won't be persisted. Change-Id: I03fcf9d64a750e3e8a71c1862d3e2ceb84aaffd2 Related-Implements: blueprint routed-networks-scheduling
* | fup: Merge duplicate volume attachment checksLee Yarwood2021-02-042-1/+24
|/ | | | | | | | | | This is a follow up to I2881d77d52bcbde9f3ac6a6ddfb4a22a9bd45c8a where it was noted that we could merge these checks into one using a single db query for all active volume attachments for a given volume. This requires changes to the BlockDeviceMappingList object and was thus left as a separate change to allow the original to be backported. Change-Id: I859be652eb8fff591899a223193bd9efc8830cf3
* Merge "Add an online migration for PciDevice.uuid"Zuul2021-01-171-3/+46
|\
| * Add an online migration for PciDevice.uuidStephen Finucane2020-04-301-3/+46
| | | | | | | | Change-Id: I44919422c48570f2647f2325ff895255fc2adf27
* | Merge "Modify PciDevice.uuid generation code"Zuul2021-01-171-27/+89
|\ \ | |/
| * Modify PciDevice.uuid generation codeStephen Finucane2020-04-301-27/+89
| | | | | | | | | | | | | | | | Use the same pattern used in nova.objects.BlockDeviceMapping, allowing us to share code with that object and paving the way for a future online migration script. Change-Id: I47a27c17ec789a96e33c2e5ff8dd8b09ac74f600
* | Remove six.text_type (2/2)Takashi Natsume2020-12-137-26/+17
| | | | | | | | | | | | | | | | | | Replace six.text_type with str. This patch completes six removal. Change-Id: I779bd1446dc1f070fa5100ccccda7881fa508d79 Implements: blueprint six-removal Signed-off-by: Takashi Natsume <takanattie@gmail.com>
* | Merge "objects: Remove Agent, AgentList"Zuul2020-11-142-105/+0
|\ \
| * | objects: Remove Agent, AgentListStephen Finucane2020-09-112-105/+0
| | | | | | | | | | | | | | | | | | | | | | | | These are no longer used given the removal of the XenAPI driver and os-agents API. Remove the objects themselves. Change-Id: Iddb6489e11dea1d3079292caf7848217df706ca6 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
* | | Remove six.iteritems/itervalues/iterkeysTakashi Natsume2020-11-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace the following items with Python 3 style code. - six.iteritems - six.itervalues - six.iterkeys Subsequent patches will replace other six usages. Change-Id: Id55de3a105bedcf61bcfc797aabe86d6e75709c8 Implements: blueprint six-removal Signed-off-by: Takashi Natsume <takanattie@gmail.com>
* | | Remove six.movesTakashi Natsume2020-11-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace the following items with Python 3 style code. - six.moves.configparser - six.moves.StringIO - six.moves.cStringIO - six.moves.urllib - six.moves.builtins - six.moves.range - six.moves.xmlrpc_client - six.moves.http_client - six.moves.http_cookies - six.moves.queue - six.moves.zip - six.moves.reload_module - six.StringIO - six.BytesIO Subsequent patches will replace other six usages. Change-Id: Ib2c406327fef2fb4868d8050fc476a7d17706e23 Implements: blueprint six-removal Signed-off-by: Takashi Natsume <takanattie@gmail.com>
* | | objects: Fix issue in exception typeStephen Finucane2020-10-121-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were attempting to pass a 'target_version' variable into an exception message. 'target_version' is a tuple which means it's expanded out resulting in the following error: TypeError: not all arguments converted during string formatting Fix this. Change-Id: I6063b2108ae38776d034fd7a4c3aa88dc66a084f Signed-off-by: Stephen Finucane <stephenfin@redhat.com> Closes-Bug: #1898554
* | | Merge "objects: Remove 'XenapiLiveMigrateData'"Zuul2020-09-132-31/+0
|\ \ \ | |/ /
| * | objects: Remove 'XenapiLiveMigrateData'Stephen Finucane2020-09-112-31/+0
| | | | | | | | | | | | | | | | | | | | | This is no longer used by anything. Change-Id: I39231b18fc0efcddba43be59ad06591d0b551ec4 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
* | | Follow up for I67504a37b0fe2ae5da3cba2f3122d9d0e18b9481Balazs Gibizer2020-09-111-0/+21
|/ / | | | | | | | | | | Part of blueprint sriov-interface-attach-detach Change-Id: Ifc5417a8eddf62ad49d898fa6c9c1da71c6e0bb3