Skip to contentSkip to conversation

QEMU 1.6 and drive discard parameter

Qemu-devel Amos Kong 1 participant 2 messages Oct 31, 2013 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): op.w5rdfdurcb68cn@whitewind-arch

A message that is not in the archive (sent off-list or not yet received): [email protected]

Amos Kong

author
#2 lore raw
Quoted 36 lines · Osier Yang

CC to Amos.

Quoted 23 lines · whitearchey

In QEMU 1.6 parameters of 'drive' option were removed:

QemuOptsList qemu_drive_opts = {
   .name = "drive",
   .head = QTAILQ_HEAD_INITIALIZER(qemu_drive_opts.head),
   .desc = {
       /*
        * no elements => accept any params
        * validation will happen later
        */
       { /* end of list */ }
   },
};

But libvirt still checks for QEMU_CAPS_DRIVE_DISCARD using QMP query-command-line-options:

static struct virQEMUCapsCommandLineProps virQEMUCapsCommandLine[] = {
   { "machine", "mem-merge", QEMU_CAPS_MEM_MERGE },
   { "drive", "discard", QEMU_CAPS_DRIVE_DISCARD },
   { "realtime", "mlock", QEMU_CAPS_MLOCK },
};
Quoted 9 lines

...
qemuMonitorGetCommandLineOptionParameters(mon,
virQEMUCapsCommandLine[i].option, &values)

So, when I try to use discard option in domain xml I get this error:

error : qemuBuildDriveStr:3986 : unsupported configuration:
discard is not supported by this QEMU binary

Quoted 5 lines

It's a qemu problem, the command "query-command-line-options" should keep working
after the structures were changed for any option, in this case, all the option descs were
moved to "qemu_common_drive_opts" instead.

{ 'execute': 'query-command-line-options', 'arguments': { 'option': 'drive' } }

{
    "return": [
        {
            "parameters": [
            ],
            "option": "drive"
        }
    ]
}

It returns a NULL parameters list, that's true, some error handling should be done by libvirt.

Quoted 2 lines

Regards,
Osier

Signature · 1 line
			Amos.
author
#3 lore raw

CC Kevin, Paolo

Quoted 55 lines · Amos Kong
Quoted 36 lines · Osier Yang

CC to Amos.

Quoted 23 lines · whitearchey

In QEMU 1.6 parameters of 'drive' option were removed:

QemuOptsList qemu_drive_opts = {
   .name = "drive",
   .head = QTAILQ_HEAD_INITIALIZER(qemu_drive_opts.head),
   .desc = {
       /*
        * no elements => accept any params
        * validation will happen later
        */
       { /* end of list */ }
   },
};

But libvirt still checks for QEMU_CAPS_DRIVE_DISCARD using QMP query-command-line-options:

static struct virQEMUCapsCommandLineProps virQEMUCapsCommandLine[] = {
   { "machine", "mem-merge", QEMU_CAPS_MEM_MERGE },
   { "drive", "discard", QEMU_CAPS_DRIVE_DISCARD },
   { "realtime", "mlock", QEMU_CAPS_MLOCK },
};
Quoted 9 lines

...
qemuMonitorGetCommandLineOptionParameters(mon,
virQEMUCapsCommandLine[i].option, &values)

So, when I try to use discard option in domain xml I get this error:

error : qemuBuildDriveStr:3986 : unsupported configuration:
discard is not supported by this QEMU binary

Quoted 5 lines

It's a qemu problem, the command "query-command-line-options" should keep working
after the structures were changed for any option, in this case, all the option descs were
moved to "qemu_common_drive_opts" instead.

{ 'execute': 'query-command-line-options', 'arguments': { 'option': 'drive' } }

{
    "return": [
        {
            "parameters": [
            ],
            "option": "drive"
        }
    ]
}
Quoted 2 lines

It returns a NULL parameters list, that's true, some error handling should be done by libvirt.

Currently we have three QemuOptsList (qemu_common_drive_opts, qemu_legacy_drive_opts, and qemu_drive_opts)

only qemu_drive_opts is added to vm_config_groups[]

| commit 492fdc6fbe17b2d45878e813e980f782ac260c30
| Author: Kevin Wolf <[email protected]>
| Date:   Wed Jun 19 13:44:17 2013 +0200
| 
|     Revert "block: Disable driver-specific options for 1.5"

This patch removed the items in qemu_drive_opts .desc

We query commandline options by checking information in vm_config_groups[], so we can only get a NULL parameter list now.

Another issue is we also can't query legacy options of -drive.

--

Can we fix this problem by copy desc items of qemu_legacy_drive_opts and qemu_common_drive_opts to qemu_drive_opts?

Signature · 1 line
			Amos.