2010-12-21 21:39:55 +00:00
|
|
|
/*
|
|
|
|
* vmx.h: VMware VMX parsing/formatting functions
|
|
|
|
*
|
2015-09-11 10:00:47 +00:00
|
|
|
* Copyright (C) 2009-2011, 2015 Matthias Bolte <matthias.bolte@googlemail.com>
|
2010-12-21 21:39:55 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-09-20 22:30:55 +00:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 10:06:23 +00:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2010-12-21 21:39:55 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __VIR_VMX_H__
|
|
|
|
# define __VIR_VMX_H__
|
|
|
|
|
|
|
|
# include "internal.h"
|
2012-12-12 16:35:35 +00:00
|
|
|
# include "virconf.h"
|
2010-12-21 21:39:55 +00:00
|
|
|
# include "domain_conf.h"
|
|
|
|
|
|
|
|
typedef struct _virVMXContext virVMXContext;
|
|
|
|
|
2013-03-15 10:40:17 +00:00
|
|
|
virDomainXMLOptionPtr virVMXDomainXMLConfInit(void);
|
2010-12-21 21:39:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
* Context
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef char * (*virVMXParseFileName)(const char *fileName, void *opaque);
|
|
|
|
typedef char * (*virVMXFormatFileName)(const char *src, void *opaque);
|
|
|
|
typedef int (*virVMXAutodetectSCSIControllerModel)(virDomainDiskDefPtr def,
|
|
|
|
int *model, void *opaque);
|
|
|
|
|
|
|
|
/*
|
2015-09-11 10:00:47 +00:00
|
|
|
* parseFileName is only used by virVMXParseConfig.
|
|
|
|
* formatFileName is only used by virVMXFormatConfig.
|
|
|
|
* autodetectSCSIControllerModel is optionally used by virVMXFormatConfig.
|
|
|
|
* datacenterPath is only used by virVMXFormatConfig.
|
2010-12-21 21:39:55 +00:00
|
|
|
*/
|
|
|
|
struct _virVMXContext {
|
|
|
|
void *opaque;
|
|
|
|
virVMXParseFileName parseFileName;
|
|
|
|
virVMXFormatFileName formatFileName;
|
|
|
|
virVMXAutodetectSCSIControllerModel autodetectSCSIControllerModel;
|
2015-09-11 10:00:47 +00:00
|
|
|
const char *datacenterPath; /* including folders */
|
2010-12-21 21:39:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
* Helpers
|
|
|
|
*/
|
|
|
|
|
|
|
|
char *virVMXEscapeHex(const char *string, char escape, const char *special);
|
|
|
|
|
|
|
|
# define virVMXEscapeHexPipe(_string) virVMXEscapeHex(_string, '|', "\"")
|
|
|
|
|
|
|
|
# define virVMXEscapeHexPercent(_string) virVMXEscapeHex(_string, '%', "/\\")
|
|
|
|
|
|
|
|
int virVMXUnescapeHex(char *string, char escape);
|
|
|
|
|
|
|
|
# define virVMXUnescapeHexPipe(_string) virVMXUnescapeHex(_string, '|')
|
|
|
|
|
|
|
|
# define virVMXUnescapeHexPercent(_string) virVMXUnescapeHex(_string, '%')
|
|
|
|
|
|
|
|
char *virVMXConvertToUTF8(const char *encoding, const char *string);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
* VMX -> Domain XML
|
|
|
|
*/
|
|
|
|
|
2013-03-15 10:40:17 +00:00
|
|
|
virDomainDefPtr virVMXParseConfig(virVMXContext *ctx,
|
|
|
|
virDomainXMLOptionPtr xmlopt,
|
2015-11-28 04:12:33 +00:00
|
|
|
virCapsPtr caps,
|
2010-12-21 21:39:55 +00:00
|
|
|
const char *vmx);
|
|
|
|
|
|
|
|
int virVMXParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def);
|
|
|
|
|
|
|
|
int virVMXParseSCSIController(virConfPtr conf, int controller, bool *present,
|
|
|
|
int *virtualDev);
|
|
|
|
|
2013-03-15 10:40:17 +00:00
|
|
|
int virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt,
|
|
|
|
virConfPtr conf, int device, int busType,
|
2015-06-22 19:13:39 +00:00
|
|
|
int controllerOrBus, int unit, virDomainDiskDefPtr *def,
|
|
|
|
virDomainDefPtr vmdef);
|
2010-12-21 21:39:55 +00:00
|
|
|
|
2012-07-11 10:16:35 +00:00
|
|
|
int virVMXParseFileSystem(virConfPtr conf, int number, virDomainFSDefPtr *def);
|
|
|
|
|
2010-12-21 21:39:55 +00:00
|
|
|
int virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def);
|
|
|
|
|
|
|
|
int virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
|
|
|
|
virDomainChrDefPtr *def);
|
|
|
|
|
|
|
|
int virVMXParseParallel(virVMXContext *ctx, virConfPtr conf, int port,
|
|
|
|
virDomainChrDefPtr *def);
|
|
|
|
|
2010-12-30 17:08:54 +00:00
|
|
|
int virVMXParseSVGA(virConfPtr conf, virDomainVideoDefPtr *def);
|
|
|
|
|
2010-12-21 21:39:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
* Domain XML -> VMX
|
|
|
|
*/
|
|
|
|
|
2013-03-15 10:40:17 +00:00
|
|
|
char *virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt,
|
2010-12-21 21:39:55 +00:00
|
|
|
virDomainDefPtr def, int virtualHW_version);
|
|
|
|
|
|
|
|
int virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer);
|
|
|
|
|
2013-08-28 18:37:06 +00:00
|
|
|
int virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|
|
|
virBufferPtr buffer);
|
2010-12-21 21:39:55 +00:00
|
|
|
|
|
|
|
int virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|
|
|
virBufferPtr buffer, bool floppy_present[2]);
|
|
|
|
|
2012-07-11 10:16:34 +00:00
|
|
|
int virVMXFormatFileSystem(virDomainFSDefPtr def, int number,
|
|
|
|
virBufferPtr buffer);
|
|
|
|
|
2010-12-21 21:39:55 +00:00
|
|
|
int virVMXFormatEthernet(virDomainNetDefPtr def, int controller,
|
|
|
|
virBufferPtr buffer);
|
|
|
|
|
|
|
|
int virVMXFormatSerial(virVMXContext *ctx, virDomainChrDefPtr def,
|
|
|
|
virBufferPtr buffer);
|
|
|
|
|
|
|
|
int virVMXFormatParallel(virVMXContext *ctx, virDomainChrDefPtr def,
|
|
|
|
virBufferPtr buffer);
|
|
|
|
|
2010-12-30 17:08:54 +00:00
|
|
|
int virVMXFormatSVGA(virDomainVideoDefPtr def, virBufferPtr buffer);
|
|
|
|
|
2010-12-21 21:39:55 +00:00
|
|
|
#endif /* __VIR_VMX_H__ */
|