Revision 3c626269

b/snf-deploy/fabfile.py
522 522

  
523 523

  
524 524
@roles("accounts")
525
def astakos_register_services():
526
    debug(env.host, " * Register services in astakos...")
525
def astakos_register_components():
526
    debug(env.host, " * Register components in astakos...")
527 527
    cmd = """
528 528
    snf-manage component-add "home" https://{0} home-icon.png
529 529
    snf-manage component-add "cyclades" https://{1}/cyclades/ui/
......
531 531
    snf-manage component-add "astakos" https://{3}/astakos/ui/
532 532
    """.format(env.env.cms.fqdn, env.env.cyclades.fqdn, env.env.pithos.fqdn, env.env.accounts.fqdn)
533 533
    try_run(cmd)
534
    import_service("astakos")
535
    import_service("pithos")
536
    import_service("cyclades")
537
    tmpl = "/tmp/resources.json"
538
    replace = {}
539
    custom = customize_settings_from_tmpl(tmpl, replace)
540
    put(custom, tmpl)
541
    try_run("snf-manage resource-import --json %s" % tmpl)
542
    cmd = """
543
    snf-manage resource-modify --limit 40G pithos.diskspace
544
    snf-manage resource-modify --limit 2 astakos.pending_app
545
    snf-manage resource-modify --limit 4 cyclades.vm
546
    snf-manage resource-modify --limit 40G cyclades.disk
547
    snf-manage resource-modify --limit 8G cyclades.ram
548
    snf-manage resource-modify --limit 16 cyclades.cpu
549
    snf-manage resource-modify --limit 4 cyclades.network.private
550
    """
551
    try_run(cmd)
552 534

  
553 535

  
554 536
@roles("accounts")
......
1151 1133
    try_run("snf-manage pool-create --type=bridge --base=prv --size=20")
1152 1134

  
1153 1135

  
1136
@roles("accounts", "cyclades", "pithos")
1137
def export_services():
1138
    debug(env.host, " * Exporting services...")
1139
    host = env.host
1140
    services = []
1141
    if host == env.env.cyclades.ip:
1142
        services.append("cyclades")
1143
    if host == env.env.pithos.ip:
1144
        services.append("pithos")
1145
    if host == env.env.accounts.ip:
1146
        services.append("astakos")
1147
    for service in services:
1148
        filename = "%s_services.json" % service
1149
        cmd = "snf-manage service-export-%s > %s" % (service, filename)
1150
        run(cmd)
1151
        get(filename, filename+".local")
1152

  
1153

  
1154
@roles("accounts")
1155
def import_services():
1156
    debug(env.host, " * Registering services to astakos...")
1157
    for service in ["cyclades", "pithos", "astakos"]:
1158
        filename = "%s_services.json" % service
1159
        put(filename +".local", filename)
1160
        cmd = "snf-manage service-import --json=%s" % filename
1161
        run(cmd)
1162

  
1163
    debug(env.host, " * Setting default quota...")
1164
    cmd = """
1165
    snf-manage resource-modify --limit 40G pithos.diskspace
1166
    snf-manage resource-modify --limit 2 astakos.pending_app
1167
    snf-manage resource-modify --limit 4 cyclades.vm
1168
    snf-manage resource-modify --limit 40G cyclades.disk
1169
    snf-manage resource-modify --limit 16G cyclades.ram
1170
    snf-manage resource-modify --limit 8G cyclades.active_ram
1171
    snf-manage resource-modify --limit 32 cyclades.cpu
1172
    snf-manage resource-modify --limit 16 cyclades.active_cpu
1173
    snf-manage resource-modify --limit 4 cyclades.network.private
1174
    """
1175
    try_run(cmd)
1176

  
1177

  
1154 1178
@roles("cyclades")
1155 1179
def add_network():
1156 1180
    debug(env.host, " * Adding public network in cyclades...")
