X

Oracle Linux, Oracle Solaris, virtualization and container technologies and Oracle Cloud Infrastructure musings

  • Friday, February 23, 2018

oci-utils (oracle cloud infrastructure) for Oracle Linux package

By: Wim Coekaerts | SVP

We recently added another little utilities RPM for Oracle Linux 7 to our collection:

oci-utils is an Oracle Linux RPM that contains a set of scripts to make managing an OCI instance easier, from within the instance.

The current version provides tools that help with managing block volumes (attach, remove, automatic discovery), secondary vnic configuration, a script to query the public IP of an instances and a script that lets you query instance metadata key/value pairs without having to parse or read json.

# yum install oci-utils
Package content:

Binaries:
/usr/bin/oci-iscsi-config
/usr/bin/oci-metadata
/usr/bin/oci-network-config
/usr/bin/oci-public-ip
System service
/etc/systemd/ocid.service
/usr/libexec/ocid
MAN pages
oci-iscsi-config(1)
oci-metadata(1)
oci-network-config(1)
oci-public-ip(1)
ocid(8)

Ideally you start the ocid service, it will monitor for any changes in block devices or vnic's attached or removed. Today, when you add a block device, you have to run a number of iscsiadm commands to actually discover it and attach it to your instance. When ocid is running, it will, on a regular basis, probe to see if these devices have been created through the OCI web console, cli or SDK. It will then automatically disover them for you.

oci-iscsi-config is a simple wrapper around iscsiadm that provides you with a single command to list and attach/detach devices without having to know the iscsiadm command syntax.

ex:

# oci-iscsi-config -s
For full functionality of this utility the ocid service must be running
The administrator can start it using this command:
    sudo systemctl start ocid.service
ocid already running.
Currently attached iSCSI devices:

Target iqn.2015-02.oracle.boot:uefi
   Persistent portal:    169.254.0.2:3260
      Current portal:    169.254.0.2:3260
               State:    running
     Attached device:    sda
                Size:    46.6G
          Partitions:    Device    Size  Filesystem   Mountpoint
                         sda1      544M        vfat   /boot/efi
                         sda2        8G        swap   [SWAP]
                         sda3       38G         xfs   /

<attach a 50G block volume in the OCI webconsole>

# oci-iscsi-config -s
Currently attached iSCSI devices:

Target iqn.2015-12.com.oracleiaas:31b78e27-0c73-43ff-98b9-0ced1722a08c
   Persistent portal:    169.254.2.2:3260
      Current portal:    169.254.2.2:3260
               State:    running
     Attached device:    sdb
                Size:    50G
    File system type:    Unknown
          Mountpoint:    Not mounted

Target iqn.2015-02.oracle.boot:uefi
   Persistent portal:    169.254.0.2:3260
      Current portal:    169.254.0.2:3260
               State:    running
     Attached device:    sda
                Size:    46.6G
          Partitions:    Device    Size  Filesystem   Mountpoint
                         sda1      544M        vfat   /boot/efi
                         sda2        8G        swap   [SWAP]
                         sda3       38G         xfs   /

You can see /dev/sdb now show up after a few seconds, without having to run any commands.

oci-network-config is similar

oci-network-config is similar

# oci-network-config -s
CONFIG ADDR            SPREFIX         SBITS VIRTRT          NS         IND IFACE      VLTAG VLAN        STATE MAC               VNIC
-      10.0.0.2        10.0.0.0        24    10.0.0.1        -          0   ens3       -     -           UP    02:00:17:01:ed:6b ocid1.vnic.oc1.iad.abuwcljs4ik52qrq7itbb32rwajjqddt7utla64t47fkkq7tebw5gknt5csa
<add a secondary interface>
# oci-network-config -s
CONFIG ADDR            SPREFIX         SBITS VIRTRT          NS         IND IFACE      VLTAG VLAN        STATE MAC               VNIC
-      10.0.0.2        10.0.0.0        24    10.0.0.1        -          0   ens3       -     -           UP    02:00:17:01:ed:6b ocid1.vnic.oc1.iad.abuwcljs4ik52qrq7itbb32rwajjqddt7utla64t47fkkq7tebw5gknt5csa
ADD    10.0.0.3        10.0.0.0        24    10.0.0.1        -          1   ens4       -     -           UP    02:00:17:01:eb:53 ocid1.vnic.oc1.iad.abuwcljsxek2mqaotafcohdmvghzrzx3jiiwq3zo45fh65dvlkpinndfjvma
oci-public-ip just contacts an internet facing server to return your public IP of your instance.

# oci-public-ip
Public IP address: 129.213.44.98

oci-medata let's you pretty-print the instance metadata and query for a given key

# oci-metadata -g region
Instance details:
  Region: iad (Ashburn, VA, USA)
# oci-metadata -g state
Instance details:
  Instance state: Running

An updated version in the near future will also use the SDK (if installed along with your pem key) to go and create a block device and attach it from within your instance and/or create a secondary vnic and automatically create and attach it.

One roadmap item is the ability to use dynamic groups and principals to allow for an instance with the right privileges to do the block volume create/secondary vnic create without a pem key.

give it a try.

Join the discussion

Comments ( 3 )
  • Mattia Rossi Wednesday, March 21, 2018
    Thanks Wim, very useful package, is an OEL 6.x version planned ?

    Regards,
    Mattia
  • Wim Coekaerts Wednesday, March 21, 2018
    Hi Mattia,

    no - sorry only OL7. It's a lot of work to maintain these add-ons for so many versions and OL6 is getting to be a bit on the old side right now.
  • Mattia Rossi Thursday, March 22, 2018
    Thanks Wim, no worries, just asking.
    I agree OL6 is past its prime time, but especiallly for Oracle Databases we tend to mirror what is deployed on engineered systems. Can't wait for Exadatas to start using OL7 as well.
    Regards
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services