We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
When the duplicated vm name is specified to CloneVM_Task request, it succeeds and the created vm has same path to the existng one.
CloneVM_Task
To Reproduce Steps to reproduce the behavior:
package main import ( "context" "fmt" "net/url" "path" "github.com/vmware/govmomi" "github.com/vmware/govmomi/find" "github.com/vmware/govmomi/vim25/types" ) func main() { ctx := context.Background() u, _ := url.Parse("https://user:pass@127.0.0.1:8989/sdk") c, _ := govmomi.NewClient(ctx, u, true) finder := find.NewFinder(c.Client) vm, _ := finder.VirtualMachine(ctx, "DC0_H0_VM0") folder, _ := finder.Folder(ctx, path.Dir(vm.InventoryPath)) config := types.VirtualMachineCloneSpec{ Template: false, PowerOn: true, } // name and folder are same as original's ones task, err := vm.Clone(ctx, folder, vm.Name(), config) if err != nil { fmt.Printf("failed to clone: %s", err) return } result, err := task.WaitForResult(ctx) if err != nil { fmt.Printf("task failed: %s", err) return } fmt.Printf("state: %#v\n", result.State) }
Expected behavior
The task failed by a name duplication error.
$ go run .\main.go task failed: The name 'DC0_H0_VM0' already exists.
Affected version
Screenshots/Debug Output
The task succeeds and two vms are located in the same path.
$ go run main.go state: "success" $ govc vm.info DC0_H0_VM0 Name: DC0_H0_VM0 Path: /DC0/vm/DC0_H0_VM0 UUID: 265104de-1472-547c-b873-6dc7883fb6cb Guest name: otherGuest Memory: 32MB CPU: 1 vCPU(s) Power state: poweredOn Boot time: 2022-11-03 20:34:07.225752728 +0900 JST IP address: Host: DC0_H0 Name: DC0_H0_VM0 Path: /DC0/vm/DC0_H0_VM0 UUID: 0d844f57-2f52-591a-bcff-16c283cd5559 Guest name: otherGuest Memory: 32MB CPU: 1 vCPU(s) Power state: poweredOff Boot time: <nil> IP address: Host: DC0_H0
Additional context
govc is not affected by this issue since it checks vmx file collision before CloneVM_Task.
govc
vmx
$ govc vm.clone -host DC0_H0 -vm DC0_H0_VM0 DC0_H0_VM0 govc: file [LocalDS_0] DC0_H0_VM0/DC0_H0_VM0.vmx already exists
The text was updated successfully, but these errors were encountered:
vcsim: Fix duplicated name check in CloneVM_Task
3d0302f
Closes: vmware#2983 Signed-off-by: syuparn <s.hello.spagetti@gmail.com>
cedf695
28e5201
Successfully merging a pull request may close this issue.
Describe the bug
When the duplicated vm name is specified to
CloneVM_Task
request, it succeeds and the created vm has same path to the existng one.To Reproduce
Steps to reproduce the behavior:
source code (click to open)
Expected behavior
The task failed by a name duplication error.
Affected version
Screenshots/Debug Output
The task succeeds and two vms are located in the same path.
Additional context
govc
is not affected by this issue since it checksvmx
file collision beforeCloneVM_Task
.The text was updated successfully, but these errors were encountered: