Coder Social home page Coder Social logo

ringods / xenserver-images Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 3.0 16 KB

Build setup for XenServer images for Vagrant

License: Apache License 2.0

Ruby 41.49% Shell 58.51%
xenserver packer-template vagrant-boxes packer xenserver-images virtualbox

xenserver-images's Introduction

Vagrant images of XenServer

Build Status

Bento is a project that encapsulates Packer templates for building Vagrant base boxes. A subset of templates are built and published to the bento org on Vagrant Cloud. The boxes also serve as default boxes for kitchen-vagrant.

Using Public Boxes

Adding a xenserver box to Vagrant

$ vagrant box add ringods/xenserver-6.2

Using a xenserver box in a Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "ringods/xenserver-6.2"
end

Building Boxes

Requirements

Using packer

To build a Xenserver 6.2 box for only the VirtualBox provider

$ cd xenserver
$ packer build -only=virtualbox-iso xenserver-6.2-amd64.json

If the build is successful, ready to import box files will be in the builds directory at the root of the repository.

Bugs and Issues

Please use GitHub issues to report bugs, features, or other problems.

License & Authors

The setup of this project is inspired by the Bento project from Chef. A big thanks to the Chef team for such an easy setup.

xenserver-images's People

Contributors

cg5labs avatar ringods avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

xenserver-images's Issues

Sample fails with default box setup

Hello again,

So I suceedeed bringing up a XenServer host in VirtualBox from a created Vagrant box.
Here is my Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.box = "debovema/xenserver"
  config.vm.box_version = "7.2.0"

  # forward HTTP(S) port from the VM to the host to access the XenServer API in Terraform
  config.vm.network "forwarded_port", guest: 80, host: 80
  config.vm.network "forwarded_port", guest: 443, host: 443

  config.vm.provider "virtualbox" do |vb|
    vb.memory = "4096" # increase memory to 4 Gb
  end
end

After doing vagrant up and vagrant ssh, I manually set a password for root user with passwd command to be used as crendentials by your Terraform provider for XenServer.

Now this is the sample Terraform file I would like to use:

provider "xenserver" {
  url      = "http://192.168.1.74/"
  username = "root"
  password = "<password>"
}

resource "xenserver_vdi" "disk1" {
  sr_uuid = "d39f638d-1977-5879-c9f1-b14e6d48241e"
  name_label = "disk1"
  size = 4294967296 # 4GB
}

resource "xenserver_network" "network" {
  name_label = "network"
  bridge = "Network 0" # default network name is "Network 0"
  description = "network"
}

resource "xenserver_vm" "vm-test" {
    name_label = "vm-test"
    base_template_name = "Debian Wheezy 7.0 (32-bit)"
    static_mem_min = 2147483648 # 2GB
    static_mem_max = 2147483648
    dynamic_mem_min = 2147483648
    dynamic_mem_max = 2147483648
    boot_order = "cdn"

    network_interface {
        network_uuid = "${xenserver_network.network.id}"
        mac = "12:34:45:67:89:12"
        mtu = 1500
        device = 0
    }

    vcpus = 2

    hard_drive {
      vdi_uuid = "${xenserver_vdi.disk1.id}"
    }
}

Notice that I used the Debian Wheezy 7.0 (32-bit) template as it will use Paravirtualization (PV) instead of Hardware-assisted Virtualization (HVM) which is not supported when the XenServer host is already running virtualized.

Basically, I create a 4Gb virtual disk on the default local storage (UUID can be seen below with xe sr-list command) and a network interface for the VM.

When I run terraform apply, here's what I got:

$ terraform apply
xenserver_network.network: Creating...
  bridge:      "" => "Network 0"
  description: "" => "network"
  name_label:  "" => "network"
xenserver_vdi.disk1: Creating...
  name_label: "" => "disk1"
  read_only:  "" => "false"
  shared:     "" => "false"
  size:       "" => "4294967296"
  sr_uuid:    "" => "d39f638d-1977-5879-c9f1-b14e6d48241e"
