cloudbase / cloudbase-init

Cross-platform instance initialization
http://openstack.org
Apache License 2.0
421 stars 149 forks source link

ExtendVolumesPlugin fails to extend volumes with small number of bytes #33

Open ader1990 opened 4 years ago

ader1990 commented 4 years ago

When ExtendVolumesPlugin tries to extend a volume with a small number of bytes, it fails with the following error:

2020-01-22 05:39:25.302 2716 INFO cloudbaseinit.init [-] Executing plugin 'ExtendVolumesPlugin'
2020-01-22 05:39:25.302 2716 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.osutils.windows.WindowsUtils' load_class c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\classloader.py:27
2020-01-22 05:39:25.318 2716 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.utils.windows.storage.vds_storage_manager.VDSStorageManager' load_class c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\classloader.py:27
2020-01-22 05:39:25.365 2716 INFO comtypes.client._code_cache [-] Imported existing <module 'comtypes.gen' from 'c:\\program files\\cloudbase solutions\\cloudbase-init\\python\\lib\\site-packages\\comtypes\\gen\\__init__.py'>
2020-01-22 05:39:25.365 2716 INFO comtypes.client._code_cache [-] Using writeable comtypes cache directory: 'c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\comtypes\gen'
2020-01-22 05:39:25.474 2716 INFO cloudbaseinit.utils.windows.storage.vds_storage_manager [-] Extending volume "\\?\GLOBALROOT\Device\HarddiskVolume4" with 1031680 bytes
2020-01-22 05:39:25.490 2716 ERROR cloudbaseinit.init [-] plugin 'ExtendVolumesPlugin' failed with error '(-2147212237, None, (None, None, None, 0, None))': _ctypes.COMError: (-2147212237, None, (None, None, None, 0, None))
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init [-] (-2147212237, None, (None, None, None, 0, None)): _ctypes.COMError: (-2147212237, None, (None, None, None, 0, None))
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init Traceback (most recent call last):
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\init.py", line 67, in _exec_plugin
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init     shared_data)
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\plugins\windows\extendvolumes.py", line 30, in execute
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init     storage_manager.extend_volumes(volumes_indexes)
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\windows\storage\vds_storage_manager.py", line 147, in extend_volumes
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init     self._extend_volumes(pack, volume_indexes)
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\windows\storage\vds_storage_manager.py", line 63, in _extend_volumes
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init     self._extend_volume(pack, volume, volume_prop)
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\windows\storage\vds_storage_manager.py", line 94, in _extend_volume
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init     extend_job = volume.Extend(input_disks_ar, len(input_disks))
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init _ctypes.COMError: (-2147212237, None, (None, None, None, 0, None))
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init 

Environment: ESXi / VMware, Windows 2019 standard.

unihon commented 4 years ago

Have you found a solution?

ader1990 commented 4 years ago

Hello,

The solution would be to skip the extending of a volume if there is a threshold of let s say 100mb and it fails the first time.

Are you affected by this issue?

Thank you, Adrian

unihon commented 4 years ago

thank 🍉

Queetinliu commented 3 years ago

yes i faced the same problem when i create win 10 image.this is because the recovery partition in c disk.i delete the recovery partition then solve the problem

Queetinliu commented 3 years ago

Have you found a solution?

I think i get a solution

ader1990 commented 3 years ago

Hello,

I am working now on a solution that will be posted soon (will just gracefully skip the extend for small disk space in case it fails in the first place).

winklerm commented 3 years ago

Hello, is there any news on the solution? We are affected as well, trying to delete the recovery partition as a workaround meanwhile.