vatesfr / xen-orchestra

The global orchestration solution to manage and backup XCP-ng and XenServer.
https://xen-orchestra.com
Other
795 stars 265 forks source link

Error to restore VM backed up in suspended state #6142

Closed savage1279 closed 2 years ago

savage1279 commented 2 years ago

If I try to restore a VM backed up in suspended state I get an error: "Cannot read properties of undefined (reading 'other_config')"

To Reproduce Steps to reproduce the behavior:

  1. Suspend a VM
  2. Back up the VM
  3. Try to restore
  4. Get an error

Additional context This happens because the backup json file contains a reference to VDI, which in not exported to backup, and the VM is in suspended state

image

If I change the VM state to Running and remove VDI reference directly in JSON backup file, it starts restoring as it should

The problem is that suspended VDI not exported to VDI

The simple solution is to not try import suspended VDI if it doesn't exist

image

if vdi is not present (and it's really not present) it throws an exeption

Just add a condition:

if (typeof vdi != "undefined") { ... } after line 197 to avoid an exception

olivierlambert commented 2 years ago

Thanks for your report! @marcungeschikts is it Kanban card 616 internally? If yes, we might just create a branch with that modification so @savage1279 can test it and see if the problem is solved :)

marcungeschikts commented 2 years ago

For sure, it could be very helpful. @savage1279 we will contact you soon.

julien-f commented 2 years ago

@savage1279Can you please send me (julien.fontanet@vates.fr) the full metadata (JSON file) of your problematic backup?

I need to understand how to replicate the issue.

savage1279 commented 2 years ago

@julien-f Yes, I sent

julien-f commented 2 years ago

@savage1279 Can you please test the branch fix-import-suspendVm-without-suspendVdi? It should fix your problem.