From 8eafb5ff941e6cbe3427456cedbf8b881bc847e3 Mon Sep 17 00:00:00 2001 From: Denys Vitali Date: Mon, 11 Sep 2017 17:38:36 +0200 Subject: [PATCH] Fixes #37 --- Gemfile.lock | 6 ++---- README.md | 2 ++ lib/vagrant-proxmox/action/create_vm.rb | 2 +- lib/vagrant-proxmox/config.rb | 7 +++++++ lib/vagrant-proxmox/version.rb | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ff0fe15..3bbd379 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -14,7 +14,7 @@ GIT PATH remote: . specs: - vagrant-proxmox (0.0.11) + vagrant-proxmox (0.0.12) activesupport (~> 4.0.0) rest-client (~> 2.0) retryable (~> 1.3.3) @@ -70,7 +70,6 @@ GEM guard (~> 2.1) rspec (>= 2.14, < 4.0) hashdiff (0.3.6) - http-accept (1.7.0) http-cookie (1.0.3) domain_name (~> 0.5) httpclient (2.8.3) @@ -112,8 +111,7 @@ GEM rb-fsevent (0.10.2) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) - rest-client (2.1.0.rc1) - http-accept (>= 1.7.0, < 2.0) + rest-client (2.0.2) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) diff --git a/README.md b/README.md index c41b475..646c92b 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ Vagrant.configure('2') do |config| proxmox.qemu_os = :l26 proxmox.qemu_disk_size = '30G' proxmox.qemu_storage = 'local' + proxmox.qemu_format = 'raw' proxmox.qemu_iso_file = '/home/user/system.iso' proxmox.vm_name_prefix = 'vagrant_test_' proxmox.qemu_cores = 1 @@ -137,6 +138,7 @@ Finally run `vagrant up --provider=proxmox` to create and start the new OpenVZ c * `qemu_nic_model` which model of network interface card to use, default 'e1000' * `qemu_bridge` connect automatically to this bridge, default 'vmbr0' * `selected_node` If specified, only this specific node is used to create machines +* `qemu_format` If specified, sets the image format (default: qcow2) ## Build the plugin diff --git a/lib/vagrant-proxmox/action/create_vm.rb b/lib/vagrant-proxmox/action/create_vm.rb index 70bd985..a2103b4 100644 --- a/lib/vagrant-proxmox/action/create_vm.rb +++ b/lib/vagrant-proxmox/action/create_vm.rb @@ -43,7 +43,7 @@ def create_params_qemu(config, env, vm_id) name: env[:machine].config.vm.hostname || env[:machine].name.to_s, ostype: config.qemu_os, ide2: "#{config.qemu_iso},media=cdrom", - sata0: "#{config.qemu_storage}:#{config.qemu_disk_size},format=qcow2", + sata0: "#{config.qemu_storage}:#{config.qemu_disk_size},format=#{config.qemu_format}", sockets: config.qemu_sockets, cores: config.qemu_cores, memory: config.vm_memory, diff --git a/lib/vagrant-proxmox/config.rb b/lib/vagrant-proxmox/config.rb index e9c0896..3a63e9c 100644 --- a/lib/vagrant-proxmox/config.rb +++ b/lib/vagrant-proxmox/config.rb @@ -151,6 +151,12 @@ class Config < Vagrant.plugin('2', :config) # @return [String] attr_accessor :qemu_bridge + # The qemu format, e.g. 'qcow2' + # defaults to 'qcow2' + # + # @return [String] + attr_accessor :qemu_format + def initialize @endpoint = UNSET_VALUE @selected_node = UNSET_VALUE @@ -181,6 +187,7 @@ def initialize @qemu_storage = 'raid' @qemu_nic_model = 'e1000' @qemu_bridge = 'vmbr0' + @qemu_format = 'qcow2' end # This is the hook that is called to finalize the object before it is put into use. diff --git a/lib/vagrant-proxmox/version.rb b/lib/vagrant-proxmox/version.rb index 1976b8a..98b3d60 100644 --- a/lib/vagrant-proxmox/version.rb +++ b/lib/vagrant-proxmox/version.rb @@ -1,7 +1,7 @@ module VagrantPlugins module Proxmox - VERSION = '0.0.11' + VERSION = '0.0.12' end end