This is a Vagrant 1.1+ plugin that adds an oVirt v4 and allowing Vagrant to control and provision machines in oVirt.
$ vagrant plugin install vagrant-ovirt4
$ vagrant up --provider=ovirt4
!requiretty
in sudoersvagrant up
vagrant destroy
vagrant ssh [-c '#command']
vagrant ssh-config
vagrant halt
vagrant reload
vagrant status
vagrant suspend
vagrant resume
vagrant snapshot list
vagrant snapshot delete [id]
vagrant snapshot save [description]
Vagrant.configure("2") do |config|
config.vm.box = 'ovirt4'
config.vm.hostname = "foo"
config.vm.box_url = 'https://github.com/myoung34/vagrant-ovirt4/blob/master/example_box/dummy.box?raw=true'
config.vm.network :private_network,
:ovirt__network_name => 'ovirtmgmt' #DHCP
# Static configuration
#:ovirt__ip => '192.168.2.198', :ovirt__network_name => 'ovirtmgmt', :ovirt__gateway => '192.168.2.125', :ovirt__netmask => '255.255.0.0', :ovirt__dns_servers => '192.168.2.1', :ovirt__dns_search => 'test.local'
# Static configuration with biosdevname. Guest OS assigns interface names (ens3, em1 or something else). ovirt__interface_name has to match that name.
#:ovirt__ip => '192.168.2.198', :ovirt__network_name => 'ovirtmgmt', :ovirt__gateway => '192.168.2.125', :ovirt__netmask => '255.255.0.0', :ovirt__dns_servers => '192.168.2.1', :ovirt__dns_search => 'test.local', :ovirt__interface_name => 'ens3'
# configure additional interface
# config.vm.network :private_network,
# :ovirt__ip => '192.168.2.199', :ovirt__network_name => 'ovirtmgmt', :ovirt__netmask => '255.255.0.0', :ovirt__interface_name => 'ens4'
config.vm.provider :ovirt4 do |ovirt|
ovirt.url = 'https://server/ovirt-engine/api'
ovirt.username = "admin@internal"
ovirt.password = "password"
ovirt.insecure = true
ovirt.debug = true
ovirt.timeout = 120 # seconds
ovirt.connect_timeout = 30 # seconds
ovirt.filtered_api = true #see http://www.ovirt.org/develop/release-management/features/infra/user-portal-permissions/
ovirt.cluster = 'Default'
ovirt.vmname = 'my-vm'
ovirt.run_once = false
ovirt.template = 'Vagrant-Centos7-test'
ovirt.console = 'vnc'
ovirt.disk_size = '15 GiB' # only growing is supported. works the same way as below memory settings
ovirt.memory_size = '1 GiB' #see https://github.com/dominikh/filesize for usage
ovirt.memory_guaranteed = '256 MiB' #see https://github.com/dominikh/filesize for usage
ovirt.cpu_cores = 2
ovirt.cpu_sockets = 2
ovirt.cpu_threads = 2
ovirt.bios_serial = aaabbbb-ccc-dddd
ovirt.optimized_for = 'server'
ovirt.cloud_init =<<EOF
write_files:
- content: |
Hello, world!
path: /tmp/greeting.txt
permissions: '0644'
EOF
# additional disks
ovirt.storage :file, size: "8 GiB", type: 'qcow2', storage_domain: "mystoragedomain"
end
end
config.vm.hostname
=> Sets the hostname of the VM. Optional. String.
Default is "vagrant"
.
a. Is the 'hostname' of the VM configured by cloud-init
config.vm.network
=> Sets the network information of the VM.
a. Note: :ip
=> is ignored, but :ovirt__ip
is used and merged with :ip
config.vm.network
=> Sets the network information of the VM.
a. Note: Only :private_network
is currently supported.
a. If :ovirt__ip
is provided, then the network type is assumed 'STATIC' and gateway
is also used.url
=> The URL for the API. Required. String. No default value.username
=> The username for the API. Required. String. No default value.password
=> The password for the API. Required. String. No default value.insecure
=> Allow connecting to SSL sites without certificates. Optional. Bool. Default is false
debug
=> Turn on additional log statements. Optional. Bool. Default is
true
if Vagrant's logging verbosity is set to info
or above
(VAGRANT_LOG={info,debug,...}
); otherwise, the default is false
.timeout
=> Per the oVirt SDK docs,
"The maximun (sic) total time to wait for the response, in seconds. A value of
zero (the default) means wait for ever." Optional. Integer. Uses the
OvirtSDK4::Connection
default if omitted; as of the time of writing,
this is 0
(i.e. wait forever).connect_timeout
=> Per the oVirt SDK docs,
"The maximun (sic) time to wait for connection establishment, in
seconds." Optional. Integer. Uses the OvirtSDK4::Connection
default if
omitted; as of the time of writing, this is 300
.vmname
=> Sets the name of the VM. Optional. String. Default is
config.vm.hostname
, if defined, otherwise "vagrant"
.
a. Is the 'name' in the Virtual Machine tab of the UIrun_once
=> Launch VM in run-once mode. Optional. Default is false
.template
=> The name of the template to use for creation. Required. String. No Default value.cluster
=> The name of the ovirt cluster to create within. Required. String. No Default value.console
=> The type of remote viewing protocol to use. Required. String. No Default value.memory_size
=> The physical size of the memory for the VM (in MB). Defaults to 256
memory_guaranteed
=> The guaranteed size of the memory for the VM (in MB). Note: cannot be larger than memory_size
. Defaults to memory_size
cpu_cores
=> The number of CPU cores. Defaults to 1
cpu_sockets
=> The number of CPU cores. Defaults to 1
cpu_threads
=> The number of CPU threads. Defaults to 1
cloud_init
=> The cloud-init data to pass. Must be properly formatted as yaml. Docs hereaffinity
=> The affinity to use. See this for possible uses. Optional. Invalid will cause a RuntimeError
placement_host
=> The host to start the VM on. Optional.bios_serial
=> The BIOS serial number to assign. Optional.optimized_for
=> The "optimized for" setting. Can be one of 'Desktop' or 'Server' (case insensitive). Optional.storage
=> adds a new storage disk to the VM
a. size
: the size of the disk
a. type
: the type of disk. It can be either qcow2
or raw
a. storage_domain
: the storage domain where the disk should be createdgit checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Some pointers:
bundle install
bundle exec rspec spec/