Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3k forks source link

az vm create (Accelerated Networking not enabled for RHEL image) #16635

Open grtn316 opened 3 years ago

grtn316 commented 3 years ago

Bug When using CLI commands to create a virtual machine using various RHEL images, results in accelerated networking turned off unless explicitly setting it to true via: --accelerated-networking true

To Reproduce az vm create -n <VM Name> -g <resouce group name> --zone <zone #> --ppg <ppg resource id> --subnet <subnet resource id> --admin-username <username> --image RedHat:RHEL:7-LVM --size Standard_E48ds_v4 --generate-ssh-keys --boot-diagnostics-storage <blob storage url>

Expected behavior Accelerated networking should be turned on by default. When creating manually in the portal, it is defaulted to true.

Environment summary azure-cli 2.16.0 core 2.16.0 telemetry 1.0.6 Python (Linux) 3.6.10 (default, Dec 4 2020, 12:36:15) [GCC 7.5.0] Ubuntu 18.04.5 LTS

Additional context When switching the image to Canonical:UbuntuServer:18.04-LTS, the VM comes up with accelerated networking enabled.

qwordy commented 3 years ago

Azure CLI is different from Azure Portal. If it is turned on automatically, some will ask why Azure CLI turns on accelerated networking for me be default. I will be charged more money. I can turn it on only if RHEL images must work on accelerated networking.

grtn316 commented 3 years ago

@qwordy Totally understand. I think the confusion is that, sometimes its on and sometimes its not.

For example: RHEL VM: off Ubuntu VM: on

I was expecting them to either both be on or off by default.

In the docs it says: Enable accelerated networking. Unless specified, CLI will enable it based on machine image and size. https://docs.microsoft.com/en-us/cli/azure/vm?view=azure-cli-latest#az_vm_create

It is currently unclear to me why RHEL defaults to off and Ubuntu defaults to on. Any insight is appreciated.

qwordy commented 3 years ago

@grtn316 Thank you for providing more details. The doc is really confusing. Undetermined behavior. If I write this command from scratch, I will not adopt this so called intelligent behavior. I will read code and debug to see what happens on different images.

qwordy commented 3 years ago

@grtn316 Code is here. https://github.com/Azure/azure-cli/blob/dcf4084a2aaf30c6093e77a65e60b1d7bdcbe642/src/azure-cli/azure/cli/command_modules/vm/_validators.py#L707 I don't know why these SKUs and images enable accelerated networking while others do not. I believe some data is stale. My suggestion is set one default value (either on or off) and users can specify it if they don't want default value. How do you think? But it is a breaking change. It is likely to rejected by reviewers.

grtn316 commented 3 years ago

@qwordy I agree with your thoughts. I suspect a majority of users would want it "enabled" by default and should explicitly disable it if its not needed.

qwordy commented 3 years ago

This issue will be taken over by @Juliehzl