This commit is part of a series to retire the Packaging Deb
project. Step 2 is to remove all content from the project
repos, replacing it with a README notification where to find
ongoing work, and how to recover the repo if needed at some
future point (as in
https://docs.openstack.org/infra/manual/drivers.html#retiring-a-project).
Change-Id: Ied3613a9c0bcd2394825d18fdfc92dd8b7b0431b
Adds the following arguments to the add_vm_to_cluster method:
* max_failover_count - the maximum number of failovers that can occur
in the given failover_period. Once a VM's number of failovers reaches
this number, the VM will simply end up in a Failed state.
* failover_period - the number of hours in which the given max_failover_count
failovers can occur.
* auto_failback - allow the VM to failback to its original host once it is
available.
Change-Id: I2af82c8ecf3bee2e2f2161976d75123f8a0c89e9
Starting with the Pike series, OpenStack no longer supports log
translation.
Update hacking rule to prevent log translation in all log level instead
of only debug level.
Since all log translations are invalidated, check_explicit_underscore_import
can be simplified.
Change-Id: I5bd3a155c685821cfddf17f741083a267a8f7114
A Planned VM and a Realized VM cannot exist at the time on the
same host, The 2 types must be treated separately.
vm_exists will only check if the Realized VM exists.
planned_vm_exists will only check if the Planned VM exists.
destroy_planned_vm will only destroy the planned VM, if it exists.
Related-Bug: #1604078
Change-Id: I91636a82b057f566eab9887c422911163668f556
networkutils currently caches WMI objects for performance reasons,
but it should be optional.
Adds cache_temporary_wmi_objects config option (default is True), which
enables or disables caching in networkutils.
Closes-Bug: #1693321
Change-Id: Id3aad3837d13a9c58c8a2898d594d412a42cd00c
We're getting a considerable amount of transient errors when
attempting to change a VM state (e.g. when pausing it).
Since this operation is idempotent, it's safe to just attempt some
retries.
Change-Id: Ic24fd282c897594fb67a45124e31b374e4e2dd4b
Closes-Bug: #1694661
At the moment, we're raising a HyperVException when a WMI job fails.
The issue is that this doesn't include the job status or error code
as attributes, which is troublesome when we need to have exception
handling logic relying on that.
This change adds a new exception that will include those fields,
also simplifying the WMI job status check method.
Note that although WMI jobs are not necessarily Hyper-V related,
we're inheriting HyperVException as that's what Nova expects at the
moment.
Also, we're now following the same logic as the HyperV PowerShell
module in terms of checking a WMI job state. States such as
"CompletedWithWarnings" (32768) will now be gracefully handled,
instead of throwing an exception.
Another thing to note is that we're now always treating the
'Exception' job state as a final state.
Partial-Bug: #1694661
Change-Id: I498281d3af673e4e6ac3adc2fb1a566efaba9d4e
There are situations in which a VM unexpectedly disappears while
we're trying to perform an operation on it. Raising an appropriate
os-win exception in such cases helps os-win consumers perform
appropriate error handling.
This change adapts the decorator translating such exceptions,
using it for the 'get_vm_summary_info' method. This will help Nova
properly handle the case in which an instance is deleted while an
instance lifecycle event is checked.
Related-Bug: #1653862
Change-Id: I6930ed9df9a79e4f8f01bb96ce6dd942fd4760f8
We enforce any dll used via ctypes to have an according module
defined in os_win.utils.winapi.libs.<lib_name>, containing
definitions for the argument and return value types of each
function used throughout os-win.
Some of the hacking rule unit tests boilerplate was *borrowed*
from Nova.
Related-Bug: #1693258
Change-Id: Ia8d014a2b4a93cb74024233823bf33335e529e43
There is a race condition between tests, and because
the _old_wmi is not set, it will try to load it, but since it
is mocked, it cannot, and it shouldn't.
Change-Id: Id029baf2e72f7b67eb6af3b3e66f998b902fd412
This change moves all the constants and structures extracted from
Windows headers to a separate module. We're adding one submodule
for each foreign library that we're using, which will also contain
the according structure definitions.
This change also ensures that we set the ctypes functions argument/return
value types for the foreign functions used throughout os-win. For this
reason, some structures were updated, also having any initialization logic
being pulled out. Some function call arguments changed in order to match
the function definitions.
Closes-Bug: #1693258
Change-Id: If355ad2c33aa085388c052de6082359e144e517d
When using WMI, the resources passed to the
Msvm_VirtualSystemManagementService are not cleaned up
by the garbage collector if the Service object is still
referenced (cached as a property in BaseUtilsVirt).
PyMI doesn't have this issue, so the Service objects can be
safely cached.
This issue only affects Windows / Hyper-V Server 2012.
Change-Id: If8df0bf0a2f13a9e94993dde8b2a18943f2e9f83
Closes-Bug: #1697389
When an instance is being rebuilt, or shelved and unshelved, the VM gets
destroyed and recreated, keeping the same neutron port. If a reference to
a non-existent object is passed to a WMI method (or no longer exists), an
x_wmi: Not Found exception is raised.
Adds decorators to the jobutils methods, which will reraise
os_win.exceptions.NotFound exceptions instead of the x_wmi: Not found
exceptions.
Change-Id: Ic371cd1e2c2a54c4f386c02557bc9cdd9518bc9b
Closes-Bug: #1694432
Running py2* post py3* tests results in error. Add
'rm -f .testrepository/times.dbm' command in testenv to
resolve this.
Change-Id: I7bede2ca96cc4ca0b36460b8aeac3e5540d91751
VMs can be destroyed before their vNICs had a chance to be bound.
When trying to bind a vNIC of an already-destroyed VM, os-win will
raise a HyperVException.
This patch specializes the exception raised in this case, allowing
consumers to treat this case differently.
Change-Id: I8fabe8799d0e57dcc5627d67b3962c4f11f08f1e
Closes-Bug: #1684045
At the moment, we expose a method which will fetch cluster vm owner
changes one by one. One issue is that this relies on a PyMI event
listener that's setup when instantiating a ClusterUtils object,
so we're ending up running multiple unused event listeners.
We're now adding an event listener similar to the one used for
VM power state change events, while preserving backwards compatibility.
The goal is to improve the event handling workflow, considering that
the compute-hyperv Nova driver is currently waiting unnecessary time
between those events.
Change-Id: Iceabc3636b5ceb37b20bfe55330ad996e3546113
pep9 can fail because of the wrong indentation of some
closing brackets in test_clusapi_utils. This fixes the issue.
Change-Id: Ib52883642b019f68b88dcf3c07ea4c9dab2e5817
We should avoid using six.iteritems to achieve
iterators. We can use dict.items instead, as it will return iterators
in PY3 as well. And dict.items/keys will be more readable.
Change-Id: I9a94f54f5f86e8f2de9a439e64bdcd8ece6c82db
We're resolving share addresses to determine if those point to a
local address. The issue is that we fetch the local ips resolving
the local hostname, which won't include '127.0.0.1' or '::1'.
For this reason, a share such as '\\localhost\share' won't be
reported as being local.
This change handles this case.
Closes-Bug: #1680029
Change-Id: I36df4aa79bb7af548b6e39f9f9e7c4f979ae0a77
copy_folder_files will copy all the given source folder's files to the
destination (only files, folders are ignored).
Change-Id: I5af94f110b4a6d7672416212f97cb0387cd0cd06
This patch only affects Windows / Hyper-V Server 2012.
On Windows / Hyper-V Server 2012_compat_conn represents the old WMI
connection, in order to ensure that the add / update operations work
properly, since PyMI's and WMI's GetText_(1) outputs are different,
causing an issue on 2012.
Closes-Bug: #1678968
Change-Id: I5542046375114c24387cbcfba0aa8528f8e0dd6d