qemu: driver: Drop support for qemu-attach

Attaching to modern qemu will not work with all this code and attempting
to ressurect it would be mostly pointless.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
Peter Krempa 2019-06-14 14:33:52 +02:00
parent fd14dfec88
commit 215d9393bb
2 changed files with 9 additions and 84 deletions

View File

@ -61,6 +61,7 @@ my %whitelist = (
"interfaceClose" => 1, "interfaceClose" => 1,
"connectURIProbe" => 1, "connectURIProbe" => 1,
"localOnly" => 1, "localOnly" => 1,
"domainQemuAttach" => 1,
); );
# XXX this vzDomainMigrateConfirm3Params looks # XXX this vzDomainMigrateConfirm3Params looks

View File

@ -16799,92 +16799,16 @@ static int qemuDomainQemuMonitorCommand(virDomainPtr domain, const char *cmd,
} }
static virDomainPtr qemuDomainQemuAttach(virConnectPtr conn, static virDomainPtr
unsigned int pid_value, qemuDomainQemuAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
unsigned int flags) unsigned int pid_value ATTRIBUTE_UNUSED,
unsigned int flags)
{ {
virQEMUDriverPtr driver = conn->privateData;
virDomainObjPtr vm = NULL;
virDomainDefPtr def = NULL;
virDomainPtr dom = NULL;
virDomainChrSourceDefPtr monConfig = NULL;
bool monJSON = false;
pid_t pid = pid_value;
char *pidfile = NULL;
virQEMUCapsPtr qemuCaps = NULL;
virCapsPtr caps = NULL;
virCheckFlags(0, NULL); virCheckFlags(0, NULL);
if (!(caps = virQEMUDriverGetCapabilities(driver, false))) virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
goto cleanup; _("attaching to a QEMU process started outside of libvirt is no longer supported"));
return NULL;
if (!(def = qemuParseCommandLinePid(driver->qemuCapsCache,
caps, driver->xmlopt, pid,
&pidfile, &monConfig, &monJSON)))
goto cleanup;
if (virDomainQemuAttachEnsureACL(conn, def) < 0)
goto cleanup;
if (!monConfig) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("No monitor connection for pid %u"), pid_value);
goto cleanup;
}
if (monConfig->type != VIR_DOMAIN_CHR_TYPE_UNIX) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Cannot connect to monitor connection of type '%s' "
"for pid %u"),
virDomainChrTypeToString(monConfig->type),
pid_value);
goto cleanup;
}
if (!(def->name) &&
virAsprintf(&def->name, "attach-pid-%u", pid_value) < 0)
goto cleanup;
if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache,
def->emulator)))
goto cleanup;
if (qemuAssignDeviceAliases(def, qemuCaps) < 0)
goto cleanup;
if (!(vm = virDomainObjListAdd(driver->domains, def,
driver->xmlopt,
VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
NULL)))
goto cleanup;
def = NULL;
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) {
qemuDomainRemoveInactive(driver, vm);
goto cleanup;
}
if (qemuProcessAttach(conn, driver, vm, pid,
pidfile, monConfig, monJSON) < 0) {
qemuDomainRemoveInactive(driver, vm);
qemuDomainObjEndJob(driver, vm);
goto cleanup;
}
dom = virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id);
qemuDomainObjEndJob(driver, vm);
cleanup:
virDomainDefFree(def);
virObjectUnref(monConfig);
virDomainObjEndAPI(&vm);
VIR_FREE(pidfile);
virObjectUnref(caps);
virObjectUnref(qemuCaps);
return dom;
} }
@ -22459,7 +22383,7 @@ static virHypervisorDriver qemuHypervisorDriver = {
.domainRevertToSnapshot = qemuDomainRevertToSnapshot, /* 0.8.0 */ .domainRevertToSnapshot = qemuDomainRevertToSnapshot, /* 0.8.0 */
.domainSnapshotDelete = qemuDomainSnapshotDelete, /* 0.8.0 */ .domainSnapshotDelete = qemuDomainSnapshotDelete, /* 0.8.0 */
.domainQemuMonitorCommand = qemuDomainQemuMonitorCommand, /* 0.8.3 */ .domainQemuMonitorCommand = qemuDomainQemuMonitorCommand, /* 0.8.3 */
.domainQemuAttach = qemuDomainQemuAttach, /* 0.9.4 */ .domainQemuAttach = qemuDomainQemuAttach, /* 0.9.4 (deprecated: 5.5.0) */
.domainQemuAgentCommand = qemuDomainQemuAgentCommand, /* 0.10.0 */ .domainQemuAgentCommand = qemuDomainQemuAgentCommand, /* 0.10.0 */
.connectDomainQemuMonitorEventRegister = qemuConnectDomainQemuMonitorEventRegister, /* 1.2.3 */ .connectDomainQemuMonitorEventRegister = qemuConnectDomainQemuMonitorEventRegister, /* 1.2.3 */
.connectDomainQemuMonitorEventDeregister = qemuConnectDomainQemuMonitorEventDeregister, /* 1.2.3 */ .connectDomainQemuMonitorEventDeregister = qemuConnectDomainQemuMonitorEventDeregister, /* 1.2.3 */