Skip to content

Instantly share code, notes, and snippets.

@hellt hellt/
Last active Mar 29, 2019

What would you like to do?
Virsh interface move
# usage ~/ <virsh_domain_name/id> <interface_name> <new_bridge_name>
tmpxml=$(mktemp /tmp/ifcfg.XXX)
macaddr="$(virsh domiflist $1 | awk "/$2\s/ {print \$NF}")"
cat > "$tmpxml" <<EOF
<interface type='bridge'>
<mac address='$macaddr'/>
<source bridge='$3'/>
<model type='virtio'/>
virsh update-device "$1" "$tmpxml" --live --persistent
rm "$tmpxml"

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.