Download presentation
Presentation is loading. Please wait.
Published byJudith Owen Modified over 8 years ago
1
StratusLab is co-funded by the European Community’s Seventh Framework Programme (Capacities) Grant Agreement INFSO-RI-261552 VM Lifecycle StratusLab Tutorial
2
2 VM Lifecycle Overview Normal VM lifecycle consists of following commands: Deploy new instance: –stratus-run-instance Describe running instances: –stratus-describe-instance [VM ID] Access instance: –stratus-connect-instance [VM ID] Shutdown instance: –stratus-shutdown-instance [VM ID] Remove instance: –stratus-kill-instance [VM ID]
3
3 Deploy a VM from the Marketplace Use a ttylinux image Identifier from the Marketplace to understand the VM lifecycle: Browse the StratusLab Marketplace: http://marketplace.stratuslab.euhttp://marketplace.stratuslab.eu export TTYLINUX_ID=BzrqtDb2pYxA5_jha4IXG4WLyD3 Deploy your virtual machine: stratus-run-instance ${TTYLINUX_ID} Response should give the VM ID and Public IP: ::::::::::::::::::::::::: :: Starting machine(s) :: ::::::::::::::::::::::::: :: Starting 1 machine :: Machine 1 (vm ID: 12) Public ip: 134.158.75.34 :: Done!
4
4 Status of Virtual Machines Follow the status of the machine with the VM ID: stratus-describe-instance All active machines can be seen with same command without VMID. $ stratus-describe-instance 12 id state vcpu memory cpu% ip name 12 Running 1 0 0 134.158.75.34 one-12 $ stratus-describe-instance id state vcpu memory cpu% ip name 11 Running 1 131072 4 134.158.75.33 one-11 12 Running 1 0 0 134.158.75.34 one-12
5
5 Connecting to the Virtual Machine Wait until the machine is "Running" then ping the VM: ping If all's OK, connect to the machine instance: stratus-connect-instance You can also log into the machine as root, using ssh: ssh root@134.158.75.33root@134.158.75.33 $ ping 134.158.75.33 PING 134.158.75.33 (134.158.75.33): 56 data bytes 64 bytes from 134.158.75.33: icmp_seq=0 ttl=63 time=0.780 ms 64 bytes from 134.158.75.33: icmp_seq=1 ttl=63 time=0.704 ms... $stratus-connect-instance 11 # # echo $USER root
6
6 More machine instances… Deploy second machine instance: stratus-run-instance … Log into machine as root Stay logged in… Common machine states: Pending: waiting for resource Prolog: cloud initialization of an image Boot: starting virtual machine from image Running: machine is active Failed: problem with starting/running the machine
7
7 Stopping the Virtual Machine Graceful shutdown from within the machine: shutdown –h Wait for the unknown state, then kill (remove) the instance: This safely stops all services and halts the machine. Rip the power cord from the wall: stratus-kill-instance # shutdown -h # Connection to 134.158.75.33 closed by remote host. Connection to 134.158.75.33 closed. $ stratus-shutdown-instance 11 id state vcpu memory cpu% ip name 11 Unknown 1 131072 3 134.158.75.33 one-11 $ stratus-kill-instance 12 $ stratus-describe-instance 12 id state vcpu memory cpu% ip name 12 Done 1 131072 4 134.158.75.34 one-12
8
8 Changing VM Resources At deployment, you can choose the number of CPUs, amount of RAM and swap space. StratusLab has a number of predefined types: stratus-run-instance --list-type (default is m1.small) Deploy an m1.xlarge instance $ stratus-run-instance --list-type Type CPU RAM SWAP m1.large 2 CPU 512 MB 1024 MB c1.xlarge 4 CPU 2048 MB 2048 MB m1.small 1 CPU 128 MB 1024 MB c1.medium 1 CPU 256 MB 1024 MB m1.xlarge 2 CPU 1024 MB 1024 MB t1.micro 1 CPU 128 MB 512 M $ stratus-run-instance --quiet --type=m1.xlarge $TTYLINUX_ID 14, 134.158.75.36 $ stratus-describe-instance 14 id state vcpu memory cpu% ip name 14 Pending 2 0 0 134.158.75.36 one-14
9
9 Non-standard Machine Types What happens when you need resource allocations different from the predefined types? New in client 1.22, users can specify all resources: stratus-run-instance –help Want to deploy ttylinux with (CPU=8 cores, RAM=4096MB,SWAP=1024MB) $ stratus-run-instance –help …… --cpu=VMCPU number of CPU cores --ram=VMRAM RAM in megabytes --swap=VMSWAP swap space in megabytes …… $ stratus-run-instance --quiet –cpu=8 –ram=4096 –swap=1024 $TTYLINUX_ID 14, 134.158.75.36 $ stratus-describe-instance 14 id state vcpu memory cpu% ip name 14 Pending 8 0 0 134.158.75.36 one-14
10
10 Non-standard Machine Types NOTE: Machine images must be capable of using multiple CPUs, additional RAM, etc. for this to be useful.
11
11 Advanced features At deployment, you can ask to save image after VM shutdown. Save image workflow stratus-run-instance --save --author-email=‘…’ Connect to the instance: stratus-connect-instance [VM ID] Apply modifications. Shutdown the instance: stratus-shutdown-instance [VM ID] Once the newly image created, user receives information on how to proceed in the email they provided with --author-email option. Note: Instances must support ACPI $ stratus-run-instance –help …… --save save image after VM shutdown --author-email=EMAIL Used with --save option. Email address of the author of the new image. After image is saved a notification is sent with further instructions. ……
12
12 Advanced features Deploy CentOS 6.2 instance (Identifier: DfXlr9qthtM6BKrPzeqyxqTvamx from the Marketplace) $ export CENTOS_ID=DfXlr9qthtM6BKrPzeqyxqTvamx $ stratus-run-instance –quiet --save --author-email=‘your email address’ $CENTOS_ID 15, 134.158.75.37 $ stratus-describe-instance 15 id state vcpu memory cpu% ip name 15 Running 1 131072 0 134.158.75.37 one-15 $ stratus-shutdown-instance 15 $ $ stratus-describe-instance 15 id state vcpu memory cpu% ip name 15 Shutdown 1 131072 0 134.158.75.37 one-15
13
13 Questions and Discussion
14
14 Exercises: Deploy Machines Marketplace Search Marketplace to see what types of machines are available What metadata is available for existing virtual machines? What metadata would you like to have? Deploy Virtual Machines Try different operating systems (ttylinux, Ubuntu, CentOS, Fedora, OpenSUSE) Change the machine types, resources Try both shutdown and kill. What differences do you see? Create a Web Site Deploy virtual machine with a web server Customize landing page or other content Verify that you can access the site with the customized content
15
Copyright © 2011-2012, Members of the StratusLab collaboration: Centre National de la Recherche Scientifique, Universidad Complutense de Madrid, Greek Research and Technology Network S.A., SixSq Sàrl, Telefónica Investigación y Desarrollo SA, and The Provost Fellows and Scholars of the College of the Holy and Undivided Trinity of Queen Elizabeth Near Dublin. This work is licensed under the Creative Commons Attribution 3.0 Unported License http://creativecommons.org/licenses/by/3.0/
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.