Commit Graph

146 Commits

Author SHA1 Message Date
Ghanshyam Mann 5288ade765 Retire compute-hyperv: remove repo content
Winstackers project has been retired
- https://review.opendev.org/c/openstack/governance/+/886880

this commit remove the content of compute-hyperv
deliverables of this project

Depends-On: https://review.opendev.org/c/openstack/project-config/+/894408/1
Change-Id: I06e90d64c0211f87d3b1347667b27e5c81f85dac
2023-09-09 12:28:11 -07:00
Lucian Petrut e7de7eef9d fix coordination unit tests
One of the coordination unit tests fails because of a mock that's
being applied twice. This affects Python 3.10 in particular.

We're addressing the issue by disabling "MOCK_TOOZ" for that
specific test.

Change-Id: If02f7ad022679d74cb88f558b85ee7d22f253c77
2022-09-19 12:12:00 +03:00
Lucian Petrut 74c6d24e29 Driver interface updates
The "destroy_secrets" argument has been added to the "destroy" and
"cleanup" driver methods [1]. At the moment, it's only passed by the
Libvirt driver, so this interface change didn't break our driver.

At the same time, the "needs_legacy_block_device_info" property has
been removed [2].

[1] I856268b371f7ba712b02189db3c927cd762a4dc3
[2] I3895b61b436b9bb882477d2d1b3f4907f03b3b1c

Change-Id: I62b45bb8c3677e0117cbe2d86764ebb904deac90
2021-11-08 09:42:55 +02:00
Lucian Petrut 700e6b4016 Drop OVS support
We're no longer maintaining the Windows OVS port.

Normally, we'd go through the standard deprecation policy but
since the Neutron OVS agent no longer runs on Windows at all since
Wallaby, we're dropping it right away.

Change-Id: I54c681c29c80f1d537e38980f68717b72f6b215b
2021-05-26 08:55:56 +03:00
Lucian Petrut b85e6a2c90 Bump requirements
The lower constraints job is failing as Nova has bumped the
oslo.config minimum requirement. We'll do the same.

The nova conf fixture has been moved so we'll have to pick that up
as well.

Change-Id: I1907982ca8ffc81b2529af22a9a6fd4a55aecafb
2021-05-25 11:28:41 +03:00
Zuul 1c35c12ed0 Merge "rbd volume support" 2021-02-05 08:18:40 +00:00
Lucian Petrut b53f7d21b4 Avoid caching images when unshelving
Shelved instances are snapshotted and then uploaded to Glance.
Once unshelved, the Glance snapshot is removed, so there's no
reason why we should cache it. Furthermore, at the moment
unshelved instances can end up using the wrong image reference,
for example when being migrated.

This change will avoid caching the base image when the instance
is being unshelved.

Closes-Bug: #1907216

Change-Id: I09a0fccdabdc7a41211e364258ca243128784b55
2020-12-14 14:31:47 +02:00
Lucian Petrut 81c7cf6c40 rbd volume support
Ceph 16 (Pacific) will support attaching RBD images to Windows
hosts as well as Hyper-V VMs [1].

This patch updates the Hyper-V driver so that it may be able to
consume RBD volumes.

os-brick patch: I56bf09cbd40679eefa5e378c9b36383de89e980c

[1] https://github.com/ceph/ceph/pull/33750

Implements: blueprint rbd-volumes

Change-Id: I726e426a7274d7c9c6a878afddd23a20ce222a33
2020-11-20 17:00:27 +02:00
Zuul b31ab3a293 Merge "hyperv: Configures chassis asset tags for VMs." 2020-10-26 14:36:32 +00:00
Lucian Petrut c57ac7aab5 Pick up InstanceMetadata changes
The InstanceMetadata constructor has been updated by
Ie27fd6a5513e53903b9acd5d63038b3b484acbde. The "request_context"
parameters was dropped, so we have to stop passing it.