/dev/null
1
{
2
    "astakos_weblogin": {
3
        "component": "astakos", 
4
        "prefix": "weblogin", 
5
        "endpoints": [
6
            {
7
                "versionId": "", 
8
                "publicURL": "https://accounts.%DOMAIN%/astakos/weblogin/"
9
            }
10
        ], 
11
        "type": "astakos_weblogin", 
12
        "public": true
13
    }, 
14
    "astakos_account": {
15
        "component": "astakos", 
16
        "prefix": "account", 
17
        "endpoints": [
18
            {
19
                "versionId": "v1.0", 
20
                "publicURL": "https://accounts.%DOMAIN%/astakos/account/v1.0/"
21
            }
22
        ], 
23
        "type": "account", 
24
        "public": true, 
25
        "resources": {
26
            "pending_app": {
27
                "service_type": "account", 
28
                "service_origin": "astakos_account", 
29
                "allow_in_projects": false, 
30
                "name": "astakos.pending_app", 
31
                "desc": "Number of pending project applications"
32
            }
33
        }
34
    }, 
35
    "astakos_identity": {
36
        "component": "astakos", 
37
        "prefix": "identity", 
38
        "endpoints": [
39
            {
40
                "versionId": "v2.0", 
41
                "publicURL": "https://accounts.%DOMAIN%/astakos/identity/v2.0/"
42
            }
43
        ], 
44
        "type": "identity", 
45
        "public": true, 
46
        "resources": {}
47
    }
48
}
49

  
/dev/null
1
{
2
    "cyclades_compute": {
3
        "component": "cyclades", 
4
        "prefix": "compute", 
5
        "endpoints": [
6
            {
7
                "versionId": "v2.0", 
8
                "publicURL": "https://compute.%DOMAIN%/cyclades/compute/v2.0/"
9
            }
10
        ], 
11
        "type": "compute", 
12
        "public": true, 
13
        "resources": {
14
            "network-private": {
15
                "service_type": "compute", 
16
                "service_origin": "cyclades_compute", 
17
                "name": "cyclades.network.private", 
18
                "desc": "Number of private networks"
19
            }, 
20
            "disk": {
21
                "service_type": "compute", 
22
                "service_origin": "cyclades_compute", 
23
                "name": "cyclades.disk", 
24
                "unit": "bytes", 
25
                "desc": "Virtual machine disk size"
26
            }, 
27
            "ram": {
28
                "service_type": "compute", 
29
                "service_origin": "cyclades_compute", 
30
                "name": "cyclades.ram", 
31
                "unit": "bytes", 
32
                "desc": "Virtual machine memory size"
33
            }, 
34
            "cpu": {
35
                "service_type": "compute", 
36
                "service_origin": "cyclades_compute", 
37
                "name": "cyclades.cpu", 
38
                "desc": "Number of virtual machine processors"
39
            }, 
40
            "vm": {
41
                "service_type": "compute", 
42
                "service_origin": "cyclades_compute", 
43
                "name": "cyclades.vm", 
44
                "desc": "Number of virtual machines"
45
            }
46
        }
47
    }, 
48
    "cyclades_vmapi": {
49
        "component": "cyclades", 
50
        "prefix": "vmapi", 
51
        "endpoints": [
52
            {
53
                "versionId": "v1.0", 
54
                "publicURL": "https://cyclades.%DOMAIN%/cyclades/vmapi/v1.0/"
55
            }
56
        ], 
57
        "type": "vmapi", 
58
        "public": true, 
59
        "resources": {}
60
    }, 
61
    "cyclades_admin": {
62
        "component": "cyclades", 
63
        "prefix": "admin", 
64
        "endpoints": [
65
            {
66
                "versionId": "", 
67
                "publicURL": "https://cyclades.%DOMAIN%/cyclades/admin/"
68
            }
69
        ], 
70
        "type": "admin", 
71
        "public": true, 
72
        "resources": {}
73
    }, 
74
    "cyclades_plankton": {
75
        "component": "cyclades", 
76
        "prefix": "image", 
77
        "endpoints": [
78
            {
79
                "versionId": "v1.0", 
80
                "publicURL": "https://cyclades.%DOMAIN%/cyclades/image/v1.0/"
81
            }
82
        ], 
83
        "type": "image", 
84
        "public": true, 
85
        "resources": {}
86
    }
87
}
88

  
/dev/null
1
{
2
    "pithos_object-store": {
3
        "component": "pithos", 
4
        "prefix": "object-store", 
5
        "endpoints": [
6
            {
7
                "versionId": "v1", 
8
                "publicURL": "https://pithos.%DOMAIN%/pithos/object-store/v1/"
9
            }
10
        ], 
11
        "type": "object-store", 
12
        "public": true, 
13
        "resources": {
14
            "diskspace": {
15
                "service_type": "object-store", 
16
                "service_origin": "pithos_object-store", 
17
                "name": "pithos.diskspace", 
18
                "unit": "bytes", 
19
                "desc": "Pithos account diskspace"
20
            }
21
        }
22
    }
23
}
24

  
/dev/null
1
[
2
    {
3
        "name": "astakos.pending_app", 
4
        "service_type": "account", 
5
        "limit": "2", 
6
        "allow_in_projects": "False", 
7
        "service_origin": "astakos_account", 
8
        "id": "1"
9
    }, 
10
    {
11
        "name": "pithos.diskspace", 
12
        "service_type": "object-store", 
13
        "limit": "10240.0 MB", 
14
        "allow_in_projects": "True", 
15
        "service_origin": "pithos_object-store", 
16
        "id": "2"
17
    }, 
18
    {
19
        "name": "cyclades.vm", 
20
        "service_type": "compute", 
21
        "limit": "4", 
22
        "allow_in_projects": "True", 
23
        "service_origin": "cyclades_compute", 
24
        "id": "3"
25
    }, 
26
    {
27
        "name": "cyclades.disk", 
28
        "service_type": "compute", 
29
        "limit": "102400.0 MB", 
30
        "allow_in_projects": "True", 
31
        "service_origin": "cyclades_compute", 
32
        "id": "4"
33
    }, 
34
    {
35
        "name": "cyclades.ram", 
36
        "service_type": "compute", 
37
        "limit": "10240.0 MB", 
38
        "allow_in_projects": "True", 
39
        "service_origin": "cyclades_compute", 
40
        "id": "5"
41
    }, 
42
    {
43
        "name": "cyclades.cpu", 
44
        "service_type": "compute", 
45
        "limit": "10", 
46
        "allow_in_projects": "True", 
47
        "service_origin": "cyclades_compute", 
48
        "id": "6"
49
    }, 
50
    {
51
        "name": "cyclades.network.private", 
52
        "service_type": "compute", 
53
        "limit": "10", 
54
        "allow_in_projects": "True", 
55
        "service_origin": "cyclades_compute", 
56
        "id": "7"
57
    }
58
]
b/snf-deploy/snfdeploy/__init__.py
73 73
      setup_apt              add_rapi_user                 add_backend
74 74
      setup_astakos          add_nodes                     add_image_locally
75 75
      setup_cms              astakos_loaddata              add_network
76
      setup_common           astakos_register_services     add_ns
76
      setup_common           astakos_register_components   add_ns
77 77
      setup_cyclades         cms_loaddata                  add_user
78 78
      setup_db               cyclades_loaddata             connect_bridges
79 79
      setup_ganeti           enable_drbd                   create_bridges
......
434 434
        "setup_astakos",
435 435
        #TODO: astakos-quota fails if no user is added.
436 436
        #      add_user fails if no groups found
437
        "astakos_loaddata", "add_user", "activate_user", "astakos_register_services",
437
        "astakos_loaddata", "add_user", "activate_user",
438
        "astakos_register_components",
438 439
        "setup_cms", "cms_loaddata",
439 440
        "setup_pithos",
440
        "setup_cyclades", "cyclades_loaddata", "add_pools", "setup_vncauthproxy",
441
        "setup_cyclades", "cyclades_loaddata", "add_pools",
442
        "export_services", "import_services", "setup_vncauthproxy",
441 443
        "setup_kamaki", "upload_image", "register_image",
442 444
        "setup_burnin"
443 445
        ],

Also available in: Unified diff