mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 14:24:39 -07:00
* usr/lib/byobu/ec2_cost: LP: #862655
- fix ec2 cost estimator on OpenStack instances by falling back to the approximation calculator
This commit is contained in:
parent
19938f1e0f
commit
c66cf1c25b
2 changed files with 8 additions and 2 deletions
4
debian/changelog
vendored
4
debian/changelog
vendored
|
@ -1,6 +1,8 @@
|
|||
byobu (4.37) unreleased; urgency=low
|
||||
|
||||
* UNRELEASED
|
||||
* usr/lib/byobu/ec2_cost: LP: #862655
|
||||
- fix ec2 cost estimator on OpenStack instances by falling back to
|
||||
the approximation calculator
|
||||
|
||||
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 27 Sep 2011 10:59:05 -0400
|
||||
|
||||
|
|
|
@ -36,12 +36,16 @@ __ec2_cost() {
|
|||
# Try to use metadata service
|
||||
if metadata_available; then
|
||||
zone=$(wget -q -O - http://169.254.169.254/latest/meta-data/placement/availability-zone)
|
||||
if [ ! -r "$BYOBU_PREFIX/share/$PKG/ec2/rates.${zone%?}" ]; then
|
||||
zone="us-east-1d"
|
||||
fi
|
||||
. "$BYOBU_PREFIX/share/$PKG/ec2/rates.${zone%?}"
|
||||
type=$(wget -q -O - http://169.254.169.254/latest/meta-data/instance-type | $SED -e "s/\./_/g")
|
||||
eval rate="\$$type"
|
||||
file_to_stat="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/ec2_cost.instance_type"
|
||||
[ -f "$file_to_stat" ] || wget -q -O "$file_to_stat" http://169.254.169.254/latest/meta-data/instance-type
|
||||
else
|
||||
fi
|
||||
if [ -z "$rate" ]; then
|
||||
. "$BYOBU_PREFIX/share/$PKG/ec2/rates."*
|
||||
# Count CPUs, Memory, Architecture, hours
|
||||
cpu=$(grep -c "^processor.*:" /proc/cpuinfo) || cpu=1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue