From 94a3ea56fad5e9890527ef6598bf3167f62bf6a6 Mon Sep 17 00:00:00 2001 From: Lucian Petrut Date: Tue, 23 May 2017 22:45:20 +0300 Subject: [PATCH] [Trivial] Hyper-V: accept Glance vhdx images Although the Hyper-V driver is used with VHDX images most of the time, it rejects Glance images marked as VHDX. Note that for legacy reasons, people usually just mark them as vhd at he moment, which is misleading and unsafe. This change ensures that such images are handled properly. Closes-Bug: #1693470 Change-Id: I1441304bd5a83b04877c1662e6e9d463ba629ed0 (cherry picked from commit f022d431e1f844a8faa7ab55597c83179c13022c) --- nova/tests/unit/virt/hyperv/test_block_device_manager.py | 3 +++ nova/virt/hyperv/block_device_manager.py | 1 + 2 files changed, 4 insertions(+) diff --git a/nova/tests/unit/virt/hyperv/test_block_device_manager.py b/nova/tests/unit/virt/hyperv/test_block_device_manager.py index 939666e87b71..cfeb6698f414 100644 --- a/nova/tests/unit/virt/hyperv/test_block_device_manager.py +++ b/nova/tests/unit/virt/hyperv/test_block_device_manager.py @@ -216,6 +216,9 @@ class BlockDeviceManagerTestCase(test_base.HyperVBaseTestCase): def test_check_and_update_root_device_gen1(self): self._test_check_and_update_root_device(disk_format='vhd') + def test_check_and_update_root_device_gen1_vhdx(self): + self._test_check_and_update_root_device(disk_format='vhdx') + def test_check_and_update_root_device_gen1_iso(self): self._test_check_and_update_root_device(disk_format='iso') diff --git a/nova/virt/hyperv/block_device_manager.py b/nova/virt/hyperv/block_device_manager.py index 3f2ff7d3fee8..9323da09f547 100644 --- a/nova/virt/hyperv/block_device_manager.py +++ b/nova/virt/hyperv/block_device_manager.py @@ -41,6 +41,7 @@ class BlockDeviceInfoManager(object): _DEFAULT_BUS = constants.CTRL_TYPE_SCSI _TYPE_FOR_DISK_FORMAT = {'vhd': constants.DISK, + 'vhdx': constants.DISK, 'iso': constants.DVD} _DEFAULT_ROOT_DEVICE = '/dev/sda'