mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-22 22:13:18 +00:00
lib: Introduce flag VIR_DOMAIN_BLOCK_COMMIT_RELATIVE
Introduce flag for the block commit API to allow the commit operation to leave the chain relatively addressed. Also adds a virsh switch to enable this behavior.
This commit is contained in:
parent
3ea661deea
commit
bda44ca2ca
@ -2606,6 +2606,9 @@ typedef enum {
|
|||||||
have been committed */
|
have been committed */
|
||||||
VIR_DOMAIN_BLOCK_COMMIT_ACTIVE = 1 << 2, /* Allow a two-phase commit when
|
VIR_DOMAIN_BLOCK_COMMIT_ACTIVE = 1 << 2, /* Allow a two-phase commit when
|
||||||
top is the active layer */
|
top is the active layer */
|
||||||
|
VIR_DOMAIN_BLOCK_COMMIT_RELATIVE = 1 << 3, /* keep the backing chain
|
||||||
|
referenced using relative
|
||||||
|
names */
|
||||||
} virDomainBlockCommitFlags;
|
} virDomainBlockCommitFlags;
|
||||||
|
|
||||||
int virDomainBlockCommit(virDomainPtr dom, const char *disk, const char *base,
|
int virDomainBlockCommit(virDomainPtr dom, const char *disk, const char *base,
|
||||||
|
@ -19884,6 +19884,11 @@ virDomainBlockRebase(virDomainPtr dom, const char *disk,
|
|||||||
* VIR_DOMAIN_BLOCK_COMMIT_DELETE, then this command will unlink all files
|
* VIR_DOMAIN_BLOCK_COMMIT_DELETE, then this command will unlink all files
|
||||||
* that were invalidated, after the commit successfully completes.
|
* that were invalidated, after the commit successfully completes.
|
||||||
*
|
*
|
||||||
|
* If @flags contains VIR_DOMAIN_BLOCK_COMMIT_RELATIVE, the name recorded
|
||||||
|
* into the overlay of the @top image (if there is such image) as the
|
||||||
|
* path to the new backing file will be kept relative to other images.
|
||||||
|
* The operation will fail if libvirt can't infer the name.
|
||||||
|
*
|
||||||
* By default, if @base is NULL, the commit target will be the bottom of
|
* By default, if @base is NULL, the commit target will be the bottom of
|
||||||
* the backing chain; if @flags contains VIR_DOMAIN_BLOCK_COMMIT_SHALLOW,
|
* the backing chain; if @flags contains VIR_DOMAIN_BLOCK_COMMIT_SHALLOW,
|
||||||
* then the immediate backing file of @top will be used instead. If @top
|
* then the immediate backing file of @top will be used instead. If @top
|
||||||
|
@ -1505,6 +1505,8 @@ blockJobImpl(vshControl *ctl, const vshCmd *cmd,
|
|||||||
vshCommandOptBool(cmd, "pivot") ||
|
vshCommandOptBool(cmd, "pivot") ||
|
||||||
vshCommandOptBool(cmd, "keep-overlay"))
|
vshCommandOptBool(cmd, "keep-overlay"))
|
||||||
flags |= VIR_DOMAIN_BLOCK_COMMIT_ACTIVE;
|
flags |= VIR_DOMAIN_BLOCK_COMMIT_ACTIVE;
|
||||||
|
if (vshCommandOptBool(cmd, "keep-relative"))
|
||||||
|
flags |= VIR_DOMAIN_BLOCK_COMMIT_RELATIVE;
|
||||||
ret = virDomainBlockCommit(dom, path, base, top, bandwidth, flags);
|
ret = virDomainBlockCommit(dom, path, base, top, bandwidth, flags);
|
||||||
break;
|
break;
|
||||||
case VSH_CMD_BLOCK_JOB_COPY:
|
case VSH_CMD_BLOCK_JOB_COPY:
|
||||||
@ -1638,6 +1640,10 @@ static const vshCmdOptDef opts_block_commit[] = {
|
|||||||
.type = VSH_OT_BOOL,
|
.type = VSH_OT_BOOL,
|
||||||
.help = N_("with --wait, don't wait for cancel to finish")
|
.help = N_("with --wait, don't wait for cancel to finish")
|
||||||
},
|
},
|
||||||
|
{.name = "keep-relative",
|
||||||
|
.type = VSH_OT_BOOL,
|
||||||
|
.help = N_("keep the backing chain relatively referenced")
|
||||||
|
},
|
||||||
{.name = NULL}
|
{.name = NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -820,7 +820,7 @@ address of virtual interface (such as I<detach-interface> or
|
|||||||
I<domif-setlink>) will accept the MAC address printed by this command.
|
I<domif-setlink>) will accept the MAC address printed by this command.
|
||||||
|
|
||||||
=item B<blockcommit> I<domain> I<path> [I<bandwidth>]
|
=item B<blockcommit> I<domain> I<path> [I<bandwidth>]
|
||||||
[I<base>] [I<--shallow>] [I<top>] [I<--delete>]
|
[I<base>] [I<--shallow>] [I<top>] [I<--delete>] [I<--keep-relative>]
|
||||||
[I<--wait> [I<--async>] [I<--verbose>]] [I<--timeout> B<seconds>]
|
[I<--wait> [I<--async>] [I<--verbose>]] [I<--timeout> B<seconds>]
|
||||||
[I<--active>] [{I<--pivot> | I<--keep-overlay>}]
|
[I<--active>] [{I<--pivot> | I<--keep-overlay>}]
|
||||||
|
|
||||||
@ -833,7 +833,8 @@ I<--shallow> can be used instead of I<base> to specify the immediate
|
|||||||
backing file of the resulting top image to be committed. The files
|
backing file of the resulting top image to be committed. The files
|
||||||
being committed are rendered invalid, possibly as soon as the operation
|
being committed are rendered invalid, possibly as soon as the operation
|
||||||
starts; using the I<--delete> flag will attempt to remove these invalidated
|
starts; using the I<--delete> flag will attempt to remove these invalidated
|
||||||
files at the successful completion of the commit operation.
|
files at the successful completion of the commit operation. When the
|
||||||
|
I<--keep-relative> flag is used, the backing file paths will be kept relative.
|
||||||
|
|
||||||
When I<top> is omitted or specified as the active image, it is also
|
When I<top> is omitted or specified as the active image, it is also
|
||||||
possible to specify I<--active> to trigger a two-phase active commit. In
|
possible to specify I<--active> to trigger a two-phase active commit. In
|
||||||
|
Loading…
Reference in New Issue
Block a user