[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: equivalent to "-drive if=ide,id=disk0....."
From: |
Kashyap Chamarthy |
Subject: |
Re: equivalent to "-drive if=ide,id=disk0....." |
Date: |
Tue, 28 Jul 2020 16:38:29 +0200 |
On Tue, Jul 28, 2020 at 01:06:48PM +0200, Kevin Wolf wrote:
> Am 27.07.2020 um 23:50 hat Kashyap Chamarthy geschrieben:
[...]
> > IIUC, specifying 'node-name' should be sufficient. Also, you don't need
> > to specify JSON syntax on the command-line; you can 'flatten it' (see
> > below).
>
> Indeed, naming BlockBackends is a legacy thing. You should never need
> it. Guest devices can be created like -device ide-hd,drive=<node-name>
> and QMP commands either accept node names (if they are about the
> backend) or the ID of the guest device (if they are about the frontend).
Thanks for the explanation.
> > On 'id' vs. 'node-name', from the documentation of `blockdev-add`,
> > https://git.qemu.org/gitweb.cgi?p=qemu.git;a=blob;f=qapi/block-core.json#l4032
> >
> > # Creates a new block device. If the @id option is given at the top
> > level, a
> > # BlockBackend will be created; otherwise, @node-name is mandatory at
> > the top
> > # level and no BlockBackend will be created.
>
> This is actually a documentation bug. @id doesn't exist, blockdev-add
> never creates a BlockBackend. This was different in the very first
> versions of the patches to add blockdev-add and we probably just forgot
> to update the documentation after removing it.
Ah, noted; sent this one (per this thread and #qemu, OFTC, IRC discussion):
https://lists.nongnu.org/archive/html/qemu-devel/2020-07/msg07929.html
– qapi/block-core.json: Remove stale description of 'blockdev-add'
> > And here's a minimal working example that I use with '-blockdev'
> >
> > /usr/bin/qemu-system-x86_64 \
> > -display none \
> > -no-user-config \
> > -nodefaults \
> > -serial stdio \
> > -cpu host \
> > -smp 1,maxcpus=2 \
> > -machine q35,accel=kvm,usb=off \
> > -m 2048 \
> > -blockdev
> > node-name=node-Base,driver=qcow2,file.driver=file,file.filename=./base.qcow2
> > \
> > -device virtio-blk,drive=node-Base,id=virtio0 \
>
> Yes, this works. Another option is to define each block node separately:
>
> ...
> -blockdev node-name=base-file,driver=file,filename=base.qcow2 \
> -blockdev node-name=base,driver=qcow2,file=base-file \
> ...
That is more readable too; thanks.
> Kevin
--
/kashyap