42
Infrastructure as a Service mit der Cloud Computing Lösung OpenStack auf SUSE Linux Enterprise Server 11 B1 Systems GmbH © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. i

Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

Infrastructure as a Service mit der CloudComputing Lösung OpenStack auf SUSE

Linux Enterprise Server 11

B1 Systems GmbH

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. i

Page 2: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

Version 2011-01These materials were written for SUSE Linux Enterprise Server 11,Service Pack 1.

If you have any questions, comments or want to report errors in the training materialplease post them to [email protected].

The following names, products or services are registered trademarks:

Adaptec, AIX, AMD, AMD Virtualization, AMD-V, AutoBuild, Cisco, DB2, Debian, Domi-no, the Gecko, IBM, Intel, Intel Logo, Intel Inside Logo, Intel Centrino Logo, iSeries, Java,JDBC, JVM, J2EE, Linux, Microsoft Windows, Microsoft Virtual PC, Nagios, Nagios Lo-go, Novell, N Logo, OpenStack, openSUSE, openSUSE Logo, pSeries, QEMU, Qumranet,Qumranet Solid ICE, Red Hat, Red Hat Linux, Red Hat Enterprise Linux, Red Hat Sha-dowman Logo, Solaris, StarOffice, Sun, Sun Java, Sun Microsystems, SUSE, SUSE Linux,SUSE Linux Enterprise Server, Type Enforcement, UNIX, VirtualBox, VMware, VMwareWorkstation, VMware Server, VMware ESX, YaST, Xen, Xen Logo, zSeries.

We want to point out that all soft and hardware names, trademarks and product names ofthe respective firms used in this manual remain property of their respective holders evenif not mentioned in the list above or marked accordingly.

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or inpart without the written permission of B1 Systems.

Page 3: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

Inhaltsverzeichnis

Inhaltsverzeichnis

0 Einführung 1

1 Szenario 31.1 Vorbereitung . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.1.1 Installation von SLES11 SP1 . . . . . . . . . . . . . . . . . . . . . . . . 31.1.2 Repository hinzufügen . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.2 Abhängigkeiten . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61.2.1 truncate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61.2.2 IP-Forwarding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.2.3 Kernelmodule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.2.4 Sonstiges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

1.3 Dienste . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81.3.1 MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81.3.2 RabbitMQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81.3.3 libvirt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2 OpenStack Compute - nova 102.1 Übersicht . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.2 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.3 Konfiguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

2.3.1 Datenbank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.3.2 AMQP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142.3.3 Konfiguration der API . . . . . . . . . . . . . . . . . . . . . . . . . . . 142.3.4 Konfiguration des Objectstorages . . . . . . . . . . . . . . . . . . . . . 152.3.5 Virtualisierungsart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.3.6 Netzwerkkonfiguration . . . . . . . . . . . . . . . . . . . . . . . . . . 152.3.7 Starten der Dienste . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162.3.8 Logfiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

2.4 novamanage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.4.1 Benutzer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.4.2 Projekte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.4.3 Netzwerke . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.4.4 SSH-Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.4.5 Zertifikate exportieren . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.4.6 Security Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.4.7 service list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

2.5 Volumes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202.6 Objectstorage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

2.6.1 Starten des Objectstores . . . . . . . . . . . . . . . . . . . . . . . . . . 202.6.2 Mit Images bestücken . . . . . . . . . . . . . . . . . . . . . . . . . . . 212.6.3 Verfügbare Images anzeigen . . . . . . . . . . . . . . . . . . . . . . . 222.6.4 Images manuell hinzufügen . . . . . . . . . . . . . . . . . . . . . . . . 22

2.7 glance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242.7.1 Übersicht . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242.7.2 Vorbereitung . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. iii

Page 4: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

Inhaltsverzeichnis

2.7.3 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.7.4 Konfiguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.7.5 Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.7.6 glanceupload . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262.7.7 Datenbank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272.7.8 Anbindung an nova . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

2.8 Instanzen spawnen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272.9 Distributed storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

2.9.1 Sheepdog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282.9.2 ISCSI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

2.10 GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342.10.1 Dashboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352.10.2 OpenStackManager . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362.10.3 ajaxterm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362.10.4 PHP - einfache Datenbankauswertung . . . . . . . . . . . . . . . . . . 37

iv © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 5: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

0 Einführung

0 Einführung

Cloud Computing ist ein Konzept um IT-Infrastruktur, z.B. Datenspeicher oder CPU Leis-tung, abstrahiert über ein Netzwerk anzubieten und zur Laufzeit den Bedarf an die Be-dürfnisse anzupassen. Der Pool der angebotenen Resource ist dabei zu jeder Zeit er-weiterbar oder reduzierbar (sprich skalierbar).

Unterschieden wird dabei nach privaten und öffentlichen Clouds (private/public Cloud).Ein Mischbetrieb ist möglich und wird dann als Hybrid Cloud bezeichnet.

Hinweis: Bei diesem Whitepaper wurden Sicherheitsaspekte ausser Acht gelassen.

Im Kapitel Sicherheit finden sich einige Anmerkungen, die man bei einem produktivenBetrieb beachten sollte.

Hinweis: OpenStack befindet sich momentan in der Entwicklung.

Viele Funktionen wurden bislang nicht implementiert oder sind nur rudimentär vorhan-den.

OpenStack besteht aus zwei Komponenten, Compute und Object Storage . Compute ist derTeil, der für das Verwalten und Einrichten größerer Gruppen von virtuellen Maschinenzuständig ist. Der Object Storage hingegen ist für das redundante Speichern von Datenverantwortlich. Da die Daten verteilt werden, spricht man vom infinite storage. Der ObjectStorage ist vergleichbar mit Amazons S3.

2005 entwickelte die Firma Rackspace die Rackspace Cloud und entschloss sich 2009, dieSoftware neu zu schreiben. Im März 2010 wurde diese dann als Open Source freigegeben(dies betrifft den Teil Storage). Im Mai 2010 gab die NASA ihr Nebula Projekt frei undbereits im Juni schlossen sie die beiden Projekte zu OpenStack zusammen. Im Juli 2010fand das erste Zusammentreffen der Entwickler mit einer Zielvorgabe statt und schon imOktober desselben Jahres wurde das erste Release namens Austin veröffentlicht. Daranwaren bereits 35 Partnerfirmen beteiligt. Das nächste Release Bexar wurde im Februar2011 veröffentlicht.

Aktuell unterscheidet man den Teil Compute , benannt Nova und natürlich den Object Sto-rage , der nun unter dem Namen Swift bekannt ist.

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 1

Page 6: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

0 Einführung

Paketübersicht

Paket Komponente Beschreibungopenstack-glance Nova Dienst zum Registrieren von Imagesopenstack-nova Nova gemeinsame Dateienopenstack-nova-api Nova der API-Daemonopenstack-nova-compute Nova startet virtuelle Maschinenopenstack-nova-doc Nova Dokumentationopenstack-nova-network Nova Netzwerkverwaltungopenstack-nova-objectstore Nova einfacher Store für Imagesopenstack-nova-scheduler Nova bestimmt, welche Node welche Maschi-

nen startetopenstack-nova-volume Nova verwaltet persistente Volumesopenstack-swift Swift Swift zweiter Teil von OpenStack , der

große Objectstoreopenstack-swift-account Swift Benutzerverwaltungopenstack-swift-auth Swift Authentifizierungopenstack-swift-container Swift Containeropenstack-swift-doc Swift Dokumentationopenstack-swift-object Swift Object Serveropenstack-swift-proxy Swift Proxy

Übersicht der zusätzlich benötigten Pakete

Paket benötigt für BeschreibungMySQL Nova Datenbankserver, enthält die Projekte, Benutzer etc.RabbitMQ Nova AMQP Server (Kommunikation der Dienste untereinan-

der)memcached Swift Speicheroptimierung

Hinweis

Eine umfangreiche Linksammlung zum Thema findet sich im entsprechenden Wikipe-diartikel (http://de.wikipedia.org/wiki/Cloud_Computing).

2 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 7: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

1 Szenario

1 Szenario

1.1 Vorbereitung

Systeme

Name IP-Adresse Funktionares 192.168.2.110 Nova (API)brontes 192.168.2.120 Nova (Compute )chronos 192.168.2.130 Swift (API), Glance (API, Registry)deimos 192.168.2.140 Dienste (MySQL , iSCSI , RabbitMQ )

Die nachfolgenden Vorbereitungen auf allen Systemen durchführen, die in Verbindungmit dem OpenStack genutzt werden sollen. Für den produktiven Betrieb wird die Erstel-lung von einem AutoYaST-Profil für die normalen Nova - sowie Swift -Nodes empfoh-len.

1.1.1 Installation von SLES11 SP1

Die Beispiele in diesem Whitepaper wurden unter SLES11 SP1 mit allen verfügbaren Pat-ches erarbeitet und getestet. Die Installation wurde in eine einzelne primäre Partition zu15 GByte durchgeführt.

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 3

Page 8: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

1 Szenario

# fdisk -l /dev/sda

Disk /dev/sda: 200.0 GB, 200049647616 bytes255 heads, 63 sectors/track, 24321 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk identifier: 0x0003d4b0

Device Boot Start End Blocks Id System/dev/sda1 * 1 1958 15727603+ 83 Linux/dev/sda2 1959 3042 8707230 82 Linux swap / Solaris# fdisk -l /dev/sda

Disk /dev/sda: 200.0 GB, 200049647616 bytes255 heads, 63 sectors/track, 24321 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk identifier: 0x0003d4b0

Device Boot Start End Blocks Id System/dev/sda1 * 1 1958 15727603+ 83 Linux/dev/sda2 1959 3042 8707230 82 Linux swap / Solaris

Installiert wurde ein minimales System, dass heisst lediglich mit den Pattern Minimalund base. Der verbleibende lokale Speicherplatz wird später zum Aufbau des DistributedStorage sowie des Object Storage verwendet. Sind die Systeme nicht ausreichend mit RAMausgestattet, sollte noch eine Swap-Partition eingerichtet werden. Generell ist es jedochzu empfehlen ausreichend dimensionierte Hardware zu verwenden.

Nicht notwendige Dienste wurden entfernt. Insbesondere wurde die SuSEfirewall2 deak-tiviert, da OpenStack seine eigenen iptables-Regeln setzt.

acpid oncron ondbus onearlysyslog onfbset onhaldaemon onirq_balancer onkbd onmicrocode.ctl onnetwork onnetwork-remotefs onntp onrandom onsplash onsplash_early onsshd onsyslog on

1.1.2 Repository hinzufügen

# zypper ar http://download.opensuse.org/repositories/ \

4 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 9: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

1 Szenario

isv:/B1-Systems:/OpenStack/SLE_11_SP1/isv:B1-Systems:OpenStack.repoRepository ’OpenStack Packages for openSUSE and SLES11 (SLE_11_SP1)’ \

hinzufügen [FERTIG]Repository ’OpenStack Packages for openSUSE and SLES11 (SLE_11_SP1)’ \

erfolgreich hinzugefügtAktiviert: JaAutomatische Aktualisierung: NeinURI: http://download.opensuse.org/repositories/\

isv:/B1-Systems:/OpenStack/SLE_11_SP1/

# zypper ar http://download.opensuse.org/repositories/ \devel:/languages:/python/SLE_11/devel:languages:python.repo

Repository ’Python and Python Modules (SLE_11)’ hinzufügen \[FERTIG]

Repository ’Python and Python Modules (SLE_11)’ erfolgreich \hinzugefügt

Aktiviert: JaAutomatische Aktualisierung: NeinURI: http://download.opensuse.org/repositories/ \

devel:/languages:/python/SLE_11/

# zypper refMetadaten von Repository ’Python and Python Modules (SLE_11)’ abrufen [\]

Neuen Signierungsschlüssel für Repository oder Paket erhalten:Schlüssel-ID: 27163A4EEDF0D733Schlüsselname: devel:languages:python OBS Project \

<devel:languages:[email protected]>Schlüssel-Fingerprint: 172CCD6B0CF49B7388F1C61127163A4EEDF0D733Repository: Python and Python Modules (SLE_11)

Wollen Sie den Schlüssel zurückweisen, ihm temporär oder immer \vertrauen? [r/t/a/?] (r): a

Metadaten von Repository ’Python and Python Modules (SLE_11)’ \abrufen [FERTIG]

Cache für Repository ’Python and Python Modules (SLE_11)’ \erzeugen [FERTIG]

Metadaten von Repository ’OpenStack Packages for openSUSE and \SLES11 (SLE_11_SP1)’ abrufen [/]

Neuen Signierungsschlüssel für Repository oder Paket erhalten:Schlüssel-ID: C0CB79B9CE9EAAB5Schlüsselname: isv:B1-Systems OBS Project \

<isv:[email protected]>Schlüssel-Fingerprint: A3A19AC6B7B8D887BA3C46DFC0CB79B9CE9EAAB5Repository: OpenStack Packages for openSUSE and SLES11 (SLE_11_SP1)

Wollen Sie den Schlüssel zurückweisen, ihm temporär oder immer \vertrauen? [r/t/a/?] (r): a

Metadaten von Repository ’OpenStack Packages for openSUSE and \SLES11 (SLE_11_SP1)’ abrufen [FERTIG]

Cache für Repository ’OpenStack Packages for openSUSE and SLES11 \(SLE_11_SP1)’ erzeugen [FERTIG]

Repository ’SLES11-SP1-Pool’ ist aktuell.

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 5

Page 10: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

1 Szenario

Metadaten von Repository ’SLES11-SP1-Updates’ abrufen [FERTIG]Cache für Repository ’SLES11-SP1-Updates’ erzeugen [FERTIG]Alle Repositorys wurden aktualisiert.

Hinweis: Standarddienste

Wenn ein eigenes System für notwendige zusätzliche Dienste, z.B. MySQL , verwendetwerden soll ist es nicht nötig, das Repository vom OBS einzubinden wenn die Dienstebereits in SLES11 SP1 enthalten sind. Da wir alle Dienste auf einem System betreibenwerden und beispielsweise RabbitMQ kein Bestandteil von SLES11 SP1 ist, muss auch aufdeimos dieses Repository hinzugefügt werden.

Hinweis: OpenSuSE Build Service

Stefan ”seife” Seyfried hat funktionierende RPM-Pakete zusammengestellt. Diese wurdenvon uns lange getestet und stehen nun auf dem OBS (OpenSUSE Build Service) im ProjektISV:B1-Systems:OpenStack zur Verfügung. Aktuellere Pakete finden sich ebenfalls auf demOBS, im Projekt home:seife:openstack.

Hinweis: Vendor Change

Da einige Pakete in einer aktuelleren Version, als in SLES11 SP1 vorhanden, benötigt wer-den kann es zu Warnungen bezüglich eines Vendor Changes kommen. Diese müssen be-stätigt werden, damit die aktuelleren Pakete eingespielt werden können.

Hinweis: verwendete Versionen

Die verwendeten Versionen in diesem Repository sind beabsichtigt. Teilweise funktionie-ren andere Versionen nicht, z.B. gibt es Probleme wenn eine andere Version von python-boto verwendet wird.

1.2 Abhängigkeiten

1.2.1 truncate

Jede Compute -Node benötigt truncate.

Leider enthält SLES11 SP1 diese normalerweise in den coreutils enthaltene Datei nicht.Aus diesem Grund benötigt man http://ftp.redhat.com/pub/redhat/rhel/beta/6/x86_64/os/Packages/coreutils-8.4-1.el6.x86_64.rpm.

Daraus extrahiert man sich truncate und kopiert die Datei nach /usr/local/bin.

6 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 11: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

1 Szenario

1.2.2 IP-Forwarding

Zur Netzwerkkommunikation muss IP-Forwarding aktiviert sein.Dazu editiert man /etc/sysconfig/sysctl:

# Runtime-configurable parameter: forward IP packets.# Is this host a router? (yes/no)#IP_FORWARD="yes"

Alternativ kann man das IP-Forwarding zur Laufzeit einschalten:

sysctl -w net.ipv4.ip_forward=1

1.2.3 Kernelmodule

Benötigte Kernelmodule:

• ext4 - ext4dev-kmp-default

• nbd

• kvm

Für den Zugriff auf Dateisysteme in den virtuellen Maschinen und die sog. Config-Injectionbenötigt man u.U. ext4. Dieses Modul muss unter SLES11 SP1 noch auf folgende Art ge-laden werden:

modprobe --allow-unsupported ext4

Hinweis: Für KVM muss Hardwarevirtualisierung im Bios aktiviert sein!

Zusätzlich zum Modul kvm muss das für die Hardwarearchitektur passende Module ge-laden werden, kvm_intel für Intel-VT oder kvm_amd für AMD-V.

1.2.4 Sonstiges

# zypper install tunctl bridge-utils kvm virt-utils[...]

Für die Netzwerkkonfiguration auf den compute-nodes benötigt man Programme zur Ver-waltung von Netzwerkbrücken.

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 7

Page 12: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

1 Szenario

1.3 Dienste

1.3.1 MySQL

Die Projektseite von MySQL findet sich unter http://www.mysql.com.

In der Datenbank werden sämtliche Benutzer, Projekte, Netzwerke, verwendete IP-Adressenund viele weitere Daten gespeichert.

Zuerst installiert und startet man den MySQL -Server und setzt ein Passwort für denBenutzer root. Danach erzeugt man eine Datenbank namens nova und erlaubt dem geradeerzeugten Benutzer den Zugriff auf diese Datenbank.

deimos:~ # zypper install mysql[...]deimos:~ # rcmysql startCreating MySQL privilege database...[...]Starting service MySQL donedeimos:~ # mysqladmin password testingdeimos:~ # mysql -u root -pEnter password:mysql> create database nova;Query OK, 1 row affected (0.00 sec)mysql> GRANT ALL PRIVILEGES ON *.* TO ’root’@’%’ \

IDENTIFIED BY ’testing’ WITH GRANT OPTION;Query OK, 0 rows affected (0.00 sec)

1.3.2 RabbitMQ

Die Kommunikation der einzelnen Dienste findet aktuell über das AMQP (Advanced Mes-sage Queueing Protocol) statt. Als Server unterstützt OpenStack aktuell RabbitMQ .

deimos:~ # zypper install rabbitmq-server[...]deimos:~ # /etc/init.d/rabbitmq-server startStarting rabbitmq-server: SUCCESSrabbitmq-server.

Die Projektseite findet sich unter http://www.rabbitmq.com.

Hinweis: Standardkonfiguration lauffähig

Die Konfiguration ist in /etc/sysconfig/rabbitmq-server enthalten. In der Default-konfiguration des SLES11-Paketes sollten keine Anpassungen erforderlich sein.

8 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 13: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

1 Szenario

1.3.3 libvirt

Verwaltung der virtuellen Maschinen mittels libvirt . Dies muss auf den Nodes geschehen,auf denen die Instanzen gestartet werden sollen (Compute -Nodes).

# zypper install libvirt[...]# rm /etc/libvirt/qemu/networks/default.xml

Weitere Informationen gibt es unter http://www.libvirt.org.

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 9

Page 14: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

2 OpenStack Compute - nova

2.1 Übersicht

2.2 Installation

Auf dem Cloud Controller, nachfolgend als API-Node bezeichnet, der auf ares laufensoll, werden Dienste betrieben die nur einmal benötigt werden. Diese sind nova-api sowienova-scheduler . Es empfiehlt sich für diese Dienste ein eigenständiges System zu verwen-den.

API-Node

• nova-api

• nova-scheduler

ares:~ # zypper install openstack-nova openstack-nova-api \openstack-nova-compute openstack-nova-network \openstack-nova-objectstore openstack-nova-scheduler \openstack-nova-volume

[...]

Die Dienste nova-compute und nova-volume sowie ggf. nova-network werden auf den Sys-temen benötigt, auf denen später die virtuellen Maschinen betrieben werden sollen unddie nachfolgend als Compute -Nodes bezeichnet werden. Die Verwaltung der virtuellenMaschine wird mittels der libvirt durchgeführt.

Compute -Node

• nova-compute

• nova-network

• nova-volume

brontes:~ # zypper install openstack-nova \openstack-nova-compute \openstack-nova-network openstack-nova-volume

[...]

10 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 15: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

2.3 Konfiguration

/etc/hosts

192.168.2.110 ares192.168.2.120 brontes192.168.2.130 chronos192.168.2.140 deimos

/etc/nova/nova.conf

--use_syslog--nodebug--state_path=/var/lib/nova--logdir=/var/log/nova

Zusätzlich zur oben genannten nova.conf existiert noch eine Datei, die die Beschrei-bung der API enthält. Seit Neuestem heisst die Date paste-api.conf, vorher lauteteder Name nova-api.conf.

/etc/nova/paste-api.conf

[DEFAULT]verbose = 1

######## EC2 ########

[composite:ec2]use = egg:Paste#urlmap/: ec2versions/services/Cloud: ec2cloud/services/Admin: ec2admin/latest: ec2metadata/2007-01-19: ec2metadata/2007-03-01: ec2metadata/2007-08-29: ec2metadata/2007-10-10: ec2metadata/2007-12-15: ec2metadata/2008-02-01: ec2metadata/2008-09-01: ec2metadata/2009-04-04: ec2metadata/1.0: ec2metadata

[pipeline:ec2cloud]pipeline = logrequest authenticate cloudrequest authorizer ec2executor#pipeline = logrequest ec2lockout authenticate cloudrequest authorizer ec2executor

[pipeline:ec2admin]pipeline = logrequest authenticate adminrequest authorizer ec2executor

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 11

Page 16: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

[pipeline:ec2metadata]pipeline = logrequest ec2md

[pipeline:ec2versions]pipeline = logrequest ec2ver

[filter:logrequest]paste.filter_factory = nova.api.ec2:RequestLogging.factory

[filter:ec2lockout]paste.filter_factory = nova.api.ec2:Lockout.factory

[filter:authenticate]paste.filter_factory = nova.api.ec2:Authenticate.factory

[filter:cloudrequest]controller = nova.api.ec2.cloud.CloudControllerpaste.filter_factory = nova.api.ec2:Requestify.factory

[filter:adminrequest]controller = nova.api.ec2.admin.AdminControllerpaste.filter_factory = nova.api.ec2:Requestify.factory

[filter:authorizer]paste.filter_factory = nova.api.ec2:Authorizer.factory

[app:ec2executor]paste.app_factory = nova.api.ec2:Executor.factory

[app:ec2ver]paste.app_factory = nova.api.ec2:Versions.factory

[app:ec2md]paste.app_factory = nova.api.ec2.metadatarequesthandler: \

MetadataRequestHandler.factory

############## Openstack ##############

[composite:osapi]use = egg:Paste#urlmap/: osversions/v1.0: openstackapi

[pipeline:openstackapi]pipeline = faultwrap auth ratelimit osapiapp

[filter:faultwrap]paste.filter_factory = nova.api.openstack:FaultWrapper.factory

[filter:auth]paste.filter_factory = nova.api.openstack.auth:AuthMiddleware.factory

12 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 17: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

[filter:ratelimit]paste.filter_factory = nova.api.openstack.ratelimiting: \

RateLimitingMiddleware.factory

[app:osapiapp]paste.app_factory = nova.api.openstack:APIRouter.factory

[pipeline:osversions]pipeline = faultwrap osversionapp

[app:osversionapp]paste.app_factory = nova.api.openstack:Versions.factory

2.3.1 Datenbank

Alle von SQL Alchemy unterstützten Datenbanken können verwendet werden.

Hinzufügen des Verbindungsparameters zu /etc/nova/nova.conf:

--sql_connection=mysql://root:testing@deimos/nova

Hinweis: SQL Alchemy

Witerführende Informationen zu SQL Alchemy finden sich unter http://www.sqlalchemy.org.

Von dem API-Node ares aus muss nun die Datenbank nova wie folgt initialisiert wer-den:

ares:~ # nova-manage db sync2011-02-10 10:32:34,176 INFO migrate.versioning.api [-] 0 -> 1...2011-02-10 10:32:34,874 INFO migrate.versioning.api [-] done2011-02-10 10:32:34,874 INFO migrate.versioning.api [-] 1 -> 2...2011-02-10 10:32:35,321 INFO migrate.versioning.api [-] done

Hinweis: Access denied

Bei der Fehlermeldung: CRITICAL nova.root [-] (OperationalError) (1045,Äccess denied for user ’root’@’192.168.2.110’ (using password: YES)")None None bitte die unter Dienste beschriebene Konfiguration von MySQL überprü-fen.

Anzeigen der angelegten Tabellen:

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 13

Page 18: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

deimos:~ # mysql -u root -pEnter password:[...]mysql> use nova;Database changedmysql> show tables;+-------------------------------------+| Tables_in_nova |+-------------------------------------+| auth_tokens || certificates |[...]

Die in der Datenbank hinterlegten Informationen lassen sich auch dazu verwenden eige-ne Auswertungsskripte zu schreiben.

2.3.2 AMQP

Hinzufügen des Messageing-Servers zur Konfiguration:

--rabbit_host=deimos

OpenStack verwendet das Python-Framework carrot zur Nutzung des AMQP Messa-ging. Unterstützt werden von diesem Framework nicht nur RabbitMQ , sondern auchZeroMQ und Apache ActiveMQ. Von OpenStack wird derzeitig ausschliesslich RabbitMQunterstützt, andere Systeme wurden bislang nicht getestet und werden nicht empfoh-len.

Hinweis: Parameterumbenennung

Die Flags in /etc/nova/nova.conf zur Konfiguration des Queingservers werden inden kommenden Releases vermutlich umbenannt werden. Weiterhin wird wahrschein-lich RabbitMQ vollständig durch ein anderes System ersetzt.

Warnung: Restart des RabbitMQ -Servers

Aktuell gibt es Probleme bei einem Neustart von RabbitMQ während Nova -Dienste dar-auf zugreifen. Teils können sich diese nicht wieder verbinden und müssen neu gestartetwerden.

2.3.3 Konfiguration der API

Die Parameter für die API:

--ec2_url=http://ares:8773/services/Cloud--cc_host=ares

14 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 19: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

2.3.4 Konfiguration des Objectstorages

Die Parameter für die API:

--s3_host=ares

2.3.5 Virtualisierungsart

Über den Parameter libvirt_type gibt man die gewünschte Virtualisierung an. Mög-liche Werte sind:

• kvm

• xen

• qemu

• uml

Paramater in der /etc/nova/nova.conf:

--libvirt_type=kvm

2.3.6 Netzwerkkonfiguration

Verschiedene Typen:

• Flat Mode

• Flat DHCP Mode

• VLan DHCP Mode

Parameter in /etc/nova/nova.conf:

--dhcpbridge_flagfile=/etc/nova/nova.conf--dhcpbridge=/usr/bin/nova-dhcpbridge--dhcp_domain=example.com--network_manager=nova.network.manager.FlatDHCPManager--flat_network_dhcp_start=192.168.3.2--flat_injected=False

Hinweis: Notwendigkeit der Einträge

Die Einträge für die Netzwerkkonfiguration sind nur auf den network-Nodes nötig.

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 15

Page 20: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

2.3.7 Starten der Dienste

/usr/local/bin/nova_init_api_node.sh

#!/bin/sh

/etc/init.d/openstack-nova-api $1/etc/init.d/openstack-nova-scheduler $1

Ausgabe

ares:~ # nova_init_api_node.sh startStarting OpenStack::Nova api server doneStarting OpenStack::Nova scheduler server done

/usr/local/bin/nova_init_network_node.sh

#!/bin/sh

/etc/init.d/openstack-nova-network $1

/usr/local/bin/nova_init_normal_node.sh

#!/bin/sh

/etc/init.d/openstack-nova-compute $1/etc/init.d/openstack-nova-volume $1

Hinweis: Relikte

Wenn der Dienst nova-network gestoppt wird, verbleiben aktuell die dynamisch erzeugtenNetzwerkbrücken. Dieser Fehler wird in einem späteren Release korrigiert.

2.3.8 Logfiles

Die Logfiles der einzelnen Dienste liegen unter /var/log/nova, für jeden Dienst gibt eseine eigene Datei:

• api.log

• compute.log

• network.log

• volume.log

• objectstore.log

• scheduler.log

16 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 21: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

Um festzustellen, ob die gerade gestarteten Dienst ordentlich durchlaufen, kann maneinen Blick in die entsprechenden Dateien werfen.

Hinweis: AMQP server

Bei dem Fehler ERROR nova.rpc [-] AMQP server on localhost:5672 is unreachable.Trying again in 10 seconds. in /var/log/messages die Konfiguration von Queingüberprüfen, es fehlt das Flag -rabbit_host in /etc/nova/nova.conf.

2.4 novamanage

nova-manage dient zur Verwaltung von Ressourcen in Nova . Darüber werden u.a. Pro-jekte, Benutzer, Netzwerke etc. angelegt, verändert oder entfernt.

2.4.1 Benutzer

ares:~ # nova-manage user admin berendt2011-02-10 12:41:27,677 AUDIT nova.auth.manager [-] Created user berendt \

(admin: True)export EC2_ACCESS_KEY=f0780055-ddb1-4216-9235-ad920f585603export EC2_SECRET_KEY=e50ace36-c617-4801-8cc7-0f7b890c6118

Hiermit erzeugen wir einen Benutzer, dabei wird der Eintrag in die Datenbank geschrie-ben und die benutzerspezifischen Access-Keys erzeugt.

2.4.2 Projekte

ares:~ # nova-manage project create testing berendt2011-02-10 12:41:42,998 AUDIT nova.auth.manager [-] Created project testing \

with manager berendt

Erstellung eines Projektes mit dem vorher erzeugten benutzer als Manager.

2.4.3 Netzwerke

ares:~ # nova-manage network create 192.168.3.0/24 1 256

Für die Verteilung per DHCP benötigt man einen Pool an Adressen, der den Instanzenzugewiesen werden kann. Hier wird ein vollständiges Class-C-Netz anglegt.

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 17

Page 22: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

2.4.4 SSH-Key

ares:~ # euca-add-keypair testing > testing.privares:~ # euca-describe-keypairsKEYPAIR testing d6:f5:d8:77:68:28:f9:9b:32:ed:f5:53:03:c6:b9:e0ares:~ # chmod 600 testing.priv

Mit Hilfe der euca2ools erzeugt man einen ssh-key. Dabei wird der Schlüssel in die Da-tenbank eingetragen und als Datei abgelegt. Auf diese Datei setzt man eingeschränkteLeserechte, sonst gibt der SSH-Zugriff später eine Fehlermeldung aus.

Warnung: euca2ools und Proxyserver

Bei Verwendung sämtlicher euca2ools darf keine Umgebungsvariable für einen Proxyser-ver gesetzt sein (export http_proxy)! Andernfalls brechen die Programme mit einemunbekannten Fehler ab. Zusätzlich darf beim Starten der einzelnen Nova -Dienste auchkein Proxyserver gesetzt sein!

2.4.5 Zertifikate exportieren

ares:~ # mkdir -p /root/credsares:~ # nova-manage project zipfile testing berendt /root/creds/novacreds.zip2011-02-10 12:43:06,419 WARNING nova.auth.manager [-] No vpn data for project \

testing

ares:~ # unzip /root/creds/novacreds.zip -d /root/creds/Archive: /root/creds/novacreds.zipextracting: /root/creds/novarcextracting: /root/creds/pk.pemextracting: /root/creds/cert.pemextracting: /root/creds/cacert.pem

ares:~ # source /root/creds/novarc

Zur Nutzung der euca2ools braucht man die entsprechenden Umgebungsvariablen. Diesewerden per oben gezeigtem Export in die Datei novarc geschrieben und könne dannproblemlos genutzt werden.

2.4.6 Security Groups

Zur späteren Erreichbarkeit der Instanzen schaltet man ICMP und ssh-Zugriff frei. Dazumüssen die passenden Einträge erzeugt werden.

ares:~ # euca-authorize -P tcp -p 22 defaultGROUP defaultPERMISSION default ALLOWS tcp 22 22

18 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 23: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

ares:~ # euca-authorize -P icmp -t -1:-1 defaultGROUP defaultPERMISSION default ALLOWS icmp -1 -1

ares:~ # euca-describe-groupsGROUP ttylinux-uec default defaultPERMISSION ttylinux-uec default ALLOWS icmp -1 -1 FROM CIDR \

0.0.0.0/0PERMISSION ttylinux-uec default ALLOWS tcp 22 22 FROM CIDR \

0.0.0.0/0

2.4.7 service list

Hiermit erhält man eine Übersicht der aktuellen Dienste, die an der API registriert sind.Die Zeitverzögerung liegt bei 10 Sekunden und man kann Dienste über nova-manage de-aktiveren oder aktivieren.

ares:~ # nova-manage service listares nova-scheduler enabled :-) 2011-02-12 17:35:37ares nova-network enabled :-) 2011-02-12 17:35:38ares nova-compute enabled :-) 2011-02-12 17:35:42ares nova-volume enabled :-) 2011-02-12 17:35:42brontes nova-compute enabled :-) 2011-02-12 17:35:38

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 19

Page 24: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

2.5 Volumes

Der Volume-Manager sorgt für die Zuteilung von persisten Volumes in den Instanzen.

ares:~ # pvcreate /dev/sda3No physical volume label read from /dev/sda3Physical volume "/dev/sda3" successfully created

ares:~ # vgcreate nova-volumes /dev/sda3Volume group "nova-volumes" successfully created

Der Standard-VolumeManager verwendet eine Volumegruppe mit den Namen nova-volumes,diese muss per lvm bereitgestellt werden und vor dem Start von nova-volume auf jedennormalen Node eingerichtet werden.

2.6 Objectstorage

Der Object Storage ist für die Ablage von Images notwendig, aus denen später die virtuel-len Systeme erstellt werden.

Konfigurationserweiterung /etc/nova/nova.conf:

--s3_host=ares

Hinweis: iptables

Automatisch erstelle iptables-Regeln blocken den TCP-Port 3333, der für den Dienst nova-objectstore benötigt wird. Daher muss man diesen nach dem Start manuell mitiptables -I INPUT -p tcp -dport 3333 -j ACCEPTfreigeben.

Für erste Tests ist es ausreichend den in Nova vorhandenen Dienst nova-objectstore zu ver-wenden. Dieser legt Images lokal unter /var/lib/nova/images ab und ist über einS3-API ansprechbar. In der Produktion sollte er später durch Glance und Swift , welchenachfolgend vorgestellt werden, ersetzt werden.

2.6.1 Starten des Objectstores

/usr/local/bin/nova_init_storage_node.sh

#!/bin/sh

/etc/init.d/openstack-nova-objectstorage $1iptables -I INPUT -p tcp --dport 3333 -j ACCEPT

20 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 25: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

Hinweis

Der nova-objectstore ist lediglich für Test- und Entwicklungszwecke gedacht. Später sollteSwift mit Glance verwendet werden.

2.6.2 Mit Images bestücken

ares:~ # uec-publish-tarball \ttylinux-uec-amd64-12.1_2.6.35-22_1.tar.gz ttylinux-uec

Thu Feb 10 18:47:20 CET 2011: ====== extracting image ======kernel : ttylinux-uec-amd64-12.1_2.6.35-22_1-vmlinuzramdisk: ttylinux-uec-amd64-12.1_2.6.35-22_1-initrdimage : ttylinux-uec-amd64-12.1_2.6.35-22_1.imgThu Feb 10 18:47:20 CET 2011: ====== bundle/upload kernel ======Thu Feb 10 18:47:22 CET 2011: ====== bundle/upload ramdisk ======Thu Feb 10 18:47:23 CET 2011: ====== bundle/upload image ======Thu Feb 10 18:47:23 CET 2011: ====== done ======emi="ami-qqu0aarf"; eri="ami-x3rgltwg"; eki="ami-04404gn9";

Anschliessend kann mit dem Skript uec-publish-tarball, welches im Paket cloud-utilsenthalten ist, der Upload eines Maschienenimages, welches sich aus Kernel, Ramdisksowie Festplattenimage zusammensetzt, getestet werden. Den tar-Ball kann man vonhttp://smoser.brickies.net/ubuntu/ttylinux-uec/ beziehen.

Hinweis: cloud-utils

Die diversen UEC Tols, wie uec-public-tarball sind im Paket cloud-utils ent-halten.

Warnung: Test- und Entwicklungszwecke

Im Skript uec-publish-tarball muss derzeit die Zeile 37 auskommentiert werden,da die Imagedateien sonst nicht hochgeladen werden.

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 21

Page 26: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

2.6.3 Verfügbare Images anzeigen

ares:~ # euca-describe-imagesIMAGE ami-ngp5c4kb testing/ttylinux-uec-amd64-12.1_2.6.35-22_1 \

-initrd.manifest.xml ttylinux-uec available private x86_64 \ramdisk true

IMAGE ami-2c2gq83x testing/ttylinux-uec-amd64-12.1_2.6.35-22_1 \-vmlinuz.manifest.xml ttylinux-uec available private x86_64 \kernel true

IMAGE ami-gn0xp5ez testing/ttylinux-uec-amd64-12.1_2.6.35-22_1.img. \manifest.xml ttylinux-uec available private x86_64 \machine ami-ngp5c4kb ami-2c2gq83x

Nun lassen sich mit dem Programm euca-describe-images, welches im Paket eu-ca2ools enthalten ist, alle auf dem konfigurierten Object Storage hinterlegten Imagesanzeigen.

2.6.4 Images manuell hinzufügen

Entpacken des Archives

ares:~ # tar xvzf euca-debian-5.0-x86_64.tar.gzeuca-debian-5.0-x86_64/euca-debian-5.0-x86_64/xen-kernel/euca-debian-5.0-x86_64/xen-kernel/vmlinuz-2.6.27.21-0.1-xeneuca-debian-5.0-x86_64/xen-kernel/initrd-2.6.27.21-0.1-xeneuca-debian-5.0-x86_64/kvm-kernel/euca-debian-5.0-x86_64/kvm-kernel/vmlinuz-2.6.28-11-genericeuca-debian-5.0-x86_64/kvm-kernel/initrd.img-2.6.28-11-genericeuca-debian-5.0-x86_64/debian.5-0.x86-64.img

Alternativ kann man die Images für die virtuellen Maschinen auch in Einzelschritten,direkt über die euca2ools hinzufügen. Für das folgende Beispiel wurde das 64-Bit-Imageeines Debian 5.0 vonhttp://open.eucalyptus.com/wiki/EucalyptusUserImageCreatorGuide_v2.0genommen.

Der Kernel

ares:~/euca-debian-5.0-x86_64 # euca-bundle-image -i kvm-kernel/vmlinuz-2.6.28 \-11-generic --kernel true

Checking imageTarring imageEncrypting imageSplitting image...Part: vmlinuz-2.6.28-11-generic.part.0Generating manifest /tmp/vmlinuz-2.6.28-11-generic.manifest.xmlares:~/euca-debian-5.0-x86_64 # euca-upload-bundle -b debian_kernel -m \

/tmp/vmlinuz-2.6.28-11-generic.manifest.xml

22 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 27: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

Checking bucket: debian_kernelCreating bucket: debian_kernelUploading manifest fileUploading part: vmlinuz-2.6.28-11-generic.part.0Uploaded image as debian_kernel/vmlinuz-2.6.28-11-generic.manifest.xml

ares:~/euca-debian-5.0-x86_64 # euca-register debian_kernel/vmlinuz-2.6.28 \-11-generic.manifest.xml

IMAGE ami-01z285yb

Die Ramdisk

ares:~/euca-debian-5.0-x86_64 # euca-bundle-image -i \kvm-kernel/initrd.img-2.6.28-11-generic --ramdisk true

Checking imageTarring imageEncrypting imageSplitting image...Part: initrd.img-2.6.28-11-generic.part.0Generating manifest /tmp/initrd.img-2.6.28-11-generic.manifest.xml

ares:~/euca-debian-5.0-x86_64 # euca-upload-bundle -b debian_ramdisk \-m /tmp/initrd.img-2.6.28-11-generic.manifest.xml

Checking bucket: debian_ramdiskCreating bucket: debian_ramdiskUploading manifest fileUploading part: initrd.img-2.6.28-11-generic.part.0Uploaded image as debian_ramdisk/initrd.img-2.6.28-11-generic.manifest.xml

ares:~/euca-debian-5.0-x86_64 # euca-register \debian_ramdisk/initrd.img-2.6.28-11-generic.manifest.xml

IMAGE ami-8gyn4ygj

ares:~/euca-debian-5.0-x86_64 # euca-bundle-image -i debian.5-0.x86-64.img \--kernel ami-01z285yb --ramdisk ami-8gyn4ygj

Checking imageTarring imageEncrypting imageSplitting image...Part: debian.5-0.x86-64.img.part.0[...]Part: debian.5-0.x86-64.img.part.19Generating manifest /tmp/debian.5-0.x86-64.img.manifest.xml

ares:~/euca-debian-5.0-x86_64 # euca-upload-bundle -b debian_image \-m /tmp/debian.5-0.x86-64.img.manifest.xml

Checking bucket: debian_imageCreating bucket: debian_imageUploading manifest fileUploading part: debian.5-0.x86-64.img.part.0[...]

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 23

Page 28: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

Uploading part: debian.5-0.x86-64.img.part.19Uploaded image as debian_image/debian.5-0.x86-64.img.manifest.xml

ares:~/euca-debian-5.0-x86_64 # euca-register \debian_image/debian.5-0.x86-64.img.manifest.xml

IMAGE ami-2a1izx00

2.7 glance

2.7.1 Übersicht

Glance ist ein Dienst, der für das Entdecken, Registrieren und Empfangen von Imageda-teien zuständig ist. Über die API ist es möglich, sowohl die Daten zu empfangen als auchMetadaten abzufragen.Images die durch Glance verfügbar gemacht werden können an zahlreichen Stellen ge-speichert werden, vom einfachen Dateisystem bis zu Object Stores wie z.B. Swift .

Hinweis

Im produktiven Betrieb sollte Glance die Images verwalten.

Die Projektseite von Glance findet sich unter http://glance.openstack.org.

2.7.2 Vorbereitung

Zuerst muss eine Testpartition oder ein Logical Volume vorbereitet werden und unter/srv/glance gemountet werden.

chronos:~ # mkdir /srv/glancechronos:~ # mkfs.xfs /dev/openstack/glancemeta-data=/dev/openstack/glance isize=256 agcount=4, agsize=1966080 blks

= sectsz=512 attr=2data = bsize=4096 blocks=7864320, imaxpct=25

= sunit=0 swidth=0 blksnaming =version 2 bsize=4096 ascii-ci=0log =internal log bsize=4096 blocks=3840, version=2

24 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 29: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

= sectsz=512 sunit=0 blks, lazy-count=1realtime =none extsz=4096 blocks=0, rtextents=0chronos:~ # echo "/dev/openstack/glance /srv/glance \

xfs noatime,nodiratime,nobarrier,logbufs=8 0 0" >> /etc/fstabchronos:~ # mount /srv/glancechronos:~ # mount[...]/dev/openstack/glance on /srv/glance type xfs (rw,noatime, \

nodiratime,nobarrier,logbufs=8)

2.7.3 Installation

Als einziges Paket muss man Folgendes installieren:

chronos:~ # zypper install openstack-glance

2.7.4 Konfiguration

Die Konfiguration von Glance findet in /etc/sysconfig/openstack-glance statt:

GLANCE_API_CONFIG="--sql_connection=mysql://root:testing@deimos/glance"GLANCE_REGISTRY_CONFIG="--filesystem_store_datadir=/srv/images --default_store=file"

Wie schon bei Nova selbst, erzeugen wir eine MySQL -Datenbank:

deimos:~ # mysql -u root -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 25Server version: 5.0.67 SUSE MySQL RPM

Type ’help;’ or ’\h’ for help. Type ’\c’ to clear the buffer.

mysql> create database glance;Query OK, 1 row affected (0.00 sec)

2.7.5 Start

Nun kann man die beiden notwendigen Dienste glance-api und glance-registrystarten:

chronos:~ # /etc/init.d/openstack-glance start

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 25

Page 30: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

2.7.6 glanceupload

Zum Testen des Uploads nimmt man erneut das Image von http://smoser.brickies.net/ubuntu/ttylinux-uec:

chronos:~ # tar xvzf ttylinux-uec-amd64-12.1_2.6.35-22_1.tar.gzttylinux-uec-amd64-12.1_2.6.35-22_1-floppyttylinux-uec-amd64-12.1_2.6.35-22_1.imgttylinux-uec-amd64-12.1_2.6.35-22_1-initrdttylinux-uec-amd64-12.1_2.6.35-22_1-loaderttylinux-uec-amd64-12.1_2.6.35-22_1-vmlinuz

chronos:~ # glance-upload --type kernel ttylinux-uec-amd64-12.1_2.6.35-22_1-vmlinuz \ttylinux-uec

Stored image. Got identifier: {u’created_at’: u’2011-02-10T17:04:03’,u’deleted’: False,u’deleted_at’: None,u’id’: 3,u’is_public’: True,u’location’: u’file:///srv/images/3’,u’name’: u’ttylinux-uec’,u’properties’: {},u’size’: 4404752,u’status’: u’active’,u’type’: u’kernel’,u’updated_at’: None}

chronos:~ # glance-upload --type ramdisk ttylinux-uec-amd64-12.1_2.6.35-22_1-initrd \ttylinux-uec

Stored image. Got identifier: {u’created_at’: u’2011-02-10T17:05:18’,u’deleted’: False,u’deleted_at’: None,u’id’: 4,u’is_public’: True,u’location’: u’file:///srv/images/4’,u’name’: u’ttylinux-uec’,u’properties’: {},u’size’: 5882349,u’status’: u’active’,u’type’: u’ramdisk’,u’updated_at’: None}

chronos:~ # glance-upload --type machine --ramdisk 4 --kernel 3 \ttylinux-uec-amd64-12.1_2.6.35-22_1.img ttylinux-uec

Stored image. Got identifier: {u’created_at’: u’2011-02-10T17:06:14’,u’deleted’: False,u’deleted_at’: None,u’id’: 5,u’is_public’: True,u’location’: u’file:///srv/images/5’,u’name’: u’ttylinux-uec’,u’properties’: {u’kernel_id’: u’3’, u’ramdisk_id’: u’4’},

26 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 31: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

u’size’: 25165824,u’status’: u’active’,u’type’: u’machine’,u’updated_at’: None}

2.7.7 Datenbank

In der Datenbank glance sollten nun neue Tabellen erstellt worden sein:

mysql> show tables;+------------------+| Tables_in_glance |+------------------+| image_properties || images |+------------------+2 rows in set (0.00 sec)

2.7.8 Anbindung an nova

Damit Nova die Images von Glance bezieht, müssen nachfolgende Flags auf den normalennova-Nodes gesetzt werden. Bei glance_port den Port des API-Servers, per Default9292, verwenden. Der Dienst nova-objectstore wird nicht mehr benötigt und kann gestopptwerden.

Ergänzungen zu /etc/nova/nova.conf:

--glance_host=chronos--glance_port=9292--image_service=nova.image.glance.GlanceImageService

2.8 Instanzen spawnen

Das folgende Beispiel nutzt die euca2ools zum Starten von Instanzen. Im ersten Schrittwirft man einen Blick auf die verfügbaren Images:

chronos:~ # euca-describe-imagesIMAGE ami-j7xy0bqw debian_image/debian.5-0.x86-64.img.manifest.xml \

testing available private x86_64 machine ami-75ults2v ami-gsfgpnv0IMAGE ami-75ults2v debian_ramdisk/initrd.img-2.6.28-11-generic.manifest.xml \

testing available private x86_64 ramdisk trueIMAGE ami-gsfgpnv0 debian_kernel/vmlinuz-2.6.28-11-generic.manifest.xml \

testing available private x86_64 kernel true

Nun startet man 4 Instanzen vom Typ m1.tiny mit dem oben ersichtlichen Machine-Image:

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 27

Page 32: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

chronos:~ # euca-run-instances ami-j7xy0bqw -t m1.tiny -n 4RESERVATION r-okdc1w0u testing defaultINSTANCE i-00000e8f ami-j7xy0bqw networking \

None (testing, ares) 2011-03-17T09:16:13Z None NoneINSTANCE i-00000e90 ami-j7xy0bqw scheduling \

None (testing, brontes) 2011-03-17T09:16:13Z None NoneINSTANCE i-00000e91 ami-j7xy0bqw scheduling \

None (testing, None) 2011-03-17T09:16:13Z None NoneINSTANCE i-00000e92 ami-j7xy0bqw scheduling \

None (testing, None) 2011-03-17T09:16:13Z None None

Zur Kontrolle sieht man sich ein paar Sekunden später den Status der Instanzen an:

chronos:~ # euca-describe-instancesRESERVATION r-okdc1w0u testing defaultINSTANCE i-00000e8f ami-j7xy0bqw 192.168.3.29 192.168.3.29 \

launching None (testing, ares) 0 m1.tiny \2011-03-17T09:16:13Z nova

INSTANCE i-00000e90 ami-j7xy0bqw 192.168.3.30 192.168.3.30 \running None (testing, brontes) 1 m1.tiny \2011-03-17T09:16:13Z nova

INSTANCE i-00000e91 ami-j7xy0bqw 192.168.3.32 192.168.3.32 \launching None (testing, ares) 2 m1.tiny \2011-03-17T09:16:13Z nova

INSTANCE i-00000e92 ami-j7xy0bqw 192.168.3.31 192.168.3.31 \launching None (testing, ares) 3 m1.tiny \2011-03-17T09:16:13Z nova

RESERVATION r-mne5so6o testing defaultINSTANCE i-00000e8e ami-j7xy0bqw 192.168.3.25 192.168.3.25 \

running testing (testing, brontes) 0 m1.tiny \2011-03-16T15:16:01Z nova

2.9 Distributed storage

Im Standard werden die Volumes für die einzelnen virtuellen Maschinen in einer loka-len LVM2 Volumegroup mit dem Namen nova-volumes abgelegt. Für den produktivenEinsatz ist diese Methode nicht geeignet.

2.9.1 Sheepdog

Bei Sheepdog handelt es sich um ein verteiltes Speichersystem für KVM. Es werden hoch-verfügbare blockorientiere Volumes zur Verfügung gestellt, die dann in KVM-basiertenvirtuellen Maschinen genutzt werden können. Dabei skaliert Sheepdog auf mehrere hun-dert Knoten und bietet Unterstützung für erweitertes Volume-Management wie z.B. Snaps-hots und Cloning.

Die Kommunikation erfolgt über Corosync , welches z.B. auch von dem Cluster ResourceManager Pacemaker verwendet wird.

Pakete sind in unserem Repository bereits vorhanden, die Installation erfolgt mit:

28 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 33: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

zypper install sheepdog corosync

Die Projektseite findet sich unter http://www.osrg.net/sheepdog/.

Warnung: Xen

Sheepdog ist nur für die Verwendung mit KVM geeignet! Bei Verwendung von Xen mussiSCSI verwendet werden.

Warnung: Sheepdog ist in Entwicklung

Bei der Verwendung von Sheepdog sollte darauf geachtet werden, dass sich die Softwarederzeitig noch in der Entwicklung befindet und kein Stable-Release vorhanden ist. Füreine stabilere Umgebung sollte die später vorgestellte iSCSI -Lösung derzeitig noch be-vorzugt werden.

# zypper ar http://download.opensuse.org/repositories/isv:/B1-Systems:\/sheepdog/SLE_11_SP1/isv:B1-Systems:sheepdog.repo

[...]# zypper ref[...]# zypper install corosync sheepdog[...]# zypper install kvm-0.14.0.rc1 virt-utils-1.1.4Loading repository data...Reading installed packages...Resolving package dependencies...2 Problems:Problem: cannot install both kvm-0.14.0.rc1-1.1.x86_64 and \

kvm-0.12.5-1.4.1.x86_64Problem: cannot install both virt-utils-1.1.4-1.1.x86_64 and \

virt-utils-1.1.2-0.2.17.x86_64

Problem: cannot install both kvm-0.14.0.rc1-1.1.x86_64 and \kvm-0.12.5-1.4.1.x86_64

Solution 1: install kvm-0.14.0.rc1-1.1.x86_64 (with vendor change)SUSE LINUX Products GmbH, Nuernberg, Germany --> openSUSE Build Service

Solution 2: do not ask to install a solvable providing kvm = 0.14.0.rc1

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 29

Page 34: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

Choose from above solutions by number or skip, retry or cancel [1/2/s/r/c] (c): 1

Problem: cannot install both virt-utils-1.1.4-1.1.x86_64 and \virt-utils-1.1.2-0.2.17.x86_64

Solution 1: install virt-utils-1.1.4-1.1.x86_64 (with vendor change)SUSE LINUX Products GmbH, Nuernberg, Germany --> openSUSE Build Service

Solution 2: do not ask to install a solvable providing virt-utils = 1.1.4

Choose from above solutions by number or skip, retry or cancel [1/2/s/r/c] (c): 1Resolving dependencies...Resolving package dependencies...

The following packages are going to be upgraded:kvm virt-utils

The following packages are going to change vendor:kvm SUSE LINUX Products GmbH, Nuernberg, Germany -> \

openSUSE Build Servicevirt-utils SUSE LINUX Products GmbH, Nuernberg, Germany -> \

openSUSE Build Service

The following packages are not supported by their vendor:kvm virt-utils

2 packages to upgrade, 2 to change vendor.Overall download size: 4.7 MiB. After the operation, additional 793.0 KiB \

will be used.Continue? [y/n/?] (y): yRetrieving package virt-utils-1.1.4-1.1.x86_64 (1/2), 140.0 KiB (544.0 KiB \

unpacked)Retrieving: virt-utils-1.1.4-1.1.x86_64.rpm [done (41.7 KiB/s)]Installing: virt-utils-1.1.4-1.1 [done]Retrieving package kvm-0.14.0.rc1-1.1.x86_64 (2/2), 4.5 MiB (9.1 MiB unpacked)Retrieving: kvm-0.14.0.rc1-1.1.x86_64.rpm [done (67.8 KiB/s)]Installing: kvm-0.14.0.rc1-1.1 [done]

Erzeugen eines Logical Volumes namens Sheepdog in der Volume Group nova:

ares:/etc/corosync # lvcreate -L 50G -n sheepdog novaLogical volume "sheepdog" created

ares:/etc/corosync # mkfs.ext3 /dev/nova/sheepdogmke2fs 1.41.9 (22-Aug-2009)Filesystem label=OS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)3276800 inodes, 13107200 blocks655360 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=4294967296400 block groups

30 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 35: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

32768 blocks per group, 32768 fragments per group8192 inodes per groupSuperblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, \4096000, 7962624, 11239424

Writing inode tables: doneCreating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 22 mounts or180 days, whichever comes first. Use tune2fs -c or -i to override.

ares:/etc/corosync # echo "/dev/nova/sheepdog /srv/sheepdog \ext3 defaults 1 2" >> /etc/fstab

ares:/etc/corosync # mount /srv/sheepdog/

Die Konfigurationsdatei /etc/corosync/corosync.conf

compatibility: whitetanktotem {version: 2secauth: offthreads: 0# Note, fail_recv_const is only needed if you’re# having problems with corosync crashing under# heavy sheepdog traffic. This crash is due to# delayed/resent/misordered multicast packets.# fail_recv_const: 5000interface {ringnumber: 0bindnetaddr: 192.168.2.110mcastaddr: 226.94.1.1mcastport: 5405}}logging {fileline: offto_stderr: noto_logfile: yesto_syslog: yeslogfile: /var/log/cluster/corosync.logdebug: offtimestamp: onlogger_subsys {subsys: AMFdebug: off

}}amf {mode: disabled}

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 31

Page 36: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

Starten von Corosync

corosync

Logdatei unter /var/log/cluster/corosync.log

Feb 22 14:13:37 ares corosync[23846]: [MAIN ] Corosync Cluster Engine (’1.2.7’): \started and ready to provide service.

Feb 22 14:13:37 ares corosync[23846]: [MAIN ] Corosync built-in features: nss rdmaFeb 22 14:13:37 ares corosync[23846]: [MAIN ] Successfully read main \

configuration file ’/etc/corosync/corosync.conf’.Feb 22 14:13:37 ares corosync[23846]: [TOTEM ] Initializing transport (UDP/IP).Feb 22 14:13:37 ares corosync[23846]: [TOTEM ] Initializing transmit/receive \

security: libtomcrypt SOBER128/SHA1HMAC (mode 0).Feb 22 14:13:37 ares corosync[23846]: [TOTEM ] The network interface \

[192.168.2.110] is now up.Feb 22 14:13:37 ares corosync[23846]: [SERV ] Service engine loaded: \

corosync extended virtual synchrony serviceFeb 22 14:13:37 ares corosync[23846]: [SERV ] Service engine loaded: \

corosync configuration serviceFeb 22 14:13:37 ares corosync[23846]: [SERV ] Service engine loaded: \

corosync cluster closed process group service v1.01Feb 22 14:13:37 ares corosync[23846]: [SERV ] Service engine loaded: \

corosync cluster config database access v1.01Feb 22 14:13:37 ares corosync[23846]: [SERV ] Service engine loaded: \

corosync profile loading serviceFeb 22 14:13:37 ares corosync[23846]: [SERV ] Service engine loaded: \

corosync cluster quorum service v0.1Feb 22 14:13:37 ares corosync[23846]: [MAIN ] Compatibility mode set to \

whitetank. Using V1 and V2 of the synchronization engine.Feb 22 14:13:37 ares corosync[23846]: [TOTEM ] A processor joined or left \

the membership and a new membership was formed.Feb 22 14:13:37 ares corosync[23846]: [MAIN ] Completed service synchronization, \

ready to provide service.Feb 22 14:13:37 ares corosync[23846]: [TOTEM ] A processor joined or left \

the membership and a new membership was formed.Feb 22 14:13:37 ares corosync[23846]: [MAIN ] Completed service synchronization, \

ready to provide service.

Starten von Sheepdog , hier verbleibt das Programm im Vordergrund:

sheep -p 7000 -f -d /srv/sheepdog

Alternativ wird Sheepdog auf normalen Weg gestartet und verschwindet im Hintergrund:

/etc/init.d/sheepdog start

Anzeigen der verfügbaren Nodes:

32 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 37: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

ares:~ # collie node listIdx Node id (FNV-1a) - Host:Port0 025127a20b5c99ea - 192.168.2.120:70001 7118e8930a237f0c - 192.168.2.110:7000

Informationen:

ares:~ # collie cluster infoWaiting for a format operation

Ctime Epoch Nodes

Der Parameter –copies gibt an, auf wie vielen Knoten ein Volume repliziert werden soll.Es empfiehlt sich hier einen Wert von mindestens 3 zu verwenden. Dazu braucht manentsprechend mind. drei Knoten auf denen Sheepdog verwendet wird.

ares:~ # collie cluster format --copies=2

ares:~ # collie cluster inforunning

Ctime Epoch Nodes1970-01-01 01:00:00 1 [192.168.2.120:7000, 192.168.2.110:7000]

Erzeugen eines Images:

ares:~ # qemu-img create sheepdog:testing1 5GFormatting ’sheepdog:testing1’, fmt=raw size=5368709120

Anzeigen der verfügbaren Images:

# collie vdi listname id size used shared creation time vdi id

------------------------------------------------------------------testing1 1 5.0 GB 0.0 MB 0.0 MB 2011-02-05 17:11 99c57e

Anzeige der Verteilung:

# collie vdi object testing1Looking for the inode object 0x99c57e with 4 nodes

172.19.134.24:7000: doesn’t have172.19.134.26:7000: has the object (should be 2 copies)172.19.134.25:7000: has the object (should be 2 copies)172.19.134.27:7000: doesn’t have

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 33

Page 38: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

Hinzufügen der Volume-Einstellungen zu /etc/nova/nova.conf:

--volume_driver=nova.volume.driver.SheepdogDriver

Erzeugen persister Volumes mit den euca2ools :

# euca-create-volume -s 5 -z novaVOLUME vol-00000005 5 creating (berendt, None, None, None) \

2011-02-05 18:48:03.678032

# euca-describe-volumesVOLUME vol-00000005 5 nova available (berendt, mandarin, \

None, None) 2011-02-05 18:48:03

# collie vdi listname id size used shared creation time vdi id

------------------------------------------------------------------volume-00000005 1 5.0 GB 0.0 MB 0.0 MB 2011-02-05 19:48 a20145

2.9.2 ISCSI

Als Alternative zu Sheepdog bietet sich momentan iSCSI an, dort kann man dann die per-sisten Volumes ablegen.

deimos:~ # zypper install iscsitarget

deimos:~ # pvcreate /dev/sda4No physical volume label read from /dev/sda4Physical volume "/dev/sda4" successfully created

deimos:~ # vgcreate iscsi /dev/sda4Volume group "iscsi" successfully created

ares:~ # zypper install open-iscsi

2.10 GUI

Derzeitig gibt es zwei sich in der Entwicklung befindliche Webinterfaces, die nachfolgendvorgestellt werden.

34 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 39: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

2.10.1 Dashboard

Das Dashboard ist eine Referenzimplementierung für ein django-nova Projekt.

Hinweis: Projektseite

Die Projektseite findet sich unter http://wiki.openstack.org/OpenStackDashboard.

Der Inhalt der Variablen NOVA_ACCESS_KEY sowie NOVA_SECRET_KEY kann der Da-tei novarc entnommen werden, die zuvor mit nova-manage user zipfile erstelltwurde.

NOVA_ACCESS_KEY == EC2_ACCESS_KEYNOVA_SECRET_KEY == EC2_SECRET_KEY

Wichtig:

Im Dashboard als Superuser den gleichen Benutzer verwenden wie auch in Nova (NO-VA_ADMIN_USER). Ansonsten ist das Webinterface nicht benutzbar.

You just installed Django’s auth system, which means you don’t have any superusers defined.Would you like to create one now? (yes/no): yesUsername (Leave blank to use ’root’): adminE-mail address: [email protected]:Password (again):

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 35

Page 40: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

2.10.2 OpenStackManager

Der OpenStackManager funktioniert lediglich als Erweiterung für das MediaWiki. Umihn betreiben zu können müssen weitere Konfigurationen vorgenommen werden, u.a.muss die Authentifizierung in einen LDAP-Baum verschoben werden.

Hinweis

Die Projektseite findet sich unter http://www.mediawiki.org/wiki/Extension:OpenStackManager.

2.10.3 ajaxterm

ajaxterm ist ein webbasiertes Terminal, inspiriert von anyterm. Allerdings ist ajaxtermin Python geschrieben. Es lässt sich recht einfach integrieren.

Hinweis

Zusätzliche Informationen sind hier zu finden: http://antony.lesuisse.org/software/ajaxterm.

36 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.

Page 41: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

2.10.4 PHP - einfache Datenbankauswertung

Im Folgenden ein kurzes php-Skript, welches die Daten von deimos abruft und als Web-seite darstellt. Dabei werden die Daten direkt aus der MySQL -Datebank abgefragt.

<html><body><?php

$location = ’mysql:dbname=nova;host=deimos’;$user = ’root’;$password = ’testing’;

try{

$db = new PDO($location, $user, $password);}

catch (PDOException $e){

echo ’Datenbank-Fehler: ’ . $e->getMessage();}

© B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems. 37

Page 42: Infrastructure as a Service mit der Cloud Computing Lösung ... · openstack-nova-doc Nova Dokumentation openstack-nova-network Nova Netzwerkverwaltung openstack-nova-objectstore

2 OpenStack Compute - nova

?>

<h1>Instances</h1><table><tr><th>hostname</th><th>hosted by</th><th>state</th></tr><?php$result = $db->query("SELECT * FROM instances WHERE state=1;");

foreach($result as $row){

echo "<tr>";echo "<td>".$row[’hostname’]."</td>";echo "<td>".$row[’host’]."</td>";echo "<td>".$row[’state_description’]."</td>";echo "</tr>\n";

}

?></table>

<h1>Servies</h1><table><tr><th>host</th><th>binary</th><th>service</th></tr><?php$result = $db->query("SELECT * FROM services WHERE deleted=0 AND disabled=0;");

foreach($result as $row){

echo "<tr>";echo "<td>".$row[’host’]."</td>";echo "<td>".$row[’binary’]."</td>";echo "<td>".$row[’topic’]."</td>";echo "</tr>\n";

}

?></table></body></html>

38 © B1 Systems GmbH 2006 – 2011; Course materials may not be reproduced in whole or in part without the written permission of B1 Systems.