Top Banner
CloudStack Day Austin 2015 Clone VMs to CloudStack templates without downtime Simplifying Template Management Using Packer
19

Using Packer to Migrate XenServer Infrastructure to CloudStack

Jul 15, 2015

Download

Technology

Tim Mackey
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Using Packer to Migrate XenServer Infrastructure to CloudStack

CloudStack Day – Austin 2015

Clone VMs to CloudStack templates without downtime

Simplifying Template Management Using Packer

Page 2: Using Packer to Migrate XenServer Infrastructure to CloudStack

#whoami

Name: Tim Mackey

Current roles: XenServer Community Manager and Evangelist; occasional coder

Cool things I’ve done• Designed laser communication systems

• Early designer of retail self-checkout machines

• Embedded special relativity algorithms into industrial control system

Find me• Twitter: @XenServerArmy

• SlideShare: slideshare.net/TimMackey

• LinkedIn: https://www.linkedin.com/in/mackeytim

• GitHub: https://github.com/xenserverarmy

Page 3: Using Packer to Migrate XenServer Infrastructure to CloudStack

Define “VM Migration”

What people think• VM moves from source host to destination

Why it doesn’t work “to the cloud”• Incompatible host micro-architecture

• Lack of control over networking

• Do we really want a VM_HALT?

• Long distance ARP

Really need “template migration”

Template

Template

Template

Page 4: Using Packer to Migrate XenServer Infrastructure to CloudStack

What is Packer?http://packer.io

Page 5: Using Packer to Migrate XenServer Infrastructure to CloudStack

DemoWe’re going to build a VM before I even explain what’s happening!!!!

Page 6: Using Packer to Migrate XenServer Infrastructure to CloudStack

Template Management in CloudStack

My first template• Existing VM or appliance

• Need to have HTTP server

• Set secstorage.allowed.internal.sites if private cloud

Creation options• Register template in UI

• Templates Register Template

• Upload using registerTemplate API

• http://cloudstack.apache.org/docs/api/apidocs-4.5/user/registerTemplate.html

• Clone from CloudStack instance

• Stop instance View Volumes Create Template

Page 7: Using Packer to Migrate XenServer Infrastructure to CloudStack

Key Template Attributes

Obvious• Hypervisor

• Operating system type

• Zone

Not so obvious• IsDynamicallyScalable Hypervisor tools

• PasswordEnabledCloudStack sets root pwd

• SSHKeyEnabled Can post configure

• RequiresHVM Defines virtualization mode

Page 8: Using Packer to Migrate XenServer Infrastructure to CloudStack

VM Password and SSH Key Management Challenges

Obtain information from VR• VR is obtained from leases

• Scripts use wget

• Assumes sysinit not systemd

What to fix – varies by OS?• CentOS 7 defaults to curl not wget

• CentOS 7 is systemd need unit files

• CentOS 7 may use NetworkManager

Page 9: Using Packer to Migrate XenServer Infrastructure to CloudStack

Core Packer Concepts

Builder• Responsible for creation of VM image

• Connects to virtual infrastructure

• Default supports vSphere, OpenStack, AMI, VirtualBox, QEMU, Docker

• No XenServer needed to fix that ;)

Provisioner• Runs post-build activities

Post-Processor• Takes VM image artifact and transforms it

• In our case upload to CloudStack needed to fix that too ;)

Page 10: Using Packer to Migrate XenServer Infrastructure to CloudStack

Key activities occurring during template build from ISO

1. Download ISO into ISO SR (if not already present)

2. Attach ISO to VM object and boot

3. Instruct installer to user kickstart file

4. Installer does its thing and shuts VM down

5. Upon shutdown, swap installer ISO for XenServer tools ISO

6. Install ISO and shutdown

7. Detect shutdown and run Provisioners

8. Export and import into CloudStack as template

Page 11: Using Packer to Migrate XenServer Infrastructure to CloudStack

Check on DemoLet’s see where we’ve gotten

Page 12: Using Packer to Migrate XenServer Infrastructure to CloudStack

xenserver-iso Builder

Creates a new XenServer image from an ISO

Key parameters• Host connection

• ISO location

• Boot commands

Artifact output type• xva, vdi_raw, vhd, vhd_raw

Known limitations• Linux only (uses SSH)

• Requires NFS shared storage

Page 13: Using Packer to Migrate XenServer Infrastructure to CloudStack

DemoYou really want to see a live VM move to CloudStack; don’t you?

Page 14: Using Packer to Migrate XenServer Infrastructure to CloudStack

xenserver-vm builder

Creates a new XenServer image from existing running VM

Key parameters• Host connection

• VM name

• Cleanse command

• Cleanse scripts

Artifact output type• xva, vdi_raw, vhd, vhd_raw

Known limitations• Linux only (uses SSH)

• Requires NFS shared storage

Page 15: Using Packer to Migrate XenServer Infrastructure to CloudStack

cloudstack-xenserver post-processor

Creates a new CloudStack template from xenserver builders

Key parameters• CloudStack API keys

• Zone, OS type

• Script configuration

Artifact input • xenserver-iso, xenserver-vm

Page 16: Using Packer to Migrate XenServer Infrastructure to CloudStack

Key activities occurring during live clone

1. Snapshot of existing VM to minimize downtime

2. Detect if VM is PV or HVM and flag accordingly

3. Copy snapshot to NFS SR to collapse snapshot chain

4. Connect primary network to HIMN to ensure no machine collision

5. Use VNC to reconfigure network and connect to XenServer DHCP

6. Copy and run cleanse scripts which shutdown clone when complete

7. Detect shutdown and run Provisioners

8. Export and import into CloudStack as template

Page 17: Using Packer to Migrate XenServer Infrastructure to CloudStack

My CloudStack Cloud

Bringing “migration” all together with a NetScaler

Users

Page 18: Using Packer to Migrate XenServer Infrastructure to CloudStack

Questions?

Page 19: Using Packer to Migrate XenServer Infrastructure to CloudStack