From 72e60b5a28520849ba9f1e508c2d55379faf4b3f Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 15 Oct 2024 21:35:47 +0900 Subject: [PATCH] Clean up the remaining logic for Windows OS Support Since Hyper-V driver was removed, we don't expect any use case where nova should be deployed in Windows OS. This scenario is no longer tested since WinStackers project has been retired. Drop the remaining code for Windows OS support to reduce unused code and focus purely on linux systems. Change-Id: I69b049d13556efe87f4be32f5e6e7f88e42f3b2a --- nova/monkey_patch.py | 4 ---- nova/tests/fixtures/nova.py | 8 +------- nova/tests/unit/virt/disk/test_inject.py | 15 --------------- nova/virt/disk/api.py | 7 +------ 4 files changed, 2 insertions(+), 32 deletions(-) diff --git a/nova/monkey_patch.py b/nova/monkey_patch.py index 6bcd9017a9..ee5e2b101b 100644 --- a/nova/monkey_patch.py +++ b/nova/monkey_patch.py @@ -44,10 +44,6 @@ def _monkey_patch(): if debugger.enabled(): # turn off thread patching to enable the remote debugger eventlet.monkey_patch(thread=False) - elif os.name == 'nt': - # for nova-compute running on Windows(Hyper-v) - # pipes don't support non-blocking I/O - eventlet.monkey_patch(os=False) else: eventlet.monkey_patch() diff --git a/nova/tests/fixtures/nova.py b/nova/tests/fixtures/nova.py index 6f1845e8af..33d7f289f2 100644 --- a/nova/tests/fixtures/nova.py +++ b/nova/tests/fixtures/nova.py @@ -1088,13 +1088,7 @@ class PoisonFunctions(fixtures.Fixture): def setUp(self): super(PoisonFunctions, self).setUp() - try: - self._poison_libvirt_driver() - except ImportError: - # The libvirt driver uses modules that are not available - # on Windows. - if os.name != 'nt': - raise + self._poison_libvirt_driver() def _poison_libvirt_driver(self): # The nova libvirt driver starts an event thread which only diff --git a/nova/tests/unit/virt/disk/test_inject.py b/nova/tests/unit/virt/disk/test_inject.py index e5e612e44c..ec268d0f16 100644 --- a/nova/tests/unit/virt/disk/test_inject.py +++ b/nova/tests/unit/virt/disk/test_inject.py @@ -13,11 +13,9 @@ # under the License. from collections import OrderedDict -import os import fixtures -from nova import exception from nova import test from nova.tests.unit.virt.disk.vfs import fakeguestfs from nova.virt.disk import api as diskapi @@ -47,19 +45,6 @@ class VirtDiskTest(test.NoDBTestCase): key="mysshkey", mandatory=('key',))) - os_name = os.name - os.name = 'nt' # Cause password injection to fail - self.assertRaises(exception.NovaException, - diskapi.inject_data, - imgmodel.LocalFileImage("/some/file", - imgmodel.FORMAT_RAW), - admin_password="p", - mandatory=('admin_password',)) - self.assertFalse(diskapi.inject_data( - imgmodel.LocalFileImage("/some/file", imgmodel.FORMAT_RAW), - admin_password="p")) - os.name = os_name - self.assertFalse(diskapi.inject_data( imgmodel.LocalFileImage("/some/fail/file", imgmodel.FORMAT_RAW), key="mysshkey")) diff --git a/nova/virt/disk/api.py b/nova/virt/disk/api.py index 9902c0608b..057dcb6a45 100644 --- a/nova/virt/disk/api.py +++ b/nova/virt/disk/api.py @@ -23,6 +23,7 @@ Includes injection of SSH PGP keys into authorized_keys file. """ +import crypt import os import random import tempfile @@ -41,9 +42,6 @@ from nova.virt.disk.vfs import api as vfs from nova.virt.image import model as imgmodel from nova.virt import images -if os.name != 'nt': - import crypt - LOG = logging.getLogger(__name__) @@ -621,9 +619,6 @@ def _set_passwd(username, admin_passwd, passwd_data, shadow_data): :raises: exception.NovaException(), IOError() """ - if os.name == 'nt': - raise exception.NovaException(_('Not implemented on Windows')) - # encryption algo - id pairs for crypt() algos = {'SHA-512': '$6$', 'SHA-256': '$5$', 'MD5': '$1$', 'DES': ''}