Am 18.07.2014 um 20:24 hat Max Reitz geschrieben:
Some block devices may not have a filename in their BDS; and for some,
there may not even be a normal filename at all. To work around this, add
a function which tries to construct a valid filename for the
BDS.filename field.
If a filename exists or a block driver is able to reconstruct a valid
filename (which is placed in BDS.exact_filename), this can directly be
used.
If no filename can be constructed, we can still construct an options
QDict which is then converted to a JSON object and prefixed with the
"json:" pseudo protocol prefix. The QDict is placed in
BDS.full_open_options.
For most block drivers, this process can be done automatically; those
that need special handling may define a .bdrv_refresh_filename() method
to fill BDS.exact_filename and BDS.full_open_options themselves.
Signed-off-by: Max Reitz <address@hidden>
---
In this version, bdrv_refresh_filename() leaves the filename unmodified
if neither a new filename nor an options QDict can be generated. Another
idea would be to clear the filename in this case as it is probably
obsolete then. I was not sure which to pick, so I just used the first
version I wrote.
To be honest, many things in this patch don't feel quite right. This
isn't necessarily your fault, I can imagine that the infrastructure is
just lacking the right properties for you to use.
My hope is that soon bs->options would be the only BDS field keeping
configuration information and that bs->filename would go away. Now with
this patch series we get both of them duplicated instead. I'm not quite
sure if this is progress, but it may still be an acceptable intermediate
step.