Comment 0 for bug 1387602

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

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 [[ $running =~ $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.