Change-Id: I80bc28f57862f420c9da01839fbfa00902f45da0
2020-10-26 14:09:52 +02:00
Claudiu Belu 32a46037e9 hyperv: Configures chassis asset tags for VMs.
The Msvm_VirtualSystemSettingData object associated with a VM has a
field named "ChassisAssetTag". The value set in this field is reflected
in Linux VMs in /sys/class/dmi/id/chassis-asset-tag. This value is
checked by cloud-init in order to figure out if it is currently running
inside an OpenStack VM.

The verification above has been introduced in cloud-init [1] in order to
avoid costly metadata probes that aren't needed in non-OpenStack VMs.

Setting the ChassisAssetTag will allow us to pass these checks. The
value we are setting is similar to what libvirt is setting in the
LibvirtConfigGuestSysinfo.

[1] 1efa8a0a03

Partially-Fixes: #1895976

Change-Id: Ib9f605f68c79ff41d3959c7a1662a9e644fde946
Depends-On: 33e6c07dab4b46442bf0fbb838d59516112899b9
2020-10-26 13:20:06 +02:00
Lucian Petrut 359fe0bc3b Pick up 'unrescue' driver method signature change
A recent patch[1] updated the 'unrescue' signature, adding a context
and dropping the 'network_info' parameter.

We'll need to pick up this change.

At the same time, we're re-adding the mock dependency. We're re-using
some of Nova's fixtures and other test helpers, which still use the
3rd party mock lib: [2].

[1] Id5e4b0f26d5a2a93db6a7d96555a2cff29d9a2cfre
[2] http://paste.openstack.org/raw/796530/

Change-Id: I0d46c4df4982e62ff81285a141c8b71bf06bcf15
2020-08-03 11:57:46 +03:00
Lucian Petrut d96fed4f3c Fix case sensitive path comparisons
Windows paths are case insensitive. Furthermore, Hyper-V even
flips the casing in some cases.

For that reason, we have to ensure that our path comparisons
are case insensitive.

Change-Id: I4cb059c6bdcb09f7e0c3217fe34654c8e197b67d
Closes-Bug: #1878579
2020-05-14 12:35:08 +03:00
Sean McGinnis b64cf50d07
Remove monotonic usage
The monotonic package was needed for monotonic time operations when
running under Python runtimes older than 3.3. Since we now only support
versions higher than this, this third party package requirement can now
be removed.

Change-Id: I0cb0339c5e681b63783828cfde9921dfd6727f50
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-05-04 17:16:38 -05:00
Zuul 4d878f576a Merge "Address driver API changes (finish_migration)" 2020-04-23 10:01:14 +00:00
Lucian Petrut 8d7384a030 Address driver API changes (finish_migration)
As part of a bug fix, Nova is now passing resource allocations to
"finish_migration".

Change-Id: I8323ee22c1c71a9fee04701f62759c57d5182fe3
Depends-On: Ifd76289964d513e9544544e5787f5f8999589475
2020-04-23 11:37:39 +03:00
Lucian Petrut 3a7ea8e7cd Pick up driver API change
The "rescue" method now accepts a block device info argument,
which we'll need to pick up.

Change-Id: I88544e220f7923decce65ffee544bd8064cdfc46
2020-04-13 14:52:23 +03:00
Zuul f327d0549c Merge "Update hacking for Python3" 2020-04-13 10:32:19 +00:00
Zuul 7becea190a Merge "Use unittest.mock instead of third party mock" 2020-04-13 10:32:18 +00:00
Sean McGinnis 0d329025c2 Use unittest.mock instead of third party mock
We can now use the standard library mock library instead of the third
party one previously needed for py27 compatibility.

Change-Id: I51f48421ac90209302de43b70ef9176195be0743
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-04-13 12:47:26 +03:00
Andreas Jaeger 176559452e Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Update local hacking checks for new flake8.

Remove local vi check, hacking test H106 covers this now.

Remove hacking and friends from lower-constraints, they are not needed
to be installed at run-time.

