xenapi_utils.h 2.3 KB
Newer Older
1 2
/*
 * xenapi_utils.h: Xen API driver -- utils header
3
 * Copyright (C) 2012, Red Hat, Inc.
4 5 6 7 8 9 10 11 12 13 14 15 16
 * Copyright (C) 2009, 2010 Citrix Ltd.
 *
 * 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
17
 * License along with this library.  If not, see
O
Osier Yang 已提交
18
 * <http://www.gnu.org/licenses/>.
19 20
 */

21 22
#ifndef LIBVIRT_XENAPI_UTILS_H
# define LIBVIRT_XENAPI_UTILS_H
23 24 25

# include <xen/api/xen_all.h>
# include "internal.h"
M
Martin Kletzander 已提交
26
# include "viruri.h"
27 28 29 30 31 32 33 34 35 36 37 38 39 40
# include "domain_conf.h"

# define NETWORK_DEVID_SIZE  (12)

typedef uint64_t cpumap_t;

void
xenSessionFree(xen_session *session);

char *
xenapiUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
                           const char *hostname);

int
M
Martin Kletzander 已提交
41
xenapiUtil_ParseQuery(virConnectPtr conn, virURIPtr uri, int *noVerify);
42 43

enum xen_on_normal_exit
44
actionShutdownLibvirt2XenapiEnum(virDomainLifecycleAction action);
45 46

enum xen_on_crash_behaviour
47
actionCrashLibvirt2XenapiEnum(virDomainLifecycleAction action);
48 49 50 51

char *
createXenAPIBootOrderString(int nboot, int *bootDevs);

52
virDomainBootOrder map2LibvirtBootOrder(char c);
53

54
virDomainLifecycleAction
55 56
xenapiNormalExitEnum2virDomainLifecycle(enum xen_on_normal_exit action);

57
virDomainLifecycleAction
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
xenapiCrashExitEnum2virDomainLifecycle(enum xen_on_crash_behaviour action);

void getCpuBitMapfromString(char *mask, unsigned char *cpumap, int maplen);

int getStorageVolumeType(char *type);

char *returnErrorFromSession(xen_session *session);

virDomainState
mapPowerState(enum xen_vm_power_state state);

char *
mapDomainPinVcpu(unsigned char *cpumap, int maplen);

int
createVMRecordFromXml (virConnectPtr conn, virDomainDefPtr defPtr,
                       xen_vm_record **record, xen_vm *vm);

int
allocStringMap (xen_string_string_map **strings, char *key, char *val);

79
#endif /* LIBVIRT_XENAPI_UTILS_H */