mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
Introduce virDomainFSFreeze() and virDomainFSThaw() public API
These will freeze and thaw filesystems within guest specified by @mountpoints parameters. The parameters can be NULL and 0, then all mounted filesystems are frozen or thawed. @flags parameter, which are currently not used, is for future extensions. Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com> Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
2c054ca176
commit
208f002c9d
@ -5279,6 +5279,16 @@ int virDomainFSTrim(virDomainPtr dom,
|
||||
unsigned long long minimum,
|
||||
unsigned int flags);
|
||||
|
||||
int virDomainFSFreeze(virDomainPtr dom,
|
||||
const char **mountpoints,
|
||||
unsigned int nmountpoints,
|
||||
unsigned int flags);
|
||||
|
||||
int virDomainFSThaw(virDomainPtr dom,
|
||||
const char **mountpoints,
|
||||
unsigned int nmountpoints,
|
||||
unsigned int flags);
|
||||
|
||||
/**
|
||||
* virSchedParameterType:
|
||||
*
|
||||
|
14
src/driver.h
14
src/driver.h
@ -1149,6 +1149,18 @@ typedef int
|
||||
unsigned int flags,
|
||||
int cancelled);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainFSFreeze)(virDomainPtr dom,
|
||||
const char **mountpoints,
|
||||
unsigned int nmountpoints,
|
||||
unsigned int flags);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainFSThaw)(virDomainPtr dom,
|
||||
const char **mountpoints,
|
||||
unsigned int nmountpoints,
|
||||
unsigned int flags);
|
||||
|
||||
typedef struct _virDriver virDriver;
|
||||
typedef virDriver *virDriverPtr;
|
||||
|
||||
@ -1363,6 +1375,8 @@ struct _virDriver {
|
||||
virDrvDomainMigrateFinish3Params domainMigrateFinish3Params;
|
||||
virDrvDomainMigrateConfirm3Params domainMigrateConfirm3Params;
|
||||
virDrvConnectGetCPUModelNames connectGetCPUModelNames;
|
||||
virDrvDomainFSFreeze domainFSFreeze;
|
||||
virDrvDomainFSThaw domainFSThaw;
|
||||
};
|
||||
|
||||
|
||||
|
@ -20698,3 +20698,96 @@ virDomainFSTrim(virDomainPtr dom,
|
||||
virDispatchError(dom->conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* virDomainFSFreeze:
|
||||
* @dom: a domain object
|
||||
* @mountpoints: list of mount points to be frozen
|
||||
* @nmountpoints: the number of mount points specified in @mountpoints
|
||||
* @flags: extra flags; not used yet, so callers should always pass 0
|
||||
*
|
||||
* Freeze specified filesystems within the guest (hence guest agent
|
||||
* may be required depending on hypervisor used). If @mountpoints is NULL and
|
||||
* @nmountpoints is 0, every mounted filesystem on the guest is frozen.
|
||||
* In some environments (e.g. QEMU guest with guest agent which doesn't
|
||||
* support mountpoints argument), @mountpoints may need to be NULL.
|
||||
*
|
||||
* Returns the number of frozen filesystems on success, -1 otherwise.
|
||||
*/
|
||||
int
|
||||
virDomainFSFreeze(virDomainPtr dom,
|
||||
const char **mountpoints,
|
||||
unsigned int nmountpoints,
|
||||
unsigned int flags)
|
||||
{
|
||||
VIR_DOMAIN_DEBUG(dom, "mountpoints=%p, nmountpoints=%d, flags=%x",
|
||||
mountpoints, nmountpoints, flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
virCheckDomainReturn(dom, -1);
|
||||
virCheckReadOnlyGoto(dom->conn->flags, error);
|
||||
if (nmountpoints)
|
||||
virCheckNonNullArgGoto(mountpoints, error);
|
||||
else
|
||||
virCheckNullArgGoto(mountpoints, error);
|
||||
|
||||
if (dom->conn->driver->domainFSFreeze) {
|
||||
int ret = dom->conn->driver->domainFSFreeze(
|
||||
dom, mountpoints, nmountpoints, flags);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
|
||||
virReportUnsupportedError();
|
||||
|
||||
error:
|
||||
virDispatchError(dom->conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* virDomainFSThaw:
|
||||
* @dom: a domain object
|
||||
* @mountpoints: list of mount points to be thawed
|
||||
* @nmountpoints: the number of mount points specified in @mountpoints
|
||||
* @flags: extra flags; not used yet, so callers should always pass 0
|
||||
*
|
||||
* Thaw specified filesystems within the guest. If @mountpoints is NULL and
|
||||
* @nmountpoints is 0, every mounted filesystem on the guest is thawed.
|
||||
* In some drivers (e.g. QEMU driver), @mountpoints may need to be NULL.
|
||||
*
|
||||
* Returns the number of thawed filesystems on success, -1 otherwise.
|
||||
*/
|
||||
int
|
||||
virDomainFSThaw(virDomainPtr dom,
|
||||
const char **mountpoints,
|
||||
unsigned int nmountpoints,
|
||||
unsigned int flags)
|
||||
{
|
||||
VIR_DOMAIN_DEBUG(dom, "flags=%x", flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
virCheckDomainReturn(dom, -1);
|
||||
virCheckReadOnlyGoto(dom->conn->flags, error);
|
||||
if (nmountpoints)
|
||||
virCheckNonNullArgGoto(mountpoints, error);
|
||||
else
|
||||
virCheckNullArgGoto(mountpoints, error);
|
||||
|
||||
if (dom->conn->driver->domainFSThaw) {
|
||||
int ret = dom->conn->driver->domainFSThaw(
|
||||
dom, mountpoints, nmountpoints, flags);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
|
||||
virReportUnsupportedError();
|
||||
|
||||
error:
|
||||
virDispatchError(dom->conn);
|
||||
return -1;
|
||||
}
|
||||
|
@ -650,5 +650,11 @@ LIBVIRT_1.2.3 {
|
||||
virDomainCoreDumpWithFormat;
|
||||
} LIBVIRT_1.2.1;
|
||||
|
||||
LIBVIRT_1.2.5 {
|
||||
global:
|
||||
virDomainFSFreeze;
|
||||
virDomainFSThaw;
|
||||
} LIBVIRT_1.2.3;
|
||||
|
||||
|
||||
# .... define new API here using predicted next version number ....
|
||||
|
Loading…
x
Reference in New Issue
Block a user