esx_vmx.h 4.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

/*
 * esx_vmx.c: VMX related methods for the VMware ESX driver
 *
 * Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
 *
 * 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
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 *
 */

#ifndef __ESX_VMX_H__
#define __ESX_VMX_H__

#include "internal.h"
M
Matthias Bolte 已提交
27
#include "conf.h"
28
#include "domain_conf.h"
29
#include "esx_vi.h"
30

M
Matthias Bolte 已提交
31 32 33
int
esxVMX_SCSIDiskNameToControllerAndID(virConnectPtr conn, const char *name,
                                     int *controller, int *id);
M
Matthias Bolte 已提交
34

M
Matthias Bolte 已提交
35 36
int
esxVMX_IDEDiskNameToControllerAndID(virConnectPtr conn, const char *name,
M
Matthias Bolte 已提交
37 38
                                    int *controller, int *id);

M
Matthias Bolte 已提交
39 40 41 42 43 44 45 46
int
esxVMX_FloppyDiskNameToController(virConnectPtr conn, const char *name,
                                  int *controller);

int
esxVMX_GatherSCSIControllers(virConnectPtr conn, virDomainDefPtr conf,
                             char *virtualDev[4], int present[4]);

M
Matthias Bolte 已提交
47 48 49 50
char *
esxVMX_AbsolutePathToDatastoreRelatedPath(virConnectPtr conn,
                                          esxVI_Context *ctx,
                                          const char *absolutePath);
M
Matthias Bolte 已提交
51 52


53

M
Matthias Bolte 已提交
54 55 56 57
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * VMX -> Domain XML
 */

M
Matthias Bolte 已提交
58 59 60 61 62
char *
esxVMX_ParseFileName(virConnectPtr conn, esxVI_Context *ctx,
                     const char *fileName, const char *datastoreName,
                     const char *directoryName);

63
virDomainDefPtr
M
Matthias Bolte 已提交
64 65
esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
                   const char *datastoreName, const char *directoryName,
66
                   esxVI_APIVersion apiVersion);
67 68 69

int
esxVMX_ParseSCSIController(virConnectPtr conn, virConfPtr conf,
70
                           int controller, int *present, char **virtualDev);
71 72

int
M
Matthias Bolte 已提交
73 74 75 76
esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
                 int device, int bus, int controller, int id,
                 const char *virtualDev, const char *datastoreName,
                 const char *directoryName, virDomainDiskDefPtr *def);
77 78 79 80 81
int
esxVMX_ParseEthernet(virConnectPtr conn, virConfPtr conf, int controller,
                     virDomainNetDefPtr *def);

int
M
Matthias Bolte 已提交
82 83 84
esxVMX_ParseSerial(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
                   int port, const char *datastoreName,
                   const char *directoryName, virDomainChrDefPtr *def);
85 86

int
M
Matthias Bolte 已提交
87 88 89
esxVMX_ParseParallel(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
                     int port, const char *datastoreName,
                     const char *directoryName, virDomainChrDefPtr *def);
90

M
Matthias Bolte 已提交
91 92 93 94 95 96 97


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Domain XML -> VMX
 */

char *
M
Matthias Bolte 已提交
98 99 100 101 102
esxVMX_FormatFileName(virConnectPtr conn, esxVI_Context *ctx, const char *src);

char *
esxVMX_FormatConfig(virConnectPtr conn, esxVI_Context *ctx,
                    virDomainDefPtr def, esxVI_APIVersion apiVersion);
M
Matthias Bolte 已提交
103 104

int
M
Matthias Bolte 已提交
105 106
esxVMX_FormatHardDisk(virConnectPtr conn, esxVI_Context *ctx,
                      virDomainDiskDefPtr def, virBufferPtr buffer);
M
Matthias Bolte 已提交
107 108

int
M
Matthias Bolte 已提交
109 110
esxVMX_FormatCDROM(virConnectPtr conn, esxVI_Context *ctx,
                   virDomainDiskDefPtr def, virBufferPtr buffer);
M
Matthias Bolte 已提交
111 112

int
M
Matthias Bolte 已提交
113 114
esxVMX_FormatFloppy(virConnectPtr conn, esxVI_Context *ctx,
                    virDomainDiskDefPtr def, virBufferPtr buffer);
M
Matthias Bolte 已提交
115 116 117 118 119 120

int
esxVMX_FormatEthernet(virConnectPtr conn, virDomainNetDefPtr def,
                      int controller, virBufferPtr buffer);

int
M
Matthias Bolte 已提交
121 122
esxVMX_FormatSerial(virConnectPtr conn, esxVI_Context *ctx,
                    virDomainChrDefPtr def, virBufferPtr buffer);
M
Matthias Bolte 已提交
123 124

int
M
Matthias Bolte 已提交
125 126
esxVMX_FormatParallel(virConnectPtr conn, esxVI_Context *ctx,
                      virDomainChrDefPtr def, virBufferPtr buffer);
M
Matthias Bolte 已提交
127

128
#endif /* __ESX_VMX_H__ */