Commit d93a4cee authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

deploy: Fix importing services to astakos

Use snf-manage service-export and service-import management commands to
import services and corresponding resources to astakos. Also, remove old
temporary files that were used for this procedure.
parent 4a24c235
......@@ -522,8 +522,8 @@ def astakos_loaddata():
@roles("accounts")
def astakos_register_services():
debug(env.host, " * Register services in astakos...")
def astakos_register_components():
debug(env.host, " * Register components in astakos...")
cmd = """
snf-manage component-add "home" https://{0} home-icon.png
snf-manage component-add "cyclades" https://{1}/cyclades/ui/
......@@ -531,24 +531,6 @@ def astakos_register_services():
snf-manage component-add "astakos" https://{3}/astakos/ui/
""".format(env.env.cms.fqdn, env.env.cyclades.fqdn, env.env.pithos.fqdn, env.env.accounts.fqdn)
try_run(cmd)
import_service("astakos")
import_service("pithos")
import_service("cyclades")
tmpl = "/tmp/resources.json"
replace = {}
custom = customize_settings_from_tmpl(tmpl, replace)
put(custom, tmpl)
try_run("snf-manage resource-import --json %s" % tmpl)
cmd = """
snf-manage resource-modify --limit 40G pithos.diskspace
snf-manage resource-modify --limit 2 astakos.pending_app
snf-manage resource-modify --limit 4 cyclades.vm
snf-manage resource-modify --limit 40G cyclades.disk
snf-manage resource-modify --limit 8G cyclades.ram
snf-manage resource-modify --limit 16 cyclades.cpu
snf-manage resource-modify --limit 4 cyclades.network.private
"""
try_run(cmd)
@roles("accounts")
......@@ -1151,6 +1133,48 @@ def add_pools():
try_run("snf-manage pool-create --type=bridge --base=prv --size=20")
@roles("accounts", "cyclades", "pithos")
def export_services():
debug(env.host, " * Exporting services...")
host = env.host
services = []
if host == env.env.cyclades.ip:
services.append("cyclades")
if host == env.env.pithos.ip:
services.append("pithos")
if host == env.env.accounts.ip:
services.append("astakos")
for service in services:
filename = "%s_services.json" % service
cmd = "snf-manage service-export-%s > %s" % (service, filename)
run(cmd)
get(filename, filename+".local")
@roles("accounts")
def import_services():
debug(env.host, " * Registering services to astakos...")
for service in ["cyclades", "pithos", "astakos"]:
filename = "%s_services.json" % service
put(filename +".local", filename)
cmd = "snf-manage service-import --json=%s" % filename
run(cmd)
debug(env.host, " * Setting default quota...")
cmd = """
snf-manage resource-modify --limit 40G pithos.diskspace
snf-manage resource-modify --limit 2 astakos.pending_app
snf-manage resource-modify --limit 4 cyclades.vm
snf-manage resource-modify --limit 40G cyclades.disk
snf-manage resource-modify --limit 16G cyclades.ram
snf-manage resource-modify --limit 8G cyclades.active_ram
snf-manage resource-modify --limit 32 cyclades.cpu
snf-manage resource-modify --limit 16 cyclades.active_cpu
snf-manage resource-modify --limit 4 cyclades.network.private
"""
try_run(cmd)
@roles("cyclades")
def add_network():
debug(env.host, " * Adding public network in cyclades...")
......
{
"astakos_weblogin": {
"component": "astakos",
"prefix": "weblogin",
"endpoints": [
{
"versionId": "",
"publicURL": "https://accounts.%DOMAIN%/astakos/weblogin/"
}
],
"type": "astakos_weblogin",
"public": true
},
"astakos_account": {
"component": "astakos",
"prefix": "account",
"endpoints": [
{
"versionId": "v1.0",
"publicURL": "https://accounts.%DOMAIN%/astakos/account/v1.0/"
}
],
"type": "account",
"public": true,
"resources": {
"pending_app": {
"service_type": "account",
"service_origin": "astakos_account",
"allow_in_projects": false,
"name": "astakos.pending_app",
"desc": "Number of pending project applications"
}
}
},
"astakos_identity": {
"component": "astakos",
"prefix": "identity",
"endpoints": [
{
"versionId": "v2.0",
"publicURL": "https://accounts.%DOMAIN%/astakos/identity/v2.0/"
}
],
"type": "identity",
"public": true,
"resources": {}
}
}
{
"cyclades_compute": {
"component": "cyclades",
"prefix": "compute",
"endpoints": [
{
"versionId": "v2.0",
"publicURL": "https://compute.%DOMAIN%/cyclades/compute/v2.0/"
}
],
"type": "compute",
"public": true,
"resources": {
"network-private": {
"service_type": "compute",
"service_origin": "cyclades_compute",
"name": "cyclades.network.private",
"desc": "Number of private networks"
},
"disk": {
"service_type": "compute",
"service_origin": "cyclades_compute",
"name": "cyclades.disk",
"unit": "bytes",
"desc": "Virtual machine disk size"
},
"ram": {
"service_type": "compute",
"service_origin": "cyclades_compute",
"name": "cyclades.ram",
"unit": "bytes",
"desc": "Virtual machine memory size"
},
"cpu": {
"service_type": "compute",
"service_origin": "cyclades_compute",
"name": "cyclades.cpu",
"desc": "Number of virtual machine processors"
},
"vm": {
"service_type": "compute",
"service_origin": "cyclades_compute",
"name": "cyclades.vm",
"desc": "Number of virtual machines"
}
}
},
"cyclades_vmapi": {
"component": "cyclades",
"prefix": "vmapi",
"endpoints": [
{
"versionId": "v1.0",
"publicURL": "https://cyclades.%DOMAIN%/cyclades/vmapi/v1.0/"
}
],
"type": "vmapi",
"public": true,
"resources": {}
},
"cyclades_admin": {
"component": "cyclades",
"prefix": "admin",
"endpoints": [
{
"versionId": "",
"publicURL": "https://cyclades.%DOMAIN%/cyclades/admin/"
}
],
"type": "admin",
"public": true,
"resources": {}
},
"cyclades_plankton": {
"component": "cyclades",
"prefix": "image",
"endpoints": [
{
"versionId": "v1.0",
"publicURL": "https://cyclades.%DOMAIN%/cyclades/image/v1.0/"
}
],
"type": "image",
"public": true,
"resources": {}
}
}
{
"pithos_object-store": {
"component": "pithos",
"prefix": "object-store",
"endpoints": [
{
"versionId": "v1",
"publicURL": "https://pithos.%DOMAIN%/pithos/object-store/v1/"
}
],
"type": "object-store",
"public": true,
"resources": {
"diskspace": {
"service_type": "object-store",
"service_origin": "pithos_object-store",
"name": "pithos.diskspace",
"unit": "bytes",
"desc": "Pithos account diskspace"
}
}
}
}
[
{
"name": "astakos.pending_app",
"service_type": "account",
"limit": "2",
"allow_in_projects": "False",
"service_origin": "astakos_account",
"id": "1"
},
{
"name": "pithos.diskspace",
"service_type": "object-store",
"limit": "10240.0 MB",
"allow_in_projects": "True",
"service_origin": "pithos_object-store",
"id": "2"
},
{
"name": "cyclades.vm",
"service_type": "compute",
"limit": "4",
"allow_in_projects": "True",
"service_origin": "cyclades_compute",
"id": "3"
},
{
"name": "cyclades.disk",
"service_type": "compute",
"limit": "102400.0 MB",
"allow_in_projects": "True",
"service_origin": "cyclades_compute",
"id": "4"
},
{
"name": "cyclades.ram",
"service_type": "compute",
"limit": "10240.0 MB",
"allow_in_projects": "True",
"service_origin": "cyclades_compute",
"id": "5"
},
{
"name": "cyclades.cpu",
"service_type": "compute",
"limit": "10",
"allow_in_projects": "True",
"service_origin": "cyclades_compute",
"id": "6"
},
{
"name": "cyclades.network.private",
"service_type": "compute",
"limit": "10",
"allow_in_projects": "True",
"service_origin": "cyclades_compute",
"id": "7"
}
]
......@@ -73,7 +73,7 @@ Usage: snf-deploy run <action> [<action>...]
setup_apt add_rapi_user add_backend
setup_astakos add_nodes add_image_locally
setup_cms astakos_loaddata add_network
setup_common astakos_register_services add_ns
setup_common astakos_register_components add_ns
setup_cyclades cms_loaddata add_user
setup_db cyclades_loaddata connect_bridges
setup_ganeti enable_drbd create_bridges
......@@ -434,10 +434,12 @@ def get_actions(*args):
"setup_astakos",
#TODO: astakos-quota fails if no user is added.
# add_user fails if no groups found
"astakos_loaddata", "add_user", "activate_user", "astakos_register_services",
"astakos_loaddata", "add_user", "activate_user",
"astakos_register_components",
"setup_cms", "cms_loaddata",
"setup_pithos",
"setup_cyclades", "cyclades_loaddata", "add_pools", "setup_vncauthproxy",
"setup_cyclades", "cyclades_loaddata", "add_pools",
"export_services", "import_services", "setup_vncauthproxy",
"setup_kamaki", "upload_image", "register_image",
"setup_burnin"
],
......
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