Revision d4f28d8f snf-deploy/snfdeploy/components.py
b/snf-deploy/snfdeploy/components.py | ||
---|---|---|
34 | 34 |
import datetime |
35 | 35 |
from snfdeploy.utils import debug |
36 | 36 |
|
37 |
|
|
37 | 38 |
class SynnefoComponent(object): |
38 | 39 |
|
39 | 40 |
REQUIRED_PACKAGES = [] |
... | ... | |
86 | 87 |
"apt-get update", |
87 | 88 |
] |
88 | 89 |
|
90 |
|
|
89 | 91 |
class SSH(SynnefoComponent): |
90 | 92 |
def prepare(self): |
91 | 93 |
return [ |
... | ... | |
234 | 236 |
def prepare(self): |
235 | 237 |
return [ |
236 | 238 |
"echo 'APT::Install-Suggests \"false\";' >> /etc/apt/apt.conf", |
237 |
"curl -k https://dev.grnet.gr/files/apt-grnetdev.pub | apt-key add -", |
|
239 |
"curl -k https://dev.grnet.gr/files/apt-grnetdev.pub | \ |
|
240 |
apt-key add -", |
|
238 | 241 |
] |
239 | 242 |
|
240 | 243 |
def configure(self): |
... | ... | |
384 | 387 |
|
385 | 388 |
return commands + self.restart() |
386 | 389 |
|
387 |
|
|
388 | 390 |
def add_node(self, node_info): |
389 | 391 |
commands = [ |
390 |
"gnt-node add --no-ssh-key-check --master-capable=yes " + \
|
|
392 |
"gnt-node add --no-ssh-key-check --master-capable=yes " + |
|
391 | 393 |
"--vm-capable=yes " + node_info.fqdn, |
392 | 394 |
] |
393 | 395 |
return commands |
... | ... | |
400 | 402 |
"gnt-group modify --disk-parameters=drbd:metavg=%s default" % vg, |
401 | 403 |
] |
402 | 404 |
|
403 |
|
|
404 | 405 |
def initialize(self): |
405 | 406 |
cmd = """ |
406 | 407 |
gnt-cluster init --enabled-hypervisors=kvm \ |
... | ... | |
446 | 447 |
return ["snf-image-update-helper -y"] |
447 | 448 |
|
448 | 449 |
|
449 |
|
|
450 | 450 |
class GTools(SynnefoComponent): |
451 | 451 |
REQUIRED_PACKAGES = [ |
452 | 452 |
"snf-cyclades-gtools", |
... | ... | |
508 | 508 |
def initialize(self): |
509 | 509 |
return ["/etc/init.d/rc.local start"] |
510 | 510 |
|
511 |
|
|
512 | 511 |
def restart(self): |
513 | 512 |
return ["/etc/init.d/nfdhcpd restart"] |
514 | 513 |
|
... | ... | |
643 | 642 |
] |
644 | 643 |
|
645 | 644 |
def set_default_quota(self): |
646 |
return [ |
|
647 |
"snf-manage resource-modify --default-quota 40G pithos.diskspace", |
|
648 |
"snf-manage resource-modify --default-quota 2 astakos.pending_app", |
|
649 |
"snf-manage resource-modify --default-quota 4 cyclades.vm", |
|
650 |
"snf-manage resource-modify --default-quota 40G cyclades.disk", |
|
651 |
"snf-manage resource-modify --default-quota 16G cyclades.total_ram", |
|
652 |
"snf-manage resource-modify --default-quota 8G cyclades.ram", |
|
653 |
"snf-manage resource-modify --default-quota 32 cyclades.total_cpu", |
|
654 |
"snf-manage resource-modify --default-quota 16 cyclades.cpu", |
|
655 |
"snf-manage resource-modify --default-quota 4 cyclades.network.private", |
|
656 |
"snf-manage resource-modify --default-quota 4 cyclades.floating_ip", |
|
645 |
cmd = "snf-manage resource-modify --default-quota" |
|
646 |
return [ |
|
647 |
"%s 40G pithos.diskspace" % cmd, |
|
648 |
"%s 2 astakos.pending_app" % cmd, |
|
649 |
"%s 4 cyclades.vm" % cmd, |
|
650 |
"%s 40G cyclades.disk" % cmd, |
|
651 |
"%s 16G cyclades.total_ram" % cmd, |
|
652 |
"%s 8G cyclades.ram" % cmd, |
|
653 |
"%s 32 cyclades.total_cpu" % cmd, |
|
654 |
"%s 16 cyclades.cpu" % cmd, |
|
655 |
"%s 4 cyclades.network.private" % cmd, |
|
656 |
"%s 4 cyclades.floating_ip" % cmd, |
|
657 | 657 |
] |
658 | 658 |
|
659 | 659 |
def modify_all_quota(self): |
660 |
return [ |
|
661 |
"snf-manage user-modify -f --all --base-quota pithos.diskspace 40G", |
|
662 |
"snf-manage user-modify -f --all --base-quota astakos.pending_app 2", |
|
663 |
"snf-manage user-modify -f --all --base-quota cyclades.vm 4", |
|
664 |
"snf-manage user-modify -f --all --base-quota cyclades.disk 40G", |
|
665 |
"snf-manage user-modify -f --all --base-quota cyclades.total_ram 16G", |
|
666 |
"snf-manage user-modify -f --all --base-quota cyclades.ram 8G", |
|
667 |
"snf-manage user-modify -f --all --base-quota cyclades.total_cpu 32", |
|
668 |
"snf-manage user-modify -f --all --base-quota cyclades.cpu 16", |
|
669 |
"snf-manage user-modify -f --all --base-quota cyclades.network.private 4", |
|
670 |
"snf-manage user-modify -f --all --base-quota cyclades.floating_ip 4", |
|
660 |
cmd = "snf-manage user-modify -f --all --base-quota" |
|
661 |
return [ |
|
662 |
"%s pithos.diskspace 40G" % cmd, |
|
663 |
"%s astakos.pending_app 2" % cmd, |
|
664 |
"%s cyclades.vm 4" % cmd, |
|
665 |
"%s cyclades.disk 40G" % cmd, |
|
666 |
"%s cyclades.total_ram 16G" % cmd, |
|
667 |
"%s cyclades.ram 8G" % cmd, |
|
668 |
"%s cyclades.total_cpu 32" % cmd, |
|
669 |
"%s cyclades.cpu 16" % cmd, |
|
670 |
"%s cyclades.network.private 4" % cmd, |
|
671 |
"%s cyclades.floating_ip 4" % cmd, |
|
671 | 672 |
] |
672 | 673 |
|
673 | 674 |
def get_services(self): |
... | ... | |
734 | 735 |
] |
735 | 736 |
|
736 | 737 |
|
737 |
|
|
738 | 738 |
class CMS(SynnefoComponent): |
739 | 739 |
REQUIRED_PACKAGES = [ |
740 | 740 |
"snf-cloudcms" |
... | ... | |
860 | 860 |
("/etc/synnefo/webclient.conf", r2, {}), |
861 | 861 |
] |
862 | 862 |
|
863 |
|
|
863 | 864 |
class Cyclades(SynnefoComponent): |
864 | 865 |
REQUIRED_PACKAGES = [ |
865 | 866 |
"memcached", |
... | ... | |
870 | 871 |
"python-django-south", |
871 | 872 |
] |
872 | 873 |
|
873 |
def add_network(self, subnet=None, gw=None, ntype=None, link=None): |
|
874 |
if not subnet: |
|
875 |
subnet = self.env.env.synnefo_public_network_subnet |
|
876 |
if not gw: |
|
877 |
gw = self.env.env.synnefo_public_network_gateway |
|
878 |
if not ntype: |
|
879 |
ntype = self.env.env.synnefo_public_network_type |
|
880 |
if not link: |
|
881 |
link = self.env.env.common_bridge |
|
874 |
def add_network(self): |
|
875 |
subnet = self.env.env.synnefo_public_network_subnet |
|
876 |
gw = self.env.env.synnefo_public_network_gateway |
|
877 |
ntype = self.env.env.synnefo_public_network_type |
|
878 |
link = self.env.env.common_bridge |
|
882 | 879 |
|
883 | 880 |
cmd = """ |
884 | 881 |
snf-manage network-create --subnet={0} --gateway={1} --public \ |
... | ... | |
888 | 885 |
|
889 | 886 |
return [cmd] |
890 | 887 |
|
891 |
def add_network6(self, subnet="babe::/64", gw="babe::1", ntype=None, link=None):
|
|
892 |
if not ntype:
|
|
893 |
ntype = self.env.env.synnefo_public_network_type
|
|
894 |
if not link:
|
|
895 |
link = self.env.env.common_bridge
|
|
888 |
def add_network6(self): |
|
889 |
subnet = "babe::/64"
|
|
890 |
gw = "babe::1"
|
|
891 |
ntype = self.env.env.synnefo_public_network_type
|
|
892 |
link = self.env.env.common_bridge |
|
896 | 893 |
|
897 |
cmd = """
|
|
898 |
snf-manage network-create --subnet6=babe::/64 \
|
|
899 |
--gateway6=babe::1 --public --dhcp=True --flavor={0} --mode=bridged \
|
|
900 |
--link={1} --name=IPv6PublicNetwork
|
|
901 |
""".format(ntype, link) |
|
894 |
cmd = """ |
|
895 |
snf-manage network-create --subnet6={0} \
|
|
896 |
--gateway6={1} --public --dhcp=True --flavor={2} --mode=bridged \
|
|
897 |
--link={3} --name=IPv6PublicNetwork
|
|
898 |
""".format(subnet, gw, ntype, link)
|
|
902 | 899 |
|
903 | 900 |
return [cmd] |
904 | 901 |
|
... | ... | |
918 | 915 |
user = self.env.env.synnefo_user |
919 | 916 |
passwd = self.env.env.synnefo_rapi_passwd |
920 | 917 |
return [ |
921 |
"snf-manage backend-add --clustername=%s --user=%s --pass=%s" % \
|
|
918 |
"snf-manage backend-add --clustername=%s --user=%s --pass=%s" %
|
|
922 | 919 |
(cluster.fqdn, user, passwd) |
923 | 920 |
] |
924 | 921 |
|
... | ... | |
959 | 956 |
return [ |
960 | 957 |
"snf-manage syncdb", |
961 | 958 |
"snf-manage migrate --delete-ghost-migrations", |
962 |
"snf-manage pool-create --type=mac-prefix --base=aa:00:0 --size=65536", |
|
959 |
"snf-manage pool-create --type=mac-prefix \ |
|
960 |
--base=aa:00:0 --size=65536", |
|
963 | 961 |
"snf-manage pool-create --type=bridge --base=prv --size=20", |
964 | 962 |
"snf-manage flavor-create %s %s %s %s" % (cpu, ram, disk, storage), |
965 | 963 |
] |
... | ... | |
970 | 968 |
"/etc/init.d/snf-dispatcher restart", |
971 | 969 |
] |
972 | 970 |
|
971 |
|
|
973 | 972 |
class VNC(SynnefoComponent): |
974 | 973 |
REQUIRED_PACKAGES = [ |
975 | 974 |
"snf-vncauthproxy" |
... | ... | |
990 | 989 |
def initialize(self): |
991 | 990 |
url = "https://%s/astakos/identity/v2.0" % self.env.env.accounts.fqdn |
992 | 991 |
return [ |
993 |
"kamaki config set cloud.default.url %s" % url, |
|
994 |
"kamaki config set cloud.default.token %s" % self.env.user_auth_token, |
|
992 |
"kamaki config set cloud.default.url %s" % url, |
|
993 |
"kamaki config set cloud.default.token %s" % |
|
994 |
self.env.user_auth_token, |
|
995 | 995 |
"kamaki container create images", |
996 | 996 |
] |
997 | 997 |
|
... | ... | |
1025 | 1025 |
cmd |
1026 | 1026 |
] |
1027 | 1027 |
|
1028 |
|
|
1028 | 1029 |
class Burnin(SynnefoComponent): |
1029 | 1030 |
REQUIRED_PACKAGES = [ |
1030 | 1031 |
"kamaki", |
1031 | 1032 |
"snf-tools", |
1032 | 1033 |
] |
1033 | 1034 |
|
1035 |
|
|
1034 | 1036 |
class Collectd(SynnefoComponent): |
1035 | 1037 |
REQUIRED_PACKAGES = [ |
1036 | 1038 |
"collectd", |
... | ... | |
1073 | 1075 |
"/etc/init.d/apache2 restart", |
1074 | 1076 |
] |
1075 | 1077 |
|
1078 |
|
|
1076 | 1079 |
class GanetiCollectd(SynnefoComponent): |
1077 | 1080 |
def configure(self): |
1078 | 1081 |
r1 = { |
... | ... | |
1082 | 1085 |
("/etc/collectd/passwd", {}, {}), |
1083 | 1086 |
("/etc/collectd/synnefo-ganeti.conf", r1, {}), |
1084 | 1087 |
] |
1085 |
|
|
1086 |
|
Also available in: Unified diff