Announce that no devices are available on startup
Upstream bug:
prior to Kubernetes 1.10.3 did not properly re-assign devices after
device-plugin restart. As a workaround, virt-handler will allocate
zero devices momentarily at startup--effectively clearly the list
of devices being tracked by the plugin framework.
@@ -173,6 +173,12 @@ func (dpi *GenericDevicePlugin) addNewGenericDevice() {
}
func (dpi *GenericDevicePlugin) ListAndWatch(e *pluginapi.Empty, s pluginapi.DevicePlugin_ListAndWatchServer) error {
+ // FIXME: sending an empty list up front should not be needed. This is a workaround for:
+ // https://github.com/kubevirt/kubevirt/issues/1196
+ // This can safely be removed once supported upstream Kubernetes is 1.10.3 or higher.
+ emptyList := []*pluginapi.Device{}
+ s.Send(&pluginapi.ListAndWatchResponse{Devices: emptyList})
+
s.Send(&pluginapi.ListAndWatchResponse{Devices: dpi.devs})
for {
