remote: Implement virDomainFSFreeze and virDomainFSThaw

New rules are added in fixup_name in gendispatch.pl to keep the name
FSFreeze and FSThaw. This adds a new ACL permission 'fs_freeze',
which is also applied to VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE flag.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
Acked-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Tomoki Sekiyama 2014-05-01 20:05:54 -04:00 committed by Eric Blake
parent 208f002c9d
commit ca3d07fd45
6 changed files with 74 additions and 5 deletions

View File

@ -1,7 +1,7 @@
/*
* viraccessperm.c: access control permissions
*
* Copyright (C) 2012-2013 Red Hat, Inc.
* Copyright (C) 2012-2014 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -39,7 +39,8 @@ VIR_ENUM_IMPL(virAccessPermDomain,
"start", "stop", "reset",
"save", "delete",
"migrate", "snapshot", "suspend", "hibernate", "core_dump", "pm_control",
"init_control", "inject_nmi", "send_input", "send_signal", "fs_trim",
"init_control", "inject_nmi", "send_input", "send_signal",
"fs_trim", "fs_freeze",
"block_read", "block_write", "mem_read",
"open_graphics", "open_device", "screenshot",
"open_namespace");

View File

@ -238,10 +238,16 @@ typedef enum {
/**
* @desc: Trim domain filesystems
* @message: Trimming domain filesystems require authorization
* @message: Trimming domain filesystems requires authorization
*/
VIR_ACCESS_PERM_DOMAIN_FS_TRIM, /* Issue TRIM to guest filesystems */
/**
* @desc: Freeze and thaw domain filesystems
* @message: Freezing and thawing domain filesystems requires authorization
*/
VIR_ACCESS_PERM_DOMAIN_FS_FREEZE, /* Freeze and thaw guest filesystems */
/* Peeking at guest */
/**

View File

@ -7768,6 +7768,8 @@ static virDriver remote_driver = {
.domainMigrateFinish3Params = remoteDomainMigrateFinish3Params, /* 1.1.0 */
.domainMigrateConfirm3Params = remoteDomainMigrateConfirm3Params, /* 1.1.0 */
.connectGetCPUModelNames = remoteConnectGetCPUModelNames, /* 1.1.3 */
.domainFSFreeze = remoteDomainFSFreeze, /* 1.2.5 */
.domainFSThaw = remoteDomainFSThaw, /* 1.2.5 */
};
static virNetworkDriver network_driver = {

View File

@ -235,6 +235,9 @@ const REMOTE_DOMAIN_JOB_STATS_MAX = 64;
/* Upper limit on number of CPU models */
const REMOTE_CONNECT_CPU_MODELS_MAX = 8192;
/* Upper limit on number of mountpoints to frozen */
const REMOTE_DOMAIN_FSFREEZE_MOUNTPOINTS_MAX = 256;
/* UUID. VIR_UUID_BUFLEN definition comes from libvirt.h */
typedef opaque remote_uuid[VIR_UUID_BUFLEN];
@ -2959,6 +2962,25 @@ struct remote_network_event_lifecycle_msg {
int detail;
};
struct remote_domain_fsfreeze_args {
remote_nonnull_domain dom;
remote_nonnull_string mountpoints<REMOTE_DOMAIN_FSFREEZE_MOUNTPOINTS_MAX>; /* (const char **) */
unsigned int flags;
};
struct remote_domain_fsfreeze_ret {
int filesystems;
};
struct remote_domain_fsthaw_args {
remote_nonnull_domain dom;
remote_nonnull_string mountpoints<REMOTE_DOMAIN_FSFREEZE_MOUNTPOINTS_MAX>; /* (const char **) */
unsigned int flags;
};
struct remote_domain_fsthaw_ret {
int filesystems;
};
/*----- Protocol. -----*/
@ -4289,7 +4311,7 @@ enum remote_procedure {
/**
* @generate: both
* @acl: domain:snapshot
* @acl: domain:write:VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE
* @acl: domain:fs_freeze:VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE
*/
REMOTE_PROC_DOMAIN_SNAPSHOT_CREATE_XML = 185,
@ -5275,5 +5297,17 @@ enum remote_procedure {
* @generate: both
* @acl: domain:core_dump
*/
REMOTE_PROC_DOMAIN_CORE_DUMP_WITH_FORMAT = 334
REMOTE_PROC_DOMAIN_CORE_DUMP_WITH_FORMAT = 334,
/**
* @generate: both
* @acl: domain:fs_freeze
*/
REMOTE_PROC_DOMAIN_FSFREEZE = 335,
/**
* @generate: both
* @acl: domain:fs_freeze
*/
REMOTE_PROC_DOMAIN_FSTHAW = 336
};

View File

@ -2427,6 +2427,28 @@ struct remote_network_event_lifecycle_msg {
int event;
int detail;
};
struct remote_domain_fsfreeze_args {
remote_nonnull_domain dom;
struct {
u_int mountpoints_len;
remote_nonnull_string * mountpoints_val;
} mountpoints;
u_int flags;
};
struct remote_domain_fsfreeze_ret {
int filesystems;
};
struct remote_domain_fsthaw_args {
remote_nonnull_domain dom;
struct {
u_int mountpoints_len;
remote_nonnull_string * mountpoints_val;
} mountpoints;
u_int flags;
};
struct remote_domain_fsthaw_ret {
int filesystems;
};
enum remote_procedure {
REMOTE_PROC_CONNECT_OPEN = 1,
REMOTE_PROC_CONNECT_CLOSE = 2,
@ -2762,4 +2784,6 @@ enum remote_procedure {
REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND_DISK = 332,
REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVED = 333,
REMOTE_PROC_DOMAIN_CORE_DUMP_WITH_FORMAT = 334,
REMOTE_PROC_DOMAIN_FSFREEZE = 335,
REMOTE_PROC_DOMAIN_FSTHAW = 336,
};

View File

@ -64,6 +64,8 @@ sub fixup_name {
$name =~ s/Nmi$/NMI/;
$name =~ s/Pm/PM/;
$name =~ s/Fstrim$/FSTrim/;
$name =~ s/Fsfreeze$/FSFreeze/;
$name =~ s/Fsthaw$/FSThaw/;
$name =~ s/Scsi/SCSI/;
$name =~ s/Wwn$/WWN/;