Closed amhuber closed 6 years ago
@amhuber Thanks for filling this issue. Indeed a regular expressions would be better. I added a story for that: https://www.pivotaltracker.com/story/show/151539797
This should be fixed by d17f5c46cfa56655826422c217e9e038a0c053da.
Awesome, thank you. Looks like that will fix our issue.
@yeshwantbabar @ktchen14 : Can we close this issue now?
Yes, we've confirmed that the new release is working correctly. Thank you, this saves us a huge amount of pain not having to manually fix the disks on every deployment. :-)
@amhuber : Thanks for reporting the issue and the update for closing it.
Ran into this, looking to upgrade to resolve but curious @amhuber what process did you do to manually fix the disks?
Assuming you have a VM that is already broken, then the CPI would have deleted the VM in question but left the disk in the VM folder. To fix it, you need to:
Find the disk. You should know the VM name from the BOSH error. Search through all datastores until you find the VM folder with the VMDK in it. The VMDK will have been renamed to match the VM name, but you will be able to confirm the size of the VMDK.
Move the disk to your disks folder. You'll need to get on the console for one of your ESX servers and use vmkfstools to move the disk to the right folder, and rename it to the original "disk-guid" file name.
Kick off the deploy again. The CPI will search all datastores until it finds the right disk based on the filename, and will then re-attach it to the newly deployed VM.
Thanks for the update @amhuber
Before a VM with a persistent disk is deleted, the CPI checks the vAppConfig property to determine the original path of the persistent VMDK and will move it back in cases where the VM has been migrated to a new datastore and the disk has been moved into the VM folder. We've been trying to troubleshoot why the move function fails in some cases with this error:
Looking at the code at https://github.com/cloudfoundry-incubator/bosh-vsphere-cpi-release/blob/master/src/vsphere_cpi/lib/cloud/vsphere/resources/vm.rb#L297-L299, you are splitting the path on a space character which breaks if the datastore name contains a space. For example, this will work fine:
This will break:
In other places in the code you're using a regular expression to grab the text between the brackets to determine the name, splitting on a space is not safe.