Change-Id: Id87f8b2d81583a7a67ee1a81c78d3ae40c579c70
2020-04-02 09:24:00 +00:00
Lucian Petrut aabd6a13b9 driver api: pick up accel_info param
A few driver methods now accept the accel_info parameter. This
change updates our driver interface accordingly.

Change-Id: Id65cd3b8154b7aa9a6b5f4859ee0de1e53cb24d1
2020-03-30 09:15:22 +03:00
Lucian Petrut f6bfefd5ad Use updated glance api class location
nova.image.glance.API should be used instead of nova.image.API,
as per this change: I7ca7d8a92dfbc7c8d0ee2f9e660eabaa7e220e2a

Change-Id: If228ed3bd7bd80d94434ff8abc387a7ea20aeaa1
2020-03-04 09:58:39 +02:00
zhouxinyong 2368188b8b Update hacking version
Change-Id: If8e7f2721f2c6f426dce0d9278ba066fa18d7ea1
2020-02-24 11:37:17 +02:00
Lucian Petrut b69b91df5c Allow limitting concurrent image ops
Nova defines a config option that allows limitting concurrent
image operations. This behavior is disabled by default.

The threshold is enforced using a semaphore, which we're now going
to use.

As opposed to the libvirt driver, we're not applying the semaphore
when merging differencing images since that would have a larger
impact on the hyper-v driver (e.g. when resizing legacy vhd images,
when deleting temporary snapshots, etc). For now, we're using it
only when downloading or uploading glance images.

Change-Id: I74ecf4b343428c71aad77b049faa5d2382e88dc8
blueprint: io-semaphore-for-concurrent-disk-ops
2020-02-13 10:57:35 +02:00
Lucian Petrut b3636915d7 Add image precache support
This change adds the driver method required for pre-caching Glance
images.

Change-Id: I9cc5d2c4533f17261f2d7facd67531014453b122
blueprint: image-precache-support
2020-02-13 10:54:01 +02:00
Lucian Petrut 71b317276f Handle nova network deprecation
The Neutron API class has been moved as part of the nova network
deprecation. We'll have to pick this up in compute-hyperv.

Change-Id: I19eae24317c0ccaa470d3711e943c612b36b1740
2020-02-12 10:23:19 +02:00
Lucian Petrut bd2aacc14f Handle Python 3 transition and fix tests
While dropping Python 2.7 support, the upstream project has been
updated, so we'll have to move the templates in-tree.

While at it, we're updating the supported Python versions.

Some Nova fixtures have been moved to oslo.test, so in order to be
able to unblock the gate, we'll have to squash those fixes as well.
For the same reason, we'll have to remove nova-network checks, which
has been completely dropped.

A few options have been moved to a separate config group, which
we'll have to take into account.

Change-Id: Ibce6b062a81200611bcaac3f2cb90b14b559375b
2020-01-16 13:12:09 +02:00
Lucian Petrut 40bd35fcc2 Pass missing arg to "migrate_instance_finish"
This method now accepts a mapping between port ids and resource
providers as per I220fa02ee916728e241503084b14984bab4b0c3b.

We'll need to figure how exactly should this dict look like.
Meanwhile, we'll just pass "None", which Nova seems to accept
for backwards compatibility reasons.

This is a temporary workaround meant to unblock the gate. It will
have to be properly handled by the time we release Ussuri, otherwise
we won't be able to support port QoS.

Change-Id: I878eab9615a76edab0f8ae5bb0d16652baae473a
Partial-Bug: #1845480
2019-09-26 13:33:23 +03:00
Lucian Petrut bf39a47dbe Trivial: improve failover logging
We log a warning when detecting a failover for which the destination
host matches the one that's already set in the Nova db. Some times
this means that instance bounced between hosts but most of the times
this is just a migration initiated by Nova, which already updated
the DB.

While at it, when the driver initializes, we'll log the list of
detected failovers before asynchronously handling them.

Change-Id: I808c8cb63ac0011be8d6824a2f8e9292fe39004f
2019-09-03 15:07:23 +03:00
Lucian Petrut 20c1b2083f Initialize coordination during driver init
At the moment, the "init_host" method initializes the distributed
lock mechanism, yet the driver may try to use distributed locks
before that.

