virtualbox scripts searches VM name incorrectly

Bug #1387602 reported by Vasiliy Pleshakov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Fix Committed
Wishlist
Serhii Ovsianikov

Bug Description

In functions/vm.sh in function is_vm_running() search VM name in list implemented incorrectly.

Steps to reproduce:
1. Assume we have list of VMs like this:
extrafuel-master
extrafuel-slave-1

2. We run:
is_vm_running fuel-master

Expected result: return 1

Actual result: return 0.

Workaround:
Search VM name with regexp:
is_vm_running() {
    name=$1
    list=$(get_vms_running)

    # Check that the list of running VMs contains the given VM
    regexp="^$node$"
    if [[ $list =~ $regexp ]]; then
        return 0
    else
        return 1
    fi
}

I understand that I describe very rare situation. But I believe we should make very stable and reusable code.

description: updated
Changed in fuel:
assignee: nobody → Miroslav Anashkin (manashkin)
milestone: none → 6.0
Revision history for this message
Roman Prykhodchenko (romcheg) wrote :

Miroslav, could you please update the status of this bug?

Changed in fuel:
milestone: 6.0 → 6.1
importance: Undecided → Wishlist
Changed in fuel:
status: New → Confirmed
Changed in fuel:
assignee: Miroslav Anashkin (manashkin) → Sergii Ovsianikov (sovsianikov)
Revision history for this message
Serhii Ovsianikov (sovsianikov) wrote :

I want to clarify steps to reproduce in functions/vm.sh:
1. We create 3 virtual machines with prefix fuel- and turned them off
2. We create another 4 virtual machines with the prefix extrafuel- and leave them work
3. If we execute is_vm_running fuel-master, it will return 0, but we expect 1

Expected result: return 1
Actual result: return 0

Are the steps correct?

Revision history for this message
Vasiliy Pleshakov (vpleshakov) wrote :

Serhiy, yes all that steps asre correct.
I did repoduce it once again.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-main (master)

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

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

Reviewed: https://review.openstack.org/137674
Committed: https://git.openstack.org/cgit/stackforge/fuel-main/commit/?id=2cfe37a6c17204ac0164bda4dd18de315b51ddcc
Submitter: Jenkins
Branch: master

commit 2cfe37a6c17204ac0164bda4dd18de315b51ddcc
Author: Serhiy Ovsianikov <email address hidden>
Date: Thu Dec 11 11:31:23 2014 +0200

    Correct search of name virtual machines in list

    In the functions is_vm_running() and is_vm_present(), located in the
    file function/vm.sh, search of running and available virtual machines
    has been fixed. The search of the names virtual machines
    extrafuel-master and extrafuel-slave-1 didn't work correctly.

    Change-Id: If73546e5b4b2a8a64f0b955f85579ee0dafd93f0
    Closes-Bug: #1387602

Changed in fuel:
status: In Progress → Fix Committed
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.