forked from qt-creator/qt-creator
Maemo: Better reporting of mount errors.
This commit is contained in:
@@ -27,8 +27,9 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "maemoglobal.h"
|
|
||||||
#include "maemoremotemounter.h"
|
#include "maemoremotemounter.h"
|
||||||
|
|
||||||
|
#include "maemoglobal.h"
|
||||||
#include "maemotoolchain.h"
|
#include "maemotoolchain.h"
|
||||||
|
|
||||||
#include <coreplugin/ssh/sftpchannel.h>
|
#include <coreplugin/ssh/sftpchannel.h>
|
||||||
@@ -89,11 +90,12 @@ void MaemoRemoteMounter::unmount()
|
|||||||
m_mountSpecs.at(i).remoteMountPoint);
|
m_mountSpecs.at(i).remoteMountPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_umountStderr.clear();
|
||||||
m_unmountProcess = m_connection->createRemoteProcess(remoteCall.toUtf8());
|
m_unmountProcess = m_connection->createRemoteProcess(remoteCall.toUtf8());
|
||||||
connect(m_unmountProcess.data(), SIGNAL(closed(int)), this,
|
connect(m_unmountProcess.data(), SIGNAL(closed(int)), this,
|
||||||
SLOT(handleUnmountProcessFinished(int)));
|
SLOT(handleUnmountProcessFinished(int)));
|
||||||
connect(m_unmountProcess.data(), SIGNAL(errorOutputAvailable(QByteArray)),
|
connect(m_unmountProcess.data(), SIGNAL(errorOutputAvailable(QByteArray)),
|
||||||
this, SIGNAL(remoteErrorOutput(QByteArray)));
|
this, SLOT(handleUmountStderr(QByteArray)));
|
||||||
m_unmountProcess->start();
|
m_unmountProcess->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,10 +127,15 @@ void MaemoRemoteMounter::handleUnmountProcessFinished(int exitStatus)
|
|||||||
}
|
}
|
||||||
m_mountSpecs.clear();
|
m_mountSpecs.clear();
|
||||||
|
|
||||||
if (errorMsg.isEmpty())
|
if (errorMsg.isEmpty()) {
|
||||||
emit unmounted();
|
emit unmounted();
|
||||||
else
|
} else {
|
||||||
|
if (!m_umountStderr.isEmpty()) {
|
||||||
|
errorMsg += tr("\nstderr was: '%1'")
|
||||||
|
.arg(QString::fromUtf8(m_umountStderr));
|
||||||
|
}
|
||||||
emit error(errorMsg);
|
emit error(errorMsg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRemoteMounter::stop()
|
void MaemoRemoteMounter::stop()
|
||||||
@@ -224,13 +231,14 @@ void MaemoRemoteMounter::startUtfsClients()
|
|||||||
remoteCall += andOp + mkdir + andOp + chmod + andOp + utfsClient;
|
remoteCall += andOp + mkdir + andOp + chmod + andOp + utfsClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_utfsClientStderr.clear();
|
||||||
m_mountProcess = m_connection->createRemoteProcess(remoteCall.toUtf8());
|
m_mountProcess = m_connection->createRemoteProcess(remoteCall.toUtf8());
|
||||||
connect(m_mountProcess.data(), SIGNAL(started()), this,
|
connect(m_mountProcess.data(), SIGNAL(started()), this,
|
||||||
SLOT(handleUtfsClientsStarted()));
|
SLOT(handleUtfsClientsStarted()));
|
||||||
connect(m_mountProcess.data(), SIGNAL(closed(int)), this,
|
connect(m_mountProcess.data(), SIGNAL(closed(int)), this,
|
||||||
SLOT(handleUtfsClientsFinished(int)));
|
SLOT(handleUtfsClientsFinished(int)));
|
||||||
connect(m_mountProcess.data(), SIGNAL(errorOutputAvailable(QByteArray)),
|
connect(m_mountProcess.data(), SIGNAL(errorOutputAvailable(QByteArray)),
|
||||||
this, SIGNAL(remoteErrorOutput(QByteArray)));
|
this, SLOT(handleUtfsClientStderr(QByteArray)));
|
||||||
m_mountProcess->start();
|
m_mountProcess->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,22 +253,30 @@ void MaemoRemoteMounter::handleUtfsClientsFinished(int exitStatus)
|
|||||||
if (m_stop)
|
if (m_stop)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
QString errMsg;
|
||||||
switch (exitStatus) {
|
switch (exitStatus) {
|
||||||
case SshRemoteProcess::FailedToStart:
|
case SshRemoteProcess::FailedToStart:
|
||||||
emit error(tr("Could not execute mount request."));
|
errMsg = tr("Could not execute mount request.");
|
||||||
break;
|
break;
|
||||||
case SshRemoteProcess::KilledBySignal:
|
case SshRemoteProcess::KilledBySignal:
|
||||||
emit error(tr("Failure running UTFS client: %1")
|
errMsg = tr("Failure running UTFS client: %1")
|
||||||
.arg(m_mountProcess->errorString()));
|
.arg(m_mountProcess->errorString());
|
||||||
break;
|
break;
|
||||||
case SshRemoteProcess::ExitedNormally:
|
case SshRemoteProcess::ExitedNormally:
|
||||||
if (m_mountProcess->exitCode() != 0)
|
if (m_mountProcess->exitCode() != 0)
|
||||||
emit error(tr("Could not execute mount request."));
|
errMsg = tr("Could not execute mount request.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Q_ASSERT_X(false, Q_FUNC_INFO,
|
Q_ASSERT_X(false, Q_FUNC_INFO,
|
||||||
"Impossible SshRemoteProcess exit status.");
|
"Impossible SshRemoteProcess exit status.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!errMsg.isEmpty()) {
|
||||||
|
if (!m_utfsClientStderr.isEmpty())
|
||||||
|
errMsg += tr("\nstderr was: '%1'")
|
||||||
|
.arg(QString::fromUtf8(m_utfsClientStderr));
|
||||||
|
emit error(errMsg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRemoteMounter::startUtfsServers()
|
void MaemoRemoteMounter::startUtfsServers()
|
||||||
@@ -268,8 +284,6 @@ void MaemoRemoteMounter::startUtfsServers()
|
|||||||
for (int i = 0; i < m_mountSpecs.count(); ++i) {
|
for (int i = 0; i < m_mountSpecs.count(); ++i) {
|
||||||
const MaemoMountSpecification &mountSpec = m_mountSpecs.at(i);
|
const MaemoMountSpecification &mountSpec = m_mountSpecs.at(i);
|
||||||
const ProcPtr utfsServerProc(new QProcess);
|
const ProcPtr utfsServerProc(new QProcess);
|
||||||
connect(utfsServerProc.data(), SIGNAL(readyReadStandardError()), this,
|
|
||||||
SLOT(handleUtfsServerErrorOutput()));
|
|
||||||
const QString port = QString::number(mountSpec.remotePort);
|
const QString port = QString::number(mountSpec.remotePort);
|
||||||
const QString localSecretOpt = QLatin1String("-l");
|
const QString localSecretOpt = QLatin1String("-l");
|
||||||
const QString remoteSecretOpt = QLatin1String("-r");
|
const QString remoteSecretOpt = QLatin1String("-r");
|
||||||
@@ -279,8 +293,15 @@ void MaemoRemoteMounter::startUtfsServers()
|
|||||||
<< mountSpec.localDir;
|
<< mountSpec.localDir;
|
||||||
utfsServerProc->start(utfsServer(), utfsServerArgs);
|
utfsServerProc->start(utfsServer(), utfsServerArgs);
|
||||||
if (!utfsServerProc->waitForStarted()) {
|
if (!utfsServerProc->waitForStarted()) {
|
||||||
emit error(tr("Could not start UTFS server: %1")
|
const QByteArray &errorOutput
|
||||||
.arg(utfsServerProc->errorString()));
|
= utfsServerProc->readAllStandardError();
|
||||||
|
QString errorMsg = tr("Could not start UTFS server: %1")
|
||||||
|
.arg(utfsServerProc->errorString());
|
||||||
|
if (!errorOutput.isEmpty()) {
|
||||||
|
errorMsg += tr("\nstderr output was: '%1'")
|
||||||
|
.arg(QString::fromLocal8Bit(errorOutput));
|
||||||
|
}
|
||||||
|
emit error(errorMsg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_utfsServers << utfsServerProc;
|
m_utfsServers << utfsServerProc;
|
||||||
@@ -289,9 +310,14 @@ void MaemoRemoteMounter::startUtfsServers()
|
|||||||
emit mounted();
|
emit mounted();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRemoteMounter::handleUtfsServerErrorOutput()
|
void MaemoRemoteMounter::handleUtfsClientStderr(const QByteArray &output)
|
||||||
{
|
{
|
||||||
emit remoteErrorOutput(qobject_cast<QProcess *>(sender())->readAllStandardError());
|
m_utfsClientStderr += output;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoRemoteMounter::handleUmountStderr(const QByteArray &output)
|
||||||
|
{
|
||||||
|
m_umountStderr += output;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MaemoRemoteMounter::utfsClientOnDevice() const
|
QString MaemoRemoteMounter::utfsClientOnDevice() const
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ signals:
|
|||||||
void mounted();
|
void mounted();
|
||||||
void unmounted();
|
void unmounted();
|
||||||
void error(const QString &reason);
|
void error(const QString &reason);
|
||||||
void remoteErrorOutput(const QByteArray &output);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleUploaderInitialized();
|
void handleUploaderInitialized();
|
||||||
@@ -78,8 +77,9 @@ private slots:
|
|||||||
void handleUploadFinished(Core::SftpJobId jobId, const QString &error);
|
void handleUploadFinished(Core::SftpJobId jobId, const QString &error);
|
||||||
void handleUtfsClientsStarted();
|
void handleUtfsClientsStarted();
|
||||||
void handleUtfsClientsFinished(int exitStatus);
|
void handleUtfsClientsFinished(int exitStatus);
|
||||||
void handleUtfsServerErrorOutput();
|
|
||||||
void handleUnmountProcessFinished(int exitStatus);
|
void handleUnmountProcessFinished(int exitStatus);
|
||||||
|
void handleUtfsClientStderr(const QByteArray &output);
|
||||||
|
void handleUmountStderr(const QByteArray &output);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void deployUtfsClient();
|
void deployUtfsClient();
|
||||||
@@ -101,6 +101,8 @@ private:
|
|||||||
typedef QSharedPointer<QProcess> ProcPtr;
|
typedef QSharedPointer<QProcess> ProcPtr;
|
||||||
QList<ProcPtr> m_utfsServers;
|
QList<ProcPtr> m_utfsServers;
|
||||||
bool m_stop;
|
bool m_stop;
|
||||||
|
QByteArray m_utfsClientStderr;
|
||||||
|
QByteArray m_umountStderr;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -66,8 +66,6 @@ MaemoSshRunner::MaemoSshRunner(QObject *parent,
|
|||||||
connect(m_mounter, SIGNAL(unmounted()), this, SLOT(handleUnmounted()));
|
connect(m_mounter, SIGNAL(unmounted()), this, SLOT(handleUnmounted()));
|
||||||
connect(m_mounter, SIGNAL(error(QString)), this,
|
connect(m_mounter, SIGNAL(error(QString)), this,
|
||||||
SLOT(handleMounterError(QString)));
|
SLOT(handleMounterError(QString)));
|
||||||
connect(m_mounter, SIGNAL(remoteErrorOutput(QByteArray)), this,
|
|
||||||
SIGNAL(remoteErrorOutput(QByteArray)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MaemoSshRunner::~MaemoSshRunner() {}
|
MaemoSshRunner::~MaemoSshRunner() {}
|
||||||
|
|||||||
Reference in New Issue
Block a user