Commit 4b58a535 authored by Daniel P. Berrange's avatar Daniel P. Berrange

Add virDomainFSFreeze/virDomainFSThaw APIs

Signed-off-by: 's avatarDaniel P. Berrange <berrange@redhat.com>
parent daee4d2e
......@@ -3,6 +3,7 @@ Revision history for perl module Sys::Virt
1.2.5 2014-00-00
- Add VIR_DOMAIN_{REBOOT,SHUTDOWN}_PARAVIRT constants
- Add virDomainFSFreeze/virDomainFSThaw APIs
1.2.4 2014-05-06
......
......@@ -4740,6 +4740,67 @@ fs_trim(dom, mountPoint, minimumsv, flags=0)
_croak_error();
void
fs_freeze(dom, mountPointsSV, flags=0)
virDomainPtr dom;
SV *mountPointsSV;
unsigned int flags;
PREINIT:
AV *mountPointsAV;
const char **mountPoints;
unsigned int nMountPoints;
unsigned int i;
PPCODE:
mountPointsAV = (AV*)SvRV(mountPointsSV);
nMountPoints = av_len(mountPointsAV) + 1;
if (nMountPoints) {
Newx(mountPoints, nMountPoints, const char *);
for (i = 0 ; i < nMountPoints ; i++) {
SV **mountPoint = av_fetch(mountPointsAV, i, 0);
mountPoints[i] = SvPV_nolen(*mountPoint);
}
} else {
mountPoints = NULL;
}
if (virDomainFSFreeze(dom, mountPoints, nMountPoints, flags) < 0) {
Safefree(mountPoints);
_croak_error();
}
Safefree(mountPoints);
void
fs_thaw(dom, mountPointsSV, flags=0)
virDomainPtr dom;
SV *mountPointsSV;
unsigned int flags;
PREINIT:
AV *mountPointsAV;
const char **mountPoints;
unsigned int nMountPoints;
unsigned int i;
PPCODE:
mountPointsAV = (AV*)SvRV(mountPointsSV);
nMountPoints = av_len(mountPointsAV) + 1;
if (nMountPoints) {
Newx(mountPoints, nMountPoints, const char *);
for (i = 0 ; i < nMountPoints ; i++) {
SV **mountPoint = av_fetch(mountPointsAV, i, 0);
mountPoints[i] = SvPV_nolen(*mountPoint);
}
} else {
mountPoints = NULL;
}
if (virDomainFSThaw(dom, mountPoints, nMountPoints, flags) < 0) {
Safefree(mountPoints);
_croak_error();
}
Safefree(mountPoints);
void
send_process_signal(dom, pidsv, signum, flags=0)
virDomainPtr dom;
......
# -*- perl -*-
use strict;
use warnings;
use Sys::Virt;
die "syntax: $0 URI DOMAIN-NAME MOUNT-POINTS\n" unless int(@ARGV) >= 2;
my $uri = shift @ARGV;
my $domname = shift @ARGV;
my @mountpoints = @ARGV;
print "Addr $uri\n";
my $con = Sys::Virt->new(address => $uri, readonly => 0);
my $dom = $con->get_domain_by_name($domname);
$dom->fs_freeze(\@mountpoints);
......@@ -1488,6 +1488,20 @@ to remove chunks of unused space that are at least
C<$minimum> bytes in length. C<$flags> is currently
unused and defaults to zero.
=item $dom->fs_freeze(\@mountPoints, $flags=0);
Freeze all the filesystems associated with the C<@mountPoints>
array reference. If <@mountPoints> is an empty list, then all
filesystems will be frozen. C<$flags> is currently
unused and defaults to zero.
=item $dom->fs_thaw(\@mountPoints, $flags=0);
Thaw all the filesystems associated with the C<@mountPoints>
array reference. If <@mountPoints> is an empty list, then all
filesystems will be thawed. C<$flags> is currently
unused and defaults to zero.
=item $dom->send_process_signal($pid, $signum, $flags=0);
Send the process C<$pid> the signal C<$signum>. The
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment