Skip to content
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

Support full clone when cloning VM with vcsim #2706

Closed
qiyanqi opened this issue Jan 16, 2022 · 1 comment · Fixed by #2704
Closed

Support full clone when cloning VM with vcsim #2706

qiyanqi opened this issue Jan 16, 2022 · 1 comment · Fixed by #2704

Comments

@qiyanqi
Copy link

qiyanqi commented Jan 16, 2022

I have multiple mock hosts, and trying to create vm template on each host with vcsim. I found the cloned VM share config.hardware.device.

Is it possible to support full clone? The expectation is each VM could have its own device but not share.

Below is an example and the script to show the issue:

clone VM1 from DC0_H0_VM0, the virtual disk point to “[host-1-local-dc] clonevm_host_1/clonevm_host_1.vmdk”
After clone VM2 from DC0_H0_VM0, virtual disk for DC0_H0_VM0, VM1, VM2 are all changed to the same vmdk [host-2-local-dc] clonevm_host_2/clonevm_host_2.vmdk”.

#!/bin/bash

# run vcsim:  ./govmomi/vcsim/vcsim -dc 1 -standalone-host 3 -vm 1

export GOVC_URL=https://user:pass@127.0.0.1:8989/sdk; export GOVC_INSECURE=1


setuphost() {
    id=$1

    # create local datastore
    rm -rf /tmp/datastore-${id}; mkdir -p /tmp/datastore-${id}
    govc datastore.create -type local -name host-${id}-local-dc -path /tmp/datastore-${id} DC0_H${id}

    # clone vm from template
    govc vm.clone -vm DC0_H0_VM0 -template=true -dc DC0 -ds host-${id}-local-dc -pool=/DC0/host/DC0_H${id}/Resources clonevm_host_${id}
}

setuphost 1
echo "###### clonevm_host_1:"
govc object.collect -o -dump /DC0/vm/clonevm_host_1 config.hardware.device|grep FileName
setuphost 2
echo "###### clonevm_host_1:"
govc object.collect -o -dump /DC0/vm/clonevm_host_1 config.hardware.device|grep FileName
echo "###### clonevm_host_2:"
govc object.collect -o -dump /DC0/vm/clonevm_host_2 config.hardware.device|grep FileName
echo "###### DC0_H0_VM0:"
govc object.collect -o -dump /DC0/vm/DC0_H0_VM0 config.hardware.device|grep FileName



output:

[14-01-22 15:41:30] Cloning /DC0/vm/DC0_H0_VM0 to clonevm_host_1...OK
###### clonevm_host_1:
                                FileName:                 "[host-1-local-dc] clonevm_host_1/clonevm_host_1.vmdk",
[14-01-22 15:41:30] Cloning /DC0/vm/DC0_H0_VM0 to clonevm_host_2...OK
###### clonevm_host_1:
                                FileName:                 "[host-2-local-dc] clonevm_host_2/clonevm_host_2.vmdk",
###### clonevm_host_2:
                                FileName:                 "[host-2-local-dc] clonevm_host_2/clonevm_host_2.vmdk",
###### DC0_H0_VM0:
                                FileName:                 "[host-2-local-dc] clonevm_host_2/clonevm_host_2.vmdk",
@github-actions
Copy link
Contributor

Howdy 🖐   qiyanqi ! Thank you for your interest in this project. We value your feedback and will respond soon.

If you want to contribute to this project, please make yourself familiar with the CONTRIBUTION guidelines.

@qiyanqi qiyanqi changed the title Need support full clone when clone VM with vcsim Support full clone when cloning VM with vcsim Jan 16, 2022
@dougm dougm added this to the 0.28 milestone Jan 17, 2022
dougm added a commit to dougm/govmomi that referenced this issue Jan 17, 2022
The vcsim CloneVM_Task method was sharing the config.hardware.device property
between the source and target VMs. The target VM now has a copy of the device
list so changes to it won't change the source VM's device list.

Closes vmware#2706
pradeep288 pushed a commit to pradeep288/govmomi that referenced this issue Jan 25, 2022
The vcsim CloneVM_Task method was sharing the config.hardware.device property
between the source and target VMs. The target VM now has a copy of the device
list so changes to it won't change the source VM's device list.

Closes vmware#2706
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants