Commit 42e9cd84 authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis
Browse files

deploy: Refactor nfs



Switch to nfs v3.
Explicitly use IP in /etc/exports and not subnet.

Subnet and gateway are only used by vlcuster and thus
move them from nodes.conf to vcluster.conf.
Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
parent c791b56c
......@@ -2,8 +2,6 @@
# with nodes (both ganeti and synnefo) residing in the same subnet/domain
[network]
domain = synnefo.live
subnet = 192.168.0.0/28
gateway = 192.168.0.14
[os]
node1 = squeeze
......
......@@ -34,3 +34,7 @@ os = squeeze
# ip addr add 192.0.0.14/28 dev auto_nodes_br
# To create run: snf-deploy cluster
bridge = auto_nodes_br
[network]
subnet = 192.168.0.0/28
gateway = 192.168.0.14
......@@ -79,7 +79,7 @@ def install_package(package):
host_info = env.env.ips_info[env.host]
if ast.literal_eval(env.env.use_local_packages):
with settings(warn_only=True):
deb = local("ls %s/%s*%s.deb" % (env.env.packages, package, host_info[os]))
deb = local("ls %s/%s*%s_all.deb" % (env.env.packages, package, host_info[os]))
if deb:
debug(env.host, " * Package %s found in %s..." % (package, env.env.packages))
put(deb, "/tmp/")
......@@ -89,7 +89,7 @@ def install_package(package):
info = getattr(env.env, package)
if info in ["squeeze-backports", "stable", "testing", "unstable"]:
if info == "squeeze-backports" and host_infa.os = "wheezy":
if info == "squeeze-backports" and host_infa.os == "wheezy":
info = host_info.os
APT_GET += " -t %s %s " % (info, package)
elif info:
......@@ -737,34 +737,41 @@ def setup_nfs_clients():
if env.host == env.env.pithos.ip:
return
host_info = env.env.ips_info[env.host]
debug(env.host, " * Mounting pithos NFS mount point...")
with settings(hide("everything")):
try_run("ping -c1 " + env.env.pithos.hostname)
with settings(host_string=env.env.pithos.ip):
update_nfs_exports(host_info.ip)
install_package("nfs-common")
for d in [env.env.pithos_dir, "/srv/okeanos"]:
for d in [env.env.pithos_dir, env.env.image_dir]:
try_run("mkdir -p " + d)
cmd = """
echo "{0}:/{1} {2} nfs4 defaults,rw,noatime,nodiratime,intr,rsize=1048576,wsize=1048576,noacl" >> /etc/fstab
""".format(env.env.pithos.hostname, os.path.basename(d), d)
echo "{0}:{1} {1} nfs defaults,rw,noatime,rsize=131072,wsize=131072,timeo=14,intr,noacl" >> /etc/fstab
""".format(env.env.pithos.ip, d)
try_run(cmd)
try_run("mount " + d)
@roles("pithos")
def setup_nfs_server():
debug(env.host, " * Setting up NFS server for pithos...")
setup_nfs_dirs()
install_package("nfs-kernel-server")
tmpl = "/etc/exports"
def update_nfs_exports(ip):
tmpl = "/tmp/exports"
replace = {
"pithos_dir": env.env.pithos_dir,
"srv": os.path.dirname(env.env.pithos_dir),
"subnet": env.env.subnet
"image_dir": env.env.image_dir,
"ip": ip,
}
custom = customize_settings_from_tmpl(tmpl, replace)
put(custom, tmpl)
try_run("cat %s >> /etc/exports" % tmpl)
try_run("/etc/init.d/nfs-kernel-server restart")
@roles("pithos")
def setup_nfs_server():
debug(env.host, " * Setting up NFS server for pithos...")
setup_nfs_dirs()
install_package("nfs-kernel-server")
@roles("pithos")
def setup_pithos():
......@@ -963,7 +970,7 @@ def setup_image_host():
debug(env.host, "Setting up snf-image...")
install_package("snf-pithos-backend")
install_package("snf-image")
try_run("mkdir -p /srv/okeanos")
try_run("mkdir -p %s" % env.env.image_dir)
tmpl = "/etc/default/snf-image"
replace = {
"synnefo_user": env.env.synnefo_user,
......@@ -1272,7 +1279,7 @@ def setup_burnin():
def add_image_locally():
debug(env.host, " * Getting image locally in order snf-image to use it directly..")
image = "debian_base.diskdump"
try_run("wget {0} -O /srv/okeanos/{1}".format(env.env.debian_base_url, image))
try_run("wget {0} -O {1}/{2}".format(env.env.debian_base_url, env.env.image_dir, image))
@roles("master")
......
%PITHOS_DIR% %SUBNET%(rw,sync,no_subtree_check,no_root_squash)
/srv/okeanos %SUBNET%(rw,sync,no_subtree_check,no_root_squash)
%SRV% %SUBNET%(rw,fsid=0,no_subtree_check,sync,no_root_squash)
%PITHOS_DIR% %IP%(rw,async,no_subtree_check,no_root_squash)
%IMAGE_DIR% %IP%(rw,async,no_subtree_check,no_root_squash)
......@@ -124,7 +124,7 @@ class Env(object):
self.ips_info[host.ip] = host
self.cluster = Host(self.cluster_name, self.cluster_ip, None,
self.domain)
self.domain, None)
self.master = self.nodes_info[self.master_node]
self.roles = {}
......@@ -138,7 +138,7 @@ class Conf(object):
files = {
"nodes": ["network", "info"],
"deploy": ["dirs", "packages", "keys", "options"],
"vcluster": ["cluster", "image"],
"vcluster": ["cluster", "image", "network"],
"synnefo": ["cred", "synnefo", "roles"],
"packages": ["debian", "ganeti", "synnefo", "other"],
"ganeti": [],
......@@ -196,8 +196,8 @@ class Conf(object):
#domain = get_domain()
#if domain:
# self.nodes.set("network", "domain", get_domain())
self.nodes.set("network", "subnet", "/".join(get_netinfo()))
self.nodes.set("network", "gateway", get_default_route()[0])
# self.nodes.set("network", "subnet", "/".join(get_netinfo()))
# self.nodes.set("network", "gateway", get_default_route()[0])
self.nodes.set("hostnames", "node1", get_hostname())
self.nodes.set("ips", "node1", get_netinfo()[0])
self.nodes.set("info", "nodes", "node1")
......
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