On Fri, Sep 18, 2015 at 18:05:46 +0300, Nikolay Shirokovskiy wrote: > Extract parameter adaptation and checking which is protocol dependent into > designated functions. Leave only branching and common checks in > virDomainMigrateUnmanagedParams. > > Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx> > --- > src/libvirt-domain.c | 118 ++++++++++++++++++++++++++++++++++---------------- > 1 files changed, 80 insertions(+), 38 deletions(-) > > diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c > index 330ccab..f87a22d 100644 > --- a/src/libvirt-domain.c > +++ b/src/libvirt-domain.c > @@ -3315,6 +3315,82 @@ virDomainMigrateCheckNotLocal(const char *dconnuri) > } > > > +static int > +virDomainMigrateUnmanagedProto2(virDomainPtr domain, > + const char *dconnuri, > + virTypedParameterPtr params, > + int nparams, > + unsigned int flags) > +{ > + const char *uri = NULL; > + const char *miguri = NULL; > + const char *dname = NULL; > + const char *xmlin = NULL; > + unsigned long long bandwidth = 0; > + > + if (virTypedParamsGetString(params, nparams, > + VIR_MIGRATE_PARAM_URI, &miguri) < 0 || > + virTypedParamsGetString(params, nparams, > + VIR_MIGRATE_PARAM_DEST_NAME, &dname) < 0 || > + virTypedParamsGetString(params, nparams, > + VIR_MIGRATE_PARAM_DEST_XML, &xmlin) < 0 || > + virTypedParamsGetULLong(params, nparams, > + VIR_MIGRATE_PARAM_BANDWIDTH, &bandwidth) < 0) { > + return -1; > + } > + > + if (xmlin) { > + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", > + _("Unable to change target guest XML during " > + "migration")); > + return -1; > + } > + > + if (flags & VIR_MIGRATE_PEER2PEER) { > + if (miguri) { > + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", While at it, you could also change VIR_ERR_INTERNAL_ERROR to a more appropriate VIR_ERR_ARGUMENT_UNSUPPORTED. But it can be done in a separate patch. ... At first sight I was thinking this patch makes the code even worse since a new parameter would need to be added in more places, but that's addressed in the next patch. ACK Jirka -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list