2016-02-16 15:24:35 +00:00
|
|
|
/*
|
|
|
|
* qemu_alias.h: QEMU alias manipulation
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006-2016 Red Hat, Inc.
|
|
|
|
* Copyright (C) 2006 Daniel P. Berrange
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __QEMU_ALIAS_H__
|
|
|
|
# define __QEMU_ALIAS_H__
|
|
|
|
|
|
|
|
# include "domain_conf.h"
|
|
|
|
|
|
|
|
# include "qemu_capabilities.h"
|
|
|
|
# include "qemu_domain.h"
|
|
|
|
# include "qemu_domain_address.h"
|
|
|
|
|
|
|
|
int qemuAssignDeviceChrAlias(virDomainDefPtr def,
|
|
|
|
virDomainChrDefPtr chr,
|
|
|
|
ssize_t idx);
|
|
|
|
|
|
|
|
int qemuAssignDeviceControllerAlias(virDomainDefPtr domainDef,
|
|
|
|
virQEMUCapsPtr qemuCaps,
|
|
|
|
virDomainControllerDefPtr controller);
|
|
|
|
|
2018-03-09 03:24:15 +00:00
|
|
|
int qemuAssignDeviceDiskAlias(virDomainDefPtr def,
|
|
|
|
virDomainDiskDefPtr disk);
|
2016-02-16 15:24:35 +00:00
|
|
|
|
|
|
|
int qemuAssignDeviceHostdevAlias(virDomainDefPtr def,
|
2016-04-01 14:40:23 +00:00
|
|
|
char **alias,
|
2016-02-16 15:24:35 +00:00
|
|
|
int idx);
|
|
|
|
|
|
|
|
int qemuAssignDeviceNetAlias(virDomainDefPtr def,
|
|
|
|
virDomainNetDefPtr net,
|
|
|
|
int idx);
|
|
|
|
|
|
|
|
int qemuAssignDeviceRedirdevAlias(virDomainDefPtr def,
|
|
|
|
virDomainRedirdevDefPtr redirdev,
|
|
|
|
int idx);
|
|
|
|
|
2016-04-06 15:32:12 +00:00
|
|
|
int qemuAssignDeviceRNGAlias(virDomainDefPtr def,
|
|
|
|
virDomainRNGDefPtr rng);
|
2016-02-16 15:24:35 +00:00
|
|
|
|
2016-04-06 15:32:12 +00:00
|
|
|
int qemuAssignDeviceMemoryAlias(virDomainDefPtr def,
|
2016-11-01 05:21:36 +00:00
|
|
|
virDomainMemoryDefPtr mems,
|
|
|
|
bool oldAlias);
|
2016-04-06 15:32:12 +00:00
|
|
|
|
2016-09-12 13:48:41 +00:00
|
|
|
int qemuAssignDeviceShmemAlias(virDomainDefPtr def,
|
|
|
|
virDomainShmemDefPtr shmem,
|
|
|
|
int idx);
|
|
|
|
|
2017-09-01 11:39:15 +00:00
|
|
|
int qemuAssignDeviceWatchdogAlias(virDomainWatchdogDefPtr watchdog);
|
|
|
|
|
2017-10-04 09:09:22 +00:00
|
|
|
int qemuAssignDeviceInputAlias(virDomainDefPtr def,
|
|
|
|
virDomainInputDefPtr input,
|
|
|
|
int idx);
|
|
|
|
|
2018-05-30 11:53:52 +00:00
|
|
|
int qemuAssignDeviceVsockAlias(virDomainVsockDefPtr vsock);
|
|
|
|
|
2016-02-16 15:24:35 +00:00
|
|
|
int qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps);
|
|
|
|
|
|
|
|
int qemuDomainDeviceAliasIndex(const virDomainDeviceInfo *info,
|
|
|
|
const char *prefix);
|
2016-02-26 15:29:58 +00:00
|
|
|
|
2018-05-31 09:55:24 +00:00
|
|
|
char *qemuAliasDiskDriveFromDisk(const virDomainDiskDef *disk);
|
2016-03-29 22:23:02 +00:00
|
|
|
|
2016-06-29 17:34:00 +00:00
|
|
|
const char *qemuAliasDiskDriveSkipPrefix(const char *dev_name);
|
|
|
|
|
2016-07-18 17:19:02 +00:00
|
|
|
char *qemuAliasFromHostdev(const virDomainHostdevDef *hostdev);
|
|
|
|
|
2016-03-29 22:23:02 +00:00
|
|
|
char *qemuDomainGetMasterKeyAlias(void);
|
|
|
|
|
2016-06-24 19:31:57 +00:00
|
|
|
char *qemuDomainGetSecretAESAlias(const char *srcalias,
|
|
|
|
bool isLuks);
|
qemu: Utilize qemu secret objects for RBD auth/secret
https://bugzilla.redhat.com/show_bug.cgi?id=1182074
If they're available and we need to pass secrets to qemu, then use the
qemu domain secret object in order to pass the secrets for RBD volumes
instead of passing the base64 encoded secret on the command line.
The goal is to make AES secrets the default and have no user interaction
required in order to allow using the AES mechanism. If the mechanism
is not available, then fall back to the current plain mechanism using
a base64 encoded secret.
New APIs:
qemu_domain.c:
qemuDomainGetSecretAESAlias:
Generate/return the secret object alias for an AES Secret Info type.
This will be called from qemuDomainSecretAESSetup.
qemuDomainSecretAESSetup: (private)
This API handles the details of the generation of the AES secret
and saves the pieces that need to be passed to qemu in order for
the secret to be decrypted. The encrypted secret based upon the
domain master key, an initialization vector (16 byte random value),
and the stored secret. Finally, the requirement from qemu is the IV
and encrypted secret are to be base64 encoded.
qemu_command.c:
qemuBuildSecretInfoProps: (private)
Generate/return a JSON properties object for the AES secret to
be used by both the command building and eventually the hotplug
code in order to add the secret object. Code was designed so that
in the future perhaps hotplug could use it if it made sense.
qemuBuildObjectSecretCommandLine (private)
Generate and add to the command line the -object secret for the
secret. This will be required for the subsequent RBD reference
to the object.
qemuBuildDiskSecinfoCommandLine (private)
Handle adding the AES secret object.
Adjustments:
qemu_domain.c:
The qemuDomainSecretSetup was altered to call either the AES or Plain
Setup functions based upon whether AES secrets are possible (we have
the encryption API) or not, we have secrets, and of course if the
protocol source is RBD.
qemu_command.c:
Adjust the qemuBuildRBDSecinfoURI API's in order to generate the
specific command options for an AES secret, such as:
-object secret,id=$alias,keyid=$masterKey,data=$base64encodedencrypted,
format=base64
-drive file=rbd:pool/image:id=myname:auth_supported=cephx\;none:\
mon_host=mon1.example.org\:6321,password-secret=$alias,...
where the 'id=' value is the secret object alias generated by
concatenating the disk alias and "-aesKey0". The 'keyid= $masterKey'
is the master key shared with qemu, and the -drive syntax will
reference that alias as the 'password-secret'. For the -drive
syntax, the 'id=myname' is kept to define the username, while the
'key=$base64 encoded secret' is removed.
While according to the syntax described for qemu commit '60390a21'
or as seen in the email archive:
https://lists.gnu.org/archive/html/qemu-devel/2016-01/msg04083.html
it is possible to pass a plaintext password via a file, the qemu
commit 'ac1d8878' describes the more feature rich 'keyid=' option
based upon the shared masterKey.
Add tests for checking/comparing output.
NB: For hotplug, since the hotplug code doesn't add command line
arguments, passing the encoded secret directly to the monitor
will suffice.
2016-04-11 15:26:14 +00:00
|
|
|
|
2017-02-16 19:59:06 +00:00
|
|
|
char *qemuAliasTLSObjFromSrcAlias(const char *srcAlias)
|
2016-06-09 22:30:55 +00:00
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2016-10-18 14:37:23 +00:00
|
|
|
char *qemuAliasChardevFromDevAlias(const char *devAlias)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2018-04-18 14:55:14 +00:00
|
|
|
const char *qemuDomainGetManagedPRAlias(void);
|
|
|
|
|
2018-05-11 12:11:36 +00:00
|
|
|
char *qemuDomainGetUnmanagedPRAlias(const char *parentalias);
|
2018-04-18 14:55:14 +00:00
|
|
|
|
2016-02-16 15:24:35 +00:00
|
|
|
#endif /* __QEMU_ALIAS_H__*/
|