@@ -62,10 +62,17 @@ type EndpointConnectivity struct {
6262}
6363
6464type hnsEndpoint struct {
65- id string
66- nid string
67- profileID string
68- Type string
65+ id string
66+ nid string
67+ profileID string
68+ Type string
69+ //Note: Currently, the sandboxID is the same as the containerID since windows does
70+ //not expose the sandboxID.
71+ //In the future, windows will support a proper sandboxID that is different
72+ //than the containerID.
73+ //Therefore, we are using sandboxID now, so that we won't have to change this code
74+ //when windows properly supports a sandboxID.
75+ sandboxID string
6976 macAddress net.HardwareAddr
7077 epOption * endpointOption // User specified parameters
7178 epConnectivity * EndpointConnectivity // User specified parameters
@@ -730,7 +737,15 @@ func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo,
730737 return err
731738 }
732739
733- // This is just a stub for now
740+ endpoint .sandboxID = sboxKey
741+
742+ err = hcsshim .HotAttachEndpoint (endpoint .sandboxID , endpoint .profileID )
743+ if err != nil {
744+ // If container doesn't exists in hcs, do not throw error for hot add/remove
745+ if err != hcsshim .ErrComputeSystemDoesNotExist {
746+ return err
747+ }
748+ }
734749
735750 jinfo .DisableGatewayService ()
736751 return nil
@@ -744,13 +759,18 @@ func (d *driver) Leave(nid, eid string) error {
744759 }
745760
746761 // Ensure that the endpoint exists
747- _ , err = network .getEndpoint (eid )
762+ endpoint , err : = network .getEndpoint (eid )
748763 if err != nil {
749764 return err
750765 }
751766
752- // This is just a stub for now
753-
767+ err = hcsshim .HotDetachEndpoint (endpoint .sandboxID , endpoint .profileID )
768+ if err != nil {
769+ // If container doesn't exists in hcs, do not throw error for hot add/remove
770+ if err != hcsshim .ErrComputeSystemDoesNotExist {
771+ return err
772+ }
773+ }
754774 return nil
755775}
756776
0 commit comments