Fixed failure to start a VM after it was imported as an XVA package.

Regression introduced by the changes for CA-64500. Since we initiate a VMStartAction
we need to ensure that the VM object passed to the action has a non-null Connection.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2020-12-12 01:31:48 +00:00
parent 0b0d6973ba
commit 542a329a27

View File

@ -231,13 +231,10 @@ namespace XenAdmin.Actions
}
}
//get the record before marking the action as completed
var vm = VM.get_record(Session, vmRef);
vm.opaque_ref = vmRef;
var vm = Connection.WaitForCache(new XenRef<VM>(vmRef));
Description = isTemplate ? Messages.IMPORT_TEMPLATE_IMPORTCOMPLETE : Messages.IMPORTVM_IMPORTCOMPLETE;
if (!vm.is_a_template && m_startAutomatically)
if (vm != null && !vm.is_a_template && m_startAutomatically)
new VMStartAction(vm, _warningDelegate, _failureDiagnosisDelegate).RunAsync();
}