vagrant-vz 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: acef22fbe496d53711438adcd372d3b9c42bbd7c0dd7a0f7bd72ba36baab3710
4
+ data.tar.gz: a6688ea0abfa6ed7661fb5c7a4347e8b23bbcae0a0c44c43d366dc231b62201d
5
+ SHA512:
6
+ metadata.gz: b26f0621cbefb3002945a37500896ae56cecaf4d008ba3be044fed55a1b5b32cf7bfc5c8f51a51fc5f3dd34569871d0b434d6c11cf4e88021f2c69dd679a2ed7
7
+ data.tar.gz: b48af44f6763429fcfe714c49e826d7844908ab9d66beec6d2b4a9ee72809bad72a7afd102bfb327a526135b51626f5285ca132f0ef5cfa9ab378007a479a6d2
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Joaquin Menchaca
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,142 @@
1
+ # vagrant-vz
2
+
3
+ A [Vagrant](https://www.vagrantup.com/) provider for Apple's
4
+ Virtualization.framework (VZ) on macOS, built on
5
+ [vfkit](https://github.com/crc-org/vfkit).
6
+
7
+ Each machine is a vfkit process that boots a raw disk image with EFI, joins
8
+ macOS's built-in NAT network, and is reached over SSH at the address the
9
+ macOS DHCP server gave it. Host folders are shared with virtio-fs.
10
+
11
+ ## Requirements
12
+
13
+ - macOS 13 or later (EFI boot of Linux guests needs it)
14
+ - Vagrant 2.3 or later
15
+ - vfkit: `brew install vfkit`
16
+ - qemu-img, only to use boxes whose disks are not raw (for example `libvirt`
17
+ boxes): `brew install qemu`
18
+
19
+ ## Install
20
+
21
+ From a checkout:
22
+
23
+ ```bash
24
+ gem build vagrant-vz.gemspec
25
+ vagrant plugin install ./vagrant-vz-0.1.0.gem
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ ```ruby
31
+ Vagrant.configure("2") do |config|
32
+ config.vm.box = "hako/ubuntu-26.04"
33
+
34
+ config.vm.provider :vz do |vz|
35
+ vz.cpus = 4
36
+ vz.memory = 4096 # MiB
37
+ vz.disk_size = 40 # GiB, grows the boot disk before boot
38
+ end
39
+ end
40
+ ```
41
+
42
+ ```bash
43
+ vagrant up --provider vz
44
+ vagrant ssh
45
+ vagrant halt
46
+ vagrant destroy
47
+ ```
48
+
49
+ Supported commands: `up`, `halt`, `reload`, `destroy`, `ssh`, `ssh-config`,
50
+ `provision`, `status`.
51
+
52
+ ## Boxes
53
+
54
+ The provider accepts two box formats, preferring the first:
55
+
56
+ - **`vz`**: a raw `box.img` plus `metadata.json`. See
57
+ [example_box/README.md](example_box/README.md).
58
+ - **`libvirt`**: existing arm64 (or x86_64 on Intel Macs) libvirt boxes. Their
59
+ qcow2 disks are converted to raw with qemu-img on the first `vagrant up`.
60
+ The guest must be able to boot with EFI and bring up DHCP on a virtio-net
61
+ interface, which most cloud-image based boxes do.
62
+
63
+ Raw disks are copied with an APFS clone (`cp -c`), and converted disks are
64
+ written sparse, so a new machine takes almost no extra space until the guest
65
+ writes to it.
66
+
67
+ ## Configuration
68
+
69
+ | Option | Default | Description |
70
+ |-----------------|--------------|---------------------------------------------------------------------|
71
+ | `cpus` | `2` | Virtual CPUs |
72
+ | `memory` | `2048` | Memory in MiB |
73
+ | `disk_size` | `nil` | Grow the boot disk to this many GiB before boot; never shrinks |
74
+ | `gui` | `false` | Open a vfkit window with a display, keyboard and pointer |
75
+ | `rosetta` | `false` | `true` or a mount tag: share Rosetta with the guest (Apple Silicon) |
76
+ | `mac_address` | generated | MAC address of the NAT interface |
77
+ | `ip_timeout` | `180` | Seconds to wait for the guest to get an address and accept SSH |
78
+ | `vfkit_path` | `"vfkit"` | vfkit binary |
79
+ | `qemu_img_path` | `"qemu-img"` | qemu-img binary |
80
+ | `extra_args` | `[]` | Extra arguments appended to the vfkit command line |
81
+
82
+ `disk_size` only grows the image. The guest has to grow its partition and
83
+ filesystem, which cloud-init's `growpart` does on boot in most cloud images.
84
+
85
+ ## Networking
86
+
87
+ Machines use vfkit's NAT device (`virtio-net,nat`) on the `192.168.64.0/24`
88
+ network that macOS manages. The provider collects candidate addresses for the
89
+ guest's MAC from the ARP table and `/var/db/dhcpd_leases`, and uses the first
90
+ one that accepts connections on the SSH port. (Guests often hold two leases: an
91
+ early one from the firmware or initramfs, and the one the booted OS asked for,
92
+ which DHCP clients such as systemd-networkd record under a DUID rather than the
93
+ MAC.) Services in the guest can be used directly at `<guest-ip>:<port>`.
94
+
95
+ macOS Local Network privacy blocks connections to the guest from programs that
96
+ are not Apple-signed, and that includes Vagrant's bundled Ruby. To get around
97
+ this, SSH connections go through `/usr/bin/nc` as a proxy command, which is
98
+ exempt. Setting `config.ssh.proxy_command` overrides it.
99
+
100
+ Not supported yet: `forwarded_port`, `private_network` and `public_network`.
101
+
102
+ ## Synced folders
103
+
104
+ `virtiofs` is the default synced folder type for this provider. The devices
105
+ are attached when vfkit starts, and the folders are mounted with
106
+ `mount -t virtiofs` once SSH is up. Other types still work, for example:
107
+
108
+ ```ruby
109
+ config.vm.synced_folder ".", "/vagrant", type: "rsync"
110
+ ```
111
+
112
+ In the guest, files in a virtiofs share show up as owned by the user reading
113
+ them, so the `vagrant` user can read and write the project directory.
114
+
115
+ ## Machine files
116
+
117
+ Everything about a machine lives in `.vagrant/machines/<name>/vz/`:
118
+
119
+ | File | Contents |
120
+ |----------------------|-------------------------------------------|
121
+ | `disk0.img`, ... | Raw disks; `disk0.img` boots |
122
+ | `efi-variable-store` | EFI NVRAM |
123
+ | `mac` | MAC address of the NAT interface |
124
+ | `vfkit.pid` | pid of the running vfkit process |
125
+ | `vfkit.log` | vfkit output; look here when boot fails |
126
+ | `console.log` | Guest serial console |
127
+
128
+ vfkit's REST API socket, used to query and stop the VM, is in the per-user
129
+ temp directory because unix socket paths are limited to 104 bytes.
130
+
131
+ ## Development
132
+
133
+ ```bash
134
+ ruby -Ilib -Itest -e 'Dir["test/*_test.rb"].each { |f| require_relative f }'
135
+ ```
136
+
137
+ The unit tests cover the parts that do not need Vagrant: DHCP lease parsing,
138
+ disk format detection and conversion, and the vfkit command line.
139
+
140
+ ## License
141
+
142
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../vfkit_command"
4
+
5
+ module VagrantPlugins
6
+ module VZ
7
+ module Action
8
+ class Boot
9
+ include Vagrant::Action::Builtin::MixinSyncedFolders
10
+
11
+ def initialize(app, _env)
12
+ @app = app
13
+ end
14
+
15
+ def call(env)
16
+ machine = env[:machine]
17
+ config = machine.provider_config
18
+
19
+ unless Vagrant::Util::Which.which(config.vfkit_path)
20
+ raise Errors::VfkitNotFound, path: config.vfkit_path
21
+ end
22
+
23
+ shares = virtiofs_shares(machine)
24
+ machine.ui.info(I18n.t("vagrant_vz.booting", cpus: config.cpus, memory: config.memory))
25
+ machine.provider.driver.start(config, shares: shares)
26
+
27
+ @app.call(env)
28
+ end
29
+
30
+ private
31
+
32
+ # virtio-fs devices can only be attached at boot, so the folders that
33
+ # resolve to the virtiofs type are collected here and handed to vfkit.
34
+ def virtiofs_shares(machine)
35
+ folders = synced_folders(machine)[:virtiofs] || {}
36
+ folders.map do |id, data|
37
+ {
38
+ tag: VfkitCommand.mount_tag(id),
39
+ path: File.expand_path(data[:hostpath], machine.env.root_path)
40
+ }
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VagrantPlugins
4
+ module VZ
5
+ module Action
6
+ class Destroy
7
+ def initialize(app, _env)
8
+ @app = app
9
+ end
10
+
11
+ def call(env)
12
+ machine = env[:machine]
13
+ machine.ui.info(I18n.t("vagrant_vz.destroying"))
14
+ machine.provider.driver.destroy
15
+ machine.id = nil
16
+ @app.call(env)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VagrantPlugins
4
+ module VZ
5
+ module Action
6
+ # Runs when the guest did not shut down by itself (or on destroy):
7
+ # stops the VM through vfkit.
8
+ class ForceHalt
9
+ def initialize(app, _env)
10
+ @app = app
11
+ end
12
+
13
+ def call(env)
14
+ machine = env[:machine]
15
+ machine.ui.info(I18n.t("vagrant_vz.force_halting"))
16
+ machine.provider.driver.stop(force: true)
17
+ @app.call(env)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fileutils"
4
+ require "securerandom"
5
+
6
+ require_relative "../disk_image"
7
+
8
+ module VagrantPlugins
9
+ module VZ
10
+ module Action
11
+ # Copies the box's disks into the machine's data dir as raw images and
12
+ # gives the machine its identity (id and MAC address).
13
+ class Import
14
+ def initialize(app, _env)
15
+ @app = app
16
+ end
17
+
18
+ def call(env)
19
+ machine = env[:machine]
20
+ config = machine.provider_config
21
+ driver = machine.provider.driver
22
+ box = machine.box
23
+
24
+ sources = DiskImage.box_disks(box.directory, box.metadata)
25
+ raise Errors::BoxDiskNotFound, path: box.directory.to_s if sources.empty?
26
+
27
+ machine.ui.info(I18n.t("vagrant_vz.importing", name: box.name, provider: box.provider))
28
+ FileUtils.mkdir_p(driver.data_dir)
29
+
30
+ sources.each_with_index do |src, index|
31
+ format = DiskImage.detect_format(src)
32
+ if format != "raw" && !Vagrant::Util::Which.which(config.qemu_img_path)
33
+ raise Errors::QemuImgNotFound, path: config.qemu_img_path, disk_format: format
34
+ end
35
+
36
+ machine.ui.detail(I18n.t("vagrant_vz.importing_disk", src: src.basename, disk_format: format))
37
+ DiskImage.import(src, driver.disk_path(index), qemu_img: config.qemu_img_path)
38
+ end
39
+
40
+ # Native vz boxes may ship an EFI variable store; otherwise vfkit
41
+ # creates a fresh one on first boot.
42
+ box_efi = box.directory.join("efi-variable-store")
43
+ FileUtils.cp(box_efi, driver.efi_store_path) if box_efi.file?
44
+
45
+ driver.mac_path.write(config.mac_address || Driver.generate_mac)
46
+ machine.id = SecureRandom.uuid
47
+
48
+ @app.call(env)
49
+ rescue DiskImage::Error => e
50
+ cleanup(driver)
51
+ raise Errors::DiskImportFailed, message: e.message
52
+ rescue StandardError
53
+ cleanup(driver) if driver && machine.id.nil?
54
+ raise
55
+ end
56
+
57
+ private
58
+
59
+ def cleanup(driver)
60
+ driver.disks.each { |d| FileUtils.rm_f(d) }
61
+ FileUtils.rm_f(driver.efi_store_path)
62
+ FileUtils.rm_f(driver.mac_path)
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../disk_image"
4
+
5
+ module VagrantPlugins
6
+ module VZ
7
+ module Action
8
+ # Grows the boot disk to vz.disk_size GiB. The guest still has to grow
9
+ # its partition and filesystem; cloud-init's growpart does this on most
10
+ # cloud images.
11
+ class ResizeDisk
12
+ def initialize(app, _env)
13
+ @app = app
14
+ end
15
+
16
+ def call(env)
17
+ machine = env[:machine]
18
+ size = machine.provider_config.disk_size
19
+ if size
20
+ disk = machine.provider.driver.disk_path(0)
21
+ case DiskImage.grow(disk, size)
22
+ when :grown
23
+ machine.ui.info(I18n.t("vagrant_vz.disk_grown", size: size))
24
+ when :smaller
25
+ machine.ui.warn(I18n.t("vagrant_vz.disk_not_shrunk", size: size))
26
+ end
27
+ end
28
+
29
+ @app.call(env)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VagrantPlugins
4
+ module VZ
5
+ module Action
6
+ # Waits until one of the guest's candidate addresses (DHCP lease or ARP
7
+ # entry) accepts connections on the SSH port, so ssh_info has a host.
8
+ class WaitForIP
9
+ def initialize(app, _env)
10
+ @app = app
11
+ end
12
+
13
+ def call(env)
14
+ machine = env[:machine]
15
+ driver = machine.provider.driver
16
+ timeout = machine.provider_config.ip_timeout
17
+ port = machine.config.ssh.guest_port || 22
18
+
19
+ machine.ui.info(I18n.t("vagrant_vz.waiting_for_ip"))
20
+ deadline = Time.now + timeout
21
+ ip = nil
22
+ loop do
23
+ return if env[:interrupted]
24
+
25
+ ip = driver.discover_ip(port: port)
26
+ break if ip
27
+
28
+ unless driver.running?
29
+ raise Errors::VfkitStartFailed, log: driver.log_tail
30
+ end
31
+ if Time.now > deadline
32
+ raise Errors::IPNotFound, mac: driver.mac_address, timeout: timeout,
33
+ console: driver.console_log_path.to_s
34
+ end
35
+
36
+ sleep 2
37
+ end
38
+
39
+ machine.ui.detail(I18n.t("vagrant_vz.ip_found", ip: ip))
40
+ @app.call(env)
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,156 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "pathname"
4
+ require "vagrant/action/builder"
5
+
6
+ module VagrantPlugins
7
+ module VZ
8
+ module Action
9
+ include Vagrant::Action::Builtin
10
+
11
+ action_root = Pathname.new(File.expand_path("action", __dir__))
12
+ autoload :Boot, action_root.join("boot")
13
+ autoload :Destroy, action_root.join("destroy")
14
+ autoload :ForceHalt, action_root.join("force_halt")
15
+ autoload :Import, action_root.join("import")
16
+ autoload :ResizeDisk, action_root.join("resize_disk")
17
+ autoload :WaitForIP, action_root.join("wait_for_ip")
18
+
19
+ def self.builder
20
+ Vagrant::Action::Builder.new
21
+ end
22
+
23
+ def self.message(key)
24
+ I18n.t("vagrant_vz.#{key}")
25
+ end
26
+
27
+ def self.action_up
28
+ builder.tap do |b|
29
+ b.use ConfigValidate
30
+ b.use BoxCheckOutdated
31
+ b.use Call, IsState, :not_created do |env, b2|
32
+ if env[:result]
33
+ b2.use HandleBox
34
+ b2.use Import
35
+ end
36
+ end
37
+ b.use action_start
38
+ end
39
+ end
40
+
41
+ def self.action_start
42
+ builder.tap do |b|
43
+ b.use Call, IsState, :running do |env, b2|
44
+ if env[:result]
45
+ b2.use Message, message("already_running")
46
+ next
47
+ end
48
+
49
+ b2.use Provision
50
+ b2.use SyncedFolderCleanup
51
+ b2.use SyncedFolders
52
+ b2.use SetHostname
53
+ b2.use ResizeDisk
54
+ b2.use Boot
55
+ b2.use WaitForIP
56
+ b2.use WaitForCommunicator, [:running]
57
+ end
58
+ end
59
+ end
60
+
61
+ def self.action_halt
62
+ builder.tap do |b|
63
+ b.use ConfigValidate
64
+ b.use Call, IsState, :not_created do |env, b2|
65
+ if env[:result]
66
+ b2.use Message, message("not_created")
67
+ next
68
+ end
69
+
70
+ b2.use Call, IsState, :stopped do |env2, b3|
71
+ if env2[:result]
72
+ b3.use Message, message("already_stopped")
73
+ next
74
+ end
75
+
76
+ b3.use Call, GracefulHalt, :stopped, :running do |env3, b4|
77
+ b4.use ForceHalt unless env3[:result]
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
83
+
84
+ def self.action_reload
85
+ builder.tap do |b|
86
+ b.use ConfigValidate
87
+ b.use Call, IsState, :not_created do |env, b2|
88
+ if env[:result]
89
+ b2.use Message, message("not_created")
90
+ next
91
+ end
92
+
93
+ b2.use action_halt
94
+ b2.use action_start
95
+ end
96
+ end
97
+ end
98
+
99
+ def self.action_destroy
100
+ builder.tap do |b|
101
+ b.use Call, IsState, :not_created do |env, b2|
102
+ if env[:result]
103
+ b2.use Message, message("not_created")
104
+ next
105
+ end
106
+
107
+ b2.use Call, DestroyConfirm do |env2, b3|
108
+ if env2[:result]
109
+ b3.use ConfigValidate
110
+ b3.use ProvisionerCleanup, :before
111
+ b3.use EnvSet, force_halt: true
112
+ b3.use action_halt
113
+ b3.use Destroy
114
+ b3.use SyncedFolderCleanup
115
+ else
116
+ b3.use Message, message("will_not_destroy")
117
+ end
118
+ end
119
+ end
120
+ end
121
+ end
122
+
123
+ def self.action_provision
124
+ running_only do |b|
125
+ b.use Provision
126
+ end
127
+ end
128
+
129
+ def self.action_ssh
130
+ running_only do |b|
131
+ b.use SSHExec
132
+ end
133
+ end
134
+
135
+ def self.action_ssh_run
136
+ running_only do |b|
137
+ b.use SSHRun
138
+ end
139
+ end
140
+
141
+ def self.running_only
142
+ builder.tap do |b|
143
+ b.use ConfigValidate
144
+ b.use Call, IsState, :running do |env, b2|
145
+ unless env[:result]
146
+ b2.use Message, message("not_running")
147
+ next
148
+ end
149
+
150
+ yield b2
151
+ end
152
+ end
153
+ end
154
+ end
155
+ end
156
+ end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VagrantPlugins
4
+ module VZ
5
+ class Config < Vagrant.plugin("2", :config)
6
+ # Number of virtual CPUs.
7
+ attr_accessor :cpus
8
+ # Memory in MiB.
9
+ attr_accessor :memory
10
+ # Grow the boot disk to this many GiB before boot (never shrinks).
11
+ attr_accessor :disk_size
12
+ # Open a vfkit window with a virtio-gpu display, keyboard and pointer.
13
+ attr_accessor :gui
14
+ # Expose Rosetta to the guest under this mount tag (Apple Silicon only).
15
+ attr_accessor :rosetta
16
+ # Fixed MAC address for the NAT interface; generated when nil.
17
+ attr_accessor :mac_address
18
+ # Path or name of the vfkit binary.
19
+ attr_accessor :vfkit_path
20
+ # Path or name of qemu-img, used to convert non-raw box disks.
21
+ attr_accessor :qemu_img_path
22
+ # Seconds to wait for the guest to get an address and accept SSH.
23
+ attr_accessor :ip_timeout
24
+ # Extra arguments appended verbatim to the vfkit command line.
25
+ attr_accessor :extra_args
26
+
27
+ def initialize
28
+ @cpus = UNSET_VALUE
29
+ @memory = UNSET_VALUE
30
+ @disk_size = UNSET_VALUE
31
+ @gui = UNSET_VALUE
32
+ @rosetta = UNSET_VALUE
33
+ @mac_address = UNSET_VALUE
34
+ @vfkit_path = UNSET_VALUE
35
+ @qemu_img_path = UNSET_VALUE
36
+ @ip_timeout = UNSET_VALUE
37
+ @extra_args = UNSET_VALUE
38
+ end
39
+
40
+ def finalize!
41
+ @cpus = 2 if @cpus == UNSET_VALUE
42
+ @memory = 2048 if @memory == UNSET_VALUE
43
+ @disk_size = nil if @disk_size == UNSET_VALUE
44
+ @gui = false if @gui == UNSET_VALUE
45
+ @rosetta = false if @rosetta == UNSET_VALUE
46
+ @rosetta = "rosetta" if @rosetta == true
47
+ @mac_address = nil if @mac_address == UNSET_VALUE
48
+ @vfkit_path = "vfkit" if @vfkit_path == UNSET_VALUE
49
+ @qemu_img_path = "qemu-img" if @qemu_img_path == UNSET_VALUE
50
+ @ip_timeout = 180 if @ip_timeout == UNSET_VALUE
51
+ @extra_args = [] if @extra_args == UNSET_VALUE
52
+ @extra_args = Array(@extra_args).map(&:to_s)
53
+ end
54
+
55
+ def validate(_machine)
56
+ errors = _detected_errors
57
+
58
+ errors << "vz.cpus must be a positive integer" unless positive_int?(@cpus)
59
+ errors << "vz.memory must be an integer number of MiB, at least 256" \
60
+ unless @memory.is_a?(Integer) && @memory >= 256
61
+ errors << "vz.disk_size must be a positive integer number of GiB" \
62
+ unless @disk_size.nil? || positive_int?(@disk_size)
63
+ errors << "vz.ip_timeout must be a positive integer" unless positive_int?(@ip_timeout)
64
+ if @mac_address && @mac_address !~ /\A\h{2}(:\h{2}){5}\z/
65
+ errors << "vz.mac_address must look like 52:54:00:12:34:56"
66
+ end
67
+ if @rosetta && !(@rosetta.is_a?(String) && !@rosetta.empty?)
68
+ errors << "vz.rosetta must be true, false or a mount tag string"
69
+ end
70
+
71
+ { "VZ Provider" => errors }
72
+ end
73
+
74
+ private
75
+
76
+ def positive_int?(value)
77
+ value.is_a?(Integer) && value.positive?
78
+ end
79
+ end
80
+ end
81
+ end