@@ -25,6 +25,10 @@ func poll(cmd string) (int, int, error) {
25
25
return 0 , 0 , errors .New (fmt .Sprintf ("ERROR: output: %s, err: %s" , out , err .Error ()))
26
26
}
27
27
28
+ if strings .Contains (string (out ), "ErrorCode:PendingCopyOperation" ) {
29
+ return 0 , 100 , nil
30
+ }
31
+
28
32
parts := strings .Split (string (out ), "/" )
29
33
if len (parts ) != 2 {
30
34
return 0 , 0 , errors .New (fmt .Sprintf ("Command should have returned <actual>/<total> instead it was: %s" , out ))
@@ -89,7 +93,11 @@ func main() {
89
93
time .Sleep (time .Second * 1 )
90
94
}
91
95
}
92
- log .Printf ("Blob size of vhd in Storage Account of %s is: %f GB" , storageAccount , float64 (sum )/ math .Pow (1024 , 3 ))
96
+ if sum < 1024 {
97
+ log .Println ("Azure didn't return exact numbers, but reported that the blob is being copied... (fingers crossed)" )
98
+ } else {
99
+ log .Printf ("Blob size of vhd in Storage Account of %s is: %f GB" , storageAccount , float64 (sum )/ math .Pow (1024 , 3 ))
100
+ }
93
101
}(storageAccount , cmd )
94
102
}
95
103
wg .Wait ()
@@ -110,7 +118,11 @@ func main() {
110
118
return
111
119
}
112
120
} else {
113
- log .Printf ("Copy status to Storage Account of %s is: (%d/%d) %.2f%% " , storageAccount , act , sum , (float64 (act )/ float64 (sum ))* 100 )
121
+ if sum < 1024 {
122
+ log .Println ("Azure didn't return exact numbers, but reported that the blob is still being copied... (fingers crossed)" )
123
+ } else {
124
+ log .Printf ("Copy status to Storage Account of %s is: (%d/%d) %.2f%% " , storageAccount , act , sum , (float64 (act )/ float64 (sum ))* 100 )
125
+ }
114
126
}
115
127
time .Sleep (time .Second * 10 )
116
128
}
0 commit comments