1403
1432
RESTORE_HUMAN="${pt_info}"
1405
1434
debug 1 "$dev: original sgdisk info:"
1406
@@ -448,10 +465,18 @@
1436
fail "${dev}: failed to parse sgdisk details"
1438
debug 1 "${dev}: code=${code} guid=${guid} name='${name}'"
1440
+ [ "$DRY_RUN" -ne 0 ] && wouldrun="would-run"
1442
# Calculate the new size of the partition
1443
new_size=$((${pt_max} - ${pt_start}))
1444
@@ -364,11 +383,8 @@
1445
new="new: size=${new_size},end=${pt_max}"
1446
change_info="${dev}: start=${pt_start} ${old} ${new}"
1449
- [ "${DRY_RUN}" -ne 0 ] && change "${change_info}"
1451
# Backup the current partition table, we're about to modify it
1452
- rq sgd_backup sgdisk "--backup=${GPT_BACKUP}" "${DISK}" ||
1453
+ rq sgd_backup $wouldrun sgdisk "--backup=${GPT_BACKUP}" "${DISK}" ||
1454
fail "${dev}: failed to backup the partition table"
1456
# Modify the partition table. We do it all in one go (the order is
1457
@@ -379,16 +395,19 @@
1458
# - set the partition code
1459
# - set the partition GUID
1460
# - set the partition name
1461
- rq sgdisk_mod sgdisk --move-second-header "--delete=${PART}" \
1462
+ rq sgdisk_mod $wouldrun sgdisk --move-second-header "--delete=${PART}" \
1463
"--new=${PART}:${pt_start}:${pt_max}" \
1464
"--typecode=${PART}:${code}" \
1465
"--partition-guid=${PART}:${guid}" \
1466
"--change-name=${PART}:${name}" "${DISK}" &&
1467
- rq pt_update pt_update "$DISK" "$PART" || {
1468
+ rq pt_update $wouldrun pt_update "$DISK" "$PART" || {
1469
RESTORE_FUNC=gpt_restore
1470
fail "${dev}: failed to repartition"
1474
+ [ "${DRY_RUN}" -ne 0 ] && change "${change_info}"
1476
changed "${change_info}"
1479
@@ -418,7 +437,20 @@
1480
local label="$1" ret="" efile=""
1481
efile="$TEMP_D/$label.err"
1483
- debug 2 "running[$label][$_capture]" "$@"
1485
+ local rlabel="running"
1486
+ [ "$1" = "would-run" ] && rlabel="would-run" && shift
1490
+ [ "${x#* }" != "$x" -o "${x#* \"}" != "$x" ] && x="'$x'"
1495
+ debug 2 "$rlabel[$label][$_capture]" "$cmd"
1496
+ [ "$rlabel" = "would-run" ] && return 0
1498
if [ "${_capture}" = "erronly" ]; then
1499
"$@" 2>"$TEMP_D/$label.err"
1501
@@ -448,10 +480,18 @@
1409
1504
if command -v partx >/dev/null 2>&1; then
1807
1902
Usage: ubuntu-ec2-run [ options ] arguments
1904
"hvm", "paravirtual", "pv",
1910
+# cleaned from http://aws.amazon.com/ec2/instance-types/
1911
+# (vcpu, compute-units, mem, disknum, disksize, diskback)
1913
+ 'm3.medium': (1,3,3.75,1,4,SSD),
1914
+ 'm3.large': (2,6.5,7.5,1,32,SSD),
1915
+ 'm3.xlarge': (4,13,15,2,40,SSD),
1916
+ 'm3.2xlarge': (8,26,30,2,80,SSD),
1917
+ 'm1.small': (1,1,1.7,1,160,SPIN),
1918
+ 'm1.medium': (1,2,3.75,1,410,SPIN),
1919
+ 'm1.large': (2,4,7.5,2,420,SPIN),
1920
+ 'm1.xlarge': (4,8,15,4,420,SPIN),
1921
+ 'c3.large': (2,7,3.75,2,16,SSD),
1922
+ 'c3.xlarge': (4,14,7.5,2,40,SSD),
1923
+ 'c3.2xlarge': (8,28,15,2,80,SSD),
1924
+ 'c3.4xlarge': (16,55,30,2,160,SSD),
1925
+ 'c3.8xlarge': (32,108,60,2,320,SSD),
1926
+ 'c1.medium': (2,5,1.7,1,350,SPIN),
1927
+ 'c1.xlarge': (8,20,7,4,420,SPIN),
1928
+ 'cc2.8xlarge': (32,88,60.5,4,840,SPIN),
1929
+ 'g2.2xlarge': (8,26,15,1,60,SSD),
1930
+ 'cg1.4xlarge': (16,33.5,22.5,2,840,SPIN),
1931
+ 'm2.xlarge': (2,6.5,17.1,1,420,SPIN),
1932
+ 'm2.2xlarge': (4,13,34.2,1,850,SPIN),
1933
+ 'm2.4xlarge': (8,26,68.4,2,840,SPIN),
1934
+ 'cr1.8xlarge': (32,88,244,2,120,SSD),
1935
+ 'i2.xlarge': (4,14,30.5,1,800,SSD),
1936
+ 'i2.2xlarge': (8,27,61,2,800,SSD),
1937
+ 'i2.4xlarge': (16,53,122,4,800,SSD),
1938
+ 'i2.8xlarge': (32,104,244,8,800,SSD),
1939
+ 'hs1.8xlarge': (16,35,117,2,2048,SPIN),
1940
+ 'hi1.4xlarge': (16,35,60.5,2,1024,SSD),
1941
+ 't1.micro': (1,.1,0.615,0x0,None),
1944
def get_argopt(args, optnames):
1946
@@ -101,27 +137,13 @@
1949
def get_block_device_mappings(itype):
1950
- # cleaned from http://aws.amazon.com/ec2/instance-types/
1951
- # t1.micro 0 # m1.large 850 # cg1.4xlarge 1690
1952
- # m1.small 160 # m2.2xlarge 850 # m1.xlarge 1690
1953
- # c1.medium 350 # c1.xlarge 1690 # m2.4xlarge 1690
1954
- # m1.medium 410 # cc1.4xlarge 1690 # hi1.4xlarge 2048
1955
- # m2.xlarge 420 # cc1.4xlarge 1690 # cc2.8xlarge 3370
1959
- if (itype in ("t1.micro", "m1.small", "c1.medium") or
1960
- itype.startswith("m3.")):
1961
- pass # the first one is always attached. ephemeral0=sda2
1962
- elif itype in ("m2.xlarge", "m1.medium"):
1963
- bdmaps = ["/dev/sdb=ephemeral0"]
1964
- elif (itype in ("m1.large", "m2.2xlarge", "hi1.4xlarge") or
1965
- itype.startswith("cg1.") or itype.startswith("cc1.")):
1966
- bdmaps = ["/dev/sdb=ephemeral0", "/dev/sdc=ephemeral1"]
1967
- elif (itype in ("m1.xlarge", "m2.4xlarge", "c1.xlarge") or
1968
- itype.startswith("cc2.8xlarge")):
1969
- bdmaps = ["sdb=ephemeral0", "sdc=ephemeral1",
1970
- "sdd=ephemeral2", "sde=ephemeral3"]
1971
+ allmaps = ["/dev/sdb=ephemeral0", "/dev/sdc=ephemeral1",
1972
+ "/dev/sdd=ephemeral2", "/dev/sde=ephemeral3"]
1973
+ if itype in SIZE_DATA:
1974
+ (vcpu, ec2, mem, disknum, disksize, diskback) = SIZE_DATA[itype]
1975
+ bdmaps = allmaps[0:disknum]
1979
args.extend(("--block-device-mapping", m,))
1809
1981
=== added file 'bin/vcs-run'
1810
1982
--- old/bin/vcs-run 1970-01-01 00:00:00 +0000