mirror of https://gitee.com/openkylin/libvirt.git
* configure.in: checking xenstore library, error out on missing libs
* include/libxen.h src/libxen.c src/libxen_sym.version: adding new entry points Daniel
This commit is contained in:
parent
afcb25b9a5
commit
aa60580097
|
@ -1,3 +1,9 @@
|
|||
Tue Nov 22 17:09:11 CET 2005 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* configure.in: checking xenstore library, error out on missing libs
|
||||
* include/libxen.h src/libxen.c src/libxen_sym.version: adding new
|
||||
entry points
|
||||
|
||||
Thu Nov 10 17:11:03 CET 2005 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* src/makefile.am src/libxen.c src/xensh.c: add a small tool sensh,
|
||||
|
|
|
@ -48,6 +48,7 @@ test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
|
|||
AM_PROG_LIBTOOL
|
||||
|
||||
dnl search for the low level Xen library
|
||||
AC_SEARCH_LIBS(xc_domain_create, [xenctrl])
|
||||
AC_SEARCH_LIBS(xc_domain_create, [xenctrl], [], [AC_MSG_ERROR([Xen control library not found])])
|
||||
AC_SEARCH_LIBS(xs_read, [xenstore], [], [AC_MSG_ERROR([Xen store library not found])])
|
||||
|
||||
AC_OUTPUT(Makefile src/Makefile include/Makefile libxen.pc libxen.spec)
|
||||
|
|
|
@ -73,7 +73,8 @@ xenDomainPtr xenCreateLinuxDomain (xenConnectPtr conn,
|
|||
const char *cmdline,
|
||||
unsigned long memory,
|
||||
unsigned int flags);
|
||||
|
||||
xenDomainPtr xenLookupDomain (xenConnectPtr conn,
|
||||
const char *name);
|
||||
int xenDestroyDomain (xenDomainPtr domain);
|
||||
|
||||
/*
|
||||
|
@ -85,6 +86,8 @@ int xenResumeDomain (xenDomainPtr domain);
|
|||
/*
|
||||
* Dynamic control of domains
|
||||
*/
|
||||
const char * xenGetName (xenDomainPtr domain);
|
||||
unsigned long xenGetMaxMemory (xenDomainPtr domain);
|
||||
int xenSetMaxMemory (xenDomainPtr domain,
|
||||
unsigned long memory);
|
||||
|
||||
|
|
82
src/libxen.c
82
src/libxen.c
|
@ -31,6 +31,7 @@
|
|||
struct _xenConnect {
|
||||
unsigned int magic; /* specific value to check */
|
||||
int handle; /* internal handle used for hypercall */
|
||||
int xshandle; /* handle to talk to the xenstore */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -38,28 +39,37 @@ struct _xenConnect {
|
|||
* @name: optional argument currently unused, pass NULL
|
||||
*
|
||||
* This function should be called first to get a connection to the
|
||||
* Hypervisor
|
||||
* Hypervisor and xen store
|
||||
*
|
||||
* Returns a pointer to the hypervisor connection or NULL in case of error
|
||||
*/
|
||||
xenConnectPtr
|
||||
xenOpenConnect(const char *name) {
|
||||
xenConnectPtr ret;
|
||||
int handle;
|
||||
int handle = -1;
|
||||
int xshandle = -1;
|
||||
|
||||
handle = xc_interface_open();
|
||||
if (handle == -1) {
|
||||
return(NULL);
|
||||
}
|
||||
if (handle == -1)
|
||||
goto failed;
|
||||
xshandle = xs_daemon_open();
|
||||
if (xshandle < 0)
|
||||
goto failed;
|
||||
|
||||
ret = (xenConnectPtr) malloc(sizeof(xenConnect));
|
||||
if (ret == NULL) {
|
||||
xc_interface_close(handle);
|
||||
return(NULL);
|
||||
}
|
||||
if (ret == NULL)
|
||||
goto failed;
|
||||
ret->magic = XEN_CONNECT_MAGIC;
|
||||
ret->handle = handle;
|
||||
ret->xshandle = xshandle;
|
||||
|
||||
return(ret);
|
||||
failed:
|
||||
if (handle >= 0)
|
||||
xc_interface_close(handle);
|
||||
if (xshandle >= 0)
|
||||
xs_daemon_close(xshandle);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,6 +89,8 @@ xenCloseConnect(xenConnectPtr conn) {
|
|||
return(-1);
|
||||
|
||||
conn->magic = -1;
|
||||
xs_daemon_close(conn->xshandle);
|
||||
conn->xshandle = -1;
|
||||
xc_interface_close(conn->handle);
|
||||
conn->handle = -1;
|
||||
free(conn);
|
||||
|
@ -122,6 +134,23 @@ xenCreateLinuxDomain(xenConnectPtr conn, const char *kernel_path,
|
|||
return(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* xenLookupDomain:
|
||||
* @conn: pointer to the hypervisor connection
|
||||
* @name: name for the domain
|
||||
*
|
||||
* Try to lookup a domain on the given hypervisor
|
||||
*
|
||||
* Returns a new domain object or NULL in case of failure
|
||||
*/
|
||||
xenDomainPtr
|
||||
xenLookupDomain(xenConnectPtr conn, const char *name) {
|
||||
if ((conn == NULL) || (name == NULL))
|
||||
return(NULL);
|
||||
TODO
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* xenDestroyDomain:
|
||||
* @domain: a domain object
|
||||
|
@ -175,6 +204,41 @@ xenResumeDomain(xenDomainPtr domain) {
|
|||
return(-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* xenGetName:
|
||||
* @domain: a domain object
|
||||
*
|
||||
* Get the public name for that domain
|
||||
*
|
||||
* Returns a pointer to the name or NULL, the string need not be deallocated
|
||||
* its lifetime will be the same as the domain object.
|
||||
*/
|
||||
const char *
|
||||
xenGetName(xenDomainPtr domain) {
|
||||
if (domain == NULL)
|
||||
return(NULL);
|
||||
TODO
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* xenGetMaxMemory:
|
||||
* @domain: a domain object or NULL
|
||||
*
|
||||
* Retrieve the maximum amount of physical memory allocated to a
|
||||
* domain. If domain is NULL, then this get the amount of memory reserved
|
||||
* to Domain0 i.e. the domain where the application runs.
|
||||
*
|
||||
* Returns the memory size in kilobytes or 0 in case of error.
|
||||
*/
|
||||
unsigned long
|
||||
xenGetMaxMemory(xenDomainPtr domain) {
|
||||
if (domain == NULL)
|
||||
return(0);
|
||||
TODO
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xenSetMaxMemory:
|
||||
* @domain: a domain object or NULL
|
||||
|
|
|
@ -4,9 +4,12 @@
|
|||
xenCloseConnect;
|
||||
xenGetVersion;
|
||||
xenCreateLinuxDomain;
|
||||
xenLookupDomain;
|
||||
xenDestroyDomain;
|
||||
xenSuspendDomain;
|
||||
xenResumeDomain;
|
||||
xenGetName;
|
||||
xenGetMaxMemory;
|
||||
xenSetMaxMemory;
|
||||
local: *;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue