Add new ironic virsh commands

As of I62a5b292891a44e3f4b82edd90b6e4402c50fabf,
Ironic has updated the commands they run over ssh we need to
now allow both the old and the new commands.

Change-Id: I389d9e9ad3ad571e148b730654a7f8e6fb644bbd
This commit is contained in:
Derek Higgins
2016-03-14 11:17:17 +00:00
parent da5c971360
commit b5848ce7bb

View File

@@ -63,13 +63,16 @@ def run_command(orig_command):
# NOTE(NobodyCam): First dumpxml command below (with grep) is for Nova Baremetal and should be
# removed when Nova's Baremetal driver is removed from the repo.
RE_COMMANDS = {
r"""^(LC_ALL=C )?/usr/bin/virsh( --connect qemu:///system)? list --all \| tail -n \+2 \| awk -F" " '{print \$2}'$""": run_command,
r"""^(LC_ALL=C )?/usr/bin/virsh( --connect qemu:///system)? list --name$""": run_command,
r"""^(LC_ALL=C )?/usr/bin/virsh( --connect qemu:///system)? dumpxml [a-z0-9_]+ \| grep "mac address" \| awk -F"'" '{print \$2}' \| tr -d ':'$""": run_command,
r"""^(LC_ALL=C )?/usr/bin/virsh( --connect qemu:///system)? dumpxml [a-z0-9_]+ \| awk -F "'" '/mac address/{print \$2}'\| tr -d ':'$""": run_command,
r"""^(LC_ALL=C )?/usr/bin/virsh( --connect qemu:///system)? list --all\|grep running( )?\|( )?awk -v qc='"' -F" " '{print qc\$2qc}'$""": run_command,
r"""^(LC_ALL=C )?/usr/bin/virsh( --connect qemu:///system)? list --all --name$""": run_command,
r"""^(LC_ALL=C )?/usr/bin/virsh( --connect qemu:///system)? (start|destroy|reset) "?[a-z0-9_]+"?$""": run_command,
r"""^(LC_ALL=C )?/usr/bin/virsh( --connect qemu:///system)? dumpxml [a-z0-9_]+ \| awk '[\w\\\/<>\(\){},.|=*;" ]+' Q="'" RS="\[<>\]" \| head -1$""": run_command,
r"""^EDITOR="sed -i '[\w\\\/<>\(\)|=*;" ]+'"( LC_ALL=C)? /usr/bin/virsh( --connect qemu:///system)? edit "?[a-z0-9_]+"?$""": run_command,
# Ironic Pre Mitaka
r"""^(LC_ALL=C )?/usr/bin/virsh( --connect qemu:///system)? list --all \| tail -n \+2 \| awk -F" " '{print \$2}'$""": run_command,
r"""^(LC_ALL=C )?/usr/bin/virsh( --connect qemu:///system)? list --all\|grep running( )?\|( )?awk -v qc='"' -F" " '{print qc\$2qc}'$""": run_command,
}