[libvirt] [PATCH 3/9] New files to glue domain and storage together
John Ferlan
jferlan at redhat.com
Thu Jan 31 17:30:00 UTC 2013
On 01/30/2013 01:11 PM, Osier Yang wrote:
> This creates src/conf/domain_storage.h and src/conf/storage_conf.c,
> which defines a driver contains internal APIs to glue the domain
> and storage. Currently there is only one API, translateDiskSourcePool,
> which is to translate the specified pool/volume into the the real
> underlying disk source. Later patch will implement API.
> ---
> src/Makefile.am | 3 ++-
> src/conf/domain_storage.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
> src/conf/domain_storage.h | 37 +++++++++++++++++++++++++++++++++++++
> src/libvirt_private.syms | 4 ++++
> 4 files changed, 87 insertions(+), 1 deletions(-)
> create mode 100644 src/conf/domain_storage.c
> create mode 100644 src/conf/domain_storage.h
>
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 070a089..d664c48 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -203,7 +203,8 @@ DOMAIN_CONF_SOURCES = \
> conf/domain_conf.c conf/domain_conf.h \
> conf/domain_audit.c conf/domain_audit.h \
> conf/domain_nwfilter.c conf/domain_nwfilter.h \
> - conf/snapshot_conf.c conf/snapshot_conf.h
> + conf/snapshot_conf.c conf/snapshot_conf.h \
> + conf/domain_storage.c conf/domain_storage.h
>
> DOMAIN_EVENT_SOURCES = \
> conf/domain_event.c conf/domain_event.h
> diff --git a/src/conf/domain_storage.c b/src/conf/domain_storage.c
> new file mode 100644
> index 0000000..299e9fd
> --- /dev/null
> +++ b/src/conf/domain_storage.c
> @@ -0,0 +1,44 @@
> +/*
> + * domain_storage.c: Internal APIs to glue domain and storage
> + *
> + * Copyright (C) 2013 Red Hat, Inc.
> + *
> + * 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: Osier Yang <jyang at redhat.com>
> + */
> +
> +#include <config.h>
> +
> +#include "internal.h"
> +
> +#include "datatypes.h"
> +#include "domain_conf.h"
> +#include "domain_storage.h"
> +
> +static virDomainStorageDriverPtr domainStorageDriver;
> +
> +void
> +virRegisterDomainStorageDriver(virDomainStorageDriverPtr driver) {
> + domainStorageDriver = driver;
> +}
This differs from what I read w/r/t what I read in HACKING which seems to use:
void
function(args)
{
code;
}
> +
> +int
> +virDomainStorageTranslateDiskSourcePool(virConnectPtr conn,
> + virDomainDefPtr def) {
> + if (domainStorageDriver != NULL)
> + return domainStorageDriver->translateDiskSourcePool(conn, def);
> + return 0;
> +}
> diff --git a/src/conf/domain_storage.h b/src/conf/domain_storage.h
> new file mode 100644
> index 0000000..143b476
> --- /dev/null
> +++ b/src/conf/domain_storage.h
> @@ -0,0 +1,37 @@
> +/*
> + * domain_storage.h: Internal APIs to glue domain and storage
> + *
> + * Copyright (C) 2013 Red Hat, Inc.
> + *
> + * 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: Osier Yang <jyang at redhat.com>
> + */
> +#ifndef DOMAIN_STORAGE_H
> +# define DOMAIN_STORAGE_H
> +
> +typedef int (*virDomainStorageDiskSourcePoolTranslate)(virConnectPtr conn,
> + virDomainDefPtr def);
> +struct _virDomainStorageDriver {
> + virDomainStorageDiskSourcePoolTranslate translateDiskSourcePool;
> +};
> +typedef struct _virDomainStorageDriver virDomainStorageDriver;
> +typedef virDomainStorageDriver *virDomainStorageDriverPtr;
> +
> +void virRegisterDomainStorageDriver(virDomainStorageDriverPtr driver);
> +int virDomainStorageTranslateDiskSourcePool(virConnectPtr conn,
> + virDomainDefPtr def);
> +
> +#endif /* DOMAIN_STORAGE_H */
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index c589236..a44f3ff 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -617,6 +617,10 @@ virDomainConfNWFilterTeardown;
> virDomainConfVMNWFilterTeardown;
>
>
> +# domain_storage.h
> +virDomainStorageTranslateDiskSourcePool;
> +virRegisterDomainStorageDriver;
> +
> # ebtables.h
> ebtablesAddForwardAllowIn;
> ebtablesAddForwardPolicyReject;
>
ACK
More information about the libvir-list
mailing list