Skip to content

seungjin/knife-xapi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Knife Xapi

This plugin gives knife the ability to create guests on a XAPI compatable hyper visor

Installation

This plugin is distributed as a Ruby Gem. To install it, run:

gem install knife-xapi

Configuration

Config options are extenable in the knife.rb the folowing k/v pairs are implemented

Chef::Config[:xenserver_host]

The API Host to connect to

Chef::Config[:xenserver_username]

The User name to connect to the api with

Chef::Config[:xenserver_password]

The Password (if not set will prompt on commandline)

Chef::Config[:xapi_vm_template]

Set a default template to be used when creating Guests

Chef::Config[:xapi_install_repo]

The install repo config option to set when using Xen builtin templates

Chef::Config[:xapi_sr]

The Storage Repository to provision from, uses pool/hypervisor default when not set

Chef::Config[:xapi_disk_size]

Default VM disk size (8g if not specified)

Chef::Config[:xapi_cpus]

The Default CPUs to provision for guests (2 if not specified)

Chef::Config[:xapi_mem] = mem

The Defaul ammount of Memory for guests (1g if not specified)

Chef::Config[:xapi_kernel_params]

Optional Boot paramaters to pass to the guest

Chef::Config[:xapi_bootstrap]

Not implemented yet, but will be the bootstrap script to execute after guest create

Usage

Create

Basic usage to create a VM from existing VM template:

knife xapi guest create "NewBox" "public"  --xapi-vm-template "MyBaseBox"   --host http://sandbox/

More verbose example using a kickstart file and booting the Centos 5 default template:

knife xapi guest create "MySpiffyBox" "pub_network" --host http://sandbox/ \
  -B "dns=8.8.8.8 ks=http://192.168.6.4/repo/ks/default.ks ip=192.168.6.7 netmask=255.255.255.0 gateway=192.168.6.1" \
  -R http://192.168.6.5/repo/centos/5/os/x86_64 -C 4 -M 4g -D 5g

*-B Boot args where i am assigning all the centos/rhel boot args for Ip setup and kickstart file *-R Repo URL used by xenserver to start the net install *-C Number of cpus for this guest *-M Memory size *-D Disk size

Use Knife builtin help schematic for more info

knife xapi guest create --help

Delete

Delete is pretty simple. When there are multiple vms with a name label you should be prompted to select one

knife xapi guest delete  testing

If you know the UUID of the VM you can specify –uuid

knife xapi guest delete b461c0d2-d24d-bc02-3231-711101f57b8e --uuid

List

List shows the vm’s on the pool/host Ignoring Controll domains and templates. VM OpaqueRef and UUID are displayed which can be

knife xapi guest list 
Name Label                 Ref                                             UUID                                 
test-server                OpaqueRef:82065b80-55ff-63ce-ef89-6b33fb5fd272  9b0a0afa-5573-7875-b787-47fbfa2548a4 
tester                     OpaqueRef:2d239fbd-bff6-4e60-f675-e1d2530199d2  de760651-2db8-6f81-0783-7b8364f591fd 
test-client                OpaqueRef:e4bbd801-c9be-e355-2a22-2ca468a90a81  35156957-45f4-02f8-6de9-6adbcd5e0c6d 
test-client                OpaqueRef:f5b562f8-a493-f535-335e-ae70b3177869  f46e4d6b-bd9e-e47b-5f0d-b849ff75c5ef

About

Knife Plugin For XAPI to control xenserver

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%