[pve-devel] [PATCH guest-common v3 2/2] add check_hookscript_volume_id to GuestHelpers
Thomas Lamprecht
t.lamprecht at proxmox.com
Wed Jan 30 08:13:54 CET 2019
On 1/29/19 4:28 PM, Dominik Csapak wrote:
> this will be used for the container/vm api to check if the
> hookscript volume id is correct
>
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> new in v3
> PVE/GuestHelpers.pm | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/PVE/GuestHelpers.pm b/PVE/GuestHelpers.pm
> index 8327dcb..5a8fdd6 100644
> --- a/PVE/GuestHelpers.pm
> +++ b/PVE/GuestHelpers.pm
> @@ -24,6 +24,21 @@ sub guest_migration_lock {
> return $res;
> }
>
> +sub check_hookscript_volume_id {
I'd have fixed this up, but if you need to send a further revision anyway:
just use check_hookscript it's telling enough, also else we normally use
volid but, IMO, in this case it does not helps if any of both is in the
name.
> + my ($volid, $storecfg) = @_;
> +
> + my ($path, undef, $type) = PVE::Storage::path($storecfg, $volid);
> +
> + die "'$volid' is not in the snippets directory\n"
> + if $type ne 'snippets';
> +
> + die "script '$volid' does not exists\n"
> + if ! -f $path;
> +
> + die "script '$volid' is not executable\n"
> + if ! -x $path;
> +}
> +
> sub exec_hookscript {
> my ($conf, $vmid, $phase, $stop_on_error) = @_;
>
>
More information about the pve-devel
mailing list