-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[Draft] VR: remove old json config when start vmware/xenserver VPC VRs #5938
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
Changes from all commits
b24525a
43376c6
09f8afe
0ef9cd7
7340cda
6345a83
811d73d
9835bf3
4b77890
a97b766
1619343
064cb07
0b156df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1804,9 +1804,43 @@ protected CheckSshAnswer execute(CheckSshCommand cmd) { | |
| networkUsage(privateIp, "create", null); | ||
| } | ||
|
|
||
| if (VirtualMachineName.isValidRouterName(vmName)) { | ||
| reconfigureDomainRouterAfterStart(vmName); | ||
| } | ||
|
|
||
| return new CheckSshAnswer(cmd); | ||
| } | ||
|
|
||
| private void reconfigureDomainRouterAfterStart(String vmName) { | ||
| s_logger.debug("Reconfigure to remove machine.id from domain router after start. vmName: " + vmName); | ||
| VmwareContext context = getServiceContext(); | ||
| try { | ||
| VmwareHypervisorHost hyperHost = getHyperHost(context); | ||
| VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(vmName); | ||
| if (vmMo == null) { | ||
| if (hyperHost instanceof HostMO) { | ||
| ClusterMO clusterMo = new ClusterMO(hyperHost.getContext(), ((HostMO) hyperHost).getParentMor()); | ||
| vmMo = clusterMo.findVmOnHyperHost(vmName); | ||
| } | ||
| } | ||
| if (vmMo == null) { | ||
| String msg = "VM " + vmName + " no longer exists to execute UnPlugNic command"; | ||
| s_logger.error(msg); | ||
| throw new Exception(msg); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could instantiate a more specific exception. |
||
| } | ||
| VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec(); | ||
| OptionValue option = new OptionValue(); | ||
| option.setKey("machine.id"); | ||
| option.setValue(""); | ||
| vmConfigSpec.getExtraConfig().add(option); | ||
| if (!vmMo.configureVm(vmConfigSpec)) { | ||
| throw new Exception("Failed to reconfigure domain router after start. vmName: " + vmName); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could instantiate a more specific exception. |
||
| } | ||
| } catch (Exception e) { | ||
| s_logger.error("Unexpected exception when reconfigure domain router after start: ", e); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can add the name of the VM to the log and pass the exception as parameter. |
||
| } | ||
| } | ||
|
|
||
| private DiskTO[] validateDisks(DiskTO[] disks) { | ||
| List<DiskTO> validatedDisks = new ArrayList<DiskTO>(); | ||
|
|
||
|
|
||
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.