Continue execution on volume extension failure
When a small amount of disk space remains to be extended, the 'Virtual Disk Service' can fail with VDS_E_EXTENT_SIZE_LESS_THAN_MIN error code. This happens on environments where a volume has already been extended and there is a small amount of bytes that somehow remain residual after the initial extension. Change-Id: I072ed568ef1f2790e95851b45afb8ffcc0acce0e
This commit is contained in:
parent
300dabb36e
commit
f8479e5cbc
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import comtypes
|
||||
import ctypes
|
||||
import re
|
||||
|
||||
@ -22,6 +23,8 @@ from cloudbaseinit.utils.windows import vds
|
||||
|
||||
LOG = oslo_logging.getLogger(__name__)
|
||||
|
||||
VDS_E_EXTENT_SIZE_LESS_THAN_MIN = -2147212237
|
||||
|
||||
ole32 = ctypes.windll.ole32
|
||||
ole32.CoTaskMemFree.restype = None
|
||||
ole32.CoTaskMemFree.argtypes = [ctypes.c_void_p]
|
||||
@ -89,10 +92,19 @@ class VDSStorageManager(base.BaseStorageManager):
|
||||
LOG.info('Extending volume "%s" with %s bytes' %
|
||||
(volume_name, extend_size))
|
||||
|
||||
input_disks_ar = (vds.VDS_INPUT_DISK *
|
||||
len(input_disks))(*input_disks)
|
||||
extend_job = volume.Extend(input_disks_ar, len(input_disks))
|
||||
extend_job.Wait()
|
||||
try:
|
||||
input_disks_ar = (vds.VDS_INPUT_DISK *
|
||||
len(input_disks))(*input_disks)
|
||||
extend_job = volume.Extend(input_disks_ar, len(input_disks))
|
||||
extend_job.Wait()
|
||||
except comtypes.COMError as ex:
|
||||
if ex.hresult == VDS_E_EXTENT_SIZE_LESS_THAN_MIN:
|
||||
LOG.debug(
|
||||
'Volume extension failed because of a '
|
||||
'Windows disk management bug issue where the '
|
||||
'estimated extend size is less than the minimum.')
|
||||
else:
|
||||
raise
|
||||
|
||||
def _get_volume_extents_to_resize(self, pack, volume_id):
|
||||
volume_extents = []
|
||||
|
Loading…
Reference in New Issue
Block a user