Installazione e configurazione del servizio Image (Glance)


Installazione Glance

Server designato per l'installazione: hostname1.domain.

  • Installare Glance tramite il gestore di pacchetti yum :
    # yum install python-swiftclient --enablerepo=epel-testing
    # yum install openstack-glance openstack-glance-doc
    


Configurazione Glance

  • Rimuovere, se esiste, il file /var/lib/glance/glance.db (cioè il DB sqlite). Verrà utilizzato MySQL.

  • Collegarsi su MySQL da linea di comando lanciando mysql -u root -p e digitando la password dell'utente root.

  • Creare il DB glance:
    mysql> CREATE DATABASE glance;
    

  • Creare l'utente "glance" che ha completo accesso al DB "glance" appena creato.
    mysql> GRANT ALL ON glance.* TO 'glance'@'%' IDENTIFIED BY '<YOUR_GLANCEDB_PASSWORD>';
    
    Dove <YOUR_GLANCEDB_PASSWORD> è la password scelta per l'utente "glance" del DB.

  • Provare ad accedere a MySQL da locale con l'utente "glance" appena creato tramite il comando myslq -u glance -p digitando la password. Nel caso di accesso negato, accedere a MySQL da root ed eliminare l'utente anonimo con i seguenti comandi:
    mysql> DROP USER ''@'localhost';
    mysql> flush privileges;
    
    Questo problema è dovuto ad un bug di MySQL

Editare i file di configurazione di Glance

  • Modificare le seguenti righe nel file /etc/glance/glance-api-paste.ini :
    [filter:authtoken]
    admin_tenant_name = service
    admin_user = glance
    admin_password = <GLANCE_PASSWORD>
    
    Nota bene:
    • service è il tenant "service" creato durante la configurazione di Keystone
    • glance è l'utente del tenant "service" associato al servizio Glance
    • <GLANCE_PASSWORD> è la password scelta per l'utente "glance" creato nel tenant "service", non la password identificata da <YOUR_GLANCEDB_PASSWORD>

  • Modificare le seguenti righe nel file /etc/glance/glance-api.conf :
    [paste_deploy]
    config_file = /etc/glance/glance-api-paste.ini
    flavor = keystone
    

  • Riavviare il servizio openstack-glance-api per rendere effettive le precedenti modifiche:
    # service openstack-glance-api restart
    

  • Modificare le seguenti righe nel file /etc/glance/glance-registry.conf :
    [keystone_authtoken]
    auth_host = 127.0.0.1
    auth_port = 35357
    auth_protocol = http
    admin_tenant_name = service
    admin_user = glance
    admin_password = <GLANCE_PASSWORD>
    
    [paste_deploy]
    flavor = keystone
    
    Verificare che sql_connection punti al DB MySQL piuttosto che a sqlite:
    sql_connection = mysql://glance:<YOUR_GLANCEDB_PASSWORD>@localhost/glance
    
    Nota bene: inserendo esplicitamente l'hostname del server al posto di localhost sono stati verificati problemi di connessione.

  • Modificare le seguenti righe nel file /etc/glance/glance-registry-paste.ini :
    [filter:authtoken]
    admin_tenant_name = service
    admin_user = glance
    admin_password = <GLANCE_PASSWORD>
    
    Verificare che la sezione pipeline:glance-registry contenga pipeline settato come segue:
    [pipeline:glance-registry]
    pipeline = authtoken auth-context context registryapp
    

  • Riavviare i servizi openstack-glance-registry e openstack-glance-api per rendere effettive le precedenti modifiche:
    # service openstack-glance-registry restart
    # service openstack-glance-api restart
    

  • Inizializzare il DB "glance":
    # glance-manage db_sync
    

  • Infine modificare il proprietario della directory /var/lib/glance :
    # chown -R glance:glance /var/lib/glance
    


Troubleshooting

  • To begin troubleshooting, look at the logs in the /var/log/glance/registry.log or /var/log/glance/api.log
  • You can find the version of the installation by using the glance --version command. The version number 2012.1 corresponds with the Essex release.
  • Obtain a test image
# mkdir /stackimages

# cd  /stackimages

# wget https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img

# glance index

# glance add name=cirros-0.3.0-x86_64 disk_format=qcow2 container_format=bare < /stackimages/cirros-0.3.0-x86_64-disk.img 
Uploading image 'cirros-0.3.0-x86_64'
================================================================================================================================================================================[100%] 23.2M/s, ETA  0h  0m  0s
Added new image with ID: a08912a4-3c73-4b17-9d96-bed2d1290d3d

# glance index
ID                                   Name                           Disk Format          Container Format     Size          
------------------------------------ ------------------------------ -------------------- -------------------- --------------
a08912a4-3c73-4b17-9d96-bed2d1290d3d cirros-0.3.0-x86_64            qcow2                bare                        9761280

-- PaoloVeronesi - 2012-08-30

Edit | Attach | PDF | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | More topic actions
Topic revision: r8 - 2012-11-19 - MatteoManzali
 
This site is powered by the TWiki collaboration platformCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback