@@ -25,6 +25,8 @@ import (
25
25
)
26
26
27
27
func main () {
28
+ var uploadBytes uint64
29
+
28
30
logger := slog .New (slog .NewJSONHandler (os .Stdout , nil ))
29
31
slog .SetDefault (logger )
30
32
@@ -61,6 +63,8 @@ func main() {
61
63
os .Exit (1 )
62
64
}
63
65
66
+ logger .Info (fmt .Sprintf ("Start clone block with %s" , helpers .FormatBytes (float64 (uploadBytes ))))
67
+
64
68
if err = helpers .RunCloner ("blockdevice-clone" , uploadBytes , mountPoint ); err != nil {
65
69
logger .Error ("Error running cdi-cloner: %v\n " , slog .String ("error" , err .Error ()))
66
70
os .Exit (1 )
@@ -73,38 +77,22 @@ func main() {
73
77
os .Exit (1 )
74
78
}
75
79
76
- // TODO correct log message
77
- if preallocation {
78
- logger .Info ("Get only used blocks in bytes" )
79
- } else {
80
- logger .Info ("Preallocating filesystem, uploading all bytes" )
81
- }
82
- // directory bytes, directory bytes
83
- // total count bytes, used count bytes
84
- // uploadBytes, err := helpers.GetDirectorySize(".", preallocation)
85
80
totalBytes , totalUsedBytes , err := helpers .GetDirectorySize ("." )
86
81
if err != nil {
87
82
logger .Error ("Directory size calculation failed: %v\n " , slog .String ("error" , err .Error ()))
88
83
os .Exit (1 )
89
84
}
90
85
91
- /*
92
- if preallocation {
93
- uploadBytes := totalUsedBytes
94
- }else
95
- {
96
- uploadBytes := totalBytes
97
- }
98
- */
99
- var uploadBytes uint64
100
-
101
86
if preallocation {
102
- uploadBytes = totalUsedBytes
103
- } else {
104
87
uploadBytes = totalBytes
88
+ logger .Info ("Preallocating filesystem, uploading all bytes" )
89
+ } else {
90
+ uploadBytes = totalUsedBytes
91
+ logger .Info ("Not preallocating filesystem, get only used blocks in bytes" )
105
92
}
106
93
107
94
logger .Info (fmt .Sprintf ("Start clone with %d bytes" , uploadBytes ))
95
+ logger .Info (fmt .Sprintf ("Start clone with %s" , helpers .FormatBytes (float64 (uploadBytes ))))
108
96
109
97
if err = helpers .RunCloner ("filesystem-clone" , uploadBytes , mountPoint ); err != nil {
110
98
logger .Error ("Error running cdi-cloner: %v\n " , slog .String ("error" , err .Error ()))
0 commit comments