Browse Source

fixed dynamic handling of loop devices for partition extraction, added lines to import dynamic subtype

master
Sebastian Rieger 9 years ago
parent
commit
4ac57c34f2
  1. 19
      create-arista-veos-image/create-arista-veos-image.sh
  2. 40
      create-arista-veos-image/dynamic-subtype-vEOS.json

19
create-arista-veos-image/create-arista-veos-image.sh

@ -1,11 +1,12 @@
#!/bin/bash #!/bin/bash
# create-arista-veos-image.sh V1.12
# create-arista-veos-image.sh V1.2
# HS-Fulda - sebastian.rieger@informatik.hs-fulda.de # HS-Fulda - sebastian.rieger@informatik.hs-fulda.de
# #
# changelog: # changelog:
# V1.1 added injection of config defined in VM Maestro using config-drivex # V1.1 added injection of config defined in VM Maestro using config-drivex
# V1.11 fixed device mapping of extracted partitions, fixed problems with stale swi directory # V1.11 fixed device mapping of extracted partitions, fixed problems with stale swi directory
# V1.12 rc.eos now supports e1000 and virtio as vnic types (virtio is supported in vEOS >=4.14.5F) # V1.12 rc.eos now supports e1000 and virtio as vnic types (virtio is supported in vEOS >=4.14.5F)
# V1.2 added dynamic handling of device mapping of extacted partitions
# usage # usage
if [ ! $# -eq 3 ] ; then if [ ! $# -eq 3 ] ; then
@ -43,9 +44,11 @@ echo "==========================================================="
# convert vmdk to raw and extract two partitions in it # convert vmdk to raw and extract two partitions in it
qemu-img convert -O raw $2 $VEOS_VMDK_BASENAME.raw qemu-img convert -O raw $2 $VEOS_VMDK_BASENAME.raw
kpartx -av $VEOS_VMDK_BASENAME.raw
dd if=/dev/mapper/loop0p1 of=$VEOS_VMDK_BASENAME-p1.raw
dd if=/dev/mapper/loop0p2 of=$VEOS_VMDK_BASENAME-p2.raw
LOOPDEV=$(kpartx -av $VEOS_VMDK_BASENAME.raw)
LOOPDEV_PART1=$(echo "$LOOPDEV" | sed '1q;d' | cut -d " " -f 3)
LOOPDEV_PART2=$(echo "$LOOPDEV" | sed '2q;d' | cut -d " " -f 3)
dd if=/dev/mapper/$LOOPDEV_PART1 of=$VEOS_VMDK_BASENAME-p1.raw
dd if=/dev/mapper/$LOOPDEV_PART2 of=$VEOS_VMDK_BASENAME-p2.raw
kpartx -d $VEOS_VMDK_BASENAME.raw kpartx -d $VEOS_VMDK_BASENAME.raw
echo echo
@ -127,9 +130,11 @@ t
w" | fdisk $TMP_NAME.raw >/dev/null w" | fdisk $TMP_NAME.raw >/dev/null
# copy the partitions from vEOS vmdk to new image # copy the partitions from vEOS vmdk to new image
kpartx -av $TMP_NAME.raw
dd if=$VEOS_VMDK_BASENAME-p1.raw of=/dev/mapper/loop0p2
dd if=$VEOS_VMDK_BASENAME-p2.raw of=/dev/mapper/loop0p3
LOOPDEV=$(kpartx -av $TMP_NAME.raw)
LOOPDEV_PART2=$(echo "$LOOPDEV" | sed '2q;d' | cut -d " " -f 3)
LOOPDEV_PART3=$(echo "$LOOPDEV" | sed '3q;d' | cut -d " " -f 3)
dd if=$VEOS_VMDK_BASENAME-p1.raw of=/dev/mapper/$LOOPDEV_PART2
dd if=$VEOS_VMDK_BASENAME-p2.raw of=/dev/mapper/$LOOPDEV_PART3
kpartx -d $TMP_NAME.raw kpartx -d $TMP_NAME.raw
echo echo

40
create-arista-veos-image/dynamic-subtype-vEOS.json

@ -1,20 +1,24 @@
{ {
"plugin_name": "vEOS",
"cli_serial": 1,
"plugin_desc": "Arista vEOS",
"baseline_image": "vEOS",
"hw_ram": 1024,
"hw_vm_extra": "",
"interface_wrap": 7,
"config_disk_type": "disk",
"interface_pattern": "Ethernet{0}",
"gui_visible": true,
"config_file": "/veos_config.txt",
"interface_first": 1,
"gui_icon": "iosvl2",
"plugin_base": "generic",
"vnc_available": false,
"interface_management": "Management1",
"interface_range": 7,
"baseline_flavor": "vEOS.small"
"dynamic-subtypes": [
{
"plugin_name": "vEOS",
"cli_serial": 1,
"plugin_desc": "Arista vEOS",
"baseline_image": "vEOS",
"hw_ram": 1024,
"hw_vm_extra": "",
"interface_wrap": 7,
"config_disk_type": "disk",
"interface_pattern": "Ethernet{0}",
"gui_visible": true,
"config_file": "/veos_config.txt",
"interface_first": 1,
"gui_icon": "iosvl2",
"plugin_base": "generic",
"vnc_available": false,
"interface_management": "Management1",
"interface_range": 7,
"baseline_flavor": "vEOS.small"
}
]
} }
Loading…
Cancel
Save