Permalink
Browse files

allow an optional second volume to be created and attached to the box

  • Loading branch information...
joesolly committed Jun 15, 2018
1 parent de4f363 commit 859457387939e8a883c57972556b65e4c649034b
View
@@ -218,6 +218,8 @@ def get_parser():
help="Attach source image to this device.")
g.add_argument("--volume-size", type=int,
help="Minimum size of the main volume in GB e.g. 16")
g.add_argument("--second-volume-size", type=int,
help="The size of an optional second volume in GB e.g. 16")
g = parser.add_argument_group("Provisioner")
g.add_argument("--yum-proxy",
@@ -245,6 +247,8 @@ def main():
package_script = PACKAGE_VIRTUALBOX_SCRIPT if args.provider == 'virtualbox' else PACKAGE_VMWARE_SCRIPT
guest_script = GUEST_VIRTUALBOX_SCRIPT if args.provider == 'virtualbox' else GUEST_VMWARE_SCRIPT
second_volume_size = str(args.second_volume_size) if args.second_volume_size else ''
# Allocate run identifier to uniquely name temporary resources.
run_name = "ectou-export-{run_id}".format(run_id=uuid.uuid4())
@@ -331,7 +335,7 @@ def main():
provision_file_get(ssh_client, "export.vmdk", vmdk)
# Package vmdk into vagrant box
local_cmd(["bash", package_script, vmdk, box])
local_cmd(["bash", package_script, vmdk, box, second_volume_size])
# Install guest additions, apply security updates.
local_cmd(["bash", guest_script, box, guestbox])
@@ -10,6 +10,7 @@ set -ex
vmdk="$1"
box="$2"
second_volume_size="$3"
vmname="$(basename "${vmdk}" .vmdk)"
@@ -19,6 +20,10 @@ VBoxManage createvm --name "${vmname}" --ostype RedHat_64 --register
# Configure vmdk disk
VBoxManage storagectl "${vmname}" --name SATA --add sata --controller IntelAhci
VBoxManage storageattach "${vmname}" --storagectl SATA --port 0 --device 0 --type hdd --medium "${vmdk}"
if [ -n "${second_volume_size}" ]; then
VBoxManage createmedium disk --filename seconddisk.vmdk --format vmdk --size $(($second_volume_size * 1024))
VBoxManage storageattach "${vmname}" --storagectl SATA --port 1 --device 0 --type hdd --medium seconddisk.vmdk
fi
# Configure network drivers as virtio
for i in 1 2 3 4; do
@@ -10,9 +10,20 @@ set -ex
vmdk="$1"
box="$2"
second_volume_size="$3"
cp "${vmdk}" "vmware_box/box-disk001.vmdk"
cd vmware_box
if [ -n "${second_volume_size}" ]; then
VBoxManage createmedium disk --filename seconddisk.vmdk --format vmdk --size $(($second_volume_size * 1024))
cp "../vmx_files/doublevolume.vmx" "./vmwarebox.vmx"
else
cp "../vmx_files/singlevolume.vmx" "./vmwarebox.vmx"
fi
tar cvzf "../${box}" ./*
rm -f box-disk001.vmdk
rm -f vmwarebox.vmx
if [ -n "${second_volume_size}" ]; then
rm -f seconddisk.vmdk
fi
cd ..
View
@@ -0,0 +1,81 @@
.encoding = "UTF-8"
cleanshutdown = "TRUE"
config.version = "8"
cpuid.corespersocket = "1"
displayname = "vmwarebox"
ethernet0.addresstype = "generated"
ethernet0.connectiontype = "nat"
ethernet0.present = "TRUE"
ethernet0.virtualdev = "e1000"
ethernet1.addresstype = "generated"
ethernet1.connectiontype = "custom"
ethernet1.present = "TRUE"
ethernet1.virtualdev = "e1000"
ethernet1.vnet = "vmnet2"
extendedconfigfile = "vmwarebox.vmxf"
floppy0.present = "FALSE"
guestos = "other"
memsize = "1024"
migrate.hostlog = "./vmwarebox-guest-0ab5b801.hlog"
monitor.phys_bits_used = "43"
msg.autoanswer = "true"
numa.autosize.cookie = "10001"
numa.autosize.vcpu.maxpervirtualnode = "1"
numvcpus = "1"
nvram = "vmwarebox.nvram"
pcibridge0.pcislotnumber = "17"
pcibridge0.present = "TRUE"
pcibridge4.functions = "8"
pcibridge4.pcislotnumber = "21"
pcibridge4.present = "TRUE"
pcibridge4.virtualdev = "pcieRootPort"
pcibridge5.functions = "8"
pcibridge5.pcislotnumber = "22"
pcibridge5.present = "TRUE"
pcibridge5.virtualdev = "pcieRootPort"
pcibridge6.functions = "8"
pcibridge6.pcislotnumber = "23"
pcibridge6.present = "TRUE"
pcibridge6.virtualdev = "pcieRootPort"
pcibridge7.functions = "8"
pcibridge7.pcislotnumber = "24"
pcibridge7.present = "TRUE"
pcibridge7.virtualdev = "pcieRootPort"
policy.vm.mvmtid = ""
sata0.pcislotnumber = "34"
sata0.present = "TRUE"
sata0:0.devicetype = "disk"
sata0:0.filename = "box-disk001.vmdk"
sata0:0.mode = "persistent"
sata0:0.present = "TRUE"
sata0:0.redo = ""
sata0:1.devicetype = "disk"
sata0:1.filename = "seconddisk.vmdk"
sata0:1.mode = "persistent"
sata0:1.present = "TRUE"
sata0:1.redo = ""
sharedfolder.maxnum = "0"
softpoweroff = "FALSE"
toolscripts.afterpoweron = "true"
toolscripts.afterresume = "true"
toolscripts.beforepoweroff = "true"
toolscripts.beforesuspend = "true"
uuid.action = "create"
uuid.bios = ""
uuid.location = ""
vc.uuid = ""
virtualhw.productcompatibility = "hosted"
virtualhw.version = "14"
vmci0.id = "1803547532"
vmci0.pcislotnumber = "33"
vmci0.present = "TRUE"
vmotion.checkpointfbsize = "67108864"
vmotion.checkpointsvgaprimarysize = "67108864"
vmxnet3.serialnumberv2 = "FALSE"
ethernet0.pciSlotNumber = "32"
ethernet1.pciSlotNumber = "35"
ethernet0.generatedAddress = "00:0c:29:f7:23:6c"
ethernet0.generatedAddressOffset = "0"
ethernet1.generatedAddress = "00:0c:29:f7:23:76"
ethernet1.generatedAddressOffset = "10"
inVMTeam = "FALSE"
File renamed without changes.

0 comments on commit 8594573

Please sign in to comment.