Add virtualbox driver method for obtaining vm information
This commit is contained in:
parent
9bf41d34ba
commit
16cccd504a
@ -8,6 +8,7 @@ module VagrantPlugins
|
||||
# @param [VagrantPlugins::Kernel_V2::VagrantConfigDisk] defined_disks
|
||||
def self.configure_disks(machine, defined_disks)
|
||||
return nil if defined_disks.empty?
|
||||
disks = current_vm_disks(machine)
|
||||
end
|
||||
|
||||
protected
|
||||
@ -15,13 +16,15 @@ module VagrantPlugins
|
||||
# Maybe move these into the virtualbox driver??
|
||||
# Versioning might be an issue :shrug:
|
||||
|
||||
def current_vm_disks(driver)
|
||||
def self.current_vm_disks(machine)
|
||||
disks = {}
|
||||
info = machine.provider.driver.show_vm_info(machine.id)
|
||||
end
|
||||
|
||||
def vmdk_to_vdi(driver)
|
||||
def self.vmdk_to_vdi(driver)
|
||||
end
|
||||
|
||||
def vdi_to_vmdk(driver)
|
||||
def self.vdi_to_vmdk(driver)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -368,6 +368,21 @@ module VagrantPlugins
|
||||
def vm_exists?(uuid)
|
||||
end
|
||||
|
||||
# Returns a hash of information about a given virtual machine
|
||||
#
|
||||
# @param [String] uuid
|
||||
# @return [Hash] info
|
||||
def show_vm_info(uuid)
|
||||
info = {}
|
||||
execute('showvminfo', uuid, '--machinereadable', retryable: true).split("\n").each do |line|
|
||||
parts = line.partition('=')
|
||||
key = parts.first.gsub('"', '')
|
||||
value = parts.last.gsub('"', '')
|
||||
info[key] = value
|
||||
end
|
||||
info
|
||||
end
|
||||
|
||||
# Execute the given subcommand for VBoxManage and return the output.
|
||||
def execute(*command, &block)
|
||||
# Get the options hash if it exists
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user