Skip to content

Instantly share code, notes, and snippets.

@jhrcz
Created August 18, 2014 10:06
Show Gist options
  • Save jhrcz/ffe1508a724a15976363 to your computer and use it in GitHub Desktop.
Save jhrcz/ffe1508a724a15976363 to your computer and use it in GitHub Desktop.
batch virsh edit
# rename volume to have .img suffix (it's volume not a file)
lvrename vg_storage $NODENAME.img $NODENAME
cat > /tmp/virsh-editor.sh << _EOF_
#!/bin/bash
sed -ie "/source dev/s/$NODENAME.img/$NODENAME/" \$1
_EOF_
chmod +x /tmp/virsh-editor.sh
EDITOR=/tmp/virsh-editor.sh
virsh edit $NODENAME
rm -f /tmp/virsh-editor.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment