This file is indexed.

/etc/xen/scripts/external-device-migrate is in xen-utils-common 4.6.0-1ubuntu4.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash

# Copyright (c) 2005 IBM Corporation
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; If not, see <http://www.gnu.org/licenses/>.
#

set -x

# This script is called by XenD for migration of external devices
# It does not handle the migration of those devices itself, but
# passes the requests on to further applications
# It handles the low-level command line parsing and some of the
# synchronization

dir=$(dirname "$0")
. "$dir/logging.sh"


function ext_dev_migrate_usage() {
cat <<EOF
Pass the following command line parameters to the script:

-step <n>              : n-th migration step
-host <host>           : the destination host
-domname <domain name> : name of the domain that is migrating
-type <device type>    : the type of device that is migrating
-subtype <dev. subtype>: the subtype of the device
-recover               : indicates recovery request; an error
                         occurred during migration
-help                  : display this help screen
EOF
}

# Parse the command line paramters. The following parameters must be
# passed as the first ones in the sequence:
#  -step       [required]
#  -host       [required]
#  -domname    [required]
#  -type       [required]
#  -subtype    [optional]
#  -recover    [optional]
# The remaining ones will be passed to the called function.
function evaluate_params()
{
	local step host domname typ recover filename func stype
	stype=""
	while [ $# -ge 1 ]; do
		case "$1" in
		-step)		step=$2; shift; shift;;
		-host)		host=$2; shift; shift;;
		-domname)	domname=$2; shift; shift;;
		-type)		typ=$2; shift; shift;;
		-subtype)	stype=$2; shift; shift;;
		-recover)	recover=1; shift;;
		-help)		ext_dev_migrate_usage; exit 0;;
		*)		break;;
		esac
	done

	if [ "$step"    = "" -o \
	     "$host"    = "" -o \
	     "$typ"     = "" -o \
	     "$domname" = "" ]; then
	 	echo "Error: Parameter(s) missing (-step/-host/-type/-domname)" 1>&2
		echo "" 1>&2
		echo "$0 -help for usage." 1>&2
		exit 1
	fi

	filename="$dir/$typ$stype-migration.sh"
	if [ ! -r $filename ]; then
		echo "Error: Could not find script '$filename'"
		return
	fi
	. "$filename"

	if [ "$recover" = "1" ]; then
		func="$typ"_recover
		eval $func $host $domname $step $*
	else
		func="$typ"_migration_step
		eval $func $host $domname $step $*
	fi
}

evaluate_params "$@"