mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
conf: add error checking of UUID generation
Reviewed-by: John Ferlan <jferlan@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
520f5752be
commit
473d2eba04
@ -30415,7 +30415,11 @@ virDomainNetDefToNetworkPort(virDomainDefPtr dom,
|
|||||||
if (VIR_ALLOC(port) < 0)
|
if (VIR_ALLOC(port) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
virUUIDGenerate(port->uuid);
|
if (virUUIDGenerate(port->uuid) < 0) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
"%s", _("Failed to generate UUID"));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(port->owneruuid, dom->uuid, VIR_UUID_BUFLEN);
|
memcpy(port->owneruuid, dom->uuid, VIR_UUID_BUFLEN);
|
||||||
if (VIR_STRDUP(port->ownername, dom->name) < 0)
|
if (VIR_STRDUP(port->ownername, dom->name) < 0)
|
||||||
@ -30576,7 +30580,11 @@ virDomainNetDefActualToNetworkPort(virDomainDefPtr dom,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Bad - we need to preserve original port uuid */
|
/* Bad - we need to preserve original port uuid */
|
||||||
virUUIDGenerate(port->uuid);
|
if (virUUIDGenerate(port->uuid) < 0) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
"%s", _("Failed to generate UUID"));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(port->owneruuid, dom->uuid, VIR_UUID_BUFLEN);
|
memcpy(port->owneruuid, dom->uuid, VIR_UUID_BUFLEN);
|
||||||
if (VIR_STRDUP(port->ownername, dom->name) < 0)
|
if (VIR_STRDUP(port->ownername, dom->name) < 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user