|
@@ -62,10 +62,17 @@ type EndpointConnectivity struct {
|
|
}
|
|
}
|
|
|
|
|
|
type hnsEndpoint struct {
|
|
type hnsEndpoint struct {
|
|
- id string
|
|
|
|
- nid string
|
|
|
|
- profileID string
|
|
|
|
- Type string
|
|
|
|
|
|
+ id string
|
|
|
|
+ nid string
|
|
|
|
+ profileID string
|
|
|
|
+ Type string
|
|
|
|
+ //Note: Currently, the sandboxID is the same as the containerID since windows does
|
|
|
|
+ //not expose the sandboxID.
|
|
|
|
+ //In the future, windows will support a proper sandboxID that is different
|
|
|
|
+ //than the containerID.
|
|
|
|
+ //Therefore, we are using sandboxID now, so that we won't have to change this code
|
|
|
|
+ //when windows properly supports a sandboxID.
|
|
|
|
+ sandboxID string
|
|
macAddress net.HardwareAddr
|
|
macAddress net.HardwareAddr
|
|
epOption *endpointOption // User specified parameters
|
|
epOption *endpointOption // User specified parameters
|
|
epConnectivity *EndpointConnectivity // User specified parameters
|
|
epConnectivity *EndpointConnectivity // User specified parameters
|
|
@@ -730,7 +737,15 @@ func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo,
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
|
|
|
|
- // This is just a stub for now
|
|
|
|
|
|
+ endpoint.sandboxID = sboxKey
|
|
|
|
+
|
|
|
|
+ err = hcsshim.HotAttachEndpoint(endpoint.sandboxID, endpoint.profileID)
|
|
|
|
+ if err != nil {
|
|
|
|
+ // If container doesn't exists in hcs, do not throw error for hot add/remove
|
|
|
|
+ if err != hcsshim.ErrComputeSystemDoesNotExist {
|
|
|
|
+ return err
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
jinfo.DisableGatewayService()
|
|
jinfo.DisableGatewayService()
|
|
return nil
|
|
return nil
|
|
@@ -744,13 +759,18 @@ func (d *driver) Leave(nid, eid string) error {
|
|
}
|
|
}
|
|
|
|
|
|
// Ensure that the endpoint exists
|
|
// Ensure that the endpoint exists
|
|
- _, err = network.getEndpoint(eid)
|
|
|
|
|
|
+ endpoint, err := network.getEndpoint(eid)
|
|
if err != nil {
|
|
if err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
|
|
|
|
- // This is just a stub for now
|
|
|
|
-
|
|
|
|
|
|
+ err = hcsshim.HotDetachEndpoint(endpoint.sandboxID, endpoint.profileID)
|
|
|
|
+ if err != nil {
|
|
|
|
+ // If container doesn't exists in hcs, do not throw error for hot add/remove
|
|
|
|
+ if err != hcsshim.ErrComputeSystemDoesNotExist {
|
|
|
|
+ return err
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|