opennebulaconf 2013 - hands-on tutorial: 2. installing and basic usage
DESCRIPTION
TRANSCRIPT
Installing and Basic Usage
OpenNebula Cloud Management Platform > Innovative Open Source Technologies and Professional Services to Build your Enterprise-ready Cloud Computing Environment
1/15 © C12G Labs S.L.
All of the material in this Tutorial is copyright-protected and may not be published in other works without express written permission from C12G Labs. All trademarks are property of their respective owners.
© C12G Labs S.L. Rev20130919
2 Installing and Basic Usage
Agenda Installing and Basic Usage
● Planning the Installation ● Installation (node 1 - Frontend) ● Installation (node 2 - Worker Node) ● Configuration ● Basic Usage
● Managing Hosts ● Images, Networks, Templates and VMs ● Managing Users, Quotas and ACLs ● Logging & Debugging
3 Installing and Basic Usage
A Typical OpenNebula Environment Planning the Installation
• Repository of VM images • Multiple Backends (LVM, Ceph)
Monitoring,Virtualization, Storage and Network
• Provides physical resources for the VMs • Must have a hypervisor installed
4 Installing and Basic Usage
Virtual Lab Planning the Installation
NODE 1 NODE 2
5 Installing and Basic Usage
Required Software Installing
● Head node ● ssh, ruby ● OpenNebula: oned, mm_sched, sunstone, …
● Worker nodes ● Hypervisor (KVM, Xen or VMWare) ● ssh, ruby (Xen & KVM)
● Optional ● Storage Backends (LVM, iSCSI, Ceph, …) ● Networking systems (VLAN, Open vSwitch, …) ● Ganglia, LDAP, Apache, Nginx
6 Installing and Basic Usage
Installation node 1 - Frontend Installing
Hands on (node1) ! ● Activate repo and Install Packages
● Add QEMU drivers
● Configure NFS Server
# cp /var/tmp/tutorial/opennebula.repo /etc/yum.repos.d/ # yum install opennebula-server opennebula-sunstone opennebula-node-kvm opennebula-flow
# sed -i 's/"kvm" ]/"qemu" ]/' /etc/one/oned.conf
# cat /etc/exports
/var/lib/one *(rw,sync,no_subtree_check,root_squash,anonuid=9869,anongid=9869)
7 Installing and Basic Usage
Installation node 1 - Frontend Installing
Hands on (node1) ! ● Configure Sunstone
● Start Services
● Quick overview of the CLI
# service nfs start # service libvirtd start # service opennebula start # service opennebula-sunstone start
# gpasswd -a oneadmin wheel # su - oneadmin $ oneuser show $ oneuser -help
# sed -i 's/127.0.0.1/0.0.0.0/' /etc/one/sunstone-server.conf
8 Installing and Basic Usage
Installation node 1 - Frontend Installing
Hands on (node1) ! ● OpenNebula CLI Commands
$ one[TAB]
oneuser Manage Users oneimage Manage Images
onegroup Manage Groups onetemplate Manage Templates
oneacl Manage ACLs onevm Manage VMs
onehost Manage Hosts oneacct Accounting Tool
onecluster Manage Clusters onemarket Marketplace Tool
onevnet Manage Networks onedb DB Tool
onedatastore Manage Datastores
9 Installing and Basic Usage
Installation node 2 – Worker Node Installing
Hands on (node2) ! ● Activate repo and Install Packages
● Configure Network, Hostname, NFS and sudo
# cp /var/tmp/tutorial/opennebula.repo /etc/yum.repos.d/ # yum install opennebula-node-kvm
# echo HOSTNAME=node2 > /etc/sysconfig/network # hostname node2 # sed -i 's/1.1.1.1/1.1.1.2/' /etc/sysconfig/network-scripts/ifcfg-br1 # ifconfig br1 1.1.1.2/24 up # mount –t nfs 1.1.1.1:/var/lib/one /var/lib/one # gpasswd -a oneadmin wheel # service libvirtd start
10 Installing and Basic Usage
Configure Password-less SSH Installing
Hands on! (always node1 from now on) ● OpenNebula needs passwordless ssh access to
all the nodes from all the nodes:
# (as oneadmin) $ ssh-keyscan node1 node2 > ~/.ssh/known_hosts
# test it!
$ ssh node2 $ exit $ ssh node1 $ exit
11 Installing and Basic Usage
Get User Information - Sunstone Installing
● Get the Sunstone Login information
● Try out sunstone! http://localhost:9869
# (as oneadmin) $ cat ~/.one/one_auth oneadmin:<password>
12 Installing and Basic Usage
oned.conf Configuration
/etc/one/oned.conf (open this file and take a look!) ● OpenNebula Daemon:
● LOG, PORT, DB ● Monitoring Intervals: MANAGER_TIMER, MONITORING_INTERVAL ● Configuration options for VMs:
● VNC_BASE_PORT ● MAC_PREFIX (MAC IP) ● DEFAULT_DEVICE_PREFIX = "hd“ (or vd, xvd, etc…)
● Drivers: ● IM_MAD, VMM_MAD, TM_MAD, DATASTORE_MAD, HM_MAD,
AUTH_MAD ● Resources:
● DEFAULT_UMASK ● VM_RESTRICTED_ATTR, IMAGE_RESTRICTED_ATTR
13 Installing and Basic Usage
sched.conf Configuration
/etc/one/sched.conf (open this file and take a look!) ● Scheduler Daemon:
● ONED_PORT, SCHED_INTERVAL, LOG ● Dispatch Options
● MAX_VM, MAX_DISPATCH, MAX_HOST, LIVE_RESCHEDS ● Policy
● DEFAULT_SCHED (packing, striping, load-aware, custom)
14 Installing and Basic Usage
Adding Hosts - Sunstone Basic Usage – Hosts
Hands on! (Sunstone) ● Create one host in Sunstone: node1
● Virtualization: KVM ● Information: KVM ● Network: dummy ● Cluster: dummy
● Watch transition INIT ON ● Click on the row for more information
● Automatic gathering of monitoring data ● Take a look at the graphs
15 Installing and Basic Usage
Adding Hosts - CLI Basic Usage – Hosts
Hands on! (CLI) (always as oneadmin in the Frontend – node 1)
$ onehost –help $ onehost create –help
$ ssh node2 ls –ld /var/tmp/one $ onehost create node2 -i kvm -v kvm -n dummy $ onehost list $ onehost top
# Wait for ON ... and then CTRL-C
$ ssh node2 ls –ld /var/tmp/one $ onehost show node2 $ onehost show 1 $ onehost show -x 1
16 Installing and Basic Usage
Adding Images Basic Usage – Images
Hands on! (Sunstone) ● Create an Image in Sunstone
● Name: tty ● Provide a Path: /var/tmp/tutorial/ttylinux.qcow2.img ● Advanced Driver: qcow2 ● Datastore: default ● Create!
● Watch transition LOCKED READY ● Ownership and Permissions (ala Unix!), Size, Driver... Hands on! (CLI) $ oneimage list $ oneimage show tty
# DO NOT EXECUTE THE FOLLOWING COMMAND $ oneimage create --name tty --driver qcow2 --path /var/tmp/tutorial/ttylinux.qcow2.img -d default
17 Installing and Basic Usage
System Datastore Basic Usage – Datastores
Hands on! (Sunstone) ● Inspect each Datastore: ● The system datastore:
● Holds images for running VMs ● The TM_MAD (transfer manager driver) is shared which means:
18 Installing and Basic Usage
Shared Datastore Basic Usage – Datastores
Hands on! (Sunstone) ● The default datastore:
● Holds images ready to be cloned or linked for VMs ● The DS_MAD is fs because our image is a regular file ● The TM_MAD (transfer manager driver) is shared which means:
19 Installing and Basic Usage
Adding Networks Basic Usage – Networks
Hands on! (Sunstone) ● Create a new Network
● Name: private ● Type: Fixed Network ● IP: 192.168.0.1 -> [ENTER] -> repeat ... -> 192.168.0.4 ● Network Model: default ● Bridge: br1
br1
VM VM
Node 1 eth1
br1
Node 2 eth1
VM VM
20 Installing and Basic Usage
Adding Networks Basic Usage – Networks
Hands on! (Sunstone) ● Network extended information:
● Lease Management Add, Hold and Remove Leases
Hands on! (CLI)
$ cat private2.net NAME = private2 TYPE = fixed BRIDGE = br1 LEASES = [ IP = 10.0.0.1 ] LEASES = [ IP = 10.0.0.2 ]
$ onevnet create private2 $ onevnet list $ onevnet show private $ onevnet addleases private 192.168.0.105 $ onevnet hold private 192.168.0.105
21 Installing and Basic Usage
Adding Templates Basic Usage – Template
Hands on! (Sunstone) ● A template is a Virtual Machine definition ready to be instantiated ● It has CPU, Memory, Disks, NIC, Graphical Ports, etc... ● Create a new Template:
● Name: ttylinux ● CPU: 0.1 ● Memory: 64M ● Storage: tty ● Network: private ● Input/Output: VNC + Keymap ● Random values in Context Custom Variables ● Create!
22 Installing and Basic Usage
Adding Templates Basic Usage – Template
Hands on! (CLI) ● Try the useful --dry option in the CLI
$ onetemplate create --help $ onetemplate create --name ttylinux --cpu 0.1 \ --memory 64 --disk tty --nic private --vnc --dry
NAME="ttylinux“ CPU=0.1 MEMORY=64 DISK=[ IMAGE="tty“ ] NIC=[ NETWORK="private“ ] GRAPHICS=[ TYPE="vnc", LISTEN="0.0.0.0" ]
23 Installing and Basic Usage
Instantiating Basic Usage – VMs
Hands on! (Sunstone) ● Instantiate the template
● Deploy 2 VMs ● Leave the name blank
● Watch the transition PENDING RUNNING ● In which host is running each VM? ● vnc ( root / password) ● ifconfig configured using context ● migrate ● live-migrate ● ping the other machine
24 Installing and Basic Usage
Main VM actions Basic Usage – VMs
suspend VM state saved. Kept in the host.
power off (--hard) Powers off a VM. Kept in the host.
stop VM state saved. Taken to the system datastore.
undeploy (--hard) Powers off a VM. Taken to the system datastore.
reboot (--hard) Reboots the VM.
delete --recreate Cleans the VM and moves it to PENDING.
shutdown (--hard) Powers off a VM, cleans host and VM is removed from OpenNebula.
delete VM is immediately destroyed regardless of state. Recommended only for oneadmin.
25 Installing and Basic Usage
Other VM actions Basic Usage – VMs
Hands on! (Sunstone) ● VM extended information tab
● Capacity - Resize VM capacity ● Storage - Attach new disk ● Network - Attach new nic ● create a new network attach nic reboot
● Snapshot ● create a file using VNC ● Take snapshot ● Modify the file ● Revert
● Placement ● Actions - Schedule action ● Template ● Log
26 Installing and Basic Usage
Managing Users Basic Usage – Users
Hands on! (Sunstone) ● Create new user: testuser / testpass ● Click on new user Update Quotas
● Enforce 1 Max VMs Add/edit quota ● Other possible options ● limit the use of a Datastore ● limit the use of an Image ● limit the use of a Network
● Apply changes! ● Create new ACL
● We can customize any rule extending the functionality provided by the Unix ownership/group/permissions schema.
27 Installing and Basic Usage
Logs Basic Usage – Logging and Debugging
● Logs are kept under /var/log/one ● oned.log: all the information related to the oned daemon. Every
request, actions and driver errors will be here. The verbosity is set by DEBUG_LEVEL in /etc/one/oned.conf
● sched.log:has all the information related to the placement of Virtual Machines. If a VM is not being deployed (kept in PENDING state), this log will explain why.
● <id>.log: the log of each VM. Also accessible through Sunstone. ● To activate driver logs, enable ONE_MAD_DEBUG in /etc/one/defaultrc
28 Installing and Basic Usage
Other Features Other Key Features in OpenNebula
● Appliance Marketplace ● Catalog of virtual appliances ● Integrated with Sunstone ● Deployable in Private Cloud
● Hybrid Cloud Computing ● AWS connector that enables Cloud-Bursting
● Service Management (OneFlow) ● Automatic execution and scaling of multi-tiered applications ● Gain insight cloud applications
● Virtual Data Centers ● Fully-isolated virtual infrastructures ● Fedaration of multiple OpenNebula Zones
● Fine-Grained Accounting
29 Installing and Basic Usage
We Will Be Happy to Clarify Any Question
Questions?