-
Notifications
You must be signed in to change notification settings - Fork 112
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
Allows to remove network interface from VM with hot update #568
Conversation
# Conflicts: # go.mod # go.sum # vendor/modules.txt
# Conflicts: # go.mod # go.sum
Merge branch 'master' of github.com:vmware/terraform-provider-vcd
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.
Looks suspicious:
=== RUN TestAccVcdVAppVmMultiNIC
testing.go:654: Step 0 error: Check failed: 1 error occurred:
* Check 37/75 error: vcd_vapp_vm.TestAccVcdVAppVmMultiNICVM: Attribute 'network.3.mac' expected "00:00:00:11:11:11", got "00:50:56:1c:17:61"
--- FAIL: TestAccVcdVAppVmMultiNIC (362.22s)
Merge branch 'master' of github.com:vmware/terraform-provider-vcd
Merge branch 'master' of github.com:vmware/terraform-provider-vcd
# Conflicts: # scripts/skip-upgrade-tests.txt # vcd/resource_vcd_vapp_vm.go
After merge can't reproduce. Looks ok. |
} | ||
|
||
network { | ||
type = "org" | ||
name = vcd_vapp_org_network.vappNetwork1.org_network_name | ||
ip_allocation_mode = "DHCP" | ||
is_primary = true | ||
is_primary = "true" |
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 quoting here?
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.
fixed
Merge branch 'master' of github.com:vmware/terraform-provider-vcd
@@ -46,6 +46,12 @@ The following fields were removed from resources in *v3.0*: | |||
* `resource/vcd_vm_affinity_rule.virtual_machine_ids` renamed to `vm_ids` | |||
|
|||
|
|||
## Removed resources and fields |
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 there a change log entry somewhere else?
-
I can't make it work. I'm removing NIC, it's an update as expected, but getting this error:
vcd_vapp_vm.demo_vm_wordpress: Still modifying... [id=urn:vcloud:vm:7417411f-14d7-4b02-8e19-228b7d3a1b10, 30s elapsed]
Error: unable to update network configuration: error updating network connection: API Error: 400: NICs with indices '0' cannot be removed while VM is powered on.
on radio2020.tf line 318, in resource "vcd_vapp_vm" "demo_vm_wordpress":
318: resource "vcd_vapp_vm" "demo_vm_wordpress" {
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.
- I just tried with two NICs and to remove the 2nd one. Same error:
# vcd_vapp_vm.demo_vm_wordpress will be updated in-place
~ resource "vcd_vapp_vm" "demo_vm_wordpress" {
accept_all_eulas = true
catalog_name = "shared-catalog"
computer_name = "bitnami-wordpress-532-2-r01-linux-centos-7-x8664-001"
cpu_cores = 1
cpu_hot_add_enabled = false
cpus = 1
expose_hardware_virtualization = false
guest_properties = {
"demo.setting" = "Guest property set by Terraform vCD Provider"
}
hardware_version = "vmx-08"
href = "https://bos1-vcloud-static-171-124.eng.vmware.com/api/vApp/vm-7417411f-14d7-4b02-8e19-228b7d3a1b10"
id = "urn:vcloud:vm:7417411f-14d7-4b02-8e19-228b7d3a1b10"
internal_disk = [
{
bus_number = 0
bus_type = "parallel"
disk_id = "2000"
iops = 0
size_in_mb = 10240
storage_profile = "*"
thin_provisioned = true
unit_number = 0
},
]
memory = 512
memory_hot_add_enabled = false
metadata = {
"demo_data" = "Terraform vCD Provider"
}
name = "demo-vm-wordpress"
os_type = "otherLinux64Guest"
power_on = true
prevent_update_power_off = false
sizing_policy_id = "urn:vcloud:vdcComputePolicy:1489d852-56d3-4931-b2d3-6d77a7c8f1c7"
storage_profile = "*"
template_name = "bitnami-wordpress-5.3.2-2-r01-linux-centos-7-x86_64"
vapp_name = "demo-web"
customization {
admin_password = (sensitive value)
allow_local_admin_password = true
auto_generate_password = true
change_sid = false
enabled = true
force = false
join_domain = false
join_org_domain = false
must_change_password_on_first_login = false
number_of_auto_logons = 0
}
network {
adapter_type = "VMXNET3"
connected = true
ip = "192.168.0.2"
ip_allocation_mode = "POOL"
is_primary = true
mac = "00:50:56:29:00:0a"
name = "demo-net-web"
type = "org"
}
- network {
- adapter_type = "E1000" -> null
- connected = true -> null
- ip = "192.168.0.6" -> null
- ip_allocation_mode = "POOL" -> null
- is_primary = false -> null
- mac = "00:50:56:29:00:0f" -> null
- name = "demo-net-web" -> null
- type = "org" -> null
}
}
Plan: 0 to add, 2 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
vcd_vapp_vm.demo_vm_wordpress: Modifying... [id=urn:vcloud:vm:7417411f-14d7-4b02-8e19-228b7d3a1b10]
vcd_vapp_vm.demo_vm_wordpress: Still modifying... [id=urn:vcloud:vm:7417411f-14d7-4b02-8e19-228b7d3a1b10, 10s elapsed]
vcd_vapp_vm.demo_vm_wordpress: Still modifying... [id=urn:vcloud:vm:7417411f-14d7-4b02-8e19-228b7d3a1b10, 20s elapsed]
Error: unable to update network configuration: error updating network connection: API Error: 400: NICs with indices '1' cannot be removed while VM is powered on.
on radio2020.tf line 318, in resource "vcd_vapp_vm" "demo_vm_wordpress":
318: resource "vcd_vapp_vm" "demo_vm_wordpress" {
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.
That is strange, I tested with VCD 10.0 and I could remove all interfaces, even that one that is_primary and has index 0
Did you test with VCD 10.1? I had that message there in the UI (did not test this PR with VCD 10.1 yet). Maybe the exception to cold plug for VCD 10.1 does not work?
By the way, will prevent_update_power_off = true
work for VCD 10.1 (warn user) but let it go on VCD 10.0 since it is a online change?
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.
Just tested VCD10.1. prevent_update_power_off and the code worked as expected (hot add, cold remove with warning)
I tested with SLES12 and SLES15 Guest OS (64bit)
@lvirbalas What guest os does you VM have? Maybe, just for testing, you change the "Operating System" value in VCD to "SUSE Linux Enterprise 15 (64bit)"
(it does not really matter what os is really installed for this test.)
EDIT: I just changed my "Operating System" value to Windows 2016 and newer
. It worked with my linux os inside on VCD10.0 as well...
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.
Need @Didainius @dataclouder help to try this scenario too.
Situation for now:
- Above issue on 10.2
- For @vbauzysvmware works on 10.1
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.
What guest os does you VM have?
bitnami-wordpress-5.3.2-2-r01-linux-centos-7-x86_64
Maybe, just for testing, you change the "Operating System" value in VCD to "SUSE Linux Enterprise 15 (64bit)" (it does not really matter what os is really installed for this test.)
It was "Other Linux", changed to "CentOS 4/5/6 (64-bit)" and then to "SUSE Linux Enterprise 10 (64-bit)", but same error.
@Didainius found references:
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.
p.s. Tried adding vmx.hotRemoveWait = 120
to VM configuration through vSphere, but same error (and in same time).
VMware Tools: Running, version:10336 (Guest Managed)
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.
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.
Though hot removal is not possible in all cases, the new "Hot and Cold update" doc section helps to understand the details. LGTM now!
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.
Thanks for all the troubles and solutions.
I have had acceptance, binary and upgrade tests passing on various instances. In some cases last (primary) interface is not allowed to be hot-removed, but that is probably not too often that all adapters are removed and there is a way to go around it by first powering of the VM (power_on=false
).
Ref: #388
This change allows to make hot VM network interface removal.
Limitations of network interface removal is on only in 10.1 version due the bug.
Tested on 9.7 and 10.0