From 80ce96c0f15fd3b244f1ab802c776de4b105670e Mon Sep 17 00:00:00 2001 From: Zac Dover Date: Fri, 23 Dec 2022 10:47:27 +1000 Subject: [PATCH] doc/rados: add prompts to librados-intro.rst Add unselectable prompts to doc/rados/api/librados-intro.rst. https://tracker.ceph.com/issues/57108 Signed-off-by: Zac Dover (cherry picked from commit a3ec661721bbf98abfdd9c3a8ef9cadde42aeca7) --- doc/rados/api/librados-intro.rst | 151 ++++++++++++++++++++----------- 1 file changed, 100 insertions(+), 51 deletions(-) diff --git a/doc/rados/api/librados-intro.rst b/doc/rados/api/librados-intro.rst index 6951476ae3a26..c3c9f44a54473 100644 --- a/doc/rados/api/librados-intro.rst +++ b/doc/rados/api/librados-intro.rst @@ -43,19 +43,25 @@ Getting librados for C/C++ -------------------------- To install ``librados`` development support files for C/C++ on Debian/Ubuntu -distributions, execute the following:: +distributions, execute the following: - sudo apt-get install librados-dev +.. prompt:: bash $ + + sudo apt-get install librados-dev To install ``librados`` development support files for C/C++ on RHEL/CentOS -distributions, execute the following:: +distributions, execute the following: + +.. prompt:: bash $ - sudo yum install librados2-devel + sudo yum install librados2-devel Once you install ``librados`` for developers, you can find the required -headers for C/C++ under ``/usr/include/rados``. :: +headers for C/C++ under ``/usr/include/rados``: + +.. prompt:: bash $ - ls /usr/include/rados + ls /usr/include/rados Getting librados for Python @@ -68,14 +74,25 @@ and the ``librados2-devel`` package for RHEL/CentOS will install the directly too. To install ``librados`` development support files for Python on Debian/Ubuntu -distributions, execute the following:: +distributions, execute the following: - sudo apt-get install python-rados +.. prompt:: bash $ + + sudo apt-get install python3-rados To install ``librados`` development support files for Python on RHEL/CentOS -distributions, execute the following:: +distributions, execute the following: + +.. prompt:: bash $ + + sudo yum install python-rados - sudo yum install python-rados +To install ``librados`` development support files for Python on SLE/openSUSE +distributions, execute the following: + +.. prompt:: bash $ + + sudo zypper install python3-rados You can find the module under ``/usr/share/pyshared`` on Debian systems, or under ``/usr/lib/python*/site-packages`` on CentOS/RHEL systems. @@ -86,37 +103,49 @@ Getting librados for Java To install ``librados`` for Java, you need to execute the following procedure: -#. Install ``jna.jar``. For Debian/Ubuntu, execute:: +#. Install ``jna.jar``. For Debian/Ubuntu, execute: + + .. prompt:: bash $ - sudo apt-get install libjna-java + sudo apt-get install libjna-java - For CentOS/RHEL, execute:: + For CentOS/RHEL, execute: - sudo yum install jna + .. prompt:: bash $ + + sudo yum install jna The JAR files are located in ``/usr/share/java``. -#. Clone the ``rados-java`` repository:: +#. Clone the ``rados-java`` repository: + + .. prompt:: bash $ + + git clone --recursive https://github.com/ceph/rados-java.git - git clone --recursive https://github.com/ceph/rados-java.git +#. Build the ``rados-java`` repository: -#. Build the ``rados-java`` repository:: + .. prompt:: bash $ - cd rados-java - ant + cd rados-java + ant The JAR file is located under ``rados-java/target``. #. Copy the JAR for RADOS to a common location (e.g., ``/usr/share/java``) and - ensure that it and the JNA JAR are in your JVM's classpath. For example:: + ensure that it and the JNA JAR are in your JVM's classpath. For example: - sudo cp target/rados-0.1.3.jar /usr/share/java/rados-0.1.3.jar - sudo ln -s /usr/share/java/jna-3.2.7.jar /usr/lib/jvm/default-java/jre/lib/ext/jna-3.2.7.jar - sudo ln -s /usr/share/java/rados-0.1.3.jar /usr/lib/jvm/default-java/jre/lib/ext/rados-0.1.3.jar + .. prompt:: bash $ -To build the documentation, execute the following:: + sudo cp target/rados-0.1.3.jar /usr/share/java/rados-0.1.3.jar + sudo ln -s /usr/share/java/jna-3.2.7.jar /usr/lib/jvm/default-java/jre/lib/ext/jna-3.2.7.jar + sudo ln -s /usr/share/java/rados-0.1.3.jar /usr/lib/jvm/default-java/jre/lib/ext/rados-0.1.3.jar - ant docs +To build the documentation, execute the following: + +.. prompt:: bash $ + + ant docs Getting librados for PHP @@ -124,29 +153,39 @@ Getting librados for PHP To install the ``librados`` extension for PHP, you need to execute the following procedure: -#. Install php-dev. For Debian/Ubuntu, execute:: +#. Install php-dev. For Debian/Ubuntu, execute: + + .. prompt:: bash $ + + sudo apt-get install php5-dev build-essential + + For CentOS/RHEL, execute: + + .. prompt:: bash $ - sudo apt-get install php5-dev build-essential + sudo yum install php-devel - For CentOS/RHEL, execute:: +#. Clone the ``phprados`` repository: - sudo yum install php-devel + .. prompt:: bash $ -#. Clone the ``phprados`` repository:: + git clone https://github.com/ceph/phprados.git - git clone https://github.com/ceph/phprados.git +#. Build ``phprados``: -#. Build ``phprados``:: + .. prompt:: bash $ - cd phprados - phpize - ./configure - make - sudo make install + cd phprados + phpize + ./configure + make + sudo make install -#. Enable ``phprados`` in php.ini by adding:: +#. Enable ``phprados`` in php.ini by adding: + + .. prompt:: bash $ - extension=rados.so + extension=rados.so Step 2: Configuring a Cluster Handle @@ -321,9 +360,11 @@ it and connecting to the cluster might look something like this: } -Compile your client and link to ``librados`` using ``-lrados``. For example:: +Compile your client and link to ``librados`` using ``-lrados``. For example: - gcc ceph-client.c -lrados -o ceph-client +.. prompt:: bash $ + + gcc ceph-client.c -lrados -o ceph-client C++ Example @@ -399,10 +440,12 @@ you to initialize a ``librados::Rados`` cluster handle object: Compile the source; then, link ``librados`` using ``-lrados``. -For example:: +For example: + +.. prompt:: bash $ - g++ -g -c ceph-client.cc -o ceph-client.o - g++ -g ceph-client.o -lrados -o ceph-client + g++ -g -c ceph-client.cc -o ceph-client.o + g++ -g ceph-client.o -lrados -o ceph-client @@ -436,9 +479,11 @@ into exceptions. print "Connected to the cluster." -Execute the example to verify that it connects to your cluster. :: +Execute the example to verify that it connects to your cluster: + +.. prompt:: bash $ - python ceph-client.py + python ceph-client.py Java Example @@ -478,10 +523,12 @@ binding converts C++-based errors into exceptions. Compile the source; then, run it. If you have copied the JAR to ``/usr/share/java`` and sym linked from your ``ext`` directory, you won't need -to specify the classpath. For example:: +to specify the classpath. For example: - javac CephClient.java - java CephClient +.. prompt:: bash $ + + javac CephClient.java + java CephClient PHP Example @@ -502,9 +549,11 @@ With the RADOS extension enabled in PHP you can start creating a new cluster han } -Save this as rados.php and run the code:: +Save this as rados.php and run the code: + +.. prompt:: bash $ - php rados.php + php rados.php Step 3: Creating an I/O Context -- 2.39.5