5 LIBDIR="@LOCALSTATEDIR@/lib"
6 DATADIR="${LIBDIR}/ganeti"
7 RUNDIR="@LOCALSTATEDIR@/run"
8 GNTRUNDIR="${RUNDIR}/ganeti"
9 LOGDIR="@LOCALSTATEDIR@/log"
10 GNTLOGDIR="${LOGDIR}/ganeti"
11 LOCKDIR="@LOCALSTATEDIR@/lock"
16 echo "@GNTMASTERUSER@:@GNTMASTERDGROUP@"
19 echo "@GNTCONFDUSER@:@GNTCONFDGROUP@"
22 echo "@GNTRAPIUSER@:@GNTRAPIGROUP@"
25 echo "root:@GNTMASTERDGROUP@"
28 echo "@GNTMASTERUSER@:@GNTDAEMONSGROUP@"
31 echo "@GNTMASTERUSER@:@GNTCONFDGROUP@"
44 [[ -e "${file}" ]] || return 1
45 chmod ${perm} "${file}"
47 if ! [[ -z "${owner}" ]]; then
48 chown ${owner} "${file}"
59 [[ -d "${dir}" ]] || mkdir "${dir}"
61 _ensure_file "${dir}" "${perm}" "${owner}"
72 find "${path}" -type f "(" "!" -perm ${perm} -or "(" "!" -user ${user} -or \
73 "!" -group ${group} ")" ")" "$@"
79 _ensure_dir ${DATADIR} 0755 "$(_fileset_owner masterd)"
80 _ensure_dir ${DATADIR}/queue 0700 "$(_fileset_owner masterd)"
81 _ensure_dir ${DATADIR}/queue/archive 0700 "$(_fileset_owner masterd)"
82 _ensure_dir ${DATADIR}/uidpool 0750 "$(_fileset_owner noded)"
83 _ensure_dir ${DATADIR}/rapi 0750 "$(_fileset_owner rapi)"
85 # We ignore these files if they don't exists (incomplete setup)
86 _ensure_file ${DATADIR}/cluster-domain-secret 0640 \
87 "$(_fileset_owner masterd)" || :
88 _ensure_file ${DATADIR}/config.data 0640 "$(_fileset_owner masterd-confd)" || :
89 _ensure_file ${DATADIR}/hmac.key 0440 "$(_fileset_owner confd)" || :
90 _ensure_file ${DATADIR}/known_hosts 0644 "$(_fileset_owner masterd)" || :
91 _ensure_file ${DATADIR}/rapi.pem 0440 "$(_fileset_owner rapi)" || :
92 _ensure_file ${DATADIR}/rapi/users 0640 "$(_fileset_owner rapi)" || :
93 _ensure_file ${DATADIR}/server.pem 0440 "$(_fileset_owner masterd)" || :
94 _ensure_file ${DATADIR}/queue/serial 0600 "$(_fileset_owner masterd)" || :
96 # To not change the utils.LockFile object
97 touch ${DATADIR}/queue/lock
98 _ensure_file ${DATADIR}/queue/lock 0600 "$(_fileset_owner masterd)"
100 if ! [[ -z "${full_run}" ]]; then
101 local queue_owner="$(_fileset_owner masterd)"
102 local ssconf_owner="$(_fileset_owner noded)"
104 _gather_files ${DATADIR}/queue 0600 @GNTMASTERUSER@ @GNTMASTERDGROUP@ | \
106 _ensure_file "$path" 0600 "$queue_owner"
109 _gather_files ${DATADIR} 0600 root @GNTMASTERDGROUP@ -name 'ssconf_*' | \
111 _ensure_file "$path" 0444 "$ssconf_owner"
117 _ensure_dir ${GNTRUNDIR} 0775 "$(_fileset_owner daemons)"
118 _ensure_dir ${GNTRUNDIR}/socket 0750 "$(_fileset_owner daemons)"
119 _ensure_dir ${GNTRUNDIR}/bdev-cache 0755 "$(_fileset_owner noded)"
120 _ensure_dir ${GNTRUNDIR}/instance-disks 0755 "$(_fileset_owner noded)"
121 _ensure_dir ${GNTRUNDIR}/crypto 0700 "$(_fileset_owner noded)"
122 _ensure_dir ${GNTRUNDIR}/import-export 0755 "$(_fileset_owner noded)"
124 # We ignore this file if it don't exists (not yet start up)
125 _ensure_file ${GNTRUNDIR}/socket/ganeti-master 0770 \
126 "$(_fileset_owner daemons)" || :
130 _ensure_dir ${GNTLOGDIR} 0770 "$(_fileset_owner daemons)"
131 _ensure_dir ${GNTLOGDIR}/os 0750 "$(_fileset_owner daemons)"
133 # We ignore these files if they don't exists (incomplete setup)
134 _ensure_file ${GNTLOGDIR}/master-daemon.log 0600 "$(_fileset_owner masterd)" || :
135 _ensure_file ${GNTLOGDIR}/conf-daemon.log 0600 "$(_fileset_owner confd)" || :
136 _ensure_file ${GNTLOGDIR}/node-daemon.log 0600 "$(_fileset_owner noded)" || :
137 _ensure_file ${GNTLOGDIR}/rapi-daemon.log 0600 "$(_fileset_owner rapi)" || :
141 _ensure_dir ${LOCKDIR} 1777 ""
144 _operate_while_hold() {
156 while getopts "f" OPTION; do
162 _operate_while_hold "_ensure_datadir" ${DATADIR} ${full_run}
163 _operate_while_hold "_ensure_rundir" ${RUNDIR}
164 _operate_while_hold "_ensure_logdir" ${LOGDIR}
165 _operate_while_hold "_ensure_lockdir" @LOCALSTATEDIR@