X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-xen-config.git/blobdiff_plain/fff5d4676e603f215db69aa580580e2e32717a8d..a232176c5a0e6fb54e993eb8d457f9e007f52ac8:/debian/transform_xend-config.sxp.invirt.mako diff --git a/debian/transform_xend-config.sxp.invirt.mako b/debian/transform_xend-config.sxp.invirt.mako index 1a3fa9a..90555e7 100755 --- a/debian/transform_xend-config.sxp.invirt.mako +++ b/debian/transform_xend-config.sxp.invirt.mako @@ -3,11 +3,21 @@ print <<'EOF'; <% from invirt.config import structs as cfg import os -hostname = os.uname()[1] +fqdn = os.uname()[1] +internal_ip = None +# This hack is necessary because cfg.hosts is an array rather than a dict. +for host in cfg.hosts: + if host.hostname == fqdn: + internal_ip = host.internal_ip + break + +class xend_template_exception(Exception): pass +if internal_ip is None: + raise xend_template_exception('Could not find an internal IP in the configuration for host %s' % fqdn) %> EOF -s/^\#?\(xend-relocation-address ''\)/(xend-relocation-address '\${hostname}-internal')/m or die; +s/^\#?\(xend-relocation-address ''\)/(xend-relocation-address '\${internal_ip}')/m or die; s/^\(xend-relocation-hosts-allow '[^']*'\)/(xend-relocation-hosts-allow '')/m or die; s/^\(dom0-min-mem [0-9]*\)/(dom0-min-mem 1536)/m or die; print;