Skip to contentSkip to conversation

Disk hot plugging without working PCI hotplug - possible?

Qemu-devel Alexey Kardashevskiy 2 participants 6 messages Jun 6, 2013 – Jun 7, 2013

lore
Share & tools
lore
#0 lore raw

Hi!

For the pseries platform (server PPC64) we do not support PCI hotplug yet. However we still want to hot plug disks.

As a workaround, we could add multiple SCSI host devices (virtio-scsi-pci, spapr-vscsi) without any disk attached and later (using qemu console) attach drives to them as we do with the "-drive" parameter in the command line.

So I enabled CONFIG_PCI_HOTPLUG_OLD=y and tried.

However, drive_add console command works only with PCI what eliminates "spapr-vscsi" from the list. Oookay.

Then I tried running qemu with "-device virtio-scsi-pci,id=device0" and later doing "drive_add 0 file=virtimg/test1" from the qemu console. This time qemu responded with "Device is not a SCSI adapter" what is correct as nowadays virtio-XXXX-pci devices are not what are they called as they simply create underlying virtio-bus, attach a real virtio-XXXX-device there (which is not PCI) and only then attach disk to non-PCI virtio device.

So as I see there is no way to attach a disk to an existing controller in already running qemu.

This is how I add disks to qemu now:
-device virtio-scsi-pci,id=virtioscsi0 \
-drive file=virtimg/fc18guest,if=none,id=drive0,readonly=off,
format=raw,media=disk,werror=stop,rerror=stop \
-device scsi-disk,id=scsidisk0,bus=virtioscsi0.0,channel=0,
scsi-id=0,lun=0,drive=drive0,removable=off \

I want to only add "-device virtio-scsi-pci,id=virtioscsi0" to the command line and do the rest from the qemu console.

Am I missing some useful command from qemu console or anything else? Thanks!

Signature · 1 line
Alexey
#1 lore raw
Quoted 14 lines · Alexey Kardashevskiy

Hi!

For the pseries platform (server PPC64) we do not support PCI hotplug yet. However we still want to hot plug disks.

As a workaround, we could add multiple SCSI host devices (virtio-scsi-pci, spapr-vscsi) without any disk attached and later (using qemu console) attach drives to them as we do with the "-drive" parameter in the command line.

So I enabled CONFIG_PCI_HOTPLUG_OLD=y and tried.

However, drive_add console command works only with PCI what eliminates "spapr-vscsi" from the list. Oookay.

Quoted 6 lines

Then I tried running qemu with "-device virtio-scsi-pci,id=device0" and later doing "drive_add 0 file=virtimg/test1" from the qemu console. This time qemu responded with "Device is not a SCSI adapter" what is correct as nowadays virtio-XXXX-pci devices are not what are they called as they simply create underlying virtio-bus, attach a real virtio-XXXX-device there (which is not PCI) and only then attach disk to non-PCI virtio device.

Hi,

Seems it's a bug: il should be compatible with the old virtio-scsi-pci. What's the meaning of the "0" in drive_add command?

Fred

Quoted 17 lines

So as I see there is no way to attach a disk to an existing controller in already running qemu.

This is how I add disks to qemu now:
-device virtio-scsi-pci,id=virtioscsi0 \
-drive file=virtimg/fc18guest,if=none,id=drive0,readonly=off,
format=raw,media=disk,werror=stop,rerror=stop \
-device scsi-disk,id=scsidisk0,bus=virtioscsi0.0,channel=0,
scsi-id=0,lun=0,drive=drive0,removable=off \

I want to only add "-device virtio-scsi-pci,id=virtioscsi0" to the command line and do the rest from the qemu console.

Am I missing some useful command from qemu console or anything else? Thanks!

#2 lore raw
Quoted 26 lines · Frederic Konrad
Quoted 17 lines · Alexey Kardashevskiy

Hi!

For the pseries platform (server PPC64) we do not support PCI hotplug yet.
However we still want to hot plug disks.

As a workaround, we could add multiple SCSI host devices (virtio-scsi-pci,
spapr-vscsi) without any disk attached and later (using qemu console) attach drives to them as we do with the "-drive" parameter in the command line.

So I enabled CONFIG_PCI_HOTPLUG_OLD=y and tried.

However, drive_add console command works only with PCI what eliminates "spapr-vscsi" from the list. Oookay.

Quoted 8 lines

