Exemplo n.º 1
0
PRL_RESULT Task_ChangeSID::run_changeSID_cmd(Libvirt::Instrument::Agent::Vm::Unit& u)
{
	Libvirt::Instrument::Agent::Vm::Exec::Request request("%programfiles%\\Qemu-ga\\prl_newsid.exe",  
		QList<QString>());
	request.setRunInShell(true);
	Prl::Expected
		<Libvirt::Instrument::Agent::Vm::Exec::Result, Error::Simple> e =
			u.getGuest().runProgram(request);

	QString uuid;
	u.getUuid(uuid);

	if (e.isFailed()) {
		return CDspTaskFailure(*this)(e.error().convertToEvent());
	}

	if (e.value().exitcode != 0) {
		QString err = QString("prl_newsid return error %1 for VM '%2' message '%3'")
				.arg(e.value().exitcode)
				.arg(uuid)
				.arg(QString::fromUtf8(e.value().stdErr));

		WRITE_TRACE(DBG_FATAL, qPrintable(err));

		return CDspTaskFailure(*this)(PRL_ERR_CHANGESID_FAILED, err);
	}

	return PRL_ERR_SUCCESS;
}
Exemplo n.º 2
0
PRL_RESULT Task_VzManager::mount_env()
{
	CProtoCommandPtr cmd = CProtoSerializer::ParseCommand( getRequestPackage());
	if ( ! cmd->IsValid() )
		return PRL_ERR_FAILURE;

	PRL_RESULT res;
	QString sUuid = cmd->GetVmUuid();

	res = check_env_state(PVE::DspCmdVmMount, sUuid);
	if (PRL_FAILED(res))
		return res;

	bool infoMode = (cmd->GetCommandFlags() & PMVD_INFO);

	if (infoMode) {
		SmartPtr<CVmConfiguration> pConfig = getVzHelper()->getCtConfig(getClient(), sUuid);
		if (!pConfig)
			return PRL_ERR_VM_GET_CONFIG_FAILED;
		Prl::Expected<QString, PRL_RESULT> info =
			get_op_helper()->get_env_mount_info(pConfig);
		if (info.isFailed())
			return info.error();
		getResponseCmd()->AddStandardParam(info.value());
	} else {
		res = get_op_helper()->mount_env(sUuid);
	}
	return res;
}