diff options
Diffstat (limited to 'boxes')
-rwxr-xr-x | boxes/vvp-empty/0.0.0/virtualbox/Vagrantfile | 83 | ||||
-rwxr-xr-x | boxes/vvp-empty/0.0.0/virtualbox/base_mac.rb | 41 | ||||
-rwxr-xr-x | boxes/vvp-empty/0.0.0/virtualbox/box.ovf | 257 | ||||
-rwxr-xr-x | boxes/vvp-empty/0.0.0/virtualbox/change_host_name.rb | 75 | ||||
-rwxr-xr-x | boxes/vvp-empty/0.0.0/virtualbox/configure_networks.rb | 180 | ||||
-rwxr-xr-x | boxes/vvp-empty/0.0.0/virtualbox/files/intel--virtio-net--pcnet32.isarom | bin | 0 -> 56832 bytes | |||
-rwxr-xr-x | boxes/vvp-empty/0.0.0/virtualbox/metadata.json | 1 |
7 files changed, 637 insertions, 0 deletions
diff --git a/boxes/vvp-empty/0.0.0/virtualbox/Vagrantfile b/boxes/vvp-empty/0.0.0/virtualbox/Vagrantfile new file mode 100755 index 0000000..0e079f8 --- /dev/null +++ b/boxes/vvp-empty/0.0.0/virtualbox/Vagrantfile @@ -0,0 +1,83 @@ +# -*- encoding: utf-8 -*- +# ============LICENSE_START======================================================= +# org.onap.vvp/engagementmgr +# =================================================================== +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# =================================================================== +# +# Unless otherwise specified, all software contained herein is licensed +# under the Apache License, Version 2.0 (the “License”); +# you may not use this software except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============LICENSE_END============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# -*- mode: ruby -*- +# # vi: set ft=ruby : + +if Vagrant::VERSION < "1.6.0" + raise "Need at least vagrant version 1.6.0, please update" +end + +require_relative 'change_host_name.rb' +require_relative 'configure_networks.rb' +require_relative 'base_mac.rb' + +Vagrant.configure("2") do |config| + # always use Vagrants insecure key + config.ssh.insert_key = false + + # SSH in as the default 'core' user, it has the vagrant ssh key. + config.ssh.username = "core" + + # Disable the base shared folder, guest additions are unavailable. + config.vm.synced_folder ".", "/vagrant", disabled: true + + config.vm.provider :virtualbox do |vb| + # Guest Additions are unavailable. + vb.check_guest_additions = false + vb.functional_vboxsf = false + + # Fix docker not being able to resolve private registry in VirtualBox + vb.customize ["modifyvm", :id, "--natdnshostresolver1", "off"] + vb.customize ["modifyvm", :id, "--natdnsproxy1", "off"] + vb.customize ['modifyvm', :id, "--boot1", "disk"] + vb.customize ['modifyvm', :id, "--boot2", "net"] + vb.customize ['setextradata', :id, "VBoxInternal/Devices/pcbios/0/Config/LanBootRom", File.join(File.dirname(__FILE__),"/files/intel--virtio-net--pcnet32.isarom")] + + end + + config.vm.provider :vmware_fusion do |vf| + vf.functional_hgfs = false + end + + config.vm.provider :parallels do |prl| + # Guest Tools are unavailable. + prl.check_guest_tools = false + prl.functional_psf = false + end + end diff --git a/boxes/vvp-empty/0.0.0/virtualbox/base_mac.rb b/boxes/vvp-empty/0.0.0/virtualbox/base_mac.rb new file mode 100755 index 0000000..6877374 --- /dev/null +++ b/boxes/vvp-empty/0.0.0/virtualbox/base_mac.rb @@ -0,0 +1,41 @@ +# -*- encoding: utf-8 -*- +# ============LICENSE_START======================================================= +# org.onap.vvp/engagementmgr +# =================================================================== +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# =================================================================== +# +# Unless otherwise specified, all software contained herein is licensed +# under the Apache License, Version 2.0 (the “License”); +# you may not use this software except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============LICENSE_END============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +Vagrant.configure("2") do |config| + config.vm.base_mac = "080027DBFA4A" +end diff --git a/boxes/vvp-empty/0.0.0/virtualbox/box.ovf b/boxes/vvp-empty/0.0.0/virtualbox/box.ovf new file mode 100755 index 0000000..1cbc01e --- /dev/null +++ b/boxes/vvp-empty/0.0.0/virtualbox/box.ovf @@ -0,0 +1,257 @@ +# -*- encoding: utf-8 -*- +# ============LICENSE_START======================================================= +# org.onap.vvp/engagementmgr +# =================================================================== +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# =================================================================== +# +# Unless otherwise specified, all software contained herein is licensed +# under the Apache License, Version 2.0 (the “License”); +# you may not use this software except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============LICENSE_END============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +<?xml version="1.0"?> +<Envelope ovf:version="1.0" xml:lang="en-US" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vbox="http://www.virtualbox.org/ovf/machine"> + <References> + <File ovf:href="vvp_empty_vagrant_image.vmdk" ovf:id="file1"/> + </References> + <DiskSection> + <Info>List of the virtual disks used in the package</Info> + <Disk ovf:capacity="19818086400" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" vbox:uuid="80707dc6-2f5b-4c66-aa82-9c0873514edd"/> + </DiskSection> + <NetworkSection> + <Info>Logical networks used in the package</Info> + <Network ovf:name="NAT"> + <Description>Logical network used by this appliance.</Description> + </Network> + </NetworkSection> + <VirtualSystem ovf:id="vvp_empty_vagrant-0-0-0"> + <Info>A virtual machine</Info> + <OperatingSystemSection ovf:id="100"> + <Info>The kind of installed guest operating system</Info> + <Description>Linux26_64</Description> + <vbox:OSType ovf:required="false">Linux26_64</vbox:OSType> + </OperatingSystemSection> + <VirtualHardwareSection> + <Info>Virtual hardware requirements for a virtual machine</Info> + <System> + <vssd:ElementName>Virtual Hardware Family</vssd:ElementName> + <vssd:InstanceID>0</vssd:InstanceID> + <vssd:VirtualSystemIdentifier>vvp_empty_vagrant-0-0-0</vssd:VirtualSystemIdentifier> + <vssd:VirtualSystemType>virtualbox-2.2</vssd:VirtualSystemType> + </System> + <Item> + <rasd:Caption>1 virtual CPU</rasd:Caption> + <rasd:Description>Number of virtual CPUs</rasd:Description> + <rasd:ElementName>1 virtual CPU</rasd:ElementName> + <rasd:InstanceID>1</rasd:InstanceID> + <rasd:ResourceType>3</rasd:ResourceType> + <rasd:VirtualQuantity>1</rasd:VirtualQuantity> + </Item> + <Item> + <rasd:AllocationUnits>MegaBytes</rasd:AllocationUnits> + <rasd:Caption>1024 MB of memory</rasd:Caption> + <rasd:Description>Memory Size</rasd:Description> + <rasd:ElementName>1024 MB of memory</rasd:ElementName> + <rasd:InstanceID>2</rasd:InstanceID> + <rasd:ResourceType>4</rasd:ResourceType> + <rasd:VirtualQuantity>1024</rasd:VirtualQuantity> + </Item> + <Item> + <rasd:Address>0</rasd:Address> + <rasd:Caption>ideController0</rasd:Caption> + <rasd:Description>IDE Controller</rasd:Description> + <rasd:ElementName>ideController0</rasd:ElementName> + <rasd:InstanceID>3</rasd:InstanceID> + <rasd:ResourceSubType>PIIX4</rasd:ResourceSubType> + <rasd:ResourceType>5</rasd:ResourceType> + </Item> + <Item> + <rasd:Address>1</rasd:Address> + <rasd:Caption>ideController1</rasd:Caption> + <rasd:Description>IDE Controller</rasd:Description> + <rasd:ElementName>ideController1</rasd:ElementName> + <rasd:InstanceID>4</rasd:InstanceID> + <rasd:ResourceSubType>PIIX4</rasd:ResourceSubType> + <rasd:ResourceType>5</rasd:ResourceType> + </Item> + <Item> + <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> + <rasd:Caption>Ethernet adapter on 'NAT'</rasd:Caption> + <rasd:Connection>NAT</rasd:Connection> + <rasd:ElementName>Ethernet adapter on 'NAT'</rasd:ElementName> + <rasd:InstanceID>5</rasd:InstanceID> + <rasd:ResourceSubType>E1000</rasd:ResourceSubType> + <rasd:ResourceType>10</rasd:ResourceType> + </Item> + <Item> + <rasd:AddressOnParent>0</rasd:AddressOnParent> + <rasd:Caption>disk1</rasd:Caption> + <rasd:Description>Disk Image</rasd:Description> + <rasd:ElementName>disk1</rasd:ElementName> + <rasd:HostResource>/disk/vmdisk1</rasd:HostResource> + <rasd:InstanceID>6</rasd:InstanceID> + <rasd:Parent>3</rasd:Parent> + <rasd:ResourceType>17</rasd:ResourceType> + </Item> + </VirtualHardwareSection> + <vbox:Machine ovf:required="false" version="1.12-linux" uuid="{265e4a05-3032-499e-a0dd-c7036457c569}" name="vvp_empty_vagrant-0-0-0" OSType="Linux26_64" snapshotFolder="Snapshots" lastStateChange="2017-02-28T01:20:23Z"> + <ovf:Info>Complete VirtualBox machine configuration in VirtualBox format</ovf:Info> + <Hardware version="2"> + <CPU count="1" hotplug="false"> + <HardwareVirtEx enabled="true" exclusive="true"/> + <HardwareVirtExNestedPaging enabled="true"/> + <HardwareVirtExVPID enabled="true"/> + <PAE enabled="true"/> + <HardwareVirtExLargePages enabled="false"/> + <HardwareVirtForce enabled="false"/> + </CPU> + <Memory RAMSize="1024" PageFusion="false"/> + <HID Pointing="PS2Mouse" Keyboard="PS2Keyboard"/> + <HPET enabled="false"/> + <Chipset type="PIIX3"/> + <Boot> + <Order position="1" device="HardDisk"/> + <Order position="2" device="DVD"/> + <Order position="3" device="None"/> + <Order position="4" device="None"/> + </Boot> + <Display VRAMSize="8" monitorCount="1" accelerate3D="false" accelerate2DVideo="false"/> + <VideoRecording enabled="false" file="Test.webm" horzRes="640" vertRes="480"/> + <RemoteDisplay enabled="false" authType="Null"/> + <BIOS> + <ACPI enabled="true"/> + <IOAPIC enabled="true"/> + <Logo fadeIn="true" fadeOut="true" displayTime="0"/> + <BootMenu mode="MessageAndMenu"/> + <TimeOffset value="0"/> + <PXEDebug enabled="false"/> + </BIOS> + <USBController enabled="false" enabledEhci="false"/> + <Network> + <Adapter slot="0" enabled="true" MACAddress="080027DBFA4A" cable="true" speed="0" type="virtio"> + <DisabledModes/> + <NAT> + <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/> + <Alias logging="false" proxy-only="false" use-same-ports="false"/> + </NAT> + </Adapter> + <Adapter slot="1" enabled="false" MACAddress="080027A7BBCD" cable="true" speed="0" type="virtio"> + <DisabledModes> + <NAT> + <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/> + <Alias logging="false" proxy-only="false" use-same-ports="false"/> + </NAT> + </DisabledModes> + </Adapter> + <Adapter slot="2" enabled="false" MACAddress="080027F87C5E" cable="true" speed="0" type="virtio"> + <DisabledModes> + <NAT> + <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/> + <Alias logging="false" proxy-only="false" use-same-ports="false"/> + </NAT> + </DisabledModes> + </Adapter> + <Adapter slot="3" enabled="false" MACAddress="0800276EC0C1" cable="true" speed="0" type="virtio"> + <DisabledModes> + <NAT> + <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/> + <Alias logging="false" proxy-only="false" use-same-ports="false"/> + </NAT> + </DisabledModes> + </Adapter> + <Adapter slot="4" enabled="false" MACAddress="080027239019" cable="true" speed="0" type="virtio"> + <DisabledModes> + <NAT> + <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/> + <Alias logging="false" proxy-only="false" use-same-ports="false"/> + </NAT> + </DisabledModes> + </Adapter> + <Adapter slot="5" enabled="false" MACAddress="0800278EB5EB" cable="true" speed="0" type="virtio"> + <DisabledModes> + <NAT> + <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/> + <Alias logging="false" proxy-only="false" use-same-ports="false"/> + </NAT> + </DisabledModes> + </Adapter> + <Adapter slot="6" enabled="false" MACAddress="080027471B4A" cable="true" speed="0" type="virtio"> + <DisabledModes> + <NAT> + <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/> + <Alias logging="false" proxy-only="false" use-same-ports="false"/> + </NAT> + </DisabledModes> + </Adapter> + <Adapter slot="7" enabled="false" MACAddress="080027DB9457" cable="true" speed="0" type="virtio"> + <DisabledModes> + <NAT> + <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/> + <Alias logging="false" proxy-only="false" use-same-ports="false"/> + </NAT> + </DisabledModes> + </Adapter> + </Network> + <UART> + <Port slot="0" enabled="false" IOBase="0x3f8" IRQ="4" hostMode="Disconnected"/> + <Port slot="1" enabled="false" IOBase="0x2f8" IRQ="3" hostMode="Disconnected"/> + </UART> + <LPT> + <Port slot="0" enabled="false" IOBase="0x378" IRQ="7"/> + <Port slot="1" enabled="false" IOBase="0x378" IRQ="7"/> + </LPT> + <AudioAdapter controller="AC97" driver="Pulse" enabled="false"/> + <RTC localOrUTC="local"/> + <SharedFolders/> + <Clipboard mode="Disabled"/> + <DragAndDrop mode="Disabled"/> + <IO> + <IoCache enabled="true" size="5"/> + <BandwidthGroups/> + </IO> + <HostPci> + <Devices/> + </HostPci> + <EmulatedUSB> + <CardReader enabled="false"/> + </EmulatedUSB> + <Guest memoryBalloonSize="0"/> + <GuestProperties/> + </Hardware> + <StorageControllers> + <StorageController name="IDE Controller" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true"> + <AttachedDevice type="HardDisk" port="0" device="0"> + <Image uuid="{80707dc6-2f5b-4c66-aa82-9c0873514edd}"/> + </AttachedDevice> + </StorageController> + </StorageControllers> + </vbox:Machine> + </VirtualSystem> +</Envelope> diff --git a/boxes/vvp-empty/0.0.0/virtualbox/change_host_name.rb b/boxes/vvp-empty/0.0.0/virtualbox/change_host_name.rb new file mode 100755 index 0000000..d8d81ad --- /dev/null +++ b/boxes/vvp-empty/0.0.0/virtualbox/change_host_name.rb @@ -0,0 +1,75 @@ +# -*- encoding: utf-8 -*- +# ============LICENSE_START======================================================= +# org.onap.vvp/engagementmgr +# =================================================================== +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# =================================================================== +# +# Unless otherwise specified, all software contained herein is licensed +# under the Apache License, Version 2.0 (the “License”); +# you may not use this software except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============LICENSE_END============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# -*- mode: ruby -*- +# # vi: set ft=ruby : + +# NOTE: This monkey-patching of the coreos guest plugin is a terrible +# hack that needs to be removed once the upstream plugin works with +# alpha CoreOS images. + +require 'tempfile' +require Vagrant.source_root.join("plugins/guests/coreos/cap/change_host_name.rb") + +CLOUD_CONFIG = <<EOF +#cloud-config + +hostname: %s +EOF + +module VagrantPlugins + module GuestCoreOS + module Cap + class ChangeHostName + def self.change_host_name(machine, name) + machine.communicate.tap do |comm| + temp = Tempfile.new("coreos-vagrant") + temp.binmode + temp.write(CLOUD_CONFIG % [name]) + temp.close + + path = "/var/tmp/hostname.yml" + path_esc = path.gsub("/", "-")[1..-1] + comm.upload(temp.path, path) + comm.sudo("systemctl start system-cloudinit@#{path_esc}.service") + end + end + end + end + end +end diff --git a/boxes/vvp-empty/0.0.0/virtualbox/configure_networks.rb b/boxes/vvp-empty/0.0.0/virtualbox/configure_networks.rb new file mode 100755 index 0000000..dc81ea3 --- /dev/null +++ b/boxes/vvp-empty/0.0.0/virtualbox/configure_networks.rb @@ -0,0 +1,180 @@ +# -*- encoding: utf-8 -*- +# ============LICENSE_START======================================================= +# org.onap.vvp/engagementmgr +# =================================================================== +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# =================================================================== +# +# Unless otherwise specified, all software contained herein is licensed +# under the Apache License, Version 2.0 (the “License”); +# you may not use this software except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============LICENSE_END============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# -*- mode: ruby -*- +# # vi: set ft=ruby : + +# NOTE: This monkey-patching of the coreos guest plugin is a terrible +# hack that needs to be removed once the upstream plugin works with +# alpha CoreOS images. + +require 'tempfile' +require 'ipaddr' +require 'log4r' +require Vagrant.source_root.join("plugins/guests/coreos/cap/configure_networks.rb") + +BASE_CLOUD_CONFIG = <<EOF +#cloud-config + +write_files: + - path: /etc/environment + content: | + COREOS_PUBLIC_IPV4=%s + COREOS_PRIVATE_IPV4=%s +coreos: + units: +EOF + +NETWORK_UNIT = <<EOF + - name: %s + runtime: no + content: | + [Match] + %s + + [Network] + Address=%s +EOF + +# Borrowed from http://stackoverflow.com/questions/1825928/netmask-to-cidr-in-ruby +IPAddr.class_eval do + def to_cidr + self.to_i.to_s(2).count("1") + end +end + +module VagrantPlugins + module GuestCoreOS + module Cap + class ConfigureNetworks + @@logger = Log4r::Logger.new("vagrant::guest::coreos::configure_networks") + + def self.configure_networks(machine, networks) + public_ipv4, private_ipv4 = get_environment_ips(machine, "127.0.0.1") + cfg = BASE_CLOUD_CONFIG % [public_ipv4, private_ipv4] + + # Define network units by mac address if possible. + match_rules = {} + if false + #if machine.provider.capability?(:nic_mac_addresses) + # untested, required feature hasn't made it into a release yet + match_rules = match_by_mac(machine) + else + match_rules = match_by_name(machine) + end + + @@logger.debug("Networks: #{networks.inspect}") + @@logger.debug("Interfaces: #{match_rules.inspect}") + + # Generate any static networks, let DHCP handle the rest + networks.each do |network| + next if network[:type].to_sym != :static + interface = network[:interface].to_i + unit_name = "50-vagrant%d.network" % [interface] + + match = match_rules[interface] + if match.nil? + @@logger.warn("Could not find match rule for network #{network.inspect}") + next + end + + cidr = IPAddr.new(network[:netmask]).to_cidr + address = "%s/%s" % [network[:ip], cidr] + cfg << NETWORK_UNIT % [unit_name, match, address] + end + + machine.communicate.tap do |comm| + temp = Tempfile.new("coreos-vagrant") + temp.binmode + temp.write(cfg) + temp.close + + path = "/var/tmp/networks.yml" + path_esc = path.gsub("/", "-")[1..-1] + comm.upload(temp.path, path) + comm.sudo("systemctl start system-cloudinit@#{path_esc}.service") + end + end + + # Find IP addresses to export in /etc/environment. This only works + # for static addresses defined in the user's Vagrantfile. + def self.get_environment_ips(machine, default) + public_ipv4 = nil + private_ipv4 = nil + + machine.config.vm.networks.each do |type, options| + next if !options[:ip] + if type == :public_network + public_ipv4 = options[:ip] + elsif type == :private_network + private_ipv4 = options[:ip] + end + end + + # Fall back to localhost if no static networks are configured. + private_ipv4 ||= default + public_ipv4 ||= private_ipv4 + return [public_ipv4, private_ipv4] + end + + def self.match_by_name(machine) + match = {} + machine.communicate.tap do |comm| + comm.sudo("ifconfig -a | grep '^en\\|^eth' | cut -f1 -d:") do |_, result| + result.split("\n").each_with_index do |name, interface| + match[interface] = "Name=#{name}" + end + end + end + match + end + + def self.match_by_mac(machine) + match = {} + macs = machine.provider.capability(:nic_mac_addresses) + macs.each do |adapter, address| + # The adapter list from VirtualBox is 1 indexed instead of 0 + interface = adapter.to_i - 1 + match[interface] = "MACAddress=#{address}" + end + match + end + end + end + end +end diff --git a/boxes/vvp-empty/0.0.0/virtualbox/files/intel--virtio-net--pcnet32.isarom b/boxes/vvp-empty/0.0.0/virtualbox/files/intel--virtio-net--pcnet32.isarom Binary files differnew file mode 100755 index 0000000..945bb35 --- /dev/null +++ b/boxes/vvp-empty/0.0.0/virtualbox/files/intel--virtio-net--pcnet32.isarom diff --git a/boxes/vvp-empty/0.0.0/virtualbox/metadata.json b/boxes/vvp-empty/0.0.0/virtualbox/metadata.json new file mode 100755 index 0000000..4fc99bd --- /dev/null +++ b/boxes/vvp-empty/0.0.0/virtualbox/metadata.json @@ -0,0 +1 @@ +{"provider": "virtualbox"} |