MCPcopy Create free account
hub / github.com/apache/mesos / nodeUnpublishVolume

Method nodeUnpublishVolume

src/examples/test_csi_plugin.cpp:1775–1808  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1773
1774
1775Try<Nothing, StatusError> TestCSIPlugin::nodeUnpublishVolume(
1776 const string& volumeId, const string& targetPath)
1777{
1778 if (!volumes.contains(volumeId)) {
1779 return StatusError(Status(
1780 grpc::NOT_FOUND, "Volume '" + volumeId + "' does not exist"));
1781 }
1782
1783 Try<internal::fs::MountInfoTable> table =
1784 internal::fs::MountInfoTable::read();
1785
1786 if (table.isError()) {
1787 return StatusError(Status(
1788 grpc::INTERNAL, "Failed to get mount table: " + table.error()));
1789 }
1790
1791 if (std::none_of(
1792 table->entries.begin(),
1793 table->entries.end(),
1794 [&](const internal::fs::MountInfoTable::Entry& entry) {
1795 return entry.target == targetPath;
1796 })) {
1797 return Nothing();
1798 }
1799
1800 Try<Nothing> unmount = internal::fs::unmount(targetPath);
1801 if (unmount.isError()) {
1802 return StatusError(Status(
1803 grpc::INTERNAL,
1804 "Failed to unmount '" + targetPath + "': " + unmount.error()));
1805 }
1806
1807 return Nothing();
1808}
1809
1810
1811// Serves CSI calls from the given endpoint through forwarding the calls to

Callers

nothing calls this directly

Calls 10

StatusErrorClass · 0.85
StatusClass · 0.85
NothingClass · 0.85
errorMethod · 0.65
readFunction · 0.50
unmountFunction · 0.50
containsMethod · 0.45
isErrorMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected