On 02/09/2011 09:58 AM, Daniel P. Berrange wrote:
The migration protocol has support for a 'cookie' parameter
which
is an opaque array of bytes as far as libvirt is concerned. Drivers
may use this for passing around arbitrary extra data they might
need during migration. The QEMU driver needs todo a few things:
s/todo/to do/
- Pass hostname/uuid to allow strict protection against localhost
migration attempts
- Pass SPICE/VNC server port from the target back to the source to
allow seemless relocation of client sessions
s/seemless/seamless/
+static void
qemuMigrationCookieGraphicsFree(qemuMigrationCookieGraphicsPtr grap)
+{
+ if (!grap)
+ return;
+ VIR_FREE(grap->listen);
+ VIR_FREE(grap->tlsSubject);
+ VIR_FREE(grap);
+}
+
+
+static void qemuMigrationCookieFree(qemuMigrationCookiePtr mig)
Should these two be added to cfg.mk's list of free-like functions?
+ if (virXPathLong("string(./graphics/@port)", ctxt,
&port) < 0) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("missing port attribute in migration
data"));
+ goto error;
+ }
+ grap->port = (int)port;
Why not just virXPathInt("...", ctxt, &grap->port, instead of going
through the temporary variable?
+ if (grap->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
+ if (virXPathLong("string(./graphics/@tlsPort)", ctxt, &port) <
0) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("missing port attribute in migration
data"));
+ goto error;
+ }
+ grap->tlsPort = (int)port;
Likewise.
@@ -358,6 +873,16 @@ qemuMigrationPrepareTunnel(struct qemud_driver
*driver,
event = virDomainEventNewFromObj(vm,
VIR_DOMAIN_EVENT_STARTED,
VIR_DOMAIN_EVENT_STARTED_MIGRATED);
+
+ if (qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutlen,
+ QEMU_MIGRATION_COOKIE_GRAPHICS) < 0) {
+ /* We could tear down the whole guest here, but
+ * cookie data is (so far) non-critical, so that
+ * seems little harsh. We'll just warn for now..
s/seems /seems a / (twice)
ACK with those nits fixed.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org