Skip to content

Instantly share code, notes, and snippets.

@niedbalski niedbalski/manual-juju.sh
Last active Aug 16, 2019

Embed
What would you like to do?
Setup a ISCSI target multipath with Juju
$ juju bootstrap -e openstack_env
$ juju add-machine
$ nova interface-attach be8c7ed3-9f5c-41f8-b596-0ae7f35c773d
$ nova interface-list be8c7ed3-9f5c-41f8-b596-0ae7f35c773d
+------------+--------------------------------------+--------------------------------------+--------------+-------------------+
| Port State | Port ID | Net ID | IP addresses | MAC Addr |
+------------+--------------------------------------+--------------------------------------+--------------+-------------------+
| ACTIVE | 9c58bd7f-324a-490e-881f-65134ba17915 | 2d5c6949-ae3d-4980-99cf-b17dcb56424a | 10.5.1.30 | fa:16:3e:73:ad:dd |
| ACTIVE | c76d3bf1-9107-4f15-90e2-753c24b219b4 | 2d5c6949-ae3d-4980-99cf-b17dcb56424a | 10.5.1.31 | fa:16:3e:48:a3:4c |
+------------+--------------------------------------+--------------------------------------+--------------+-------------------+
$ nova volume-create 100
$ nova volume-attach be8c7ed3-9f5c-41f8-b596-0ae7f35c773d volume-id
$ juju ssh 1
# Enable the second interface, Edit /etc/network/interfaces.
$ cat /etc/network/interfaces.d/eth1.cfg
# The secondary network interfacs
auto eth1
iface eth1 inet dhcp
$ sudo ifup eth1
# Configuring Cinder:
## Configuration (cinder.conf)
cinder:
block-device: vdd
ubuntu@niedbalski2-bastion:~/specs/1374999$ juju deploy cinder --config ./cinder.conf --to 1
Added charm "cs:trusty/cinder-23" to the environment.
# Configure the other openstack services
$ juju bootstrap -e openstack_env
$ juju add-machine
$ nova interface-attach be8c7ed3-9f5c-41f8-b596-0ae7f35c773d
$ nova interface-list be8c7ed3-9f5c-41f8-b596-0ae7f35c773d
+------------+--------------------------------------+--------------------------------------+--------------+-------------------+
| Port State | Port ID | Net ID | IP addresses | MAC Addr |
+------------+--------------------------------------+--------------------------------------+--------------+-------------------+
| ACTIVE | 9c58bd7f-324a-490e-881f-65134ba17915 | 2d5c6949-ae3d-4980-99cf-b17dcb56424a | 10.5.1.30 | fa:16:3e:73:ad:dd |
| ACTIVE | c76d3bf1-9107-4f15-90e2-753c24b219b4 | 2d5c6949-ae3d-4980-99cf-b17dcb56424a | 10.5.1.31 | fa:16:3e:48:a3:4c |
+------------+--------------------------------------+--------------------------------------+--------------+-------------------+
$ nova volume-create 100
$ nova volume-attach be8c7ed3-9f5c-41f8-b596-0ae7f35c773d volume-id
$ juju ssh 1
# Enable the second interface, Edit /etc/network/interfaces.
$ cat /etc/network/interfaces.d/eth1.cfg
# The secondary network interfacs
auto eth1
iface eth1 inet dhcp
$ sudo ifup eth1
# Configure lvm
$ sudo apt-get install lvm2
$ sudo pvcreate /dev/vdd
$ sudo vgcreate storage /dev/vdd
$ sudo lvcreate -L 25G -n volume-01 storage #this will create /dev/storage/volume-01
Setting up the targets
======================
$ sudo apt-get install tgt
$ sudo tgtadm --lld iscsi --op new --mode target --tid 1 --targetname iqn.2015-05.com.niedbalski:storage
#Attach a logical unit ( LUN )
$ sudo tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 --backing-store /dev/storage/volume-01
# Make the setup persistent across reboots
$ sudo tgt-admin --dump > /etc/tgt/conf.d/my-targets.conf
$ cat /etc/tgt/conf.d/my-targets.conf
default-driver iscsi
<target iqn.201505.com.niedbalski:storage>
backing-store /dev/virtstore/volume-01
</target>
$ sudo restart tgt
# Verify that LUN 1 exists
$ sudo tgtadm --mode target --op show
Target 1: iqn.201505.com.niedbalski:storage
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
SWP: No
Thin-provisioning: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 26844 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
SWP: No
Thin-provisioning: No
Backing store type: rdwr
Backing store path: /dev/virtstore/volume-01
Backing store flags:
Account information:
ACL information:
ALL
# Now setup another machine as the iscsi initiator
$ juju add-machine
$ juju ssh 2
$ sudo apt-get install open-iscsi open-iscsi-utils multipath-tools
# Start the iscsi discovery with both ips
$ sudo iscsiadm -m discovery -t sendtargets -p 10.5.1.30
$ sudo iscsiadm -m discovery -t sendtargets -p 10.5.1.31
# At this point you should login into the target
$ sudo iscsiadm -m node -T iqn.201505.com.niedbalski:storage -p 10.5.1.30 --login
Logging in to [iface: default, target: iqn.201505.com.niedbalski:storage, portal: 10.5.1.30,3260] (multiple)
Login to [iface: default, target: iqn.201505.com.niedbalski:storage, portal: 10.5.1.30,3260] successful.
$ sudo iscsiadm -m node -T iqn.201505.com.niedbalski:storage -p 10.5.1.31 --login
sudo: unable to resolve host juju-1374999-machine-2
Logging in to [iface: default, target: iqn.201505.com.niedbalski:storage, portal: 10.5.1.31,3260] (multiple)
Login to [iface: default, target: iqn.201505.com.niedbalski:storage, portal: 10.5.1.31,3260] successful.
# And finally you should validate that multipath is working correctly.
$ sudo multipath -ll
33000000100000001 dm-0 IET,VIRTUAL-DISK
size=25G features='0' hwhandler='0' wp=rw
|-+ policy='round-robin 0' prio=1 status=active
| - 3:0:0:1 sdb 8:16 active ready running
-+- policy='round-robin 0' prio=1 status=enabled
- 2:0:0:1 sda 8:0 active ready running
Multipath has detected a redundant path for sdb and sda and created a device which i could use.
Next step is to configure cinder to use this ISCI backend.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.