File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 99 "io"
1010 "os"
1111 "strings"
12+ "syscall"
1213)
1314
1415// Constants for the managed image library
@@ -456,6 +457,20 @@ func copyFile(src, dst string) error {
456457 return fmt .Errorf ("failed to sync destination file: %w" , err )
457458 }
458459
460+ // Fix ownership for libvirt access - inherit from parent directory
461+ if parentInfo , err := os .Stat (flintImagePoolPath ); err == nil {
462+ if stat , ok := parentInfo .Sys ().(* syscall.Stat_t ); ok {
463+ if err := os .Chown (dst , int (stat .Uid ), int (stat .Gid )); err != nil {
464+ return fmt .Errorf ("failed to set file ownership: %w" , err )
465+ }
466+ }
467+ }
468+
469+ // Set proper permissions for libvirt access
470+ if err := os .Chmod (dst , 0644 ); err != nil {
471+ return fmt .Errorf ("failed to set file permissions: %w" , err )
472+ }
473+
459474 return nil
460475}
461476
You can’t perform that action at this time.
0 commit comments