Kiril Nesenko has posted comments on this change.

Change subject: core: Unable to restore from 3.1 LogCollector...
......................................................................


Patch Set 7: (2 inline comments)

....................................................
File backend/manager/dbscripts/restore.sh
Line 37: restore_from_tar() {
Line 38:     # Copy tar file to working dir
Line 39:     name=$(basename $FILE)
Line 40:     dir=$(dirname $FILE)/"${name}"_dir
Line 41:     mkdir "${dir}"
You should do it from tmp directory. There is a possibility that postgres user 
has no permissions to access to ${dir} and you will fail to restore.

dir=$(mktemp -d /tmp/${name}.XXX) is better
Line 42:     chmod 777 "${dir}"
Line 43:     cp "${FILE}" "${dir}"/"${name}"
Line 44:     pushd "${dir}"
Line 45:     # Restoring SELinux default settings


Line 49:     if [ $? -ne 0 ]; then
Line 50:         echo "Failed to extract TAR content to working directory 
${dir}."
Line 51:         exit 5
Line 52:     fi
Line 53:     chmod 777 *
and what about selinux ?
Seems like you need to use postgresql_db_t context.

if [[ $(getenforce) == 'Enforcing' ]]; then
        here you should change the file context
fi
Line 54:     # dropping all statements we don't need on a clean DB from teh 
restore.sql file
Line 55:     sed -i -e '/^DROP /d' -e '/^CREATE SCHEMA/d' -e '/^ALTER TABLE 
ONLY public\./d' -e '/^ALTER FUNCTION public\.uuid_/d' -e '/^CREATE PROCEDURAL 
LANGUAGE plpgsql/d' -e '/^ALTER PROCEDURAL LANGUAGE plpgsql/d' -e 's/^CREATE 
FUNCTION uuid_/CREATE OR REPLACE FUNCTION uuid_/g' -e 's?/tmp?'`pwd`'?'  -e 
's?\$\$PATH\$\$?'`pwd`'?' restore.sql
Line 56: 
Line 57:     psql -w -h ${SERVERNAME} -p ${PORT} -U ${USERNAME} -f restore.sql 
${DATABASE}


-- 
To view, visit http://gerrit.ovirt.org/15068
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id17f718d5acf7a4df00092875d308f52e6dd7e3f
Gerrit-PatchSet: 7
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Eli Mesika <emes...@redhat.com>
Gerrit-Reviewer: Alex Lourie <alou...@redhat.com>
Gerrit-Reviewer: Eli Mesika <emes...@redhat.com>
Gerrit-Reviewer: Kiril Nesenko <knese...@redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to