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
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-06-18 16:13:11 +00:00
|
|
|
#pragma once
|
2010-12-21 21:39:55 +00:00
|
|
|
|
2019-06-18 16:13:11 +00:00
|
|
|
#include "internal.h"
|
|
|
|
#include "virconf.h"
|
|
|
|
#include "domain_conf.h"
|
2010-12-21 21:39:55 +00:00
|
|
|
|
2019-06-18 16:13:11 +00:00
|
|
|
#define VMX_CONFIG_FORMAT_ARGV "vmware-vmx"
|
2019-04-09 10:01:25 +00:00
|
|
|
|
2010-12-21 21:39:55 +00:00
|
|
|
typedef struct _virVMXContext virVMXContext;
|
|
|
|
|
2019-12-03 10:49:49 +00:00
|
|
|
virDomainXMLOptionPtr virVMXDomainXMLConfInit(virCapsPtr caps);
|
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.
|
2017-08-25 13:36:58 +00:00
|
|
|
* moref 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 */
|
2017-08-25 13:36:58 +00:00
|
|
|
const char *moref;
|
2010-12-21 21:39:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
* Helpers
|
|
|
|
*/
|
|
|
|
|
|
|
|
char *virVMXEscapeHex(const char *string, char escape, const char *special);
|
|
|
|
|
2019-06-18 16:13:11 +00:00
|
|
|
#define virVMXEscapeHexPipe(_string) virVMXEscapeHex(_string, '|', "\"")
|
2010-12-21 21:39:55 +00:00
|
|
|
|
2019-06-18 16:13:11 +00:00
|
|
|
#define virVMXEscapeHexPercent(_string) virVMXEscapeHex(_string, '%', "/\\")
|
2010-12-21 21:39:55 +00:00
|
|
|
|
|
|
|
int virVMXUnescapeHex(char *string, char escape);
|
|
|
|
|
2019-06-18 16:13:11 +00:00
|
|
|
#define virVMXUnescapeHexPipe(_string) virVMXUnescapeHex(_string, '|')
|
2010-12-21 21:39:55 +00:00
|
|
|
|
2019-06-18 16:13:11 +00:00
|
|
|
#define virVMXUnescapeHexPercent(_string) virVMXUnescapeHex(_string, '%')
|
2010-12-21 21:39:55 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
* 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);
|