File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 99 "time"
1010
1111 "github.com/Azure/azure-container-networking/cni"
12+ "github.com/Azure/azure-container-networking/cni/api"
1213 zapLog "github.com/Azure/azure-container-networking/cni/log"
1314 "github.com/Azure/azure-container-networking/cni/network"
1415 "github.com/Azure/azure-container-networking/common"
@@ -127,6 +128,19 @@ func rootExecute() error {
127128 panic ("network plugin start fatal error" )
128129 }
129130 }
131+ // dump an empty state in case the API is called for StateMigration or InitilizeCNS from CNI State
132+ if cniCmd == cni .CmdGetEndpointsState {
133+ logger .Debug ("returning an empty state" )
134+ simpleState := api.AzureCNIState {
135+ ContainerInterfaces : make (map [string ]api.PodNetworkInterfaceInfo ),
136+ }
137+ err = simpleState .PrintResult ()
138+ if err != nil {
139+ logger .Error ("Failed to print state result to stdout" , zap .Error (err ))
140+ }
141+
142+ return errors .Wrap (err , "Get cni state printresult error" )
143+ }
130144
131145 if cniCmd == cni .CmdVersion {
132146 return errors .Wrap (err , "Execute netplugin failure" )
You can’t perform that action at this time.
0 commit comments