Then I tried running qemu with "-device virtio-scsi-pci,id=device0" and later doing "drive_add 0 file=virtimg/test1" from the qemu console. This time qemu responded with "Device is not a SCSI adapter" what is correct as
nowadays virtio-XXXX-pci devices are not what are they called as they simply create underlying virtio-bus, attach a real virtio-XXXX-device there
(which is not PCI) and only then attach disk to non-PCI virtio device.

Quoted 4 lines

Hi,

Seems it's a bug: il should be compatible with the old virtio-scsi-pci. What's the meaning of the "0" in drive_add command?

It is a PCI slot number, the complete address would include a domain and a bus.

Quoted 18 lines

Fred

Quoted 17 lines

So as I see there is no way to attach a disk to an existing controller in already running qemu.

This is how I add disks to qemu now:
-device virtio-scsi-pci,id=virtioscsi0 \
-drive file=virtimg/fc18guest,if=none,id=drive0,readonly=off,
format=raw,media=disk,werror=stop,rerror=stop \
-device scsi-disk,id=scsidisk0,bus=virtioscsi0.0,channel=0,
scsi-id=0,lun=0,drive=drive0,removable=off \

I want to only add "-device virtio-scsi-pci,id=virtioscsi0" to the command
line and do the rest from the qemu console.

Am I missing some useful command from qemu console or anything else? Thanks!

Signature · 3 lines
With best regards

Alexey Kardashevskiy -- icq: 52150396
#3 lore raw
Quoted 27 lines · Alexey Kardashevskiy
Quoted 26 lines · Frederic Konrad
Quoted 25 lines · Alexey Kardashevskiy

Hi!

For the pseries platform (server PPC64) we do not support PCI hotplug yet.
However we still want to hot plug disks.

As a workaround, we could add multiple SCSI host devices (virtio-scsi-pci,
spapr-vscsi) without any disk attached and later (using qemu console) attach drives to them as we do with the "-drive" parameter in the command line.

So I enabled CONFIG_PCI_HOTPLUG_OLD=y and tried.

However, drive_add console command works only with PCI what eliminates "spapr-vscsi" from the list. Oookay.

Then I tried running qemu with "-device virtio-scsi-pci,id=device0" and later doing "drive_add 0 file=virtimg/test1" from the qemu console. This time qemu responded with "Device is not a SCSI adapter" what is correct as
nowadays virtio-XXXX-pci devices are not what are they called as they simply create underlying virtio-bus, attach a real virtio-XXXX-device there
(which is not PCI) and only then attach disk to non-PCI virtio device.

Quoted 8 lines
Quoted 4 lines

Hi,

Seems it's a bug: il should be compatible with the old virtio-scsi-pci. What's the meaning of the "0" in drive_add command?

It is a PCI slot number, the complete address would include a domain and a bus.

Ok thanks, I'll take a look.

Quoted 10 lines
Quoted 10 lines

Fred

Quoted 9 lines

So as I see there is no way to attach a disk to an existing controller in already running qemu.

This is how I add disks to qemu now:

   -device virtio-scsi-pci,id=virtioscsi0 \
   -drive file=virtimg/fc18guest,if=none,id=drive0,readonly=off,

format=raw,media=disk,werror=stop,rerror=stop \
-device scsi-disk,id=scsidisk0,bus=virtioscsi0.0,channel=0,
scsi-id=0,lun=0,drive=drive0,removable=off \

This two last command isn't available in the monitor?

Quoted 8 lines
Quoted 7 lines
Quoted 7 lines

I want to only add "-device virtio-scsi-pci,id=virtioscsi0" to the command
line and do the rest from the qemu console.

Am I missing some useful command from qemu console or anything else? Thanks!

#4 lore raw
Quoted 44 lines · Frederic Konrad
Quoted 28 lines · Alexey Kardashevskiy
Quoted 27 lines · Frederic Konrad
Quoted 26 lines · Alexey Kardashevskiy

Hi!

For the pseries platform (server PPC64) we do not support PCI hotplug yet.
However we still want to hot plug disks.

As a workaround, we could add multiple SCSI host devices (virtio-scsi-pci,
spapr-vscsi) without any disk attached and later (using qemu console) attach drives to them as we do with the "-drive" parameter in the command line.

So I enabled CONFIG_PCI_HOTPLUG_OLD=y and tried.

However, drive_add console command works only with PCI what eliminates "spapr-vscsi" from the list. Oookay.

Then I tried running qemu with "-device virtio-scsi-pci,id=device0" and later doing "drive_add 0 file=virtimg/test1" from the qemu console. This
time qemu responded with "Device is not a SCSI adapter" what is correct as
nowadays virtio-XXXX-pci devices are not what are they called as they simply create underlying virtio-bus, attach a real virtio-XXXX-device there
(which is not PCI) and only then attach disk to non-PCI virtio device.

