vic icon indicating copy to clipboard operation
vic copied to clipboard

WIP: Support edit of config for running cVMs and endpointVM

Open hickeng opened this issue 4 years ago • 1 comments

This updates config handling to make use of the fact that the bug1985862 has been addressed and in the field for a while now. That bug prevented us from using the vim API to update guestinfo keys while the VM was running as they would convert to non-persistent.

NOTE this PR should not be shipped without determining which ESX builds include that fix and a check of some kind during vic-machine install/upgrade to confirm that the target, or all current ESXs in the target cluster are of sufficiently high version.

This enables any of the blocked work such as docker network add <bridgenet> <cid> for running containers that was previously blocked.

There is a quirk in my validation of rename after upgrade; the rename applies in ESX but does not update the VIC metadata for the VM. If I recall correctly we had a statement about levels of support for old containers, particularly those that had never been run. I think that's what I'm seeing but haven't tracked down the support statement.

ghicken@kube-worker:~/vic$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS              PORTS               NAMES
bbd2a3a574e8        busybox             "/bin/ash"          6 seconds ago        Created                                 never-start
e0396488a573        busybox             "/bin/ash"          34 seconds ago       Up 20 seconds                           will-exit-after-rename
c358443dfe3a        busybox             "/bin/ash"          About a minute ago   Up 47 seconds                           will-rename
ab8fff253b49        busybox             "/bin/ash"          About a minute ago   Up About a minute                       wont-rename
ghicken@kube-worker:~/vic$ docker rename will-rename renamed
ghicken@kube-worker:~/vic$ docker rename will-exit-after-rename rename-and-exit
ghicken@kube-worker:~/vic$ docker rename never-start rename-not-started
ghicken@kube-worker:~/vic$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS              PORTS               NAMES
bbd2a3a574e8        busybox             "/bin/ash"          About a minute ago   Created                                 rename-not-started
e0396488a573        busybox             "/bin/ash"          About a minute ago   Up About a minute                       rename-and-exit
c358443dfe3a        busybox             "/bin/ash"          2 minutes ago        Up About a minute                       renamed
ab8fff253b49        busybox             "/bin/ash"          2 minutes ago        Up 2 minutes                            wont-rename
ghicken@kube-worker:~/vic$ vic-ls
INFO[0000] ### Listing VCHs ####
INFO[0000] Validating target

ID        PATH                                                                  NAME           VERSION                      UPGRADE STATUS
8         /ha-datacenter/host/sc2-10-185-251-91.eng.vmware.com/Resources        vic-esx        v1.5.5-21324-50a44954        VCH has newer version
ghicken@kube-worker:~/vic$ vic-upgrade --force
INFO[0000] ### Upgrading VCH ####
INFO[0000] Validating target
WARN[0000] Disabling ha-host hostd.log collection (ServerFaultCode: Cannot complete the operation due to an incorrect request to the server.)
INFO[0000]
INFO[0000] VCH ID: VirtualMachine:8
INFO[0000] Creating directory [datastore1] vic-esx
INFO[0000] datastore root [datastore1] vic-esx already exists
INFO[0000] Datastore path is [datastore1] vic-esx
INFO[0000] Uploading ISO images
INFO[0000] Uploading appliance.iso as V1.5.5-0-5F70FBD30-appliance.iso
INFO[0009] Uploading bootstrap.iso as V1.5.5-0-5F70FBD30-bootstrap.iso
INFO[0015] Switching appliance iso to [datastore1] vic-esx/V1.5.5-0-5F70FBD30-appliance.iso
INFO[0015] Setting VM configuration
INFO[0016] Waiting for IP information
INFO[0022] Waiting for major appliance components to launch
INFO[0031] Obtained IP address for client interface: "10.185.246.19"
INFO[0031] Checking VCH connectivity with vSphere target
INFO[0031] vSphere API Test: https://10.185.251.91 vSphere API target responds as expected
WARN[0034] Server certificate hostname doesn't match: x509: cannot validate certificate for 10.185.246.19 because it doesn't contain any IP SANs
INFO[0034] Completed successfully
ghicken@kube-worker:~/vic$ vic-ssh
SSH to sc2-10-185-246-19.eng.vmware.com
Warning: Permanently added 'sc2-10-185-246-19.eng.vmware.com,10.185.246.19' (ECDSA) to the list of known hosts.
Warning: your password will expire in 0 days
root@vic-esx [ ~ ]# exit
ghicken@kube-worker:~/vic$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                       PORTS               NAMES
bbd2a3a574e8        busybox             "/bin/ash"          7 minutes ago       Created                                          rename-not-started
e0396488a573        busybox             "/bin/ash"          7 minutes ago       Exited (143) 5 minutes ago                       rename-and-exit
c358443dfe3a        busybox             "/bin/ash"          8 minutes ago       Up 8 minutes                                     renamed
ab8fff253b49        busybox             "/bin/ash"          9 minutes ago       Up 8 minutes                                     wont-rename
ghicken@kube-worker:~/vic$ docker rename rename-and-exit renamed-again
ghicken@kube-worker:~/vic$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                       PORTS               NAMES
bbd2a3a574e8        busybox             "/bin/ash"          8 minutes ago       Created                                          rename-not-started
e0396488a573        busybox             "/bin/ash"          8 minutes ago       Exited (143) 6 minutes ago                       renamed-again
c358443dfe3a        busybox             "/bin/ash"          8 minutes ago       Up 8 minutes                                     renamed
ab8fff253b49        busybox             "/bin/ash"          9 minutes ago       Up 9 minutes                                     wont-rename
ghicken@kube-worker:~/vic$ docker rename rename-not-started not-started-renamed-post-upgrade
ghicken@kube-worker:~/vic$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                       PORTS               NAMES
bbd2a3a574e8        busybox             "/bin/ash"          8 minutes ago       Created                                          rename-not-started
e0396488a573        busybox             "/bin/ash"          9 minutes ago       Exited (143) 6 minutes ago                       renamed-again
c358443dfe3a        busybox             "/bin/ash"          9 minutes ago       Up 9 minutes                                     renamed
ab8fff253b49        busybox             "/bin/ash"          10 minutes ago      Up 10 minutes                                    wont-rename
ghicken@kube-worker:~/vic$ govc ls /ha-datacenter/vm
/ha-datacenter/vm/renamed-c358443dfe3a
/ha-datacenter/vm/renamed-again-e0396488a573
/ha-datacenter/vm/not-started-renamed-post-upgrade-bbd2a3a574e8
/ha-datacenter/vm/vic-esx
/ha-datacenter/vm/wont-rename-ab8fff253b49
ghicken@kube-worker:~/vic$

Related #5553

[full ci]

hickeng avatar May 13 '20 05:05 hickeng

Turns out the guestinfo "fix" did not address making persistent changes to keys on a running VM via the API, so the old problems with updating a live cVM are all still present.

hickeng avatar Dec 03 '22 05:12 hickeng