mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
* src/libvir.c src/xen_internal.c src/xen_internal.h: implement
Pause, Resume, Destroy, but untested yet. Daniel
This commit is contained in:
parent
086a0ffe4f
commit
6be439c983
@ -1,3 +1,8 @@
|
||||
Thu Dec 8 18:16:20 CET 2005 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* src/libvir.c src/xen_internal.c src/xen_internal.h: implement
|
||||
Pause, Resume, Destroy, but untested yet.
|
||||
|
||||
Thu Dec 8 17:43:11 CET 2005 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* include/libvir.h src/libvir.c src/libvir_sym.version: adding
|
||||
|
14
src/libvir.c
14
src/libvir.c
@ -538,9 +538,15 @@ virDomainLookupByID(virConnectPtr conn, int id) {
|
||||
*/
|
||||
int
|
||||
virDomainDestroy(virDomainPtr domain) {
|
||||
int ret;
|
||||
|
||||
if ((domain == NULL) || (domain->magic != VIR_DOMAIN_MAGIC))
|
||||
return(-1);
|
||||
TODO
|
||||
if ((domain->conn == NULL) || (domain->conn->magic != VIR_CONNECT_MAGIC))
|
||||
return(-1);
|
||||
ret = xenHypervisorDestroyDomain(domain->conn->handle, domain->handle);
|
||||
if (ret < 0)
|
||||
return(-1);
|
||||
|
||||
return(virDomainFree(domain));
|
||||
}
|
||||
@ -583,8 +589,9 @@ int
|
||||
virDomainSuspend(virDomainPtr domain) {
|
||||
if ((domain == NULL) || (domain->magic != VIR_DOMAIN_MAGIC))
|
||||
return(-1);
|
||||
TODO
|
||||
if ((domain->conn == NULL) || (domain->conn->magic != VIR_CONNECT_MAGIC))
|
||||
return(-1);
|
||||
return(xenHypervisorPauseDomain(domain->conn->handle, domain->handle));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -600,8 +607,9 @@ int
|
||||
virDomainResume(virDomainPtr domain) {
|
||||
if ((domain == NULL) || (domain->magic != VIR_DOMAIN_MAGIC))
|
||||
return(-1);
|
||||
TODO
|
||||
if ((domain->conn == NULL) || (domain->conn->magic != VIR_CONNECT_MAGIC))
|
||||
return(-1);
|
||||
return(xenHypervisorResumeDomain(domain->conn->handle, domain->handle));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,3 +177,75 @@ xenHypervisorGetDomainInfo(int handle, int domain, dom0_getdomaininfo_t *info) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xenHypervisorPauseDomain:
|
||||
* @handle: the handle to the Xen hypervisor
|
||||
* @domain: the domain ID
|
||||
*
|
||||
* Do an hypervisor call to pause the given domain
|
||||
*
|
||||
* Returns 0 in case of success, -1 in case of error.
|
||||
*/
|
||||
int
|
||||
xenHypervisorPauseDomain(int handle, int domain) {
|
||||
dom0_op_t op;
|
||||
int ret;
|
||||
|
||||
op.cmd = DOM0_PAUSEDOMAIN;
|
||||
op.u.pausedomain.domain = (domid_t) domain;
|
||||
|
||||
ret = xenHypervisorDoOp(handle, &op);
|
||||
|
||||
if (ret < 0)
|
||||
return(-1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xenHypervisorResumeDomain:
|
||||
* @handle: the handle to the Xen hypervisor
|
||||
* @domain: the domain ID
|
||||
*
|
||||
* Do an hypervisor call to resume the given domain
|
||||
*
|
||||
* Returns 0 in case of success, -1 in case of error.
|
||||
*/
|
||||
int
|
||||
xenHypervisorResumeDomain(int handle, int domain) {
|
||||
dom0_op_t op;
|
||||
int ret;
|
||||
|
||||
op.cmd = DOM0_UNPAUSEDOMAIN;
|
||||
op.u.unpausedomain.domain = (domid_t) domain;
|
||||
|
||||
ret = xenHypervisorDoOp(handle, &op);
|
||||
|
||||
if (ret < 0)
|
||||
return(-1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xenHypervisorDestroyDomain:
|
||||
* @handle: the handle to the Xen hypervisor
|
||||
* @domain: the domain ID
|
||||
*
|
||||
* Do an hypervisor call to destroy the given domain
|
||||
*
|
||||
* Returns 0 in case of success, -1 in case of error.
|
||||
*/
|
||||
int
|
||||
xenHypervisorDestroyDomain(int handle, int domain) {
|
||||
dom0_op_t op;
|
||||
int ret;
|
||||
|
||||
op.cmd = DOM0_DESTROYDOMAIN;
|
||||
op.u.destroydomain.domain = (domid_t) domain;
|
||||
|
||||
ret = xenHypervisorDoOp(handle, &op);
|
||||
|
||||
if (ret < 0)
|
||||
return(-1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,12 @@ extern "C" {
|
||||
int xenHypervisorOpen (void);
|
||||
int xenHypervisorClose (int handle);
|
||||
unsigned long xenHypervisorGetVersion (int handle);
|
||||
int xenHypervisorDestroyDomain (int handle,
|
||||
int domain);
|
||||
int xenHypervisorResumeDomain (int handle,
|
||||
int domain);
|
||||
int xenHypervisorPauseDomain (int handle,
|
||||
int domain);
|
||||
int xenHypervisorGetDomainInfo (int handle,
|
||||
int domain,
|
||||
dom0_getdomaininfo_t *info);
|
||||
|
Loading…
Reference in New Issue
Block a user