mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
let the user set the domain title and description
This commit is contained in:
parent
18c7803863
commit
19cd1d5629
@ -302,6 +302,8 @@ end
|
||||
|
||||
### Domain Specific Options
|
||||
|
||||
* `title` - A short description of the domain.
|
||||
* `description` - A human readable description of the virtual machine.
|
||||
* `disk_bus` - The type of disk device to emulate. Defaults to virtio if not
|
||||
set. Possible values are documented in Libvirt's [description for
|
||||
_target_](http://libvirt.org/formatdomain.html#elementsDisks). NOTE: this
|
||||
|
@ -31,6 +31,8 @@ module VagrantPlugins
|
||||
|
||||
# Gather some info about domain
|
||||
@name = env[:domain_name]
|
||||
@title = config.title
|
||||
@description = config.description
|
||||
@uuid = config.uuid
|
||||
@cpus = config.cpus.to_i
|
||||
@cpuset = config.cpuset
|
||||
@ -195,6 +197,8 @@ module VagrantPlugins
|
||||
# Output the settings we're going to use to the user
|
||||
env[:ui].info(I18n.t('vagrant_libvirt.creating_domain'))
|
||||
env[:ui].info(" -- Name: #{@name}")
|
||||
env[:ui].info(" -- Title: #{@title}") if @title != ''
|
||||
env[:ui].info(" -- Description: #{@description}") if @description != ''
|
||||
env[:ui].info(" -- Forced UUID: #{@uuid}") if @uuid != ''
|
||||
env[:ui].info(" -- Domain type: #{@domain_type}")
|
||||
env[:ui].info(" -- Cpus: #{@cpus}")
|
||||
|
@ -67,6 +67,8 @@ module VagrantPlugins
|
||||
attr_accessor :default_prefix
|
||||
|
||||
# Domain specific settings used while creating new domain.
|
||||
attr_accessor :title
|
||||
attr_accessor :description
|
||||
attr_accessor :uuid
|
||||
attr_accessor :memory
|
||||
attr_accessor :nodeset
|
||||
@ -197,6 +199,8 @@ module VagrantPlugins
|
||||
@system_uri = UNSET_VALUE
|
||||
|
||||
# Domain specific settings.
|
||||
@title = UNSET_VALUE
|
||||
@description = UNSET_VALUE
|
||||
@uuid = UNSET_VALUE
|
||||
@memory = UNSET_VALUE
|
||||
@nodeset = UNSET_VALUE
|
||||
@ -697,6 +701,8 @@ module VagrantPlugins
|
||||
@uri = _generate_uri if @uri == UNSET_VALUE
|
||||
|
||||
# Domain specific settings.
|
||||
@title = '' if @title == UNSET_VALUE
|
||||
@description = '' if @description == UNSET_VALUE
|
||||
@uuid = '' if @uuid == UNSET_VALUE
|
||||
@memory = 512 if @memory == UNSET_VALUE
|
||||
@nodeset = nil if @nodeset == UNSET_VALUE
|
||||
|
@ -1,5 +1,7 @@
|
||||
<domain type='<%= @domain_type %>' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
|
||||
<name><%= @name %></name>
|
||||
<title><%= @title %></title>
|
||||
<description><%= @description %></description>
|
||||
<uuid><%= @uuid %></uuid>
|
||||
<memory><%= @memory_size %></memory>
|
||||
<vcpu<% if @cpuset %> cpuset='<%= @cpuset %>'<% end %>><%= @cpus %></vcpu>
|
||||
|
@ -1,5 +1,7 @@
|
||||
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
|
||||
<name></name>
|
||||
<title>title</title>
|
||||
<description>description</description>
|
||||
<uuid></uuid>
|
||||
<memory></memory>
|
||||
<vcpu cpuset='1-4,^3,6'>1</vcpu>
|
||||
|
@ -1,5 +1,7 @@
|
||||
<domain type='' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
|
||||
<name></name>
|
||||
<title></title>
|
||||
<description></description>
|
||||
<uuid></uuid>
|
||||
<memory></memory>
|
||||
<vcpu>1</vcpu>
|
||||
|
@ -1,5 +1,7 @@
|
||||
<domain type='' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
|
||||
<name></name>
|
||||
<title></title>
|
||||
<description></description>
|
||||
<uuid></uuid>
|
||||
<memory></memory>
|
||||
<vcpu>1</vcpu>
|
||||
|
@ -27,6 +27,8 @@ describe 'templates/domain' do
|
||||
|
||||
context 'when all settings enabled' do
|
||||
before do
|
||||
domain.title = 'title'
|
||||
domain.description = 'description'
|
||||
domain.instance_variable_set('@domain_type', 'kvm')
|
||||
domain.cpu_mode = 'custom'
|
||||
domain.cpu_feature(name: 'AAA', policy: 'required')
|
||||
|
Loading…
Reference in New Issue
Block a user