For example, the method that reclaims failed over instances is
called by the driver init method, before init_host. While we
can fix this particular call, it's safer that we initialize the
lock mechanism as early as possible.

Change-Id: If361c0f754d3680726762e3126286227bea6f3f3
Related-Bug: #1841777
2019-09-03 14:17:40 +03:00
Lucian Petrut e8e2bedd76 Handle instances failed over while nova was down
At the moment, the driver won't handle instances that were failed
over while the service was down. This is due to a regression,
the method doing this isn't called properly.

Closes-Bug: #1841777

Change-Id: I4ecf916b1d3323077646a38b9491785accb3c87c
2019-09-03 14:17:40 +03:00
Lucian Petrut 7dd16950d3 Recreate ports for failed over instances
OVS ports can become invalid after the instances are failed over.
If an instance lands back on the initial host and the ports are
not cleaned up, it will be left with those stale ports.

This change adds a config option, allowing those ports to be recreated.
It will be enabled by default. Deployers may consider disabling it
if the remaining ports are cleaned up when rebooting nodes or if the
network backend is not affected by this issue.

Closes-Bug: #1841778

Change-Id: I58aba53b7bc0a5e8954cf31adac6e7e106944b7e
2019-09-03 14:17:40 +03:00
Lucian Petrut a721681e61 Avoid error state for recovered instances after failed migrations
Most users expect that if a live migration fails but the instance
is fully recovered, it shouldn't enter 'error' state. Setting
the migration status to 'error' should be enough. This simplifies
debugging, making it clear that the instance dosn't have to be
manually recovered.

This patch changed this behavior, indirectly affecting the Hyper-V
driver: Idfdce9e7dd8106af01db0358ada15737cb846395

We'll stop propagating exceptions when managing to recover the
instance, which matches the reference driver (libvirt) behavior.

Change-Id: I4b667c06e008b03457d35ce9c920b916d21c255f
Closes-Bug: 1841411
2019-09-03 14:17:40 +03:00
Lucian Petrut d9c1cb6aa1 Allocations leaked during migration rollback
Allocations committed against the destination host are not reverted
during live migration rollbacks. The reason is that we're not passing
the migrate data object properly.

At some point, the rollback callback signature has changed. We picked
it up but only for the main (non-cluster) driver:
I5f247d733642464f4ede0430d4dfc8a27a02e7fd

This change addresses the cluster driver as well.

Change-Id: I8c509d411b8fdf7e65622f1fbb2095fe9c3b98b5
Closes-Bug: #1841068
2019-09-03 14:17:40 +03:00
Lucian Petrut cb203978f2 Update driver interface
spawn() now accepts the "power_on" flag, allowing instances to be
created without being turned on. This is part of the cross-cell
migration workflow.

Change-Id: Ifd18a69f476ebbfb4ee6ec34abb03da0d2e30ceb
2019-09-03 13:10:26 +03:00
Lucian Petrut 20ee0665c5 Update driver interface
finish_revert_migration() now accepts a migration object and
estimate_instance_overhead() has been dropped.

Change-Id: Iddd6c2cad1e6f94b1904e1f1196f6c7dee1b2f99
2019-08-09 21:43:56 +03:00
Zuul 6c7e4f812b Merge "Implement update_provider_tree" 2019-06-14 12:06:07 +00:00
Zuul ee6de950ab Merge "Expose Hyper-V supported image types" 2019-06-14 11:41:36 +00:00
Lucian Petrut 9dcbece93e Expose Hyper-V supported image types
VHD and VHDX are the only image formats currently supported by the
Hyper-V driver.

This change updates the driver capabilities accordingly, which will
then be advertised through traits.

Related to blueprint request-filter-image-types

(cherry-picked from I193a3e32c6d99493fe76608ef0b1b9fe1bbd5422)

