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

fix clone vm without datastore relocation #135

Merged

Conversation

timogoebel
Copy link
Member

@timogoebel timogoebel commented Mar 28, 2018

Fixes #132.

This commit checks if the new_volume has a datastore attribute before trying to relocate it.

The error in the issue happens, because this is passed to vSphere (because new_volume.datastore is nil):

relocation_spec[:disk] -> [{:diskId=>nil, :datastore=>nil}]

@timogoebel
Copy link
Member Author

@scambra: Do you mind taking a look? Does this still work with your use case?

Copy link
Collaborator

@chris1984 chris1984 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timogoebel I am hitting this:

/home/chrobert/.rvm/gems/ruby-2.4.3/gems/fog-vsphere-2.0.1/lib/fog/vsphere/requests/compute/vm_clone.rb:134:in `vm_clone': undefined method `parent' for nil:NilClass (NoMethodError)

I sent you a PM on IRC with my file, let me know if its something I am doing wrong ( more than likely) as I am not seeing any reference to parent in this PR. I will be online at 9 AM EST tomorrow.

@chris1984
Copy link
Collaborator

Thanks @timogoebel tested and working

@chris1984 chris1984 merged commit 9173951 into fog:master Apr 5, 2018
@kartikaydw
Copy link

Hey There,

I am getting below error while attaching the disk. Any Pointers?

**Required property id is missing from data object of type ID

while parsing serialized DataObject of type vim.vslm.ID
at line 1, column 255

while parsing call information for method AttachDisk_Task
at line 1, column 177

while parsing SOAP body
at line 1, column 167

while parsing SOAP envelope
at line 1, column 0

while parsing HTTP request for method attachDisk
on object of type vim.VirtualMachine
at line 1, column 0**

Code snippet.

 vm.AttachDisk_Task(
    diskId: did,
    datastore: vmdk_datastore,
    controllerKey: 1000,
    unitNumber: 14,

)

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

Successfully merging this pull request may close these issues.

Required property diskId is missing from data object of type VirtualMachineRelocateSpecDiskLocator
3 participants