• Iustin Pop's avatar
    Abstract check that an instance is down · 31624382
    Iustin Pop authored
    Multiple LUs require that an instance is not running while they operate
    on the instance (reinstall, rename, modify, recreate disks, deactivate
    disks). The code to do this check is duplicate many times, and not very
    consistent (some use call_instance_list, some call_instance_info).
    The patch moves this check into a separate function that is then reused.
    The only drawback is that _SafeShutdowInstanceDisks now raises an
    OpPrereqError (even though it is run during Exec()), but this use case
    is fine (there are no other modifications in that Exec).
    Signed-off-by: default avatarIustin Pop <iustin@google.com>
    Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
cmdlib.py 320 KB