-
Notifications
You must be signed in to change notification settings - Fork 913
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
Right way to replace/swap attached disk with another existing disk #3367
Comments
Howdy 🖐 rickatnight11 ! 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 |
Digging more into the code, it looks like EditDevice is the helper function I'm looking for. Trying to figure out how to use it correctly. |
So far I've tried swapping out the disk's backing with a bare-bones one that sets a different path:
...but vCenter is returning:
I feel like I'm close. |
I didn't manage to figure this out, but I did finally get RemoveDevice + AddDevice working, borrowing heavily from govc's device.remove and vm.disk.attach implementations. It's slightly annoying, because I end up needing to removing all disks and adding them back to maintain the original label order (i.e. "Hard disk 1", "Hard disk 2", etc), but it works! Would still love any feedback on cleaner/preferred ways to do this. |
This issue is stale because it has been open for 90 days with no |
/remove-lifecycle stale |
This issue is stale because it has been open for 90 days with no |
/remove-lifecycle stale |
I'm trying to replace the root disk across a bunch of VMs by cloning the disk from a template, then swap the new disk in for the existing one. I'm having a heck of a time figuring out the right way to do this.
I have tried with DetachDisk and AttachDisk, but struggling to determine what disk ID AttachDisk is looking for (tried the UUID, but get
The object or item referred to could not be found
).I have also tried a Reconfigure (similar to #790, but I don't just want to add another disk, I want to swap one in (and keep the original one "detached" in the datastore), which looks like a better option (more atomic), but I can't quite figure out the way to construct the desired change.
I basically want the equivalent of this call:
https://developer.vmware.com/apis/vsphere-automation/latest/vcenter/api/vcenter/vm/vm/hardware/disk/disk/patch/
Would love some guidance on how to approach this!
The text was updated successfully, but these errors were encountered: