Port support for linked clones to VirtualBox 5.0 driver.
This commit is contained in:
parent
dbcb513075
commit
772f276ee3
|
@ -34,6 +34,15 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def clonevm(master_id, box_name, snapshot_name)
|
||||||
|
@logger.debug("Creating linked clone from master vm with id #{master_id} from snapshot '#{snapshot_name}'")
|
||||||
|
|
||||||
|
machine_name = "#{box_name}_#{snapshot_name}_clone_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}"
|
||||||
|
execute("clonevm", master_id, "--snapshot", snapshot_name, "--options", "link", "--register", "--name", machine_name)
|
||||||
|
|
||||||
|
return get_machine_id machine_name
|
||||||
|
end
|
||||||
|
|
||||||
def create_dhcp_server(network, options)
|
def create_dhcp_server(network, options)
|
||||||
execute("dhcpserver", "add", "--ifname", network,
|
execute("dhcpserver", "add", "--ifname", network,
|
||||||
"--ip", options[:dhcp_ip],
|
"--ip", options[:dhcp_ip],
|
||||||
|
@ -62,6 +71,10 @@ module VagrantPlugins
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def create_snapshot(machine_id, snapshot_name)
|
||||||
|
execute("snapshot", machine_id, "take", snapshot_name)
|
||||||
|
end
|
||||||
|
|
||||||
def delete
|
def delete
|
||||||
execute("unregistervm", @uuid, "--delete")
|
execute("unregistervm", @uuid, "--delete")
|
||||||
end
|
end
|
||||||
|
@ -156,6 +169,13 @@ module VagrantPlugins
|
||||||
execute("modifyvm", @uuid, *args) if !args.empty?
|
execute("modifyvm", @uuid, *args) if !args.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_machine_id(machine_name)
|
||||||
|
output = execute("list", "vms", retryable: true)
|
||||||
|
match = /^"#{Regexp.escape(machine_name)}" \{(.+?)\}$/.match(output)
|
||||||
|
return match[1].to_s if match
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
def halt
|
def halt
|
||||||
execute("controlvm", @uuid, "poweroff")
|
execute("controlvm", @uuid, "poweroff")
|
||||||
end
|
end
|
||||||
|
@ -231,10 +251,7 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
output = execute("list", "vms", retryable: true)
|
return get_machine_id specified_name
|
||||||
match = /^"#{Regexp.escape(specified_name)}" \{(.+?)\}$/.match(output)
|
|
||||||
return match[1].to_s if match
|
|
||||||
nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def max_network_adapters
|
def max_network_adapters
|
||||||
|
|
Loading…
Reference in New Issue