xenserver_network.network: Creation complete after 0s (ID: 76f0adf4-0991-8a66-bf84-32ba6cb4103e)
xenserver_vdi.disk1: Creation complete after 1s (ID: 00efcb93-45a3-41b1-948b-2bfa168cc952)
xenserver_vm.vm-test: Creating...
  base_template_name:                       "" => "Debian Wheezy 7.0 (32-bit)"
  boot_order:                               "" => "cdn"
  cores_per_socket:                         "" => "<computed>"
  dynamic_mem_max:                          "" => "2147483648"
  dynamic_mem_min:                          "" => "2147483648"
  hard_drive.#:                             "0" => "1"
  hard_drive.380500672.bootable:            "" => "<computed>"
  hard_drive.380500672.is_from_template:    "" => "false"
  hard_drive.380500672.mode:                "" => "<computed>"
  hard_drive.380500672.user_device:         "" => "<computed>"
  hard_drive.380500672.vdi_uuid:            "" => "00efcb93-45a3-41b1-948b-2bfa168cc952"
  name_label:                               "" => "vm-test"
  network_interface.#:                      "0" => "1"
  network_interface.434444472.device:       "" => "0"
  network_interface.434444472.mac:          "" => "12:34:45:67:89:12"
  network_interface.434444472.mtu:          "" => "1500"
  network_interface.434444472.network_uuid: "" => "76f0adf4-0991-8a66-bf84-32ba6cb4103e"
  static_mem_max:                           "" => "2147483648"
  static_mem_min:                           "" => "2147483648"
  vcpus:                                    "" => "2"
  xenstore_data.%:                          "" => "<computed>"
Error applying plan:

1 error(s) occurred:

* xenserver_vm.vm-test: 1 error(s) occurred:

* xenserver_vm.vm-test: API Error: UUID_INVALID sr

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

So to sum up I have API Error: UUID_INVALID sr whereas the different resources seem to be created (as seen with XenCenter). However none of the dependencies is bound to the VM.

Is there something I am missing ?
Do you have a much appreciated working sample ? The one on this page is not very comprehensive.

Here is the list of available networks:

[root@localhost ~]# xe network-list
uuid ( RO)                : aaf48c3e-0797-22db-c3e8-f08aae02c68b
          name-label ( RW): Host internal management network
    name-description ( RW): Network on which guests will be assigned a private link-local IP address which can be used to talk XenAPI
              bridge ( RO): xenapi


uuid ( RO)                : dee0d926-adf7-86f8-1260-18e0cc9bd111
          name-label ( RW): network
    name-description ( RW): network
              bridge ( RO): Network 0


uuid ( RO)                : 46177683-6eb1-dfb0-b4a6-7f8e3910eeb1
          name-label ( RW): Network 1
    name-description ( RW):
              bridge ( RO): xapi0


uuid ( RO)                : 66281518-bd1d-3b83-4718-da672ba4de88
          name-label ( RW): Pool-wide network associated with eth0
    name-description ( RW):
              bridge ( RO): xenbr0

Here is the list of available storages:

[root@localhost ~]# xe sr-list
uuid ( RO)                : ca14e0b1-5d9e-a117-bc41-fd69342ab6e3
          name-label ( RW): XenServer Tools
    name-description ( RW): XenServer Tools ISOs
                host ( RO): localhost
                type ( RO): iso
        content-type ( RO): iso


uuid ( RO)                : d701617e-03bc-be96-3401-824c8d974c55
          name-label ( RW): DVD drives
    name-description ( RW): Physical DVD drives
                host ( RO): localhost
                type ( RO): udev
        content-type ( RO): iso


uuid ( RO)                : d39f638d-1977-5879-c9f1-b14e6d48241e
          name-label ( RW): Local storage
    name-description ( RW):
                host ( RO): localhost
                type ( RO): ext
        content-type ( RO): user


uuid ( RO)                : b53f09cf-ea4d-bd00-decf-371650d748de
          name-label ( RW): SMB ISO library
    name-description ( RW): SMB ISO Library [\\192.168.1.74\share]
                host ( RO): localhost
                type ( RO): iso
        content-type ( RO): iso


uuid ( RO)                : c9cec2df-ef0f-9876-28f6-822ecc673470
          name-label ( RW): Removable storage
    name-description ( RW):
                host ( RO): localhost
                type ( RO): udev
        content-type ( RO): disk

Thank you very much for your help.

How to use the built boxes?

Hi,

I succeeded to build a Vagrant box with Packer for XenServer 7.2.
I did a vagrant up with this box and it seems to boot.

However the vagrant ssh is not working.
I also tried using the VirtualBox console where I can access the Xen console but I don't know the default credentials (for root user).

Any hint ?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.