cloudbase / windows-imaging-tools

Tools to automate the creation of a Windows image for OpenStack, supporting KVM, Hyper-V, ESXi and more.
Apache License 2.0
656 stars 225 forks source link

Windows 10 Pro disk and cpu scalability #372

Open ehsankhodayar opened 1 year ago

ehsankhodayar commented 1 year ago

I have created a windows 10 pro cloud image using cloud-init and VirtIO drivers and followed the provided instructions on OpenStack website. Moreover, I installed win10 drivers and followed all steps very carefully during my installation process. However, when I create a new instance in OpenStack (Devstack stable/yoga), the disk size and the number of CPU cores don't change based on the provided flavor configurations, and it follows the preliminary configurations during the image creation phase. Moreover, if the given root disk size is bigger than the default image root disk size, the extra disk size will be assigned to the new instance as unallocated space, and you cannot even assign it manually to the root disk.

During the instance login process, I also seed the following error in the logs:

2022-11-26 03:52:12.265 6528 ERROR cloudbaseinit.init [-] plugin 'ExtendVolumesPlugin' failed with error '(-2147212237, None, (None, None, None, 0, None))': _ctypes.COMError: (-2147212237, None, (None, None, None, 0, None)) 2022-11-26 03:52:12.281 6528 ERROR cloudbaseinit.init [-] (-2147212237, None, (None, None, None, 0, None)): _ctypes.COMError: (-2147212237, None, (None, None, None, 0, None)) 2022-11-26 03:52:12.281 6528 ERROR cloudbaseinit.init Traceback (most recent call last): 2022-11-26 03:52:12.281 6528 ERROR cloudbaseinit.init File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\init.py", line 67, in _exec_plugin 2022-11-26 03:52:12.281 6528 ERROR cloudbaseinit.init shared_data) 2022-11-26 03:52:12.281 6528 ERROR cloudbaseinit.init File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\plugins\windows\extendvolumes.py", line 30, in execute 2022-11-26 03:52:12.281 6528 ERROR cloudbaseinit.init storage_manager.extend_volumes(volumes_indexes) 2022-11-26 03:52:12.281 6528 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 2022-11-26 03:52:12.281 6528 ERROR cloudbaseinit.init self._extend_volumes(pack, volume_indexes) 2022-11-26 03:52:12.281 6528 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 2022-11-26 03:52:12.281 6528 ERROR cloudbaseinit.init self._extend_volume(pack, volume, volume_prop) 2022-11-26 03:52:12.281 6528 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 2022-11-26 03:52:12.281 6528 ERROR cloudbaseinit.init extend_job = volume.Extend(input_disks_ar, len(input_disks)) 2022-11-26 03:52:12.281 6528 ERROR cloudbaseinit.init _ctypes.COMError: (-2147212237, None, (None, None, None, 0, None)) 2022-11-26 03:52:12.281 6528 ERROR cloudbaseinit.init

Last, I tested the windows server 12 cloud image provided by cloud base website, and it worked fine. I should mention that my image format is qcow2. Please let me know how I can solve this problem.

ader1990 commented 1 year ago

Hello,

Please make sure you use the latest cloudbase-init MSI from https://cloudbase.it/downloads/CloudbaseInitSetup_x64.msi, that should have the issue fixed.

Thank you, Adrian Vladu

ehsankhodayar commented 1 year ago

Hi @ader1990 , Thank you for your response. Last week, I generated new windows images using windows-imaging-tools on a windows 10 host using hyper-v, and it solved the storage issue. But when I follow the OpenStack documentation for the generation of windows images, I have these problems. OpenStack documentation doesn't use windows-imaging-tools to generate windows images. However, I still have a CPU problem. The generated windows image doesn't follow the OpenStack flavor configuration and only considers 2 CPU cores. Have we had any new updates on Cloudbase-init since last week?

ader1990 commented 1 year ago

Hello,

The image generation tool and cloudbase-init are just some tools (applications) that do not interfere with OpenStack behaviour on how much CPUs it allocates to the virtual machine. The generated image is basically a .VHDX, and does not have such metadata.

There are, of course, ways to limit the CPUs seen by Windows using the bcd configuration, but windows-imaging-tools or cloudbase-init does not configure any of those settings.

Considering that your OpenStack compute nodes are Linux nodes, can you provide the following output if possible, for one Windows VM instance: ps auxf | grep -i kvm. There, we can clearly see how many CPUs were allocated. At the same time, a screenshot from the Task Manager for that said Windows VM from above. A KVM Virtual Machine has a corresponding qemu-kvm process (only one).

This will help to clear the issue.

Thank you.

ehsankhodayar commented 1 year ago

Thanks for the information. I have just run one Windows VM in OpenStack and this is the result of ps auxf | grep -i kvm:

Untitled

Task manager:

image

In OpenStack, I have dedicated 4 CPU cores to this VM.

ader1990 commented 1 year ago

I see what you mean, that is weird. If you create a Linux with the same flavor / vm settings, same CPU configuration is seen by Linux?

From the docs https://linux.die.net/man/1/qemu-kvm:

-smp n[,cores=cores][,threads=threads][,sockets=sockets][,maxcpus=maxcpus] Simulate an SMP system with n CPUs. On the PC target, up to 255 CPUs are supported. On Sparc32 target, Linux limits the number of usable CPUs to 4. For the PC target, the number of cores per socket, the number of threads per cores and the total number of sockets can be specified. Missing values will be computed. If any on the three values is given, the total number of CPUs n can be omitted. maxcpus specifies the maximum number of hotpluggable CPUs.

Maybe there is an issue with specifying the smp params?

Thank you.

ader1990 commented 1 year ago

I think what happens is that the qemu-kvm params do not properly match the CPU / SOCKET you have and it might be the issue in this situation, as you are using KVM and not the software virtualization. Still, it would make sense only if also the Linux VM with same config sees the same topology as the Windows. If Linux see the same topology, it is clearly an error on the KVM configuration or a bug.

ehsankhodayar commented 1 year ago

I create an Ubuntu 20.04 instance with 4 CPU cores, and the VM shows it correctly. From the VM:

image

ps auxf | grep -i kvm (two VMs are running):

Untitled

I think I see one core from the server side only. Right?

pluto00987 commented 1 year ago

Windows 10 Pro only support two CPU sockets max. That is a product limitation and has nothing to do with how you're generating the image. Your kvm command has sockets=4 which is why you're not seeing all the vCPU. I don't know how it's done but if you can configure OpenStack to present more cores per socket you can get more vCPU into your VM (like -smp 4, sockets=2)

ehsankhodayar commented 1 year ago

Thank you for your response. At the moment, I am not working with OpenStack anymore. I hope your solution is fine.