| 143 | |
| 144 | |
| 145 | inline void removeDockerIPv6UserNetwork() |
| 146 | { |
| 147 | // Docker IPv6 is not supported on Windows, so no-op on that platform. |
| 148 | // TODO(akagup): Remove the #ifdef when Windows supports IPv6 networks |
| 149 | // in docker containers. See MESOS-8566. |
| 150 | #ifndef __WINDOWS__ |
| 151 | // Delete the Docker user network. |
| 152 | Try<std::string> dockerCommand = |
| 153 | strings::format("docker network rm %s", DOCKER_IPv6_NETWORK); |
| 154 | |
| 155 | Try<process::Subprocess> s = subprocess( |
| 156 | dockerCommand.get(), |
| 157 | process::Subprocess::PATH("/dev/null"), |
| 158 | process::Subprocess::PATH("/dev/null"), |
| 159 | process::Subprocess::PIPE()); |
| 160 | |
| 161 | // This is best effort cleanup. In case of an error just a log an |
| 162 | // error. |
| 163 | ASSERT_SOME(s) << "Unable to delete the Docker IPv6 network: " |
| 164 | << DOCKER_IPv6_NETWORK; |
| 165 | |
| 166 | process::Future<std::string> err = process::io::read(s->err().get()); |
| 167 | |
| 168 | // Wait for the network to be deleted. |
| 169 | AWAIT_READY(s->status()); |
| 170 | AWAIT_READY(err); |
| 171 | |
| 172 | ASSERT_SOME(s->status().get()); |
| 173 | ASSERT_EQ(s->status()->get(), 0) |
| 174 | << "Unable to delete the Docker IPv6 network " |
| 175 | << DOCKER_IPv6_NETWORK |
| 176 | << " : " << err.get(); |
| 177 | #endif // __WINDOWS__ |
| 178 | } |
| 179 | |
| 180 | |
| 181 | inline void assertDockerKillStatus(process::Future<Option<int>>& status) |