From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xen.org
Cc: Ian Campbell <ian.campbell@eu.citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH v11 09/17] libxl: set nic type of stub to PV instead of copying from the parent
Date: Mon, 23 Jul 2012 18:27:37 +0100 [thread overview]
Message-ID: <1343064465-17864-10-git-send-email-roger.pau@citrix.com> (raw)
In-Reply-To: <1343064465-17864-1-git-send-email-roger.pau@citrix.com>
Introduce a new function used to copy the array of nics from the
parent guest to the stubdomain, and set the type of the nics used to
PV unconditianlly, or the call to setdefaults later is going to fail.
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@eu.citrix.com>
Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
---
tools/libxl/libxl_dm.c | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 9a2b247..aaabf1b 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -640,6 +640,27 @@ static int libxl__vfb_and_vkb_from_hvm_guest_config(libxl__gc *gc,
return 0;
}
+static int libxl__nics_from_hvm_guest_config(libxl__gc *gc,
+ const libxl_domain_config *guest_config,
+ libxl_device_nic *nic)
+{
+ const libxl_domain_build_info *b_info = &guest_config->b_info;
+ int i;
+
+ if (b_info->type != LIBXL_DOMAIN_TYPE_HVM)
+ return ERROR_INVAL;
+
+ for (i = 0; i < guest_config->num_nics; i++) {
+ libxl_device_nic_init(&nic[i]);
+ memcpy(&nic[i], &guest_config->nics[i], sizeof(nic[i]));
+ nic[i].nictype = LIBXL_NIC_TYPE_VIF;
+ nic[i].backend_domid = 0;
+ nic[i].devid = 0;
+ }
+
+ return 0;
+}
+
static int libxl__write_stub_dmargs(libxl__gc *gc,
int dm_domid, int guest_domid,
char **args)
@@ -764,7 +785,10 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
dm_config->disks = guest_config->disks;
dm_config->num_disks = guest_config->num_disks;
- dm_config->nics = guest_config->nics;
+ GCNEW_ARRAY(dm_config->nics,
+ guest_config->num_nics * sizeof(*dm_config->nics));
+ ret = libxl__nics_from_hvm_guest_config(gc, guest_config, dm_config->nics);
+ if (ret) goto out;
dm_config->num_nics = guest_config->num_nics;
dm_config->c_info.run_hotplug_scripts =
--
1.7.7.5 (Apple Git-26)
next prev parent reply other threads:[~2012-07-23 17:27 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-23 17:27 [PATCH v11 0/17] execute hotplug scripts from libxl Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 01/17] libxl: fix stubdom console destruction Roger Pau Monne
2012-07-24 7:50 ` Ian Campbell
2012-07-24 8:39 ` Roger Pau Monne
2012-07-24 10:16 ` Stefano Stabellini
2012-07-24 10:54 ` Roger Pau Monne
2012-07-24 10:57 ` Ian Campbell
2012-07-24 11:01 ` Roger Pau Monne
2012-07-24 11:58 ` Stefano Stabellini
2012-07-24 12:14 ` Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 02/17] libxl: refactor disk addition to take a helper Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 03/17] libxl: convert libxl__device_disk_local_attach to an async op Roger Pau Monne
2012-07-24 15:19 ` Ian Jackson
2012-07-24 16:09 ` Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 04/17] libxl: rename vifs to nics Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 05/17] libxl: convert libxl_device_disk_add to an async op Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 06/17] libxl: convert libxl_device_nic_add to an async operation Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 07/17] libxl: add option to choose who executes hotplug scripts Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 08/17] libxl: rename _IOEMU nic type to VIF_IOEMU Roger Pau Monne
2012-07-23 17:27 ` Roger Pau Monne [this message]
2012-07-24 15:27 ` [PATCH v11 09/17] libxl: set nic type of stub to PV instead of copying from the parent Ian Jackson
2012-07-24 15:32 ` Ian Campbell
2012-07-24 16:05 ` Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 10/17] libxl: set correct nic type depending on the guest Roger Pau Monne
2012-07-24 15:28 ` Ian Jackson
2012-07-24 16:02 ` Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 11/17] libxl: use libxl__xs_path_cleanup on device_destroy Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 12/17] libxl: call hotplug scripts for disk devices from libxl Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 13/17] libxl: call hotplug scripts for nic " Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 14/17] libxl: convert libxl_device_vkb_add to an async operation Roger Pau Monne
2012-07-23 17:27 ` [PATCH v11 15/17] libxl: convert libxl_device_vfb_add " Roger Pau Monne
2012-07-24 15:20 ` Ian Jackson
2012-07-25 11:00 ` Roger Pau Monne
2012-07-26 14:26 ` Ian Jackson
2012-07-23 17:27 ` [PATCH v11 16/17] xl: main_blockdetach don't call destroy if remove succeeds Roger Pau Monne
2012-07-24 15:29 ` Ian Jackson
2012-07-23 17:27 ` [PATCH v11 17/17] libxl: libxl__xs_path_cleanup don't print error if ENOENT Roger Pau Monne
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=1343064465-17864-10-git-send-email-roger.pau@citrix.com \
--to=roger.pau@citrix.com \
--cc=ian.campbell@eu.citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
/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).