bitkeeper revision 1.1010.1.2 (40daf234LK7ohaP4f1QHGPJq0t3yZw)

Change configs to live in /etc/xen, other stuff in /var/xen.
Update xendomains to use xm.
This commit is contained in:
mjw@wray-m-3.hpl.hp.com committed 2004-06-24 15:24:36 +00:00
1 parent 5eb94a602b
commit d8855c862a
6 files changed
+48 -45

No files matched your search

+5 -4
View File
@@ -1,19 +1,20 @@
INSTALL = $(wildcard *.py)
ETC = defaults democd netbsd xmdefaults
ETCDIR = /etc/xen
INITD = init.d/xendomains init.d/xend
all:
install: all
mkdir -p $(prefix)/usr/bin
mkdir -p $(prefix)/etc/xc
mkdir -p $(prefix)/etc/xc/auto
mkdir -p $(prefix)$(ETCDIR)
mkdir -p $(prefix)$(ETCDIR)/auto
mkdir -p $(prefix)/etc/init.d
install -m0755 $(INSTALL) $(prefix)/usr/bin
for i in $(ETC); \
do [ -a $(prefix)/etc/xc/$$i ] || \
install -m0644 $$i $(prefix)/etc/xc; \
do [ -a $(prefix)/$(ETCDIR)/$$i ] || \
install -m0644 $$i $(prefix)$(ETCDIR); \
done
install -m0755 $(INITD) $(prefix)/etc/init.d
+16 -30
View File
@@ -19,6 +19,9 @@ RETVAL=0
INITD=/etc/init.d/
AUTODIR=/etc/xen/auto
LOCKFILE=/var/lock/subsys/xendomains
if [ -e /lib/lsb ]; then
# assume an LSB-compliant distro (Debian with LSB package,
# recent-enough SuSE, others...)
@@ -52,24 +55,23 @@ fi
start() {
if [ -f /var/lock/subsys/xendomains ]; then return; fi
if [ -f $LOCKFILE ]; then return; fi
echo -n $"Starting auto Xen domains:"
# we expect config scripts for auto starting domains to be in
# /etc/xc/auto/ - they could just be symlinks to files elsewhere
if [ -d /etc/xc/auto ] &&
[ $(ls /etc/xc/auto/ | wc -l) -gt 0 ]; then
# We expect config scripts for auto starting domains to be in
# AUTODIR - they could just be symlinks to files elsewhere
if [ -d $AUTODIR ] && [ $(ls $AUTODIR | wc -l) -gt 0 ]; then
touch $LOCKFILE
# create all domains with config files in /etc/xc/auto
for dom in /etc/xc/auto/*; do
xc_dom_create.py -q -f $dom
# Create all domains with config files in AUTODIR.
for dom in $AUTODIR/*; do
xm create --quiet --defaults $dom
if [ $? -ne 0 ]; then
RETVAL=$?
fi
done
touch /var/lock/subsys/xendomains
fi
on_fn_exit
@@ -78,40 +80,24 @@ start() {
stop()
{
# NB. this shuts down ALL Xen domains (politely), not just the ones in
# /etc/xc/auto/*
# AUTODIR/*
# This is because it's easier to do ;-) but arguably if this script is run
# on system shutdown then it's also the right thing to do.
echo -n $"Shutting down all Xen domains:"
if [ -d /var/run/xendomains ] &&
[ $(ls /var/run/xendomains/ | wc -l) -gt 0 ]; then
cd /var/run/xendomains/
xm shutdown --all --wait --norestart
for pid in *; do
kill -s SIGTERM $(cat $pid)
done
fi
sleep 3 # avoid races
xc_dom_control.py shutdown all -w # shut down all domains, politely and wait
# for all to exit
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/xendomains
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
on_fn_exit
}
# This does NOT necessarily restart all running domains: instead it
# stops all running domains and then boots all the domains specified in
# /etc/xc/auto. If other domains have been started manually then they will
# AUTODIR. If other domains have been started manually then they will
# not get restarted.
# Commented out to avoid confusion!
#
@@ -149,7 +135,7 @@ case "$1" in
# ;;
status)
xc_dom_control.py list
xm list
;;
*)
+11
View File
@@ -12,6 +12,7 @@ os.defpath = os.defpath + ':/sbin:/usr/sbin:/usr/local/sbin'
CMD_IFCONFIG = 'ifconfig'
CMD_ROUTE = 'route'
CMD_BRCTL = 'brctl'
CMD_IPTABLES = "iptables"
DEFAULT_BRIDGE = 'nbe-br'
DEFAULT_INTERFACE = 'eth0'
@@ -61,6 +62,16 @@ def vif_bridge_rem(dom, vif, bridge=None):
d = { 'bridge': bridge, 'vif': vif_dev(dom, vif) }
cmd(CMD_BRCTL, 'delif %(bridge)s %(vif)s' % d)
def vif_restrict_addr(dom, vif, addr, delete=0):
d = { 'vif': vif_dev(dom, vif), 'addr': addr}
if delete:
d['flag'] = '-D'
else:
d['flag' = '-A'
cmd(CMD_IPTABLES, '-P FORWARD DROP')
cmd(CMD_IPTABLES, '%(flag)s FORWARD -m physdev --physdev-in %(vif)s -s %(addr)s -j ACCEPT' % d)
cmd(CMD_IPTABLES, '%(flag)s FORWARD -m physdev --physdev-out %(vif)s -d %(addr)s -j ACCEPT' % d)
def bridge_create(bridge=None, **kwd):
"""Create a bridge.
Defaults hello time to 0, forward delay to 0 and stp off.
+3 -3
View File
@@ -30,13 +30,13 @@ def last_reboot():
class XendRoot:
"""Root of the management classes."""
lastboot_default = "/etc/xen/xend/lastboot"
lastboot_default = "/var/xen/lastboot"
"""Default path to the root of the database."""
dbroot_default = "/etc/xen/xend/xenmgr-db"
dbroot_default = "/var/xen/xend-db"
"""Default path to the config file."""
config_default = "/etc/xen/xenmgr-config.sxp"
config_default = "/etc/xen/xend-config.sxp"
"""Environment variable used to override config_default."""
config_var = "XEND_CONFIG"
+9 -8
View File
@@ -24,11 +24,11 @@ gopts.opt('quiet', short='q',
use="Quiet.")
gopts.opt('path', val='PATH',
fn=set_value, default='.:/etc/xc',
fn=set_value, default='.:/etc/xen',
use="Search path for default scripts.")
gopts.opt('defaults', short='f', val='FILE',
fn=set_value, default='xmdefaults',
fn=set_value, default='defaults',
use="Use the given default script.")
gopts.opt('config', short='F', val='FILE',
@@ -220,12 +220,13 @@ def configure_vifs(config_devs, opts):
config_vif.append(['bridge', bridge])
config_devs.append(['device', config_vif])
## if vfr_ipaddr:
## config_vfr = ['vfr']
## idx = 0 # No way of saying which IP is for which vif?
## for ip in vfr_ipaddr:
## config_vfr.append(['vif', ['id', idx], ['ip', ip]])
## config.append(config_vfr)
def configure_vfr(config, opts):
if not opts.ipaddr: return
config_vfr = ['vfr']
idx = 0 # No way of saying which IP is for which vif?
for ip in opts.ipaddr:
config_vfr.append(['vif', ['id', idx], ['ip', ip]])
config.append(config_vfr)
def make_config(opts):
+4
View File
@@ -24,6 +24,10 @@ gopts.opt('wait', short='w',
fn=set_true, default=0,
use='Wait for shutdown to complete.')
gopts.opt('norestart', short='n',
fn=set_true, default=0,
use='Prevent domain restart.')
def shutdown(opts, doms, wait):
def domains():
return [ int(a) for a in server.xend_domains() ]
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.