mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
ESX Add esxDomainXMLToNative()
Extend and cleanup the VMX to domain XML mapping. Add the domain XML to VMX mapping functions. * src/esx/esx_driver.c: add esxDomainXMLToNative() * src/esx/esx_vmx.[ch]: add esxVMX_SCSIDiskNameToControllerAndID(), esxVMX_IDEDiskNameToControllerAndID(), esxVMX_FloppyDiskNameToController(), esxVMX_GatherSCSIControllers(), add basic handling for the VMX guestOS entry to distinguish between i686 and x86_64, make SCSI virtualDev VMX entry optional as it should be, map the VMX networkName entry to the domain XML interface bridge name, add basic mapping for serial devices in pipe mode, add several esxVMX_Format*() functions
This commit is contained in:
parent
6f9d8bdbcb
commit
a1c4d7d765
@ -2232,6 +2232,42 @@ esxDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat,
|
||||
|
||||
|
||||
|
||||
static char *
|
||||
esxDomainXMLToNative(virConnectPtr conn, const char *nativeFormat,
|
||||
const char *domainXml,
|
||||
unsigned int flags ATTRIBUTE_UNUSED)
|
||||
{
|
||||
esxPrivate *priv = (esxPrivate *)conn->privateData;
|
||||
virDomainDefPtr def = NULL;
|
||||
char *vmx = NULL;
|
||||
|
||||
if (priv->phantom) {
|
||||
ESX_ERROR(conn, VIR_ERR_OPERATION_INVALID,
|
||||
"Not possible with a phantom connection");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (STRNEQ(nativeFormat, "vmware-vmx")) {
|
||||
ESX_ERROR(conn, VIR_ERR_INVALID_ARG,
|
||||
"Unsupported config format '%s'", nativeFormat);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
def = virDomainDefParseString(conn, priv->caps, domainXml, 0);
|
||||
|
||||
if (def == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
vmx = esxVMX_FormatConfig(conn, def, priv->host->apiVersion);
|
||||
|
||||
virDomainDefFree(def);
|
||||
|
||||
return vmx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
esxListDefinedDomains(virConnectPtr conn, char **const names, int maxnames)
|
||||
{
|
||||
@ -3093,7 +3129,7 @@ static virDriver esxDriver = {
|
||||
NULL, /* nodeGetSecurityModel */
|
||||
esxDomainDumpXML, /* domainDumpXML */
|
||||
esxDomainXMLFromNative, /* domainXMLFromNative */
|
||||
NULL, /* domainXMLToNative */
|
||||
esxDomainXMLToNative, /* domainXMLToNative */
|
||||
esxListDefinedDomains, /* listDefinedDomains */
|
||||
esxNumberOfDefinedDomains, /* numOfDefinedDomains */
|
||||
esxDomainCreate, /* domainCreate */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -24,9 +24,33 @@
|
||||
#define __ESX_VMX_H__
|
||||
|
||||
#include "internal.h"
|
||||
#include "conf.h"
|
||||
#include "domain_conf.h"
|
||||
#include "esx_vi.h"
|
||||
|
||||
char *
|
||||
esxVMX_IndexToDiskName(virConnectPtr conn, int idx, const char *prefix);
|
||||
|
||||
int
|
||||
esxVMX_SCSIDiskNameToControllerAndID(virConnectPtr conn, const char *name,
|
||||
int *controller, int *id);
|
||||
int
|
||||
esxVMX_IDEDiskNameToControllerAndID(virConnectPtr conn, const char *name,
|
||||
int *controller, int *id);
|
||||
int
|
||||
esxVMX_FloppyDiskNameToController(virConnectPtr conn, const char *name,
|
||||
int *controller);
|
||||
|
||||
int
|
||||
esxVMX_GatherSCSIControllers(virConnectPtr conn, virDomainDefPtr conf,
|
||||
char *virtualDev[4], int present[4]);
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* VMX -> Domain XML
|
||||
*/
|
||||
|
||||
virDomainDefPtr
|
||||
esxVMX_ParseConfig(virConnectPtr conn, const char *vmx,
|
||||
esxVI_APIVersion apiVersion);
|
||||
@ -35,9 +59,6 @@ int
|
||||
esxVMX_ParseSCSIController(virConnectPtr conn, virConfPtr conf,
|
||||
int controller, int *present, char **virtualDev);
|
||||
|
||||
char *
|
||||
esxVMX_IndexToDiskName(virConnectPtr conn, int idx, const char *prefix);
|
||||
|
||||
int
|
||||
esxVMX_ParseDisk(virConnectPtr conn, virConfPtr conf, int device, int bus,
|
||||
int controller, int id, const char *virtualDev,
|
||||
@ -54,4 +75,38 @@ int
|
||||
esxVMX_ParseParallel(virConnectPtr conn, virConfPtr conf, int port,
|
||||
virDomainChrDefPtr *def);
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Domain XML -> VMX
|
||||
*/
|
||||
|
||||
char *
|
||||
esxVMX_FormatConfig(virConnectPtr conn, virDomainDefPtr def,
|
||||
esxVI_APIVersion apiVersion);
|
||||
|
||||
int
|
||||
esxVMX_FormatHardDisk(virConnectPtr conn, virDomainDiskDefPtr def,
|
||||
virBufferPtr buffer);
|
||||
|
||||
int
|
||||
esxVMX_FormatCDROM(virConnectPtr conn, virDomainDiskDefPtr def,
|
||||
virBufferPtr buffer);
|
||||
|
||||
int
|
||||
esxVMX_FormatFloppy(virConnectPtr conn, virDomainDiskDefPtr def,
|
||||
virBufferPtr buffer);
|
||||
|
||||
int
|
||||
esxVMX_FormatEthernet(virConnectPtr conn, virDomainNetDefPtr def,
|
||||
int controller, virBufferPtr buffer);
|
||||
|
||||
int
|
||||
esxVMX_FormatSerial(virConnectPtr conn, virDomainChrDefPtr def,
|
||||
virBufferPtr buffer);
|
||||
|
||||
int
|
||||
esxVMX_FormatParallel(virConnectPtr conn, virDomainChrDefPtr def,
|
||||
virBufferPtr buffer);
|
||||
|
||||
#endif /* __ESX_VMX_H__ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user