mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu: Move incoming URI code to qemu_migration
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
08600de376
commit
34b9fe6101
@ -9088,45 +9088,6 @@ qemuBuildTPMCommandLine(virDomainDefPtr def,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
qemuBuildIncomingCheckProtocol(virQEMUCapsPtr qemuCaps,
|
||||
const char *migrateFrom)
|
||||
{
|
||||
if (STRPREFIX(migrateFrom, "rdma")) {
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_RDMA)) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("incoming RDMA migration is not supported "
|
||||
"with this QEMU binary"));
|
||||
return -1;
|
||||
}
|
||||
} else if (!STRPREFIX(migrateFrom, "tcp") &&
|
||||
!STRPREFIX(migrateFrom, "exec") &&
|
||||
!STRPREFIX(migrateFrom, "fd") &&
|
||||
!STRPREFIX(migrateFrom, "unix") &&
|
||||
STRNEQ(migrateFrom, "stdio")) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("unknown migration protocol"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
qemuBuildIncomingURI(const char *migrateFrom,
|
||||
int migrateFd)
|
||||
{
|
||||
char *uri = NULL;
|
||||
|
||||
if (STREQ(migrateFrom, "stdio"))
|
||||
ignore_value(virAsprintf(&uri, "fd:%d", migrateFd));
|
||||
else
|
||||
ignore_value(VIR_STRDUP(uri, migrateFrom));
|
||||
|
||||
return uri;
|
||||
}
|
||||
|
||||
|
||||
qemuBuildCommandLineCallbacks buildCommandLineCallbacks = {
|
||||
.qemuGetSCSIDeviceSgName = virSCSIDeviceGetSgName,
|
||||
|
@ -319,10 +319,5 @@ bool qemuCheckCCWS390AddressSupport(virDomainDefPtr def,
|
||||
virDomainDeviceInfo info,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
const char *devicename);
|
||||
int qemuBuildIncomingCheckProtocol(virQEMUCapsPtr qemuCaps,
|
||||
const char *migrateFrom);
|
||||
|
||||
char *qemuBuildIncomingURI(const char *migrateFrom,
|
||||
int migrateFd);
|
||||
|
||||
#endif /* __QEMU_COMMAND_H__*/
|
||||
|
@ -2911,6 +2911,46 @@ qemuDomainMigrateOPDRelocate(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuMigrationCheckIncoming(virQEMUCapsPtr qemuCaps,
|
||||
const char *migrateFrom)
|
||||
{
|
||||
if (STRPREFIX(migrateFrom, "rdma")) {
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_RDMA)) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("incoming RDMA migration is not supported "
|
||||
"with this QEMU binary"));
|
||||
return -1;
|
||||
}
|
||||
} else if (!STRPREFIX(migrateFrom, "tcp") &&
|
||||
!STRPREFIX(migrateFrom, "exec") &&
|
||||
!STRPREFIX(migrateFrom, "fd") &&
|
||||
!STRPREFIX(migrateFrom, "unix") &&
|
||||
STRNEQ(migrateFrom, "stdio")) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("unknown migration protocol"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
qemuMigrationIncomingURI(const char *migrateFrom,
|
||||
int migrateFd)
|
||||
{
|
||||
char *uri = NULL;
|
||||
|
||||
if (STREQ(migrateFrom, "stdio"))
|
||||
ignore_value(virAsprintf(&uri, "fd:%d", migrateFd));
|
||||
else
|
||||
ignore_value(VIR_STRDUP(uri, migrateFrom));
|
||||
|
||||
return uri;
|
||||
}
|
||||
|
||||
|
||||
/* This is called for outgoing non-p2p migrations when a connection to the
|
||||
* client which initiated the migration was closed but we were waiting for it
|
||||
* to follow up with the next phase, that is, in between
|
||||
|
@ -199,4 +199,10 @@ void qemuMigrationErrorSave(virQEMUDriverPtr driver,
|
||||
void qemuMigrationErrorReport(virQEMUDriverPtr driver,
|
||||
const char *name);
|
||||
|
||||
int qemuMigrationCheckIncoming(virQEMUCapsPtr qemuCaps,
|
||||
const char *migrateFrom);
|
||||
|
||||
char *qemuMigrationIncomingURI(const char *migrateFrom,
|
||||
int migrateFd);
|
||||
|
||||
#endif /* __QEMU_MIGRATION_H__ */
|
||||
|
@ -4514,10 +4514,10 @@ int qemuProcessStart(virConnectPtr conn,
|
||||
}
|
||||
|
||||
if (migrateFrom) {
|
||||
if (qemuBuildIncomingCheckProtocol(priv->qemuCaps, migrateFrom) < 0)
|
||||
if (qemuMigrationCheckIncoming(priv->qemuCaps, migrateFrom) < 0)
|
||||
goto error;
|
||||
|
||||
if (!(migrateURI = qemuBuildIncomingURI(migrateFrom, stdin_fd)))
|
||||
if (!(migrateURI = qemuMigrationIncomingURI(migrateFrom, stdin_fd)))
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
# include "qemu/qemu_capabilities.h"
|
||||
# include "qemu/qemu_command.h"
|
||||
# include "qemu/qemu_domain.h"
|
||||
# include "qemu/qemu_migration.h"
|
||||
# include "datatypes.h"
|
||||
# include "conf/storage_conf.h"
|
||||
# include "cpu/cpu_map.h"
|
||||
@ -410,8 +411,8 @@ testCompareXMLToArgvHelper(const void *data)
|
||||
char *migrateURI = NULL;
|
||||
|
||||
if (info->migrateFrom &&
|
||||
!(migrateURI = qemuBuildIncomingURI(info->migrateFrom,
|
||||
info->migrateFd)))
|
||||
!(migrateURI = qemuMigrationIncomingURI(info->migrateFrom,
|
||||
info->migrateFd)))
|
||||
goto cleanup;
|
||||
|
||||
if (virAsprintf(&xml, "%s/qemuxml2argvdata/qemuxml2argv-%s.xml",
|
||||
|
Loading…
Reference in New Issue
Block a user