2008-02-20 15:34:52 +00:00
|
|
|
/*
|
Mark many more strings for translation.
* Makefile.maint (err_func_re): Add to the list and make it readable.
* po/POTFILES.in: Add src/util.c and src/xm_internal.c, and sort.
* src/storage_backend.c: Fix comment.
* src/util.c (virFileLinkPointsTo): Mark a string.
* qemud/remote.c (remoteDispatchClientRequest): Mark strings.
(remoteDispatchOpen, CHECK_CONN, remoteDispatchGetType): Likewise.
(remoteDispatchDomainGetSchedulerType): Likewise.
(remoteDispatchDomainGetSchedulerParameters): Likewise.
(remoteDispatchDomainSetSchedulerParameters): Likewise.
(remoteDispatchDomainBlockStats): Likewise.
(remoteDispatchDomainInterfaceStats): Likewise.
(remoteDispatchDomainAttachDevice, remoteDispatchDomainCreate):
(remoteDispatchDomainDestroy, remoteDispatchDomainDetachDevice):
(remoteDispatchDomainDumpXml, remoteDispatchDomainGetAutostart):
(remoteDispatchDomainGetInfo, remoteDispatchDomainGetMaxMemory):
(remoteDispatchDomainGetMaxVcpus, remoteDispatchDomainGetOsType):
(remoteDispatchDomainGetVcpus): Likewise.
(remoteDispatchDomainMigratePerform): Likewise.
(remoteDispatchListDefinedDomains, remoteDispatchDomainPinVcpu):
(remoteDispatchDomainReboot, remoteDispatchDomainResume):
(remoteDispatchDomainSave, remoteDispatchDomainCoreDump):
(remoteDispatchDomainSetAutostart): Likewise.
(remoteDispatchDomainSetMaxMemory, remoteDispatchDomainSetMemory):
(remoteDispatchDomainSetVcpus, remoteDispatchDomainShutdown):
(remoteDispatchDomainSuspend, remoteDispatchDomainUndefine):
(remoteDispatchListDefinedNetworks, remoteDispatchListDomains):
(remoteDispatchListNetworks, remoteDispatchNetworkCreate):
(remoteDispatchNetworkDestroy, remoteDispatchNetworkDumpXml):
(remoteDispatchNetworkGetAutostart, remoteDispatchNetworkGetBridgeName):
(remoteDispatchNetworkSetAutostart, remoteDispatchNetworkUndefine):
(addrToString, remoteDispatchAuthSaslInit, remoteDispatchAuthSaslStart):
(remoteDispatchAuthSaslStep, remoteDispatchListDefinedStoragePools):
(remoteDispatchListStoragePools, remoteDispatchStoragePoolCreate):
(remoteDispatchStoragePoolBuild, remoteDispatchStoragePoolDestroy):
(remoteDispatchStoragePoolDelete, remoteDispatchStoragePoolRefresh):
(remoteDispatchStoragePoolGetInfo, remoteDispatchStoragePoolDumpXml):
(remoteDispatchStoragePoolGetAutostart): Likewise.
(remoteDispatchStoragePoolSetAutostart):
(remoteDispatchStoragePoolListVolumes):
(remoteDispatchStoragePoolNumOfVolumes):
(remoteDispatchStoragePoolUndefine, remoteDispatchStorageVolCreateXml):
(remoteDispatchStorageVolDelete, remoteDispatchStorageVolGetInfo):
(remoteDispatchStorageVolDumpXml, remoteDispatchStorageVolGetPath):
(remoteDispatchStorageVolLookupByName): Likewise.
* src/qemu_driver.c (qemudOpenMonitor, qemudStartVMDaemon):
(dhcpStartDhcpDaemon, qemudStartNetworkDaemon):
(qemudDomainSuspend, qemudDomainResume, qemudDomainShutdown):
(qemudDomainGetOSType, qemudDomainSetMaxMemory):
(qemudDomainSetMemory, qemudDomainGetInfo, qemudDomainSave):
(qemudDomainRestore, qemudDomainDumpXML, qemudDomainStart):
(qemudDomainUndefine, qemudDomainChangeCDROM):
(qemudDomainAttachDevice, qemudDomainGetAutostart):
(qemudDomainSetAutostart, qemudDomainInterfaceStats):
(qemudNetworkLookupByUUID, qemudNetworkLookupByName):
(qemudNetworkUndefine, qemudNetworkStart, qemudNetworkDestroy):
(qemudNetworkDumpXML, qemudNetworkGetAutostart):
(qemudNetworkSetAutostart): Likewise.
* src/virsh.c (cmdVcpupin, cmdAttachDevice, cmdDetachDevice): Likewise.
* src/xm_internal.c (xenXMConfigCacheRefresh, xenXMDomainPinVcpu): Likewise.
2008-03-27 13:43:01 +00:00
|
|
|
* storage_backend.c: internal storage driver backend contract
|
2008-02-20 15:34:52 +00:00
|
|
|
*
|
2016-01-29 12:35:35 +00:00
|
|
|
* Copyright (C) 2007-2016 Red Hat, Inc.
|
2008-02-20 15:34:52 +00:00
|
|
|
* Copyright (C) 2007-2008 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
|
2012-09-20 22:30:55 +00:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 10:06:23 +00:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2008-02-20 15:34:52 +00:00
|
|
|
*
|
|
|
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include <string.h>
|
2008-02-20 15:38:29 +00:00
|
|
|
#include <sys/stat.h>
|
2015-01-23 10:22:34 +00:00
|
|
|
|
2009-08-14 18:06:59 +00:00
|
|
|
#include "datatypes.h"
|
2012-12-13 18:21:53 +00:00
|
|
|
#include "virerror.h"
|
2012-12-12 18:06:53 +00:00
|
|
|
#include "viralloc.h"
|
2009-09-03 08:22:57 +00:00
|
|
|
#include "internal.h"
|
2012-12-13 15:25:48 +00:00
|
|
|
#include "virstoragefile.h"
|
2008-09-05 12:03:45 +00:00
|
|
|
#include "storage_backend.h"
|
2012-12-12 17:59:27 +00:00
|
|
|
#include "virlog.h"
|
2017-02-07 18:40:29 +00:00
|
|
|
#include "virfile.h"
|
|
|
|
#include "configmake.h"
|
Standardize use of header files, making internal.h primary.
* qemud/internal.h, qemud/qemud.h: Rename this file so it
doesn't conflict with src/internal.h.
* HACKING: Document how header files should be used.
* qemud/Makefile.am: Add src/ directory to includes.
* qemud/event.c, qemud/mdns.c, qemud/qemud.c, qemud/remote.c,
qemud/remote_protocol.c, qemud/remote_protocol.h,
qemud/remote_protocol.x, src/buf.c, src/libvirt.c,
src/nodeinfo.c, src/qemu_conf.c, src/qemu_driver.c,
src/stats_linux.c, src/storage_backend.c, src/storage_backend_fs.c,
src/storage_backend_iscsi.c, src/storage_backend_logical.c,
src/storage_conf.c, src/storage_driver.c, src/util.c,
src/util.h, src/virsh.c, src/virterror.c, src/xend_internal.c,
src/xml.c, tests/reconnect.c, tests/xmlrpctest.c,
tests/qparamtest.c: Standardize use of header files.
* docs/*, po/*: Rebuild docs.
2008-05-23 08:24:41 +00:00
|
|
|
|
2008-11-12 16:28:27 +00:00
|
|
|
#if WITH_STORAGE_LVM
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "storage_backend_logical.h"
|
2008-11-12 16:28:27 +00:00
|
|
|
#endif
|
|
|
|
#if WITH_STORAGE_ISCSI
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "storage_backend_iscsi.h"
|
2008-11-12 16:28:27 +00:00
|
|
|
#endif
|
2009-04-01 16:03:22 +00:00
|
|
|
#if WITH_STORAGE_SCSI
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "storage_backend_scsi.h"
|
2009-04-01 16:03:22 +00:00
|
|
|
#endif
|
2009-09-08 13:47:45 +00:00
|
|
|
#if WITH_STORAGE_MPATH
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "storage_backend_mpath.h"
|
2009-09-08 13:47:45 +00:00
|
|
|
#endif
|
2008-11-12 16:28:27 +00:00
|
|
|
#if WITH_STORAGE_DISK
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "storage_backend_disk.h"
|
2008-11-12 16:28:27 +00:00
|
|
|
#endif
|
|
|
|
#if WITH_STORAGE_DIR
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "storage_backend_fs.h"
|
2008-11-12 16:28:27 +00:00
|
|
|
#endif
|
2012-05-14 09:06:42 +00:00
|
|
|
#if WITH_STORAGE_RBD
|
|
|
|
# include "storage_backend_rbd.h"
|
|
|
|
#endif
|
2012-07-18 19:06:58 +00:00
|
|
|
#if WITH_STORAGE_SHEEPDOG
|
|
|
|
# include "storage_backend_sheepdog.h"
|
|
|
|
#endif
|
2013-11-19 23:26:05 +00:00
|
|
|
#if WITH_STORAGE_GLUSTER
|
|
|
|
# include "storage_backend_gluster.h"
|
|
|
|
#endif
|
2014-07-21 14:38:42 +00:00
|
|
|
#if WITH_STORAGE_ZFS
|
|
|
|
# include "storage_backend_zfs.h"
|
|
|
|
#endif
|
2017-01-17 14:10:55 +00:00
|
|
|
#if WITH_STORAGE_VSTORAGE
|
|
|
|
# include "storage_backend_vstorage.h"
|
|
|
|
#endif
|
2008-11-12 16:28:27 +00:00
|
|
|
|
2009-01-20 17:13:33 +00:00
|
|
|
#define VIR_FROM_THIS VIR_FROM_STORAGE
|
|
|
|
|
2014-02-28 12:16:17 +00:00
|
|
|
VIR_LOG_INIT("storage.storage_backend");
|
|
|
|
|
2017-01-13 15:50:11 +00:00
|
|
|
#define VIR_STORAGE_BACKENDS_MAX 20
|
|
|
|
|
|
|
|
static virStorageBackendPtr virStorageBackends[VIR_STORAGE_BACKENDS_MAX];
|
|
|
|
static size_t virStorageBackendsCount;
|
|
|
|
static virStorageFileBackendPtr virStorageFileBackends[VIR_STORAGE_BACKENDS_MAX];
|
|
|
|
static size_t virStorageFileBackendsCount;
|
|
|
|
|
2017-02-07 18:40:29 +00:00
|
|
|
#if WITH_DRIVER_MODULES
|
|
|
|
|
|
|
|
# define STORAGE_BACKEND_MODULE_DIR LIBDIR "/libvirt/storage-backend"
|
|
|
|
|
|
|
|
static int
|
|
|
|
virStorageDriverLoadBackendModule(const char *name,
|
2017-02-07 17:58:39 +00:00
|
|
|
const char *regfunc,
|
|
|
|
bool forceload)
|
2017-02-07 18:40:29 +00:00
|
|
|
{
|
|
|
|
char *modfile = NULL;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (!(modfile = virFileFindResourceFull(name,
|
|
|
|
"libvirt_storage_backend_",
|
|
|
|
".so",
|
|
|
|
abs_topbuilddir "/src/.libs",
|
|
|
|
STORAGE_BACKEND_MODULE_DIR,
|
|
|
|
"LIBVIRT_STORAGE_BACKEND_DIR")))
|
|
|
|
return 1;
|
|
|
|
|
2017-02-07 17:58:39 +00:00
|
|
|
if ((ret = virDriverLoadModuleFull(modfile, regfunc, NULL)) != 0) {
|
|
|
|
if (forceload) {
|
|
|
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
|
_("failed to load storage backend module '%s'"),
|
|
|
|
name);
|
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
}
|
2017-02-07 18:40:29 +00:00
|
|
|
|
|
|
|
VIR_FREE(modfile);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# define VIR_STORAGE_BACKEND_REGISTER(func, module) \
|
2017-02-07 17:58:39 +00:00
|
|
|
if (virStorageDriverLoadBackendModule(module, #func, allbackends) < 0) \
|
2017-02-07 18:40:29 +00:00
|
|
|
return -1
|
|
|
|
#else
|
|
|
|
# define VIR_STORAGE_BACKEND_REGISTER(func, module) \
|
|
|
|
if (func() < 0) \
|
2017-01-13 15:50:11 +00:00
|
|
|
return -1
|
2017-02-07 18:40:29 +00:00
|
|
|
#endif
|
2017-01-13 15:50:11 +00:00
|
|
|
|
|
|
|
int
|
2017-02-07 17:58:39 +00:00
|
|
|
virStorageBackendDriversRegister(bool allbackends ATTRIBUTE_UNUSED)
|
2017-01-13 15:50:11 +00:00
|
|
|
{
|
|
|
|
#if WITH_STORAGE_DIR || WITH_STORAGE_FS
|
2017-02-07 18:40:29 +00:00
|
|
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendFsRegister, "fs");
|
2008-11-12 16:28:27 +00:00
|
|
|
#endif
|
|
|
|
#if WITH_STORAGE_LVM
|
2017-02-07 18:40:29 +00:00
|
|
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendLogicalRegister, "logical");
|
2008-11-12 16:28:27 +00:00
|
|
|
#endif
|
|
|
|
#if WITH_STORAGE_ISCSI
|
2017-02-07 18:40:29 +00:00
|
|
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendISCSIRegister, "iscsi");
|
2008-11-12 16:28:27 +00:00
|
|
|
#endif
|
2009-04-01 16:03:22 +00:00
|
|
|
#if WITH_STORAGE_SCSI
|
2017-02-07 18:40:29 +00:00
|
|
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendSCSIRegister, "scsi");
|
2009-04-01 16:03:22 +00:00
|
|
|
#endif
|
2009-09-08 13:47:45 +00:00
|
|
|
#if WITH_STORAGE_MPATH
|
2017-02-07 18:40:29 +00:00
|
|
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendMpathRegister, "mpath");
|
2009-09-08 13:47:45 +00:00
|
|
|
#endif
|
2008-11-12 16:28:27 +00:00
|
|
|
#if WITH_STORAGE_DISK
|
2017-02-07 18:40:29 +00:00
|
|
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendDiskRegister, "disk");
|
2012-05-14 09:06:42 +00:00
|
|
|
#endif
|
|
|
|
#if WITH_STORAGE_RBD
|
2017-02-07 18:40:29 +00:00
|
|
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendRBDRegister, "rbd");
|
2012-07-18 19:06:58 +00:00
|
|
|
#endif
|
|
|
|
#if WITH_STORAGE_SHEEPDOG
|
2017-02-07 18:40:29 +00:00
|
|
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendSheepdogRegister, "sheepdog");
|
2013-11-19 23:26:05 +00:00
|
|
|
#endif
|
|
|
|
#if WITH_STORAGE_GLUSTER
|
2017-02-07 18:40:29 +00:00
|
|
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendGlusterRegister, "gluster");
|
2014-07-21 14:38:42 +00:00
|
|
|
#endif
|
|
|
|
#if WITH_STORAGE_ZFS
|
2017-02-07 18:40:29 +00:00
|
|
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendZFSRegister, "zfs");
|
2017-01-17 14:10:55 +00:00
|
|
|
#endif
|
|
|
|
#if WITH_STORAGE_VSTORAGE
|
2017-02-07 18:40:29 +00:00
|
|
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendVstorageRegister, "vstorage");
|
2008-11-12 16:28:27 +00:00
|
|
|
#endif
|
2008-11-11 15:52:16 +00:00
|
|
|
|
2017-01-13 15:50:11 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#undef VIR_STORAGE_BACKEND_REGISTER
|
2014-02-03 15:12:57 +00:00
|
|
|
|
2017-01-13 15:50:11 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
virStorageBackendRegister(virStorageBackendPtr backend)
|
|
|
|
{
|
|
|
|
VIR_DEBUG("Registering storage backend '%s'",
|
|
|
|
virStorageTypeToString(backend->type));
|
|
|
|
|
|
|
|
if (virStorageBackendsCount >= VIR_STORAGE_BACKENDS_MAX) {
|
|
|
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
|
_("Too many drivers, cannot register storage backend '%s'"),
|
|
|
|
virStorageTypeToString(backend->type));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
virStorageBackends[virStorageBackendsCount] = backend;
|
|
|
|
virStorageBackendsCount++;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
virStorageBackendFileRegister(virStorageFileBackendPtr backend)
|
|
|
|
{
|
|
|
|
VIR_DEBUG("Registering storage file backend '%s' protocol '%s'",
|
|
|
|
virStorageTypeToString(backend->type),
|
|
|
|
virStorageNetProtocolTypeToString(backend->protocol));
|
|
|
|
|
|
|
|
if (virStorageFileBackendsCount >= VIR_STORAGE_BACKENDS_MAX) {
|
|
|
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
|
_("Too many drivers, cannot register storage file "
|
|
|
|
"backend '%s'"),
|
|
|
|
virStorageTypeToString(backend->type));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
virStorageFileBackends[virStorageFileBackendsCount] = backend;
|
|
|
|
virStorageFileBackendsCount++;
|
|
|
|
return 0;
|
|
|
|
}
|
2014-02-03 15:12:57 +00:00
|
|
|
|
|
|
|
|
2017-01-11 17:04:15 +00:00
|
|
|
virStorageBackendPtr
|
|
|
|
virStorageBackendForType(int type)
|
Fix UUID handling in secrets/storage encryption APIs
Convert all the secret/storage encryption APIs / wire format to
handle UUIDs in raw format instead of non-canonical printable
format. Guarentees data format correctness.
* docs/schemas/storageencryption.rng: Make UUID mandatory for a secret
and validate fully
* docs/schemas/secret.rng: Fully validate UUID
* include/libvirt/libvirt.h, include/libvirt/libvirt.h.in, Add
virSecretLookupByUUID and virSecretGetUUID. Make
virSecretGetUUIDString follow normal API design pattern
* python/generator.py: Skip generation of virSecretGetUUID,
virSecretGetUUIDString and virSecretLookupByUUID
* python/libvir.c, python/libvirt-python-api.xml: Manual impl
of virSecretGetUUID,virSecretGetUUIDString and virSecretLookupByUUID
* qemud/remote.c: s/virSecretLookupByUUIDString/virSecretLookupByUUID/
Fix get_nonnull_secret/make_nonnull_secret to use unsigned char
* qemud/remote_protocol.x: Fix remote_nonnull_secret to use a
remote_uuid instead of remote_nonnull_string for UUID field.
Rename REMOTE_PROC_SECRET_LOOKUP_BY_UUID_STRING to
REMOTE_PROC_SECRET_LOOKUP_BY_UUID_STRING and make it take an
remote_uuid value
* qemud/remote_dispatch_args.h, qemud/remote_dispatch_prototypes.h,
qemud/remote_dispatch_ret.h, qemud/remote_dispatch_table.h,
qemud/remote_protocol.c, qemud/remote_protocol.h: Re-generate
* src/datatypes.h, src/datatypes.c: Store UUID in raw format instead
of printable. Change virGetSecret to use raw format UUID
* src/driver.h: Rename virDrvSecretLookupByUUIDString to
virDrvSecretLookupByUUID and use raw format UUID
* src/libvirt.c: Add virSecretLookupByUUID and virSecretGetUUID
and re-implement virSecretLookupByUUIDString and
virSecretGetUUIDString in terms of those
* src/libvirt_public.syms: Add virSecretLookupByUUID and
virSecretGetUUID
* src/remote_internal.c: Rename remoteSecretLookupByUUIDString
to remoteSecretLookupByUUID. Fix typo in args for
remoteSecretDefineXML impl. Use raw UUID format for
get_nonnull_secret and make_nonnull_secret
* src/storage_encryption_conf.c, src/storage_encryption_conf.h:
Storage UUID in raw format, and require it to be present in
XML. Use UUID parser to validate.
* secret_conf.h, secret_conf.c: Generate a UUID if none is provided.
Storage UUID in raw format.
* src/secret_driver.c: Adjust to deal with raw UUIDs. Save secrets
in a filed with printable UUID, instead of base64 UUID.
* src/virsh.c: Adjust for changed public API contract of
virSecretGetUUIDString.
* src/storage_Backend.c: DOn't undefine secret we just generated
upon successful volume creation. Fix to handle raw UUIDs. Generate
a non-clashing UUID
* src/qemu_driver.c: Change to use lookupByUUID instead of
lookupByUUIDString
2009-09-10 16:44:12 +00:00
|
|
|
{
|
2017-01-11 17:04:15 +00:00
|
|
|
size_t i;
|
2017-01-13 15:50:11 +00:00
|
|
|
for (i = 0; i < virStorageBackendsCount; i++)
|
|
|
|
if (virStorageBackends[i]->type == type)
|
|
|
|
return virStorageBackends[i];
|
Fix UUID handling in secrets/storage encryption APIs
Convert all the secret/storage encryption APIs / wire format to
handle UUIDs in raw format instead of non-canonical printable
format. Guarentees data format correctness.
* docs/schemas/storageencryption.rng: Make UUID mandatory for a secret
and validate fully
* docs/schemas/secret.rng: Fully validate UUID
* include/libvirt/libvirt.h, include/libvirt/libvirt.h.in, Add
virSecretLookupByUUID and virSecretGetUUID. Make
virSecretGetUUIDString follow normal API design pattern
* python/generator.py: Skip generation of virSecretGetUUID,
virSecretGetUUIDString and virSecretLookupByUUID
* python/libvir.c, python/libvirt-python-api.xml: Manual impl
of virSecretGetUUID,virSecretGetUUIDString and virSecretLookupByUUID
* qemud/remote.c: s/virSecretLookupByUUIDString/virSecretLookupByUUID/
Fix get_nonnull_secret/make_nonnull_secret to use unsigned char
* qemud/remote_protocol.x: Fix remote_nonnull_secret to use a
remote_uuid instead of remote_nonnull_string for UUID field.
Rename REMOTE_PROC_SECRET_LOOKUP_BY_UUID_STRING to
REMOTE_PROC_SECRET_LOOKUP_BY_UUID_STRING and make it take an
remote_uuid value
* qemud/remote_dispatch_args.h, qemud/remote_dispatch_prototypes.h,
qemud/remote_dispatch_ret.h, qemud/remote_dispatch_table.h,
qemud/remote_protocol.c, qemud/remote_protocol.h: Re-generate
* src/datatypes.h, src/datatypes.c: Store UUID in raw format instead
of printable. Change virGetSecret to use raw format UUID
* src/driver.h: Rename virDrvSecretLookupByUUIDString to
virDrvSecretLookupByUUID and use raw format UUID
* src/libvirt.c: Add virSecretLookupByUUID and virSecretGetUUID
and re-implement virSecretLookupByUUIDString and
virSecretGetUUIDString in terms of those
* src/libvirt_public.syms: Add virSecretLookupByUUID and
virSecretGetUUID
* src/remote_internal.c: Rename remoteSecretLookupByUUIDString
to remoteSecretLookupByUUID. Fix typo in args for
remoteSecretDefineXML impl. Use raw UUID format for
get_nonnull_secret and make_nonnull_secret
* src/storage_encryption_conf.c, src/storage_encryption_conf.h:
Storage UUID in raw format, and require it to be present in
XML. Use UUID parser to validate.
* secret_conf.h, secret_conf.c: Generate a UUID if none is provided.
Storage UUID in raw format.
* src/secret_driver.c: Adjust to deal with raw UUIDs. Save secrets
in a filed with printable UUID, instead of base64 UUID.
* src/virsh.c: Adjust for changed public API contract of
virSecretGetUUIDString.
* src/storage_Backend.c: DOn't undefine secret we just generated
upon successful volume creation. Fix to handle raw UUIDs. Generate
a non-clashing UUID
* src/qemu_driver.c: Change to use lookupByUUID instead of
lookupByUUIDString
2009-09-10 16:44:12 +00:00
|
|
|
|
2017-01-11 17:04:15 +00:00
|
|
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
|
_("missing backend for pool type %d (%s)"),
|
|
|
|
type, NULLSTR(virStoragePoolTypeToString(type)));
|
|
|
|
return NULL;
|
Fix UUID handling in secrets/storage encryption APIs
Convert all the secret/storage encryption APIs / wire format to
handle UUIDs in raw format instead of non-canonical printable
format. Guarentees data format correctness.
* docs/schemas/storageencryption.rng: Make UUID mandatory for a secret
and validate fully
* docs/schemas/secret.rng: Fully validate UUID
* include/libvirt/libvirt.h, include/libvirt/libvirt.h.in, Add
virSecretLookupByUUID and virSecretGetUUID. Make
virSecretGetUUIDString follow normal API design pattern
* python/generator.py: Skip generation of virSecretGetUUID,
virSecretGetUUIDString and virSecretLookupByUUID
* python/libvir.c, python/libvirt-python-api.xml: Manual impl
of virSecretGetUUID,virSecretGetUUIDString and virSecretLookupByUUID
* qemud/remote.c: s/virSecretLookupByUUIDString/virSecretLookupByUUID/
Fix get_nonnull_secret/make_nonnull_secret to use unsigned char
* qemud/remote_protocol.x: Fix remote_nonnull_secret to use a
remote_uuid instead of remote_nonnull_string for UUID field.
Rename REMOTE_PROC_SECRET_LOOKUP_BY_UUID_STRING to
REMOTE_PROC_SECRET_LOOKUP_BY_UUID_STRING and make it take an
remote_uuid value
* qemud/remote_dispatch_args.h, qemud/remote_dispatch_prototypes.h,
qemud/remote_dispatch_ret.h, qemud/remote_dispatch_table.h,
qemud/remote_protocol.c, qemud/remote_protocol.h: Re-generate
* src/datatypes.h, src/datatypes.c: Store UUID in raw format instead
of printable. Change virGetSecret to use raw format UUID
* src/driver.h: Rename virDrvSecretLookupByUUIDString to
virDrvSecretLookupByUUID and use raw format UUID
* src/libvirt.c: Add virSecretLookupByUUID and virSecretGetUUID
and re-implement virSecretLookupByUUIDString and
virSecretGetUUIDString in terms of those
* src/libvirt_public.syms: Add virSecretLookupByUUID and
virSecretGetUUID
* src/remote_internal.c: Rename remoteSecretLookupByUUIDString
to remoteSecretLookupByUUID. Fix typo in args for
remoteSecretDefineXML impl. Use raw UUID format for
get_nonnull_secret and make_nonnull_secret
* src/storage_encryption_conf.c, src/storage_encryption_conf.h:
Storage UUID in raw format, and require it to be present in
XML. Use UUID parser to validate.
* secret_conf.h, secret_conf.c: Generate a UUID if none is provided.
Storage UUID in raw format.
* src/secret_driver.c: Adjust to deal with raw UUIDs. Save secrets
in a filed with printable UUID, instead of base64 UUID.
* src/virsh.c: Adjust for changed public API contract of
virSecretGetUUIDString.
* src/storage_Backend.c: DOn't undefine secret we just generated
upon successful volume creation. Fix to handle raw UUIDs. Generate
a non-clashing UUID
* src/qemu_driver.c: Change to use lookupByUUID instead of
lookupByUUIDString
2009-09-10 16:44:12 +00:00
|
|
|
}
|
|
|
|
|
2009-08-14 18:06:59 +00:00
|
|
|
|
2017-01-11 17:04:15 +00:00
|
|
|
virStorageFileBackendPtr
|
|
|
|
virStorageFileBackendForTypeInternal(int type,
|
|
|
|
int protocol,
|
|
|
|
bool report)
|
2013-06-05 07:41:38 +00:00
|
|
|
{
|
2017-01-11 17:04:15 +00:00
|
|
|
size_t i;
|
2011-05-06 18:35:51 +00:00
|
|
|
|
2017-01-13 15:50:11 +00:00
|
|
|
for (i = 0; i < virStorageFileBackendsCount; i++) {
|
|
|
|
if (virStorageFileBackends[i]->type == type) {
|
2017-01-11 17:04:15 +00:00
|
|
|
if (type == VIR_STORAGE_TYPE_NETWORK &&
|
2017-01-13 15:50:11 +00:00
|
|
|
virStorageFileBackends[i]->protocol != protocol)
|
2017-01-11 17:04:15 +00:00
|
|
|
continue;
|
2015-10-14 13:56:14 +00:00
|
|
|
|
2017-01-13 15:50:11 +00:00
|
|
|
return virStorageFileBackends[i];
|
2010-01-20 23:41:52 +00:00
|
|
|
}
|
|
|
|
}
|
2015-04-27 20:48:05 +00:00
|
|
|
|
2017-01-11 17:04:15 +00:00
|
|
|
if (!report)
|
|
|
|
return NULL;
|
2016-04-11 16:16:20 +00:00
|
|
|
|
2017-01-11 17:04:15 +00:00
|
|
|
if (type == VIR_STORAGE_TYPE_NETWORK) {
|
2016-04-11 16:16:20 +00:00
|
|
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
2017-01-11 17:04:15 +00:00
|
|
|
_("missing storage backend for network files "
|
|
|
|
"using %s protocol"),
|
|
|
|
virStorageNetProtocolTypeToString(protocol));
|
2016-05-25 19:08:49 +00:00
|
|
|
} else {
|
2017-01-11 17:04:15 +00:00
|
|
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
|
_("missing storage backend for '%s' storage"),
|
|
|
|
virStorageTypeToString(type));
|
2016-05-25 19:08:49 +00:00
|
|
|
}
|
|
|
|
|
2017-01-11 17:04:15 +00:00
|
|
|
return NULL;
|
2016-05-25 19:08:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-01-11 17:04:15 +00:00
|
|
|
virStorageFileBackendPtr
|
|
|
|
virStorageFileBackendForType(int type,
|
|
|
|
int protocol)
|
2014-04-24 14:21:20 +00:00
|
|
|
{
|
|
|
|
return virStorageFileBackendForTypeInternal(type, protocol, true);
|
|
|
|
}
|