Commit 5420ffc9 authored by Guido Trotter's avatar Guido Trotter
Browse files

KVM: replace hardcoded network script path



Currently the kvm automatic network scripts accepts to be overridden by
an user supplied /etc/ganeti/kvm-vif-bridge script. We keep this
functionality but move the hardcoded path to a constant, dependent also
on SYSCONFDIR.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 2971c913
......@@ -101,6 +101,7 @@ RAPI_USERS_FILE = DATA_DIR + "/rapi_users"
QUEUE_DIR = DATA_DIR + "/queue"
ETC_HOSTS = "/etc/hosts"
DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR
SYSCONFDIR = _autoconf.SYSCONFDIR
MASTER_SOCKET = SOCKET_DIR + "/ganeti-master"
......
......@@ -76,6 +76,8 @@ class KVMHypervisor(hv_base.BaseHypervisor):
_MIGRATION_STATUS_RE = re.compile('Migration\s+status:\s+(\w+)',
re.M | re.I)
_KVM_NETWORK_SCRIPT = constants.SYSCONFDIR + "/ganeti/kvm-vif-bridge"
def __init__(self):
hv_base.BaseHypervisor.__init__(self)
# Let's make sure the directories we need exist, even if the RUN_DIR lives
......@@ -148,9 +150,9 @@ class KVMHypervisor(hv_base.BaseHypervisor):
script.write("export BRIDGE=%s\n" % nic.bridge)
script.write("export INTERFACE=$1\n")
# TODO: make this configurable at ./configure time
script.write("if [ -x /etc/ganeti/kvm-vif-bridge ]; then\n")
script.write("if [ -x '%s' ]; then\n" % self._KVM_NETWORK_SCRIPT)
script.write(" # Execute the user-specific vif file\n")
script.write(" /etc/ganeti/kvm-vif-bridge\n")
script.write(" %s\n" % self._KVM_NETWORK_SCRIPT)
script.write("else\n")
script.write(" # Connect the interface to the bridge\n")
script.write(" /sbin/ifconfig $INTERFACE 0.0.0.0 up\n")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment