-
Notifications
You must be signed in to change notification settings - Fork 262
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
feat(xo-web/disks): allow user to delete snapshots before migrating VDI #7903
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1035,14 +1035,24 @@ export default class Xapi extends XapiBase { | |
return this.callAsync('VDI.clone', vdi.$ref) | ||
} | ||
|
||
async moveVdi(vdiId, srId) { | ||
async moveVdi(vdiId, srId, removeSnapshotsBeforeMigrating) { | ||
const vdi = this.getObject(vdiId) | ||
const sr = this.getObject(srId) | ||
|
||
if (vdi.SR === sr.$ref) { | ||
return vdi | ||
} | ||
|
||
if (removeSnapshotsBeforeMigrating) { | ||
for (const vdiRef of vdi.snapshots) { | ||
const vdi = this.getObject(vdiRef) | ||
for (const vbdRef of vdi.VBDs) { | ||
const vbd = this.getObject(vbdRef) | ||
await this.VM_destroy(vbd.VM) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not destroy VMs when migrating a VDI! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry I should have commented the code because indeed it's not very clear like this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The issue is about migrating VDI, not VM, and therefore destroying all its snapshot. We are not talking about destroying VM snapshots here, that's a possibility but that's not the original request. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Either:
In either case, this should be obvious in the API and the UI. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think there's any sense to keep some VM snapshots alone without their VDIs. Since we decided to migrate the VM original VDI, we have a binary choice:
Most of the time, there's one disk per VM, but maybe 2 or 3 VM.snapshot. Since delta won't work as soon as we move the VM VDI to a new SR, most of the time, removing all VM.snapshots make sense (and when it's not, the user can make a choice) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could add a second toggle to allow the user to also destroy the VDIs snapshots? |
||
} | ||
} | ||
} | ||
|
||
log.debug(`Moving VDI ${vdi.name_label} from ${vdi.$SR.name_label} to ${sr.name_label}`) | ||
try { | ||
return this.barrier( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removeSnapshotsBeforeMigrating
→destroySnapshots
.