Re: [PATCH v2 01/12] qemu: Introduce qemuDomainSecretInfo

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

 




On 05/02/2016 07:17 AM, Ján Tomko wrote:
> On Sat, Apr 16, 2016 at 10:17:34AM -0400, John Ferlan wrote:
>> Introduce a new private structure to hold qemu domain auth/secret data.
>> This will be stored in the qemuDomainDiskPrivate as a means to store the
>> auth and fetched secret data rather than generating during building of
>> the command line.
>>
>> The initial changes will handle the current username and secret values
>> for rbd and iscsi disks (in their various forms). The rbd secret is
>> stored as a base64 encoded value, while the iscsi secret is stored as
>> a plain text value. Future changes will store encoded/encrypted secret
>> data as well as an initialization vector needed to be given to qemu
>> in order to decrypt the encoded password along with the domain masterKey.
>> The inital assumption will be that VIR_DOMAIN_SECRET_INFO_PLAIN is
>> being used.
>>
>> Although it's expected that the cleanup of the secret data will be
>> done immediately after command line generation, reintroduce the object
>> dispose function qemuDomainDiskPrivateDispose to handle removing
>> memory associated with the structure for "normal" cleanup paths.
>>
>> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
>> ---
>>  src/qemu/qemu_domain.c | 32 +++++++++++++++++++++++++++++++-
>>  src/qemu/qemu_domain.h | 27 +++++++++++++++++++++++++++
>>  2 files changed, 58 insertions(+), 1 deletion(-)
> 
>> diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
>> index 7d2c4fd..9cfe3e4 100644
>> --- a/src/qemu/qemu_domain.h
>> +++ b/src/qemu/qemu_domain.h
>> @@ -239,6 +239,29 @@ struct _qemuDomainObjPrivate {
>>      size_t masterKeyLen;
>>  };
>>  
>> +/* Type of domain secret */
>> +typedef enum {
>> +    VIR_DOMAIN_SECRET_INFO_PLAIN = 0,
>> +
>> +    VIR_DOMAIN_SECRET_INFO_LAST
>> +} qemuDomainSecretInfoType;
> 
> Just a nit: the enum name has 'Type' in it, but the enum values do not.
> 

Nor does qemuProcessEventType in qemu_domain.h

Nor does qemuMonitorJSONObjectPropertyType in qemu_monitor_json.h

But I can make the change to VIR_DOMAIN_SECRET_INFO_TYPE_{PLAIN|IV|LAST}

>> +
>> +typedef struct _qemuDomainSecretPlain qemuDomainSecretPlain;
>> +typedef struct _qemuDomainSecretPlain *qemuDomainSecretPlainPtr;
>> +struct _qemuDomainSecretPlain {
>> +    char *username;
>> +    char *secret;
>> +};
>> +
>> +typedef struct _qemuDomainSecretInfo qemuDomainSecretInfo;
>> +typedef qemuDomainSecretInfo *qemuDomainSecretInfoPtr;
>> +struct _qemuDomainSecretInfo {
>> +    int type;  /* qemuDomainSecretInfoType */
> 
> Is there any issue with using:
> qemuDomainSecretInfoType type;
> 
> As far as I know we cannot use enums in public structures because their
> size varies per-platform/compiler, but they should be safe in internal
> code.
> 

OK - I'll make these adjustments and send it along as the 1st patch of
the follow-up series.

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]