Skip to content

Commit 7e8acd2

Browse files
authored
Update GuestOS name after upgrading VCH (#8427)
* Update GuestOS name after upgrading VCH VitrualMachineSpec struct contains this info. This fix update the field when upgrading vch. BTW, not only upgrade but also configure command doing this calling link: Configure()->d.update()->reconfigVCH()->update vmSpec. But it may change lots of code to distinguish upgrade and configure in this calling link, so I update vmSpec in both commands. Modify test case `Check Upgrade Version` to add checking of GuestOS name
1 parent e2f1b28 commit 7e8acd2

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

lib/install/management/configure.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"github.com/vmware/govmomi/vim25/types"
2828

2929
"github.com/vmware/vic/lib/config"
30+
"github.com/vmware/vic/lib/constants"
3031
"github.com/vmware/vic/lib/install/data"
3132
"github.com/vmware/vic/lib/install/opsuser"
3233
"github.com/vmware/vic/pkg/errors"
@@ -386,7 +387,7 @@ func (d *Dispatcher) ensureRollbackReady(conf *config.VirtualContainerHostConfig
386387
func (d *Dispatcher) reconfigVCH(conf *config.VirtualContainerHostConfigSpec, isoFile string) error {
387388
defer trace.End(trace.Begin(isoFile, d.op))
388389

389-
spec := &types.VirtualMachineConfigSpec{}
390+
spec := &types.VirtualMachineConfigSpec{AlternateGuestName: constants.DefaultAltVCHGuestName()}
390391

391392
if isoFile != "" {
392393
deviceChange, err := d.switchISO(isoFile)

tests/resources/VCH-Util.robot

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,10 @@ Upgrade with ID
784784
Check Upgraded Version
785785
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux version
786786
@{vers}= Split String ${output}
787+
${releaseNumber}= Run echo @{vers}[2] | awk -F'-' '{print $1}'
788+
${rc} ${out}= Run And Return Rc And Output govc vm.info %{VCH-NAME}
789+
Should Contain ${out} ${releaseNumber}
790+
Should Be Equal As Integers ${rc} 0
787791
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux inspect --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE}
788792
Log ${output}
789793
Should Contain ${output} Completed successfully

0 commit comments

Comments
 (0)