mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-23 03:42:19 +00:00
Add function that raises error if domain is not active
Add a function named virDomainObjCheckIsActive in src/conf/domain_conf.c. It calls virDomainObjIsActive, raises error if necessary and returns. There is a lot of occurence of this pattern and it will save 3 lines on each call. Signed-off-by: Clementine Hayat <clem@lse.epita.fr> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
825bb9b842
commit
749282d400
@ -5997,6 +5997,17 @@ virDomainDefValidate(virDomainDefPtr def,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
virDomainObjCheckActive(virDomainObjPtr dom)
|
||||||
|
{
|
||||||
|
if (!virDomainObjIsActive(dom)) {
|
||||||
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
|
"%s", _("domain is not running"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virDomainDeviceLoadparmIsValid
|
* virDomainDeviceLoadparmIsValid
|
||||||
|
@ -2722,6 +2722,8 @@ virDomainObjIsActive(virDomainObjPtr dom)
|
|||||||
return dom->def->id != -1;
|
return dom->def->id != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int virDomainObjCheckActive(virDomainObjPtr dom);
|
||||||
|
|
||||||
int virDomainDefSetVcpusMax(virDomainDefPtr def,
|
int virDomainDefSetVcpusMax(virDomainDefPtr def,
|
||||||
unsigned int vcpus,
|
unsigned int vcpus,
|
||||||
virDomainXMLOptionPtr xmlopt);
|
virDomainXMLOptionPtr xmlopt);
|
||||||
|
@ -474,6 +474,7 @@ virDomainNostateReasonTypeFromString;
|
|||||||
virDomainNostateReasonTypeToString;
|
virDomainNostateReasonTypeToString;
|
||||||
virDomainObjAssignDef;
|
virDomainObjAssignDef;
|
||||||
virDomainObjBroadcast;
|
virDomainObjBroadcast;
|
||||||
|
virDomainObjCheckActive;
|
||||||
virDomainObjCopyPersistentDef;
|
virDomainObjCopyPersistentDef;
|
||||||
virDomainObjEndAPI;
|
virDomainObjEndAPI;
|
||||||
virDomainObjFormat;
|
virDomainObjFormat;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user