/* ------------------------------------------------------------------------- */ int main( int argc, char *argv[] ) { CARDINAL32 Error_Code = 1; /* Open the LVM engine */ Open_LVM_Engine( TRUE, &Error_Code ); if ( Error_Code != LVM_ENGINE_NO_ERROR ) { printf("ERROR\nOpen_LVM_Engine returned %d\n", Error_Code ); return ( Error_Code ); } if ( argc > 1 ) { if ( strncmp( argv[1], "-v", 2 ) == 0 ) ListVolumes( 1 ); else if ( strncmp( argv[1], "-d", 2 ) == 0 ) ListDisks(); else if ( strncmp( argv[1], "-?", 2 ) == 0 ) PrintHelp(); else { printf("Unrecognized option: %s\n", argv[1] ); PrintHelp(); } } else ListVolumes( 0 ); Close_LVM_Engine(); return ( 0 ); }
int wmain(int argc, LPWSTR argv[]) { if (argc==1) return Usage(0, L"No arguments"); if (!g_args.Parse(argc, argv)) return Usage(); if (g_args.hasHelp) return Usage(); EnumerateDrivesAndPartitions(); auto hr = EnumerateVolumes(); if (hr) return Usage(hr, L"EnumerateVolumes"); if (g_args.hasLv) ListVolumes(); else if (g_args.hasLp) ListPartitions(); else if (g_args.hasCp) return Copy(); else return Usage(0, L"Incorrect arguments"); return 0; }
int ListVolumes(std::vector<Volume> &volumes) { return ListVolumes(std::string(), std::string(), volumes); }
MockCSIPlugin::MockCSIPlugin() { EXPECT_CALL(*this, GetPluginInfo(_, _, _)) .WillRepeatedly(Return(Status::OK)); // Enable all plugin capabilities by default for testing with the test CSI // plugin in forwarding mode. EXPECT_CALL(*this, GetPluginCapabilities(_, _, _)) .WillRepeatedly(Invoke([]( ServerContext* context, const csi::v0::GetPluginCapabilitiesRequest* request, csi::v0::GetPluginCapabilitiesResponse* response) { response->add_capabilities()->mutable_service()->set_type( csi::v0::PluginCapability::Service::CONTROLLER_SERVICE); return Status::OK; })); EXPECT_CALL(*this, Probe(_, _, _)) .WillRepeatedly(Return(Status::OK)); EXPECT_CALL(*this, CreateVolume(_, _, _)) .WillRepeatedly(Return(Status::OK)); EXPECT_CALL(*this, DeleteVolume(_, _, _)) .WillRepeatedly(Return(Status::OK)); EXPECT_CALL(*this, ControllerPublishVolume(_, _, _)) .WillRepeatedly(Return(Status::OK)); EXPECT_CALL(*this, ControllerUnpublishVolume(_, _, _)) .WillRepeatedly(Return(Status::OK)); EXPECT_CALL(*this, ValidateVolumeCapabilities(_, _, _)) .WillRepeatedly(Return(Status::OK)); EXPECT_CALL(*this, ListVolumes(_, _, _)) .WillRepeatedly(Return(Status::OK)); EXPECT_CALL(*this, GetCapacity(_, _, _)) .WillRepeatedly(Return(Status::OK)); // Enable all controller capabilities by default for testing with the test CSI // plugin in forwarding mode. EXPECT_CALL(*this, ControllerGetCapabilities(_, _, _)) .WillRepeatedly(Invoke([]( ServerContext* context, const csi::v0::ControllerGetCapabilitiesRequest* request, csi::v0::ControllerGetCapabilitiesResponse* response) { response->add_capabilities()->mutable_rpc()->set_type( csi::v0::ControllerServiceCapability::RPC::CREATE_DELETE_VOLUME); response->add_capabilities()->mutable_rpc()->set_type( csi::v0::ControllerServiceCapability::RPC::PUBLISH_UNPUBLISH_VOLUME); response->add_capabilities()->mutable_rpc()->set_type( csi::v0::ControllerServiceCapability::RPC::GET_CAPACITY); response->add_capabilities()->mutable_rpc()->set_type( csi::v0::ControllerServiceCapability::RPC::LIST_VOLUMES); return Status::OK; })); EXPECT_CALL(*this, NodeStageVolume(_, _, _)) .WillRepeatedly(Return(Status::OK)); EXPECT_CALL(*this, NodeUnstageVolume(_, _, _)) .WillRepeatedly(Return(Status::OK)); EXPECT_CALL(*this, NodePublishVolume(_, _, _)) .WillRepeatedly(Return(Status::OK)); EXPECT_CALL(*this, NodeUnpublishVolume(_, _, _)) .WillRepeatedly(Return(Status::OK)); EXPECT_CALL(*this, NodeGetId(_, _, _)) .WillRepeatedly(Return(Status::OK)); // Enable all node capabilities by default for testing with the test CSI // plugin in forwarding mode. EXPECT_CALL(*this, NodeGetCapabilities(_, _, _)) .WillRepeatedly(Invoke([]( ServerContext* context, const csi::v0::NodeGetCapabilitiesRequest* request, csi::v0::NodeGetCapabilitiesResponse* response) { response->add_capabilities()->mutable_rpc()->set_type( csi::v0::NodeServiceCapability::RPC::STAGE_UNSTAGE_VOLUME); return Status::OK; })); }