mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 19:41:16 +00:00
conf: add net device prefix to capabilities
In the reverted commit d2e5538b1
, the libxl driver was changed to copy
interface names autogenerated by libxl to the corresponding network def
in the domain's virDomainDef object. The copied name is freed when the
domain transitions to the shutoff state. But when migrating a domain,
the autogenerated name is included in the XML sent to the destination
host. It is possible an interface with the same name already exists on
the destination host, causing migration to fail.
This patch defines a new capability for setting the network device
prefix that will be used in the driver. Valid prefixes are
VIR_NET_GENERATED_PREFIX or the one announced by the driver.
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
This commit is contained in:
parent
6221b8944e
commit
819d1d9438
@ -221,6 +221,7 @@ virCapabilitiesDispose(void *object)
|
||||
virCapabilitiesClearSecModel(&caps->host.secModels[i]);
|
||||
VIR_FREE(caps->host.secModels);
|
||||
|
||||
VIR_FREE(caps->host.netprefix);
|
||||
VIR_FREE(caps->host.pagesSize);
|
||||
virCPUDefFree(caps->host.cpu);
|
||||
}
|
||||
@ -269,6 +270,23 @@ virCapabilitiesAddHostMigrateTransport(virCapsPtr caps,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* virCapabilitiesSetNetPrefix:
|
||||
* @caps: capabilities to extend
|
||||
* @name: prefix for host generated network interfaces
|
||||
*
|
||||
* Registers the prefix that is used for generated network interfaces
|
||||
*/
|
||||
int
|
||||
virCapabilitiesSetNetPrefix(virCapsPtr caps,
|
||||
const char *prefix)
|
||||
{
|
||||
if (VIR_STRDUP(caps->host.netprefix, prefix) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virCapabilitiesAddHostNUMACell:
|
||||
@ -913,6 +931,10 @@ virCapabilitiesFormatXML(virCapsPtr caps)
|
||||
virBufferAddLit(&buf, "</migration_features>\n");
|
||||
}
|
||||
|
||||
if (caps->host.netprefix)
|
||||
virBufferAsprintf(&buf, "<netprefix>%s</netprefix>\n",
|
||||
caps->host.netprefix);
|
||||
|
||||
if (caps->host.nnumaCell &&
|
||||
virCapabilitiesFormatNUMATopology(&buf, caps->host.nnumaCell,
|
||||
caps->host.numaCell) < 0)
|
||||
|
@ -160,6 +160,7 @@ struct _virCapsHost {
|
||||
size_t nsecModels;
|
||||
virCapsHostSecModelPtr secModels;
|
||||
|
||||
char *netprefix;
|
||||
virCPUDefPtr cpu;
|
||||
int nPagesSize; /* size of pagesSize array */
|
||||
unsigned int *pagesSize; /* page sizes support on the system */
|
||||
@ -219,6 +220,9 @@ extern int
|
||||
virCapabilitiesAddHostMigrateTransport(virCapsPtr caps,
|
||||
const char *name);
|
||||
|
||||
extern int
|
||||
virCapabilitiesSetNetPrefix(virCapsPtr caps,
|
||||
const char *prefix);
|
||||
|
||||
extern int
|
||||
virCapabilitiesAddHostNUMACell(virCapsPtr caps,
|
||||
|
@ -59,6 +59,7 @@ virCapabilitiesGetCpusForNodemask;
|
||||
virCapabilitiesHostSecModelAddBaseLabel;
|
||||
virCapabilitiesNew;
|
||||
virCapabilitiesSetHostCPU;
|
||||
virCapabilitiesSetNetPrefix;
|
||||
|
||||
|
||||
# conf/cpu_conf.h
|
||||
|
Loading…
Reference in New Issue
Block a user