live-migration ceph: fix typo in ruleset parsing

The rule_id line is formatted as:

"rule_id": 0,

Which means the id integer is the second column of the parsed output,
not the third.

Since a third column doesn't exist, the call to cut returns nothing,
leaving $RULE_ID invalid, which then causes the subsequent ruleset
commands to fail.

We don't see this normally because $CEPH_REPLICAS is set to 1 by
default.

Change-Id: I3255f9421119aafb7407ba7443400bd3ace0d827
Closes-Bug: #1581159
This commit is contained in:
Jon Bernard 2016-05-12 14:09:02 -04:00
parent 355fa5307f
commit 9572066490

View File

@ -106,7 +106,7 @@ EOF
# then apply this rules to the default pool
if [[ $CEPH_REPLICAS -ne 1 ]]; then
sudo ceph -c ${CEPH_CONF_FILE} osd crush rule create-simple devstack default osd
RULE_ID=$(sudo ceph -c ${CEPH_CONF_FILE} osd crush rule dump devstack | awk '/rule_id/ {print $3}' | cut -d ',' -f1)
RULE_ID=$(sudo ceph -c ${CEPH_CONF_FILE} osd crush rule dump devstack | awk '/rule_id/ {print $2}' | cut -d ',' -f1)
sudo ceph -c ${CEPH_CONF_FILE} osd pool set rbd crush_ruleset ${RULE_ID}
sudo ceph -c ${CEPH_CONF_FILE} osd pool set data crush_ruleset ${RULE_ID}
sudo ceph -c ${CEPH_CONF_FILE} osd pool set metadata crush_ruleset ${RULE_ID}