2

When I do

virsh list

I get ubuntu14.10 and ubuntu15.10 running but when I run this command to take a snapshot.

virsh qemu-monitor-command ubuntu15.10 '{ "execute": "transaction", "arguments":{"actions": [{ "type": "blockdev-snapshot-sync", "data" :{ "device": "ubuntu15.10", "snapshot-file": "hd0-snap.qcow2"} } ] } }'

I get an error saying "Cannot find device=ubuntu15.10 nor node_name="

1 Answers1

1

Device needs to be the actual block device, not the name of the node/machine. (see: http://wiki.qemu.org/Features/Snapshots#QMP_command)

Try:

virsh qemu-monitor-command ubuntu15.10 '{"execute":"query-block"}'

to find out the Target of the block device you want to snapshot.

madeddie
  • 418
  • 2
  • 6
  • The file is /var/lib/libvirt/images/ubuntu15.10.qcow2 and when I replace it's path, the error remains the same. Cannot find device="path of file". – Douglas Turner Aug 09 '16 at 18:04
  • I'm sorry, I didn't mean the file backing the device, but the name of the device as is known to qemu. In the documentation I pasted you can see it being referred to as `virtio0`, so, something like that, maybe vda, hd0, disk0. It should be under the `Target` heading in domblklist. – madeddie Aug 09 '16 at 18:10
  • Okay. Below the target, I see vda but upon entering it in the command. I see the same error again. Cannot find device vda. – Douglas Turner Aug 09 '16 at 18:15
  • Ok, it might still be virtio0, but, could you try: `virsh qemu-monitor-command ubuntu15.10 '{"execute":"query-block"}'` that should show the block devices as known to qemu. What do you see as "device": line(s)? – madeddie Aug 09 '16 at 18:29
  • Oh Yes. Got it. It now shows another error "Permission denied" although I tried running it with sudo. – Douglas Turner Aug 09 '16 at 18:34
  • Apologies for another request but kindly help me if you have time. Will be much grateful. – Douglas Turner Aug 09 '16 at 18:35
  • it'd be best to open a new question for that, when you do, specify your host OS and paste the complete command and complete error (anonymizing is ok of course), possible reasons could be selinux or apparmor, or problems with rights of the snapshot location. i've edited my answer here to reflect the different command actually needed – madeddie Aug 09 '16 at 18:41