Interoperable OpenStack guest provisioning with Cloudbase-Init

21
Interoperable OpenStack guest provisioning Alessandro Pilotti CEO @cloudbaseit

description

 

Transcript of Interoperable OpenStack guest provisioning with Cloudbase-Init

Page 1: Interoperable OpenStack guest provisioning with Cloudbase-Init

Interoperable OpenStack guest provisioning

Alessandro PilottiCEO

@cloudbaseit

Page 2: Interoperable OpenStack guest provisioning with Cloudbase-Init

OpenStackAn open source IaaS project– Apache 2 license

Managed by the OpenStack Foundation– More than 150 companies joined it

including:– AMD, Intel, Canonical, SUSE Linux, Red

Hat, Cisco, Dell, HP, IBM, NEC, Vmware

Portable– Mostly used on Linux

Written in Python

Page 3: Interoperable OpenStack guest provisioning with Cloudbase-Init

ReleasesVery aggressive schedule

– Twice a year

• Essex– Apr 2012– Hyper-V removed

• Folsom– October 2012– Cloudbase Solutions involvement - Hyper-V re-included

• Grizzly– Apr 2013

• Havana– October 2013

• Icehouse– Apr 2014

Page 4: Interoperable OpenStack guest provisioning with Cloudbase-Init

OpenStack Architecture• Distributed Components

– Can be deployed on a single server or multiple servers

• Public RESTful API– Bindings available for various languages (including .Net)

• Queues (AMQP) for private APIs– Great scalability

• Relational DBs for storing the configuration– MySQL, PostgreSQL, SQLite (and SQL server)

• UI– CLI tools– Web dashboard

Page 5: Interoperable OpenStack guest provisioning with Cloudbase-Init

ComponentsCompute (Nova)Object Storage (Swift)Block Storage (Cinder)Image Service (Glance)Networking (Neutron)Dashboard (Horizon)Identity (Keystone)Metering (Ceilometer)Orchestration (Heat)

Page 6: Interoperable OpenStack guest provisioning with Cloudbase-Init

Architecture 1

Page 7: Interoperable OpenStack guest provisioning with Cloudbase-Init

Architecture 2

Page 8: Interoperable OpenStack guest provisioning with Cloudbase-Init

Component interaction• AMQP– RabbitMQ– Apache Qpid

• API– RESTful services

• Database– Any Python SQLAlchemy provider– Mostly MySQL– SQL Server required various bug fixes

Page 9: Interoperable OpenStack guest provisioning with Cloudbase-Init

And now the guests• Nova’s IaaS role ends in the moment

in which the VM boots.• What happens afterwards, is

something that the guest OS has to sort out.

• Clouds need to support a variety of guest operating systems:– Linux (Ubuntu, RHEL / CentOS and lots

more)– Windows Server (and workstation for VDI)– FreeBSD– etc

Page 10: Interoperable OpenStack guest provisioning with Cloudbase-Init

Guest init actions• Setting the host name• Manage users / groups• Configure network• Deploy ssh keys for public key auth– Passwords are BAD!

• Extend partitions automatically• Run custom scripts• (and more)

Page 11: Interoperable OpenStack guest provisioning with Cloudbase-Init

Config data? • Passing configuration data to the

guest is tricky– Remember: no networking yet!

• The “classic” EC2 approach– A url on a magic IP http://169.254.169.254– Various HTTP metadata format exists

• e.g. EC2, OpenStack (Nova)

• An ISO image (ConfigDrive)– File system reflects the content available

via HTTP

Page 12: Interoperable OpenStack guest provisioning with Cloudbase-Init

Multi platform support• This is the really tricky part• IaaS components (e.g. Nova) don’t

care about the guest OS• Doing provisioning in Linux differs

from Windows and from FreeBSD• cloud-init works on Linux– Too tightly coupled with the OS– Porting is very though

• So we had to start a new project

Page 13: Interoperable OpenStack guest provisioning with Cloudbase-Init

Cloudbase-Init• Standard de facto on Windows

OpenStack deployments• Ported to FreeBSD as well:– https://github.com/pellaeon/bsd-cloudinit

• “Made in TM”, like the rest of the Cloudbase stuff

• 100% Python code

Page 14: Interoperable OpenStack guest provisioning with Cloudbase-Init

Architecture• Needs to be completely decoupled

from the OS– Must be portable to any OS

• Highly extensible model• Basic UML class diagram: – https://drive.draw.io/

#G0B6gjkOr4OobDQnVHY0QyQ2pSVlE

Page 15: Interoperable OpenStack guest provisioning with Cloudbase-Init

Tricky Windows parts• CPython works great on Windows

– Lots of modules for basic OS integration

• What to do when we need to go “deeper”?– PyWin32

• COM• Wraps lots of Win32 APIs

– PythonNet• .Net• Not to be confused with IronPython!

– WMI• CIM implementation

– Ctypes• Direct Win32 calls• Very flexible• Can be tedious to code• Similar to .Net PInvoke

Page 16: Interoperable OpenStack guest provisioning with Cloudbase-Init

Examples -WMI• Win32_NetworkAdapter– https://github.com/cloudbase/cloudbase-

init/blob/master/cloudbaseinit/osutils/windows.py#L340

Page 17: Interoperable OpenStack guest provisioning with Cloudbase-Init

Examples - ctypes• Win32 - VerifyVersionInfoW– https://github.com/cloudbase/cloudbase-

init/blob/master/cloudbaseinit/osutils/windows.py#L557

• Portable - openssl API– https://github.com/cloudbase/cloudbase-

init/blob/master/cloudbaseinit/utils/crypt.py#L124

Page 18: Interoperable OpenStack guest provisioning with Cloudbase-Init

Examples COM• COM exposes properties and methods

via getattr / setattr• Volumes management– https://github.com/cloudbase/cloudbase-

init/blob/master/cloudbaseinit/plugins/windows/vds.py#L322

– https://github.com/cloudbase/cloudbase-init/blob/master/cloudbaseinit/plugins/windows/extendvolumes.py#L161

Page 19: Interoperable OpenStack guest provisioning with Cloudbase-Init

Logging to serial port• Fact: serial ports never grow old • Clouds use often serial ports to

communicate between hypervisors and guests– E.g. OpenStack with KVM

• Linux can easily use serial ports for console I/O– That’s how Unix was used in the old days

Page 20: Interoperable OpenStack guest provisioning with Cloudbase-Init

pyserial• Windows does not log to serial port• Serial port can be integrated into

Python’s logging– https://github.com/cloudbase/cloudbase-

init/blob/master/cloudbaseinit/utils/log.py#L34

• By adding this Log Handler, anytime you issue a LOG.info/warn/error etc it will be logged to serial port and collected by KVM (for example)

Page 21: Interoperable OpenStack guest provisioning with Cloudbase-Init

Q & A