Change-Id: If4c8db2d51dbdc85a4d8b6782354a9f68987e7cc
2019-05-10 14:08:13 +03:00
Lucian Petrut 6f3e999d1d Implement update_provider_tree
For now, we'll just set the available ram, disk and vcpus.
This will allow allocation ratios to be set at the placement
inventory level. At the same time, driver capabilities will be
exposed through traits.

Once #1784020 is addressed, we may skip reporting shared storage
capacity.

We're also skipping CPU features for a couple of reasons:
* there are just a few features defined by os-traits, yet even
  fewer exposed by Windows APIs. One option would be to call cpuid
  to get a more exhaustive list of features but that would require
  a C Python extension or separate executable.
* we can't tell for sure which CPU features will actually be exposed
  to the guest, especially when limiting guest CPU features in order
  to support live migration in heterogeneous deployments.

Change-Id: Ibfb879751bba038054ba7852dc49f6d9e67027d6
2019-04-23 15:47:22 +03:00
Lucian Petrut 3057125702 Move config option definition
The 'move_disks_on_cold_migration' config option is currently
defined in migrationops.py instead of conf.py, for which reason
it's not included in the generated documentation.

This simple change will move it next to the rest of compute-hyperv
config options. While at it, we're adding a help string.

Change-Id: I762156dea8d32bdc13716b88821ed7495e705607
2019-04-19 19:32:16 +03:00
Lucian Petrut 05a55ce5c9 sync: pick up some small changes from upstream
* driver.get_info received a new argument, which we don't use.
  The good news is that the manager expects a TypeError
* driver.extend_volume now accepts the new volume size
* the driver shouldn't set the 'is_public' image property when
  taking snapshots. This is already handled outside the driver
* missing whitespace between words in log message
* avoid using utils.execute, use processutils.execute
* update os_win utils "auto-spec" helper (we're relying a bit too
  much on os-win internals, which meanwhile have changed)
* nova dropped the helper method that was merging allocations so
  we'll have to include it in compute_hyperv. Note that we only
  use it for the cluster driver.

Change-Id: I0b59a118764421ec9daba3f3732f45ec9cb7287b
2019-03-25 11:57:12 +02:00
Zuul 0937cd1073 Merge "Prevent reverting resizes from leaking files" 2018-11-29 17:40:29 +00:00
Lucian Petrut 976d316eb7 Prevent reverting resizes from leaking files
When reverting resizes, the manager will request instance files
cleanup to be skipped if the hosts use shared storage, in which
case we'd leak files if multiple CSVs are used.

It's safe to cleanup the instance files when reverting resizes
as long as we preserve the "*_revert" dir.

Closes-Bug: #1805833

Change-Id: I09428c2e25bed41f99b51c08a677d7152d9680ee
2018-11-29 15:11:19 +02:00
Lucian Petrut a9a82b2e9b Report the correct image format to glance when snapshotting
When taking instance snapshots, the image format is always set to
"vhd", but it may as well be vhdx. This happens because of legacy
reasons, as Glance used to reject vhdx images.

Cinder started to validate the image formats a few releases ago for
security reasons, so it will reject creating volumes from Glance
images that have incorrect image formats.

This change ensures that we'll set the right image format when taking
snapshots.

Closes-Bug: #1805442

Change-Id: Ie151ed15bc806e0c16a363734d0c078fe358b899
2018-11-29 15:10:39 +02:00
Zuul a00ce2c989 Merge "Bump placement API version" 2018-11-20 08:01:32 +00:00
Zuul 0d3eceb9da Merge "Update allocations for failed over instances" 2018-11-20 07:46:03 +00:00
Zuul 8e4dd0143f Merge "Trivial: use string for exception message" 2018-11-19 15:32:30 +00:00
Lucian Petrut 99949548dc Bump placement API version
We can now pass request ids and consumer generation ids, which
can detect race conditions that affect allocation updates.

Change-Id: Idccf7aeeecc619871b27e16c68f0706c1514c63b
2018-11-14 11:26:32 +02:00