Skip to content

Commit fa2793a

Browse files
committed
return function on snapshot rename returns to renamed snapshot
1 parent ff7d130 commit fa2793a

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

cmd.cgi

+2-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ elsif ($in{'cmd'} =~ "rename") {
9292
$cmd = ($config{'snap_properties'} =~ /1/) ? "zfs rename ".$in{'force'}.$in{'recurse'}.$in{'zfs'}." ".$in{'parent'}.'@'.$in{'name'} : undef;
9393
@footer = ('status.cgi?snap='.$in{'parent'}.'@'.$in{'name'}, $in{'parent'}.'@'.$in{'name'});
9494
} elsif (index($in{'zfs'}, '/') != -1) {
95-
$cmd = ($config{'zfs_properties'} =~ /1/) ? "zfs rename ".$in{'force'}.$in{'prnt'}.$in{'zfs'}." ".$in{'parent'}.'/'.$in{'name'} : undef;
95+
$cmd = ($config{'zfs_properties'} =~ /1/) ? "zfs rename ".$in{'force'}.$in{'prnt'}.$in{'zfs'}." ".$in{'parent'}.'/'.$in{'name'} : undef;
96+
if ($in{'confirm'}) { @footer = ('status.cgi?zfs='.$in{'parent'}.'/'.$in{'name'}, $in{'parent'}.'/'.$in{'name'}); }
9697
}
9798
ui_cmd($in{'zfs'}." to ".$in{'name'}, $cmd);
9899
}

create.cgi

+5-5
Original file line numberDiff line numberDiff line change
@@ -168,24 +168,24 @@ if ($in{'create'} =~ "zpool")
168168
$in{'snap'} = $in{'clone'};
169169
} elsif ($in{'rename'}) {
170170
ui_print_header(undef, "Rename", "", undef, 1, 1);
171-
print ui_form_start("cmd.cgi", "post");
171+
print ui_form_start("cmd.cgi", "post");
172172
%parent = find_parent($in{'rename'});
173173
if (index($in{'rename'}, '@') != -1) {
174174
#is snapshot
175175
print ui_hidden('confirm', 'yes');
176176
$parent = $parent{'filesystem'};
177177
print ui_table_start('Rename snapshot', 'width=100%', '6');
178-
print ui_table_row(undef, '<b>Snapshot:</b> '.$in{'rename'});
179-
print ui_table_row(undef, "<b>New Name: </b>".$parent."@".ui_textbox('name'));
178+
print ui_table_row(undef, '<b>Snapshot:</b> '.$in{'rename'});
179+
print ui_table_row(undef, "<b>New Name: </b>".$parent."@".ui_textbox('name', $parent{'snapshot'}, 35));
180180
print ui_table_row(undef, ui_checkbox("recurse", "-r ", "Recursively rename the snapshots of all descendent datasets."));
181181
@footer = ("status.cgi?snap=".$in{'rename'}, $in{'rename'});
182182
} elsif (index($in{'rename'}, '/') != -1) {
183-
#is filesystem
183+
#is filesystem
184184
$parent = $parent{'pool'};
185185
ui_zfs_list("-r ".$in{'rename'});
186186
print ui_table_start('Rename filesystem', 'width=100%', '6');
187187
print ui_table_row(undef, '<b>Filesystem:</b> '.$in{'rename'});
188-
print ui_table_row(undef, "<b>New Name: </b>".$parent."/".ui_textbox('name'));
188+
print ui_table_row(undef, "<b>New Name: </b>".$parent."/".ui_textbox('name', undef, 35));
189189
print ui_table_row(undef, ui_checkbox("prnt", "-p ", "Create all the nonexistent parent datasets."));
190190
}
191191
print ui_table_row(undef, ui_checkbox("force", "-f ", "Force unmount any filesystems that need to be unmounted in the process."));

zfsmanager-lib.pl

+1
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ sub find_parent
358358
($parent{'pool'}) = split(/[@\/]/g, $filesystem);
359359
$null = reverse $filesystem =~ /[@\/]/g;
360360
$parent{'filesystem'} = substr $filesystem, 0, $-[0];
361+
if (index($filesystem, '@') != -1) { (undef, $parent{'snapshot'}) = split(/@/, $filesystem); }
361362
return %parent;
362363
}
363364

0 commit comments

Comments
 (0)