Skip to content

Commit

Permalink
Merge pull request xapi-project#5196 from psafont/public-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
psafont authored Oct 11, 2023
2 parents fe3f4df + fac6dc8 commit 7ced146
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 63 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/1.249-lcm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ jobs:
# invalidate cache every week, gets built using a scheduled job
key: ${{ steps.cache-key.outputs.date }}-1.249

- name: Update Ubuntu repositories
run: sudo apt-get update

- name: Use ocaml
uses: avsm/setup-ocaml@v1
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:
id: dotenv
uses: falti/[email protected]

- name: Update Ubuntu repositories
run: sudo apt-get update

- name: Use ocaml
uses: avsm/setup-ocaml@v1
with:
Expand Down
1 change: 0 additions & 1 deletion scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ install:
$(IPROG) print-custom-templates $(DESTDIR)$(LIBEXECDIR)
$(IPROG) backup-sr-metadata.py $(DESTDIR)$(LIBEXECDIR)
$(IPROG) restore-sr-metadata.py $(DESTDIR)$(LIBEXECDIR)
$(IPROG) probe-device-for-file $(DESTDIR)$(LIBEXECDIR)
$(IPROG) backup-metadata-cron $(DESTDIR)$(LIBEXECDIR)
$(IPROG) pbis-force-domain-leave $(DESTDIR)$(LIBEXECDIR)
mkdir -p $(DESTDIR)/etc/sysconfig
Expand Down
56 changes: 0 additions & 56 deletions scripts/probe-device-for-file

This file was deleted.

17 changes: 11 additions & 6 deletions scripts/xe-restore-metadata
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
# Script which restores metadata into a VDI
# Citrix Systems Inc, 2008

function file_exists() {
local out
out="$(debugfs -R "stat $2" "$1" 2>/dev/null | head -n1 | grep "Type: regular")"
if [ -n "${out}" ]; then
echo y
fi
}

if [ ! -e @INVENTORY@ ]; then
echo Must run on a Citrix Hypervisor host.
exit 1
Expand Down Expand Up @@ -173,22 +181,19 @@ for vdi_uuid in ${vdis}; do
${debug} echo ${device} >&2

${debug} echo -n "Probing device: " >&2
probecmd="@LIBEXECDIR@/probe-device-for-file"
metadata_stamp="/.ctxs-metadata-backup"
mnt=
${probecmd} ${device} ${metadata_stamp}
if [ $? -eq 0 ]; then
if [ "$(file_exists "${device}" "/.ctxs-metadata-backup")" = y ]; then
${debug} echo found metadata backup >&2
${debug} echo -n "Mounting filesystem: " >&2
mnt=/var/run/pool-backup-${vdi_uuid}
mkdir -p ${mnt}
/sbin/fsck -a ${device} >/dev/null 2>&1
/sbin/e2fsck -p -f "${device}" >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo File system integrity error. Please correct manually. >&2
cleanup
continue
fi
mount ${device} ${mnt} >/dev/null 2>&1
mount -o ro,nosuid,noexec,nodev "${device}" "${mnt}" >/dev/null 2>&1
if [ $? -ne 0 ]; then
${debug} echo failed >&2
cleanup
Expand Down

0 comments on commit 7ced146

Please sign in to comment.