Re: [PATCH v2 2/9] qemu: Move drive alias processing to qemu_alias

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 08/01/2016 04:39 AM, Ján Tomko wrote:
> On Tue, Jul 19, 2016 at 10:30:45AM -0400, John Ferlan wrote:
>> Move qemuDeviceDriveHostAlias from qemu_command and rename to
>> qemuAssignDeviceDiskDriveAlias in qemu_alias.  Also change the parameter
>> to just be the disk->info.alias (e.g. srcalias)
>>
>> Includes some innocent bystanders that seem to need
>> QEMU_DRIVE_HOST_PREFIX
>> which requires include qemu_alias.h instead of qemu_command.h
>>
>> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
>> ---
>> src/qemu/qemu_alias.c        | 17 +++++++++++++++++
>> src/qemu/qemu_alias.h        |  4 ++++
>> src/qemu/qemu_command.c      | 11 -----------
>> src/qemu/qemu_command.h      |  1 -
>> src/qemu/qemu_hotplug.c      |  4 ++--
>> src/qemu/qemu_migration.c    |  2 +-
>> src/qemu/qemu_monitor_json.c |  2 +-
>> src/qemu/qemu_monitor_text.c |  2 +-
>> 8 files changed, 26 insertions(+), 17 deletions(-)
>>
>> diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
>> index 51a654a..70cd9f1 100644
>> --- a/src/qemu/qemu_alias.c
>> +++ b/src/qemu/qemu_alias.c
>> @@ -170,6 +170,23 @@ qemuAssignDeviceControllerAlias(virDomainDefPtr
>> domainDef,
>>     return virAsprintf(&controller->info.alias, "%s%d", prefix,
>> controller->idx);
>> }
>>
>> +/* qemuAssignDeviceDiskDriveAlias:
>> + * @srcalias: Disk source alias
>> + *
>> + * Generate and return an alias for the device disk '-drive'
> 
> The other Assign* functions fill out the alias in device info.
> This one just returns the string.
> 
> Also, most of the functions in this file do not have a prefix derived
> from the file name, they start with qemuAssign instead of qemuAlias
> 
> I propose qemuAliasDiskDrive or qemuAliasDiskDriveStr.
> 

OK... Interesting though - searching on qemuAlias in qemu_alias.c
discovered qemuAliasFromDisk.

So how about if I use qemuAliasFromDisk instead?  Of course I'd replace
the "drive-" in there with QEMU_DRIVE_HOST_PREFIX.

Also, searching on \"drive- finds a function that open coded things:
qemuDomainSnapshotCreateSingleDiskActive - it probably should have used
qemuAliasFromDisk as well - I can send a separate patch on that.

Finally, of course the one path that doesn't conform to the existing API
and passes 'alias' in order to generate "drive-%s", alias is the qcow
passphrase generation code...  That's easily changed though and I can
send a separate patch for that.

John

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]