mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-31 00:45:18 +00:00
virsh: domain: use early return in virshDomainDefine()
Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
bc7b8a34fa
commit
14a804ee67
@ -245,18 +245,18 @@ static virDomainPtr
|
||||
virshDomainDefine(virConnectPtr conn, const char *xml, unsigned int flags)
|
||||
{
|
||||
virDomainPtr dom;
|
||||
if (flags) {
|
||||
dom = virDomainDefineXMLFlags(conn, xml, flags);
|
||||
/* If validate is the only flag, just drop it and
|
||||
* try again.
|
||||
*/
|
||||
if (!dom) {
|
||||
if ((virGetLastErrorCode() == VIR_ERR_NO_SUPPORT) &&
|
||||
(flags == VIR_DOMAIN_DEFINE_VALIDATE))
|
||||
dom = virDomainDefineXML(conn, xml);
|
||||
}
|
||||
} else {
|
||||
dom = virDomainDefineXML(conn, xml);
|
||||
|
||||
if (!flags)
|
||||
return virDomainDefineXML(conn, xml);
|
||||
|
||||
dom = virDomainDefineXMLFlags(conn, xml, flags);
|
||||
/* If validate is the only flag, just drop it and
|
||||
* try again.
|
||||
*/
|
||||
if (!dom) {
|
||||
if ((virGetLastErrorCode() == VIR_ERR_NO_SUPPORT) &&
|
||||
(flags == VIR_DOMAIN_DEFINE_VALIDATE))
|
||||
dom = virDomainDefineXML(conn, xml);
|
||||
}
|
||||
return dom;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user