add multiple server support to nova reset-state

Bug #1314217 reported by Corey Bryant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-novaclient
Fix Released
Wishlist
ugvddm

Bug Description

It would be nice if nova reset-state supported specifying multiple servers in a single invocation, similar to nova delete.

usage: nova reset-state [--active] <server>
usage: nova delete <server> [<server> ...]

It can be scripted similar to below, but it would be nice to have the command line support.

#!/bin/bash

set -e

function usage() {
    echo "Usage: nova-reset-state [--active] [--all] [--help] -- [<server> ...]"
}

active=""
all=false

while [ $# -ne 0 ]; do
    case "$1" in
        --all) all=true; shift;;
        --active) active="--active"; shift;;
        --help) usage; exit 1;;
        --) shift; break;
    esac
done

if [ "$all" = true ]; then
    servers=($(nova list | awk 'NR > 2 { print $2 }'))
    for server in "${servers[@]}"; do
        nova reset-state $active $server
    done
else
    for server in "$@"; do
        nova reset-state $active $server
    done
fi

Thang Pham (thang-pham)
Changed in nova:
importance: Undecided → Wishlist
Revision history for this message
Corey Bryant (corey.bryant) wrote :

Hi Thang, Would this have to be fixed in the v3 api or could it be fixed in v1, or neither?

Tracy Jones (tjones-i)
tags: added: api
tags: added: low-hanging-fruit
Revision history for this message
Christopher Yeoh (cyeoh-0) wrote :

I think this is something we'd leave until the tasks api is implemented.

Changed in nova:
status: New → Confirmed
ugvddm (271025598-9)
Changed in nova:
assignee: nobody → ugvddm (271025598-9)
ugvddm (271025598-9)
affects: nova → python-novaclient
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-novaclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/104875

Changed in python-novaclient:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-novaclient (master)

Reviewed: https://review.openstack.org/104875
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=3b8f0097003de1d526092b19ffffc419e70fcfc8
Submitter: Jenkins
Branch: master

commit 3b8f0097003de1d526092b19ffffc419e70fcfc8
Author: ozg <ozg@ozg-GREATWALL-PC.(none)>
Date: Fri Jul 4 07:35:16 2014 -0400

    Adding multiple server support to nova reset-state

    Adding support specifying multiple servers to nova reset-state in
    a single invocation.

    Change-Id: I7add0c26b0e59b31751de7a60ebdde3f568b3354
    Closes-Bug: #1314217

Changed in python-novaclient:
status: In Progress → Fix Committed
Michael Still (mikal)
Changed in python-novaclient:
milestone: none → 2.18.0
Michael Still (mikal)
Changed in python-novaclient:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.