Quoted 8 lines
Quoted 4 lines

Hi,

Seems it's a bug: il should be compatible with the old virtio-scsi-pci. What's the meaning of the "0" in drive_add command?

It is a PCI slot number, the complete address would include a domain and a bus.

Ok thanks, I'll take a look.

Quoted 5 lines
Quoted 5 lines

Fred

Quoted 4 lines

So as I see there is no way to attach a disk to an existing controller in
already running qemu.

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

This is how I add disks to qemu now:

   -device virtio-scsi-pci,id=virtioscsi0 \
   -drive file=virtimg/fc18guest,if=none,id=drive0,readonly=off,

format=raw,media=disk,werror=stop,rerror=stop \
-device scsi-disk,id=scsidisk0,bus=virtioscsi0.0,channel=0,
scsi-id=0,lun=0,drive=drive0,removable=off \

This two last command isn't available in the monitor?

-device is (looks like) but did not look further as drive_add (which I thought as an analog of "-drive") is not exactly the same and I cannot add disks without it anyway.

Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines

I want to only add "-device virtio-scsi-pci,id=virtioscsi0" to the command
line and do the rest from the qemu console.

Am I missing some useful command from qemu console or anything else? Thanks!

Signature · 3 lines
With best regards

Alexey Kardashevskiy -- icq: 52150396
#5 lore raw
In reply to Frederic Konrad
Quoted 42 lines · Frederic Konrad
Quoted 27 lines · Alexey Kardashevskiy
Quoted 26 lines · Frederic Konrad
Quoted 25 lines · Alexey Kardashevskiy

Hi!

For the pseries platform (server PPC64) we do not support PCI hotplug yet.
However we still want to hot plug disks.

As a workaround, we could add multiple SCSI host devices (virtio-scsi-pci,
spapr-vscsi) without any disk attached and later (using qemu console) attach drives to them as we do with the "-drive" parameter in the command line.

So I enabled CONFIG_PCI_HOTPLUG_OLD=y and tried.

However, drive_add console command works only with PCI what eliminates "spapr-vscsi" from the list. Oookay.

Then I tried running qemu with "-device virtio-scsi-pci,id=device0" and later doing "drive_add 0 file=virtimg/test1" from the qemu console. This time qemu responded with "Device is not a SCSI adapter" what is correct as
nowadays virtio-XXXX-pci devices are not what are they called as they simply create underlying virtio-bus, attach a real virtio-XXXX-device there
(which is not PCI) and only then attach disk to non-PCI virtio device.

Quoted 8 lines
Quoted 4 lines

Hi,

Seems it's a bug: il should be compatible with the old virtio-scsi-pci. What's the meaning of the "0" in drive_add command?

It is a PCI slot number, the complete address would include a domain and a bus.

Ok thanks, I'll take a look.

Quoted 4 lines
Quoted 4 lines

Fred

Quoted 3 lines

So as I see there is no way to attach a disk to an existing controller in already running qemu.

Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

This is how I add disks to qemu now:

   -device virtio-scsi-pci,id=virtioscsi0 \
   -drive file=virtimg/fc18guest,if=none,id=drive0,readonly=off,

format=raw,media=disk,werror=stop,rerror=stop \
-device scsi-disk,id=scsidisk0,bus=virtioscsi0.0,channel=0,
scsi-id=0,lun=0,drive=drive0,removable=off \

This two last command isn't available in the monitor?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

I want to only add "-device virtio-scsi-pci,id=virtioscsi0" to the command
line and do the rest from the qemu console.

Am I missing some useful command from qemu console or anything else? Thanks!

This works (thanks to Anthony):

./qemu-system-ppc64 \
-L "qemu-ppc64-bios/" \
-nodefaults \
-chardev "stdio,id=char1,signal=off,mux=on" \
-device "spapr-vty,id=ser1,chardev=char1" \
-mon "chardev=char1,mode=readline,id=mon1" \
-m "1024" \
-machine "pseries" \
-nographic \
-vga "none" \
-enable-kvm \
-kernel "guest.vmlinux.n" \
-initrd "1.cpio" \
-device "virtio-scsi-pci,id=foo"

And then issue 2 commands in the qemu console:

drive_add auto file=virtimg/fc18guest,if=none,id=bar device_add scsi-disk,bus=foo.0,drive=bar,unit=0

The guest is even able to autodetect new volume. Profit.

Signature · 1 line
Alexey