conf: Introduce virDomainObjIsPostcopy helper

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Jiri Denemark 2022-05-10 15:20:25 +02:00
parent efe95fb878
commit 83ccd3a3d1
3 changed files with 27 additions and 0 deletions

View File

@ -29249,6 +29249,28 @@ virDomainObjIsFailedPostcopy(virDomainObj *dom)
}
bool
virDomainObjIsPostcopy(virDomainObj *dom,
virDomainJobOperation op)
{
if (op != VIR_DOMAIN_JOB_OPERATION_MIGRATION_IN &&
op != VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT)
return false;
if (op == VIR_DOMAIN_JOB_OPERATION_MIGRATION_IN) {
return (dom->state.state == VIR_DOMAIN_PAUSED &&
dom->state.reason == VIR_DOMAIN_PAUSED_POSTCOPY_FAILED) ||
(dom->state.state == VIR_DOMAIN_RUNNING &&
(dom->state.reason == VIR_DOMAIN_RUNNING_POSTCOPY ||
dom->state.reason == VIR_DOMAIN_RUNNING_POSTCOPY_FAILED));
}
return dom->state.state == VIR_DOMAIN_PAUSED &&
(dom->state.reason == VIR_DOMAIN_PAUSED_POSTCOPY ||
dom->state.reason == VIR_DOMAIN_PAUSED_POSTCOPY_FAILED);
}
void
virDomainObjSetState(virDomainObj *dom, virDomainState state, int reason)
{

View File

@ -3889,6 +3889,10 @@ virDomainObjGetState(virDomainObj *obj, int *reason)
bool
virDomainObjIsFailedPostcopy(virDomainObj *obj)
ATTRIBUTE_NONNULL(1);
bool
virDomainObjIsPostcopy(virDomainObj *dom,
virDomainJobOperation op)
ATTRIBUTE_NONNULL(1);
virSecurityLabelDef *
virDomainDefGetSecurityLabelDef(const virDomainDef *def, const char *model);

View File

@ -578,6 +578,7 @@ virDomainObjGetOneDefState;
virDomainObjGetPersistentDef;
virDomainObjGetState;
virDomainObjIsFailedPostcopy;
virDomainObjIsPostcopy;
virDomainObjNew;
virDomainObjParseFile;
virDomainObjParseNode;