From: Jim Fehlig <jfehlig@suse.com>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: libvir-list@redhat.com, xen-devel@lists.xensource.com
Subject: Re: [libvirt] [PATCH 1/5] Don't pass virDomainObjPtr to libxlBuildDomainConfig
Date: Fri, 30 May 2014 16:26:20 -0600 [thread overview]
Message-ID: <5389058C.8080908@suse.com> (raw)
In-Reply-To: <1401470645-19869-2-git-send-email-berrange@redhat.com>
Daniel P. Berrange wrote:
> To make it easier to unit test, change libxlBuildDomainConfig
> so that it takes 'virDomainDefPtr' and 'libxl_ctx *' objects
> as separate parameters.
>
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
> src/libxl/libxl_conf.c | 19 +++++++++----------
> src/libxl/libxl_conf.h | 4 +++-
> src/libxl/libxl_domain.c | 3 ++-
> 3 files changed, 14 insertions(+), 12 deletions(-)
>
ACK.
Regards,
Jim
> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> index b7fed7f..a98e27a 100644
> --- a/src/libxl/libxl_conf.c
> +++ b/src/libxl/libxl_conf.c
> @@ -567,10 +567,10 @@ libxlMakeChrdevStr(virDomainChrDefPtr def, char **buf)
> }
>
> static int
> -libxlMakeDomBuildInfo(virDomainObjPtr vm, libxl_domain_config *d_config)
> +libxlMakeDomBuildInfo(virDomainDefPtr def,
> + libxl_ctx *ctx,
> + libxl_domain_config *d_config)
> {
> - virDomainDefPtr def = vm->def;
> - libxlDomainObjPrivatePtr priv = vm->privateData;
> libxl_domain_build_info *b_info = &d_config->b_info;
> int hvm = STREQ(def->os.type, "hvm");
> size_t i;
> @@ -583,7 +583,7 @@ libxlMakeDomBuildInfo(virDomainObjPtr vm, libxl_domain_config *d_config)
> libxl_domain_build_info_init_type(b_info, LIBXL_DOMAIN_TYPE_PV);
>
> b_info->max_vcpus = def->maxvcpus;
> - if (libxl_cpu_bitmap_alloc(priv->ctx, &b_info->avail_vcpus, def->maxvcpus))
> + if (libxl_cpu_bitmap_alloc(ctx, &b_info->avail_vcpus, def->maxvcpus))
> goto error;
> libxl_bitmap_set_none(&b_info->avail_vcpus);
> for (i = 0; i < def->vcpus; i++)
> @@ -1306,17 +1306,16 @@ libxlMakeCapabilities(libxl_ctx *ctx)
>
> int
> libxlBuildDomainConfig(libxlDriverPrivatePtr driver,
> - virDomainObjPtr vm, libxl_domain_config *d_config)
> + virDomainDefPtr def,
> + libxl_ctx *ctx,
> + libxl_domain_config *d_config)
> {
> - virDomainDefPtr def = vm->def;
> - libxlDomainObjPrivatePtr priv = vm->privateData;
> -
> libxl_domain_config_init(d_config);
>
> - if (libxlMakeDomCreateInfo(priv->ctx, def, &d_config->c_info) < 0)
> + if (libxlMakeDomCreateInfo(ctx, def, &d_config->c_info) < 0)
> return -1;
>
> - if (libxlMakeDomBuildInfo(vm, d_config) < 0)
> + if (libxlMakeDomBuildInfo(def, ctx, d_config) < 0)
> return -1;
>
> if (libxlMakeDiskList(def, d_config) < 0)
> diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
> index 24e1720..1dd9de3 100644
> --- a/src/libxl/libxl_conf.h
> +++ b/src/libxl/libxl_conf.h
> @@ -160,7 +160,9 @@ libxlMakePCI(virDomainHostdevDefPtr hostdev, libxl_device_pci *pcidev);
>
> int
> libxlBuildDomainConfig(libxlDriverPrivatePtr driver,
> - virDomainObjPtr vm, libxl_domain_config *d_config);
> + virDomainDefPtr def,
> + libxl_ctx *ctx,
> + libxl_domain_config *d_config);
>
> static inline void
> libxlDriverLock(libxlDriverPrivatePtr driver)
> diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
> index 80d5280..f95f8ce 100644
> --- a/src/libxl/libxl_domain.c
> +++ b/src/libxl/libxl_domain.c
> @@ -1151,7 +1151,8 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
>
> libxl_domain_config_init(&d_config);
>
> - if (libxlBuildDomainConfig(driver, vm, &d_config) < 0)
> + if (libxlBuildDomainConfig(driver, vm->def,
> + priv->ctx, &d_config) < 0)
> goto endjob;
>
> if (cfg->autoballoon && libxlDomainFreeMem(priv, &d_config) < 0) {
>
next prev parent reply other threads:[~2014-05-30 22:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-30 17:24 [libvirt] [PATCH 0/5] Testing libvirt XML -> libxl_domain_config conversion Daniel P. Berrange
2014-05-30 17:24 ` [libvirt] [PATCH 1/5] Don't pass virDomainObjPtr to libxlBuildDomainConfig Daniel P. Berrange
2014-05-30 22:26 ` Jim Fehlig [this message]
2014-05-30 17:24 ` [libvirt] [PATCH 2/5] Don't pass libxlDriverPrivatePtr into libxlBuildDomainConfig Daniel P. Berrange
2014-05-30 22:34 ` Jim Fehlig
2014-05-30 17:24 ` [libvirt] [PATCH 3/5] libxl: Move virDomainXMLOptionNew into libxlCreateXMLConf Daniel P. Berrange
2014-05-30 22:41 ` Jim Fehlig
2014-06-02 9:33 ` Daniel P. Berrange
2014-05-30 17:24 ` [libvirt] [PATCH 4/5] Add more test suite mock helpers Daniel P. Berrange
2014-05-30 17:24 ` [PATCH 5/5] Add a test suite for libxl option generator Daniel P. Berrange
2014-06-02 12:53 ` Ian Campbell
2014-06-02 12:57 ` [libvirt] [Xen-devel] " Daniel P. Berrange
2014-06-02 21:42 ` Jim Fehlig
2014-06-02 12:41 ` [PATCH 0/5] Testing libvirt XML -> libxl_domain_config conversion Ian Campbell
2014-06-02 12:49 ` [libvirt] [Xen-devel] " Daniel P. Berrange
2014-06-02 22:43 ` Jim Fehlig
2014-06-03 9:26 ` [libvirt] [Xen-devel] " Daniel P. Berrange
2014-06-02 12:57 ` Ian Campbell
2014-06-02 13:15 ` Processed: " xen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5389058C.8080908@suse.com \
--to=jfehlig@suse.com \
--cc=berrange@redhat.com \
--cc=libvir-list@redhat.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).