mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-25 10:03:49 +03:00
qemu: adopt to VIR_DRV_SUPPORTS_FEATURE return -1
Otherwise in some places we can mistakenly report 'unsupported' error instead of root cause. So let's handle root cause explicitly from the macro. Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
032a35893b
commit
910b94dfe4
@ -4706,12 +4706,13 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriverPtr driver,
|
|||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
g_autoptr(virConnect) dconn = NULL;
|
g_autoptr(virConnect) dconn = NULL;
|
||||||
bool p2p;
|
int p2p;
|
||||||
virErrorPtr orig_err = NULL;
|
virErrorPtr orig_err = NULL;
|
||||||
bool offline = !!(flags & VIR_MIGRATE_OFFLINE);
|
bool offline = !!(flags & VIR_MIGRATE_OFFLINE);
|
||||||
bool dstOffline = false;
|
int dstOffline;
|
||||||
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
||||||
bool useParams;
|
int useParams;
|
||||||
|
int rc;
|
||||||
|
|
||||||
VIR_DEBUG("driver=%p, sconn=%p, vm=%p, xmlin=%s, dconnuri=%s, uri=%s, "
|
VIR_DEBUG("driver=%p, sconn=%p, vm=%p, xmlin=%s, dconnuri=%s, uri=%s, "
|
||||||
"graphicsuri=%s, listenAddress=%s, nmigrate_disks=%zu, "
|
"graphicsuri=%s, listenAddress=%s, nmigrate_disks=%zu, "
|
||||||
@ -4771,17 +4772,27 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriverPtr driver,
|
|||||||
qemuDomainObjEnterRemote(vm);
|
qemuDomainObjEnterRemote(vm);
|
||||||
p2p = VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
|
p2p = VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
|
||||||
VIR_DRV_FEATURE_MIGRATION_P2P);
|
VIR_DRV_FEATURE_MIGRATION_P2P);
|
||||||
|
if (p2p < 0)
|
||||||
|
goto cleanup;
|
||||||
/* v3proto reflects whether the caller used Perform3, but with
|
/* v3proto reflects whether the caller used Perform3, but with
|
||||||
* p2p migrate, regardless of whether Perform2 or Perform3
|
* p2p migrate, regardless of whether Perform2 or Perform3
|
||||||
* were used, we decide protocol based on what target supports
|
* were used, we decide protocol based on what target supports
|
||||||
*/
|
*/
|
||||||
*v3proto = VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
|
rc = VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
|
||||||
VIR_DRV_FEATURE_MIGRATION_V3);
|
VIR_DRV_FEATURE_MIGRATION_V3);
|
||||||
|
if (rc < 0)
|
||||||
|
goto cleanup;
|
||||||
|
*v3proto = !!rc;
|
||||||
useParams = VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
|
useParams = VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
|
||||||
VIR_DRV_FEATURE_MIGRATION_PARAMS);
|
VIR_DRV_FEATURE_MIGRATION_PARAMS);
|
||||||
if (offline)
|
if (useParams < 0)
|
||||||
|
goto cleanup;
|
||||||
|
if (offline) {
|
||||||
dstOffline = VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
|
dstOffline = VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
|
||||||
VIR_DRV_FEATURE_MIGRATION_OFFLINE);
|
VIR_DRV_FEATURE_MIGRATION_OFFLINE);
|
||||||
|
if (dstOffline < 0)
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
if (qemuDomainObjExitRemote(vm, !offline) < 0)
|
if (qemuDomainObjExitRemote(vm, !offline) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -4819,7 +4830,7 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriverPtr driver,
|
|||||||
persist_xml, dname, uri, graphicsuri,
|
persist_xml, dname, uri, graphicsuri,
|
||||||
listenAddress, nmigrate_disks, migrate_disks,
|
listenAddress, nmigrate_disks, migrate_disks,
|
||||||
nbdPort, nbdURI, migParams, resource,
|
nbdPort, nbdURI, migParams, resource,
|
||||||
useParams, flags);
|
!!useParams, flags);
|
||||||
} else {
|
} else {
|
||||||
ret = qemuMigrationSrcPerformPeer2Peer2(driver, sconn, dconn, vm,
|
ret = qemuMigrationSrcPerformPeer2Peer2(driver, sconn, dconn, vm,
|
||||||
dconnuri, flags, dname, resource,
|
dconnuri, flags, dname, resource,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user