[libvirt] [PATCH 0/4] qemu: handle ',' and '=' in VM names

Cole Robinson crobinso at redhat.com
Sat Apr 23 13:06:24 UTC 2016


On 04/23/2016 08:47 AM, John Ferlan wrote:
> 
> 
> On 04/22/2016 06:46 PM, Cole Robinson wrote:
>> This series adds qemu cli comma escaping to several places that
>> are dependent on the VM name, to enable names with embedded commas.
>>
>> Patch 4 makes use of qemu -name guest=X value to allow names with
>> '=' in them.
>>
>> There's likely other places that are VM name dependent that need
>> escaping too, but this hits the mandatory ones. I'm going to through
>> the remaining list on the BiteSizedTasks page
>>
>> Cole Robinson (4):
>>   qemu: command: escape commas in VM name
>>   qemu: command: escape commas in secret master path
>>   qemu: command: escape commas in chardev socket path
>>   qemu: command: Use -name guest= if available
>>
>>  src/qemu/qemu_capabilities.c                       |  2 ++
>>  src/qemu/qemu_capabilities.h                       |  1 +
>>  src/qemu/qemu_command.c                            | 22 ++++++++++++--------
>>  tests/qemucapabilitiesdata/caps_2.1.1-1.caps       |  1 +
>>  tests/qemucapabilitiesdata/caps_2.4.0-1.caps       |  1 +
>>  tests/qemucapabilitiesdata/caps_2.5.0-1.caps       |  1 +
>>  tests/qemucapabilitiesdata/caps_2.6.0-1.caps       |  1 +
>>  .../qemuxml2argvdata/qemuxml2argv-name-escape.args | 24 ++++++++++++++++++++++
>>  .../qemuxml2argvdata/qemuxml2argv-name-escape.xml  | 18 ++++++++++++++++
>>  tests/qemuxml2argvtest.c                           |  2 ++
>>  10 files changed, 65 insertions(+), 8 deletions(-)
>>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-name-escape.args
>>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-name-escape.xml
>>
> 
> 
> Is "ewww" the proper word here ;-)
> 

Maybe, seems to be popular on the list recently ;)

> What about the vmagent path?
> 

? 'git grep -i vmagent' doesn't give me anything. I guess you mean qemu-ga
path... that's handled by the chardev socket= escaping, which is what most
<channel> devices will be using.


> Since the 'path' that the masterKey uses is essentially the priv->libDir
> path, would fixing that path to have escaped chars work? (just typing
> without researching, thinking)... Similarly channelTargetDir. IOW:
> qemuDomainSetPrivatePaths
> 

Escaping these paths is a qemu command line thing only. Editing libDir
directly means that non-cli uses of libDir in the code will be trying to
access the wrong path (one with a literal double comma in it, vs the actual
single comma)

> What about places in qemu_process which use the [obj->]def->name to
> build Path's (stateDir).
> 

Those don't matter, they can have embedded comma/equals just fine. Those
characters are only a problem on the qemu command line which uses it as a
delimiter, so it needs special handling. For regular FS paths those characters
are totally legit

> Does this work with domain name rename?  migrations? If the target host
> doesn't support "guest=".
> 

If the target host doesn't support guest= it may fail, but only if the name
has an embedded equals sign. I think that's fine.

> I guess I'm also somewhat surprised that there'd be no issues w/ cgroups
> and systemd interactions.
> 
> Just some quick Saturday morning thoughts with only 1 cup of coffee...
> 

See above, I think maybe you are confusing this 'escaping' with general shell
escaping? Or I myself need more coffee, still working on cup #1 :)

- Cole




More information about the libvir-list mailing list