conf: move storage source type to util/

With this patch, all information related to a host resource in
a storage file backing chain now lives in util/virstoragefile.h.
The next step will be to consolidate various places that have
been tracking backing chain details to all use a common struct.

The changes to tools/Makefile.am were made necessary by the
fact that virstorageencryption includes uses of libxml, and is
now pulled in by inclusion from virstoragefile.h.  No
additional libraries are linked into the final image, and in
comparison, the build of the setuid library in src/Makefile.am
already was using LIBXML_CFLAGS via AM_CFLAGS.

* src/conf/domain_conf.h (virDomainDiskSourceDef): Move...
* src/util/virstoragefile.h (virStorageSource): ...and rename.
* src/conf/domain_conf.c (virDomainDiskSourceDefClear)
(virDomainDiskAuthClear): Adjust clients.
* tools/Makefile.am (virt_login_shell_CFLAGS)
(virt_host_validate_CFLAGS): Add libxml headers.

Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Eric Blake 2014-03-28 12:38:43 -06:00
parent c05d9dcad7
commit 8a20e227f6
4 changed files with 38 additions and 32 deletions

View File

@ -1193,7 +1193,7 @@ virDomainDiskSourcePoolDefFree(virStorageSourcePoolDefPtr def)
static void
virDomainDiskSourceDefClear(virDomainDiskSourceDefPtr def)
virDomainDiskSourceDefClear(virStorageSourcePtr def)
{
size_t i;
@ -1237,7 +1237,7 @@ virDomainDiskDefFree(virDomainDiskDefPtr def)
void
virDomainDiskAuthClear(virDomainDiskSourceDefPtr def)
virDomainDiskAuthClear(virStorageSourcePtr def)
{
VIR_FREE(def->auth.username);

View File

@ -595,38 +595,10 @@ struct _virDomainBlockIoTuneInfo {
};
typedef virDomainBlockIoTuneInfo *virDomainBlockIoTuneInfoPtr;
typedef struct _virDomainDiskSourceDef virDomainDiskSourceDef;
typedef virDomainDiskSourceDef *virDomainDiskSourceDefPtr;
/* Stores information related to a host resource. In the case of
* backing chains, multiple source disks join to form a single guest
* view. TODO Move this to util/ */
struct _virDomainDiskSourceDef {
int type; /* enum virStorageType */
char *path;
int protocol; /* enum virStorageNetProtocol */
size_t nhosts;
virStorageNetHostDefPtr hosts;
virStorageSourcePoolDefPtr srcpool;
struct {
char *username;
int secretType; /* enum virStorageSecretType */
union {
unsigned char uuid[VIR_UUID_BUFLEN];
char *usage;
} secret;
} auth;
virStorageEncryptionPtr encryption;
char *driverName;
int format; /* enum virStorageFileFormat */
size_t nseclabels;
virSecurityDeviceLabelDefPtr *seclabels;
};
/* Stores the virtual disk configuration */
struct _virDomainDiskDef {
virDomainDiskSourceDef src;
virStorageSource src;
int device; /* enum virDomainDiskDevice */
int bus; /* enum virDomainDiskBus */
@ -2153,7 +2125,7 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def);
void virDomainInputDefFree(virDomainInputDefPtr def);
void virDomainDiskDefFree(virDomainDiskDefPtr def);
void virDomainLeaseDefFree(virDomainLeaseDefPtr def);
void virDomainDiskAuthClear(virDomainDiskSourceDefPtr def);
void virDomainDiskAuthClear(virStorageSourcePtr def);
int virDomainDiskGetType(virDomainDiskDefPtr def);
void virDomainDiskSetType(virDomainDiskDefPtr def, int type);
int virDomainDiskGetActualType(virDomainDiskDefPtr def);

View File

@ -25,6 +25,8 @@
# define __VIR_STORAGE_FILE_H__
# include "virbitmap.h"
# include "virseclabel.h"
# include "virstorageencryption.h"
# include "virutil.h"
/* Minimum header size required to probe all known formats with
@ -182,6 +184,36 @@ enum virStorageSecretType {
};
typedef struct _virStorageSource virStorageSource;
typedef virStorageSource *virStorageSourcePtr;
/* Stores information related to a host resource. In the case of
* backing chains, multiple source disks join to form a single guest
* view. */
struct _virStorageSource {
int type; /* enum virStorageType */
char *path;
int protocol; /* enum virStorageNetProtocol */
size_t nhosts;
virStorageNetHostDefPtr hosts;
virStorageSourcePoolDefPtr srcpool;
struct {
char *username;
int secretType; /* enum virStorageSecretType */
union {
unsigned char uuid[VIR_UUID_BUFLEN];
char *usage;
} secret;
} auth;
virStorageEncryptionPtr encryption;
char *driverName;
int format; /* enum virStorageFileFormat */
size_t nseclabels;
virSecurityDeviceLabelDefPtr *seclabels;
};
# ifndef DEV_BSIZE
# define DEV_BSIZE 512
# endif

View File

@ -148,6 +148,7 @@ virt_host_validate_LDADD = \
$(NULL)
virt_host_validate_CFLAGS = \
$(LIBXML_CFLAGS) \
$(WARN_CFLAGS) \
$(PIE_CFLAGS) \
$(COVERAGE_CFLAGS) \
@ -173,6 +174,7 @@ virt_login_shell_LDADD = \
virt_login_shell_CFLAGS = \
-DLIBVIRT_SETUID_RPC_CLIENT \
$(LIBXML_CFLAGS) \
$(WARN_CFLAGS) \
$(PIE_CFLAGS) \
$(COVERAGE_CFLAGS)