summaryrefslogtreecommitdiff
path: root/kernels/xen/xendomains.patch
blob: 16f62b65a59d924d96677f537f96ea304611b2c7 (plain)
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
98
99
100
101
102
103
104
105
106
107
108
--- xen-4.3.1.orig/tools/hotplug/Linux/init.d/xendomains	2013-07-19 14:52:52.159013757 -0500
+++ xen-4.3.1/tools/hotplug/Linux/init.d/xendomains	2013-07-19 14:56:00.079145322 -0500
@@ -51,17 +51,13 @@
 fi
 
 # See docs/misc/distro_mapping.txt
-if [ -d /var/lock/subsys ]; then
-	LOCKFILE=/var/lock/subsys/xendomains
+if [ -d /run/lock/subsys ]; then
+	LOCKFILE=/run/lock/subsys/xendomains
 else
-	LOCKFILE=/var/lock/xendomains
+	LOCKFILE=/run/lock/xendomains
 fi
 
-if [ -d /etc/sysconfig ]; then
-	XENDOM_CONFIG=/etc/sysconfig/xendomains
-else
-	XENDOM_CONFIG=/etc/default/xendomains
-fi
+XENDOM_CONFIG=/etc/conf.d/xendomains
 
 test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing";
 	if [ "$1" = "stop" ]; then exit 0;
@@ -185,8 +181,13 @@
 # read name from xen config file
 rdname()
 {
-    NM=$($CMD create --quiet --dryrun --defconfig "$1" |
-         sed -n 's/^.*(name \(.*\))$/\1/p')
+    if [ "$CMD" == "xm" ]; then
+        NM=$($CMD create --quiet --dryrun --defconfig "$1" |
+             sed -n 's/^.*(name \(.*\))$/\1/p')
+    else 
+        NM=$($CMD create --quiet --dryrun --defconfig "$1" |
+             perl -pe 's|^.*"name":"(.*?)".*$|$1|')
+    fi
 }
 
 rdnames()
@@ -229,15 +230,15 @@
     rdname $1
     RC=1
     name=;id=
-    while read LN; do
-	parseln "$LN" || continue
+    while read id; do
 	if test $id = 0; then continue; fi
+        name=`xenstore-read /local/domain/$id/name`
 	case $name in 
 	    ($NM)
 		RC=0
 		;;
 	esac
-    done < <($CMD list -l | grep "$LIST_GREP")
+    done < <(xenstore-list /local/domain)
     return $RC
 }
 
@@ -312,6 +313,8 @@
 
 all_zombies()
 {
+    return 0
+
     name=;id=
     while read LN; do
 	parseln "$LN" || continue
@@ -363,9 +366,9 @@
     fi
     echo -n "Shutting down Xen domains:"
     name=;id=
-    while read LN; do
-	parseln "$LN" || continue
+    while read id; do
 	if test $id = 0; then continue; fi
+        name=`xenstore-read /local/domain/$id/name`
 	echo -n " $name"
 	if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
 	    eval "
@@ -450,7 +453,7 @@
 	    fi
 	    kill $WDOG_PID >/dev/null 2>&1
 	fi
-    done < <($CMD list -l | grep "$LIST_GREP")
+    done < <(xenstore-list /local/domain)
 
     # NB. this shuts down ALL Xen domains (politely), not just the ones in
     # AUTODIR/*
@@ -479,15 +482,15 @@
 check_domain_up()
 {
     name=;id=
-    while read LN; do
-	parseln "$LN" || continue
+    while read id; do
 	if test $id = 0; then continue; fi
+        name=`xenstore-read /local/domain/$id/name`
 	case $name in 
 	    ($1)
 		return 0
 		;;
 	esac
-    done < <($CMD list -l | grep "$LIST_GREP")
+    done < <(xenstore-list /local/domain)
     return 1
 }