mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
commit
9cc0ff906c
@ -277,6 +277,10 @@ end
|
|||||||
_target_](http://libvirt.org/formatdomain.html#elementsDisks). NOTE: this
|
_target_](http://libvirt.org/formatdomain.html#elementsDisks). NOTE: this
|
||||||
option applies only to disks associated with a box image. To set the bus type
|
option applies only to disks associated with a box image. To set the bus type
|
||||||
on additional disks, see the [Additional Disks](#additional-disks) section.
|
on additional disks, see the [Additional Disks](#additional-disks) section.
|
||||||
|
* `disk_device` - The disk device to emulate. Defaults to vda if not
|
||||||
|
set, which should be fine for paravirtualized guests, but some fully
|
||||||
|
virtualized guests may require hda. NOTE: this option also applies only to
|
||||||
|
disks associated with a box image.
|
||||||
* `nic_model_type` - parameter specifies the model of the network adapter when
|
* `nic_model_type` - parameter specifies the model of the network adapter when
|
||||||
you create a domain value by default virtio KVM believe possible values, see
|
you create a domain value by default virtio KVM believe possible values, see
|
||||||
the [documentation for
|
the [documentation for
|
||||||
|
@ -42,6 +42,7 @@ module VagrantPlugins
|
|||||||
@machine_type = config.machine_type
|
@machine_type = config.machine_type
|
||||||
@machine_arch = config.machine_arch
|
@machine_arch = config.machine_arch
|
||||||
@disk_bus = config.disk_bus
|
@disk_bus = config.disk_bus
|
||||||
|
@disk_device = config.disk_device
|
||||||
@nested = config.nested
|
@nested = config.nested
|
||||||
@memory_size = config.memory.to_i * 1024
|
@memory_size = config.memory.to_i * 1024
|
||||||
@management_network_mac = config.management_network_mac
|
@management_network_mac = config.management_network_mac
|
||||||
|
@ -20,13 +20,19 @@ module VagrantPlugins
|
|||||||
libvirt_domain = env[:machine].provider.driver.connection.client.lookup_domain_by_uuid(
|
libvirt_domain = env[:machine].provider.driver.connection.client.lookup_domain_by_uuid(
|
||||||
env[:machine].id
|
env[:machine].id
|
||||||
)
|
)
|
||||||
libvirt_domain.list_snapshots.each do |name|
|
begin
|
||||||
@logger.info("Deleting snapshot '#{name}'")
|
libvirt_domain.list_snapshots.each do |name|
|
||||||
begin
|
@logger.info("Deleting snapshot '#{name}'")
|
||||||
libvirt_domain.lookup_snapshot_by_name(name).delete
|
begin
|
||||||
rescue => e
|
libvirt_domain.lookup_snapshot_by_name(name).delete
|
||||||
raise Errors::DeleteSnapshotError, error_message: e.message
|
rescue => e
|
||||||
|
raise Errors::DeleteSnapshotError, error_message: e.message
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
rescue
|
||||||
|
# Some drivers (xen) don't support getting list of snapshots,
|
||||||
|
# not much can be done here about it
|
||||||
|
@logger.warn("Failed to get list of snapshots")
|
||||||
end
|
end
|
||||||
|
|
||||||
# must remove managed saves
|
# must remove managed saves
|
||||||
|
@ -71,6 +71,7 @@ module VagrantPlugins
|
|||||||
attr_accessor :machine_arch
|
attr_accessor :machine_arch
|
||||||
attr_accessor :machine_virtual_size
|
attr_accessor :machine_virtual_size
|
||||||
attr_accessor :disk_bus
|
attr_accessor :disk_bus
|
||||||
|
attr_accessor :disk_device
|
||||||
attr_accessor :nic_model_type
|
attr_accessor :nic_model_type
|
||||||
attr_accessor :nested
|
attr_accessor :nested
|
||||||
attr_accessor :volume_cache
|
attr_accessor :volume_cache
|
||||||
@ -170,6 +171,7 @@ module VagrantPlugins
|
|||||||
@machine_arch = UNSET_VALUE
|
@machine_arch = UNSET_VALUE
|
||||||
@machine_virtual_size = UNSET_VALUE
|
@machine_virtual_size = UNSET_VALUE
|
||||||
@disk_bus = UNSET_VALUE
|
@disk_bus = UNSET_VALUE
|
||||||
|
@disk_device = UNSET_VALUE
|
||||||
@nic_model_type = UNSET_VALUE
|
@nic_model_type = UNSET_VALUE
|
||||||
@nested = UNSET_VALUE
|
@nested = UNSET_VALUE
|
||||||
@volume_cache = UNSET_VALUE
|
@volume_cache = UNSET_VALUE
|
||||||
@ -569,6 +571,7 @@ module VagrantPlugins
|
|||||||
@machine_arch = nil if @machine_arch == UNSET_VALUE
|
@machine_arch = nil if @machine_arch == UNSET_VALUE
|
||||||
@machine_virtual_size = nil if @machine_virtual_size == UNSET_VALUE
|
@machine_virtual_size = nil if @machine_virtual_size == UNSET_VALUE
|
||||||
@disk_bus = 'virtio' if @disk_bus == UNSET_VALUE
|
@disk_bus = 'virtio' if @disk_bus == UNSET_VALUE
|
||||||
|
@disk_device = 'vda' if @disk_device == UNSET_VALUE
|
||||||
@nic_model_type = 'virtio' if @nic_model_type == UNSET_VALUE
|
@nic_model_type = 'virtio' if @nic_model_type == UNSET_VALUE
|
||||||
@nested = false if @nested == UNSET_VALUE
|
@nested = false if @nested == UNSET_VALUE
|
||||||
@volume_cache = 'default' if @volume_cache == UNSET_VALUE
|
@volume_cache = 'default' if @volume_cache == UNSET_VALUE
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
<driver name='qemu' type='qcow2' cache='<%= @domain_volume_cache %>'/>
|
<driver name='qemu' type='qcow2' cache='<%= @domain_volume_cache %>'/>
|
||||||
<source file='<%= @domain_volume_path %>'/>
|
<source file='<%= @domain_volume_path %>'/>
|
||||||
<%# we need to ensure a unique target dev -%>
|
<%# we need to ensure a unique target dev -%>
|
||||||
<target dev='vda' bus='<%= @disk_bus %>'/>
|
<target dev='<%= @disk_device %>' bus='<%= @disk_bus %>'/>
|
||||||
</disk>
|
</disk>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%# additional disks -%>
|
<%# additional disks -%>
|
||||||
|
@ -18,7 +18,7 @@ class EnvironmentHelper
|
|||||||
1024
|
1024
|
||||||
end
|
end
|
||||||
|
|
||||||
%w(cpus cpu_mode loader boot_order machine_type disk_bus nested volume_cache kernel cmd_line initrd graphics_type graphics_autoport graphics_port graphics_ip graphics_passwd video_type video_vram keymap storage_pool_name disks cdroms driver).each do |name|
|
%w(cpus cpu_mode loader boot_order machine_type disk_bus disk_device nested volume_cache kernel cmd_line initrd graphics_type graphics_autoport graphics_port graphics_ip graphics_passwd video_type video_vram keymap storage_pool_name disks cdroms driver).each do |name|
|
||||||
define_method(name.to_sym) do
|
define_method(name.to_sym) do
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
@ -36,6 +36,7 @@ describe 'templates/domain' do
|
|||||||
domain.instance_variable_set('@domain_volume_path', '/var/lib/libvirt/images/test.qcow2')
|
domain.instance_variable_set('@domain_volume_path', '/var/lib/libvirt/images/test.qcow2')
|
||||||
domain.instance_variable_set('@domain_volume_cache', 'unsafe')
|
domain.instance_variable_set('@domain_volume_cache', 'unsafe')
|
||||||
domain.disk_bus = 'ide'
|
domain.disk_bus = 'ide'
|
||||||
|
domain.disk_device = 'vda'
|
||||||
domain.storage(:file, path: 'test-disk1.qcow2')
|
domain.storage(:file, path: 'test-disk1.qcow2')
|
||||||
domain.storage(:file, path: 'test-disk2.qcow2')
|
domain.storage(:file, path: 'test-disk2.qcow2')
|
||||||
domain.disks.each do |disk|
|
domain.disks.each do |disk|
|
||||||
|
Loading…
Reference in New Issue
Block a user