mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-09-21 09:44:54 +03:00
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainManagedSaveRemove
Signed-off-by: Matt Coleman <matt@datto.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
committed by
Laine Stump
parent
54d96d7fde
commit
97c558b5d7
@@ -2843,27 +2843,21 @@ hypervDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags)
|
|||||||
static int
|
static int
|
||||||
hypervDomainManagedSaveRemove(virDomainPtr domain, unsigned int flags)
|
hypervDomainManagedSaveRemove(virDomainPtr domain, unsigned int flags)
|
||||||
{
|
{
|
||||||
int result = -1;
|
g_autoptr(Msvm_ComputerSystem) computerSystem = NULL;
|
||||||
Msvm_ComputerSystem *computerSystem = NULL;
|
|
||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
|
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (computerSystem->data->EnabledState != MSVM_COMPUTERSYSTEM_ENABLEDSTATE_SUSPENDED) {
|
if (computerSystem->data->EnabledState != MSVM_COMPUTERSYSTEM_ENABLEDSTATE_SUSPENDED) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("Domain has no managed save image"));
|
_("Domain has no managed save image"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = hypervInvokeMsvmComputerSystemRequestStateChange(domain,
|
return hypervInvokeMsvmComputerSystemRequestStateChange(domain,
|
||||||
MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_DISABLED);
|
MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_DISABLED);
|
||||||
|
|
||||||
cleanup:
|
|
||||||
hypervFreeObject((hypervObject *)computerSystem);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user