2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-10-20 22:55:40 +00:00

fix(imgport): take the image lock for a statelite import

imgimport took the image lock only when the bundle had a rootimg. A
statelite bundle has a rootimgtree instead, so its import extracted the
tree while genimage, packimage, liteimg or rmimage could change the same
image. imgimport now locks the directory of the first of the rootimg,
rootimgtree, kernel and ramdisk that the bundle has.
This commit is contained in:
Vinícius Ferrão
2026-10-13 23:10:22 -03:00
parent 0437ddd44d
commit 9ecde2b838
+4 -2
View File
@@ -1888,9 +1888,11 @@ sub place_image {
return 0 if !check_import($data, $imgdir, $nodes, $callback);
# genimage, packimage, liteimg and rmimage hold this lock while they change the image.
# A statelite bundle has a rootimgtree instead of a rootimg.
my ($imagefile) = grep { $_ } map { (split(',', $data->{$_} // ''))[0] } qw(rootimg rootimgtree kernel ramdisk);
my $lock;
if ($data->{rootimg}) {
my $rootimgdir = dirname((split(',', $data->{rootimg}))[0]);
if ($imagefile) {
my $rootimgdir = dirname($imagefile);
mkpath($rootimgdir) unless -d $rootimgdir;
(my $retcode, $lock) = xCAT::Utils->acquire_lock_imageop("$rootimgdir/rootimg");
if ($retcode) {