-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Compute] VM NIC updates #1421
[Compute] VM NIC updates #1421
Conversation
@tjprescott, thanks for your PR! By analyzing the history of the files in this pull request, we identified @BurtBiel, @derekbekoe and @yugangw-msft to be potential reviewers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest LGTM.
register_cli_argument('vm nic', 'vm_name', existing_vm_name, id_part=None) | ||
register_cli_argument('vm nic', 'nic_ids', multi_ids_type) | ||
register_cli_argument('vm nic', 'nic_names', multi_ids_type) | ||
register_cli_argument('vm nic', 'vm_name', existing_vm_name, options_list=('--vm-name',), id_part=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is options_list=('--vm-name',)
redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because existing_vm_name
would make it --name, which isn't correct here.
cli_command(__name__, 'vm open-port', 'azure.cli.command_modules.vm.custom#vm_open_port') | ||
op_var = 'virtual_machines_operations' | ||
op_class = 'VirtualMachinesOperations' | ||
cli_command(__name__, 'vm delete', mgmt_path.format(op_var, op_class, 'delete'), cf_vm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//cc @derekbekoe. I am fine with this new style. As long as we agree, let us propagate this style across moving forward
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep I'm fine with this!
def vm_show_nic(resource_group_name, vm_name, nic=None): | ||
''' Show details of a network interface configuration attached to a virtual machine ''' | ||
vm = _vm_get(resource_group_name, vm_name) | ||
found = next((n for n in vm.network_profile.network_interfaces if nic in n.id), None) # pylint: disable=no-member |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nic in n.id
should consider case insensitive matching. Also is nic
always a id? If not, then in
is not a reliable matching as it is possible the nic name will collide with any sub-str in the id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is. The validator essentially takes names or ids and converts them to ids. I'll add the case insensitivity and change the matching to ==
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one question.
@@ -693,20 +691,37 @@ def show_default_diagnostics_configuration(is_windows_os=False): | |||
'''show the default config file which defines data to be collected''' | |||
return get_default_diag_config(is_windows_os) | |||
|
|||
def vm_add_nics(resource_group_name, vm_name, nic_ids=None, nic_names=None, primary_nic=None): | |||
'''add network interface configurations to the virtual machine | |||
def vm_show_nic(resource_group_name, vm_name, nic=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is nic
optional?
Lower down, you have if nic in n.id
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be required.
* Azure/master: (39 commits) User should use no-cache so we build a fresh image (Azure#1455) Bump all modules to version 0.1.0b10 (Azure#1454) [Docs] Move around the order of install instructions. (Azure#1439) acs: *_install_cli mark cli as executable (Azure#1449) Fix resource list table. (Azure#1452) [Compute] VM NIC updates (Azure#1421) Introduce batch upload and download for blob (Azure#1428) Add auto-registration for resource providers. (Azure#1330) interpret the '@' syntax if something higher hasn't already done that. (Azure#1423) Aliasing plan argument with shorthand (Azure#1433) ad:fix one more place which still uses localtime for secret starttime (Azure#1429) Add table formatting for deployments and sort by timestmap. (Azure#1427) Add table formatting for resource group list (and add 'status') (Azure#1425) [Docs] Add shields specifying latest version and supported python versions (Azure#1420) Add new az storage blob copy start-batch command (Azure#1250) Component Discovery (Azure#1409) Add poison logic to prevent re-recording tests that need updating. (Azure#1412) [Storage] Fix storage table outputs and help text. (Azure#1402) [mention-bot] Attempt to fix config (Azure#1410) ad:use utc time on setting app's creds (Azure#1408) ...
**BC** Replace --nic-ids and --nic-names with --nics parameter for existing `vm nic` commands. **BC** Renames `vm nic delete` to `vm nic remove` and `vm nic update` to `vm nic set` * Add NIC show and list commands to VM NIC. * Code review feedback.
Fixes #783, fixes #785.
vm nic show
(which is basically an alias ofaz network nic show
) andvm nic list
--nic-ids
and--nic-names
into a single--nics
parameter for existing commands Breaking Changevm nic
commands into VM multi-NIC create scenario instead of relying on unit tests.vm nic delete
tovm nic remove
since it does NOT actually delete a NIC. Renamesvm nic update
tovm nic set
since it does not update the settings but in fact replaces them. Breaking Change