ZStack平臺鏈接iSCSI存儲構建雲計算服務

OpenStack是雲計算服務解決方案中發展較早的一個體系性產品,但它的組件多而複雜,個組件間的關係藕斷絲連,整個平臺的搭建部署、使用維護均存在較高的技術門檻,不是通常的非技術性組織可以駕馭的了的。榆次類似的產品還有Ctrix貢獻給Apache的CloudStack。兩者都可以提供較好的雲計算管理服務,甚至在某些方面能夠和亞馬遜公司的商業產品AWS一較高下,但較高水準的技術門檻使得絕大部分非專業人士望而卻步。此外,因爲OpenStack並不是一個完整的軟件產品,這致使它在產品產品穩定性方面較差,且不能實現新舊版本間的平滑升級,並不具有產品級的軟件使用價值。
目前中國大陸的雲計算服務解決方案供應商的軟件產品或方案几乎都是在開源產品OpenStack作的換皮式包裝,這就繼承了OpenStack的天生缺陷,但供應商的作法是進行軟件和硬件的綁定,進行定製化維保,這雖然必定解決了「要不要隨着新版本升級」的問題,但並無從根本上解決OpenStack的產品穩定性與安全性問題。這類典型供應商有華爲、中興、深信服等,他們的商業營銷噱頭是「提供超融合服務」或者「提供超融合解決方案」。
另外一類雲計算服務供應商側重於提供基於OpenStack的本土化服務,絕大部分最終淪爲了人力資源外包服務項目,對承接的維保項目進行駐點維護。目前在這方面作得比較受承認、且被央企收購的產品是易捷行雲的EasyStack,還有紅帽公司二次封裝的Red_Hat_Enterprise_Linux_OpenStack_Platform,這兩者都提供了商業收費的技術支持服務,但使用和維護這類產品依舊存在較大技術成本。
國大陸的雲計算服務解決方案市場上還有一類側重於產品技術推動的供應商,他們把雲計算服務的軟件體系封裝了成穩定產品,提供普惠性的產品級的銷售服務和售後服務,典型的廠商是ZStack。儘管ZStack一再宣稱並不是基於OpenStack深度定製,但ZStack的總設計師張鑫曾長期服務於CloudStack項目和Ctrix的虛擬化項目,而這兩者又和OpenStack的關係諱莫如深,不免在技術方向和設計思路上有點兒藕斷絲連。所幸ZStack也是一個開源項目,從目前產品的主要功能上看,有可能借鑑了AWS的思路,新版本中重點強調了它的計費服務功能。node

如下展現如何經過搭建ZStack雲計算平臺鏈接iSCSI存儲服務後構建成一個私有云環境的雲計算服務平臺。
首先搭建好一個能夠對外提供存儲服務的iSCSI存儲服務器,能提供iSCSI服務的軟件產品有不少,這裏選擇的是CentOS7系統中提供的iSCSI服務程序 scsi-target-utils。
其次,準備一臺配置不低於4核心CPU、8GB內存、50GB硬盤的主機,用於部署ZStack平臺。在對ZStack平臺完成資源初始化後便可對外提供虛擬計算機服務,也就是阿里雲或騰訊雲針對我的提供的雲主機服務。python

如下是實驗操做過程:linux

配置iSCSI存儲服務器
CentOS71908安裝配置iSCSI服務端chrome

先執行OS初始化腳本完成對OS環境的初始化,初始化腳本以下:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.original
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all && yum makecache
yum -y update
yum install -y ntpdate
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
yum localinstall -y google-chrome-stable_current_x86_64.rpm
ntpdate cn.ntp.org.cn
systemctl stop firewalld && systemctl disable firewalld
sed -i 's/^SELINUX=./SELINUX=disabled/' /etc/selinux/config && setenforce 0
wget https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
sed -i 's|^#baseurl=https://download.fedoraproject.org/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel

sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
yum clean all && yum makecache
yum -y update
yum install -y tree
init 6centos

查看防火牆與SELinux狀態:
[googlebigtable@localhost ~]$ su - root
Password:
Last login: Sun Jun 7 16:08:45 CST 2020 on pts/0
[root@localhost ~]# ls -F
anaconda-ks.cfg initial-setup-ks.cfg
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
[root@localhost ~]# sestatus
SELinux status: disabled
[root@localhost ~]#
[root@localhost ~]# yum -y install targetcli
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile安全

  • base: mirrors.aliyun.com
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com
    Package targetcli-2.1.fb49-1.el7.noarch already installed and latest version
    Nothing to do
    [root@localhost ~]# mkdir -p /root/iscsishare
    [root@localhost ~]# yum install -y tree
    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
  • base: mirrors.aliyun.com
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com
    Resolving Dependencies
    --> Running transaction check
    ---> Package tree.x86_64 0:1.6.0-10.el7 will be installed
    --> Finished Dependency Resolution

Dependencies Resolved服務器

=================================================================================================================================================
Package Arch Version Repository Size

Installing:
tree x86_64 1.6.0-10.el7 base 46 kapp

Transaction Summary

Install 1 Packagedom

Total download size: 46 k
Installed size: 87 k
Downloading packages:
tree-1.6.0-10.el7.x86_64.rpm | 46 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : tree-1.6.0-10.el7.x86_64 1/1
Verifying : tree-1.6.0-10.el7.x86_64 1/1 python2.7

Installed:
tree.x86_64 0:1.6.0-10.el7

Complete!
[root@localhost ~]# tree /root/
/root/
├── anaconda-ks.cfg
├── initial-setup-ks.cfg
└── iscsishare

1 directory, 2 files
[root@localhost ~]# yum install -y scsi-target-utils
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile

  • base: mirrors.aliyun.com
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com
    Resolving Dependencies
    --> Running transaction check
    ---> Package scsi-target-utils.x86_64 0:1.0.55-4.el7 will be installed
    --> Processing Dependency: perl(Config::General) for package: scsi-target-utils-1.0.55-4.el7.x86_64
    --> Running transaction check
    ---> Package perl-Config-General.noarch 0:2.61-1.el7 will be installed
    --> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================
Package Arch Version Repository Size

Installing:
scsi-target-utils x86_64 1.0.55-4.el7 epel 209 k
Installing for dependencies:
perl-Config-General noarch 2.61-1.el7 epel 75 k

Transaction Summary

Install 1 Package (+1 Dependent package)

Total download size: 283 k
Installed size: 697 k
Downloading packages:
(1/2): perl-Config-General-2.61-1.el7.noarch.rpm | 75 kB 00:00:01
(2/2): scsi-target-utils-1.0.55-4.el7.x86_64.rpm | 209 kB 00:00:01

Total 241 kB/s | 283 kB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : perl-Config-General-2.61-1.el7.noarch 1/2
Installing : scsi-target-utils-1.0.55-4.el7.x86_64 2/2
Verifying : perl-Config-General-2.61-1.el7.noarch 1/2
Verifying : scsi-target-utils-1.0.55-4.el7.x86_64 2/2

Installed:
scsi-target-utils.x86_64 0:1.0.55-4.el7

Dependency Installed:
perl-Config-General.noarch 0:2.61-1.el7

Complete!
[root@localhost ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00013359

Device Boot Start End Blocks Id System
/dev/sda1 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM
Disk /dev/mapper/centos-root: 18.2 GB, 18249416704 bytes, 35643392 sectors
Units = sectors of 1
512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@localhost ~]#
添加一塊新硬盤到服務器

[googlebigtable@localhost ~]$ su - root
Password:
Last login: Sun Jun 7 17:07:22 CST 2020 on pts/0
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 10G 0 disk
sr0 11:0 1 1024M 0 rom
[root@localhost ~]# fdisk -l /dev/sda

Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00013359

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM
[root@localhost ~]# fdisk -l

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00013359

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM

Disk /dev/mapper/centos-root: 18.2 GB, 18249416704 bytes, 35643392 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 13M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/mapper/centos-root 17G 5.8G 12G 35% /
/dev/sda1 1014M 237M 778M 24% /boot
tmpfs 378M 24K 378M 1% /run/user/1000
[root@localhost ~]#
在sdb設備上建立分區
[root@localhost ~]# fdisk -l

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00013359

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM

Disk /dev/mapper/centos-root: 18.2 GB, 18249416704 bytes, 35643392 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@localhost ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x4360a56d.

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): o
Building a new DOS disklabel with disk identifier 0x3c8e6b8d.

Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-20971519, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): 2500m
Partition 1 of type Linux and of size 226.5 KiB is set

Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p):
Using default response p
Partition number (2-4, default 2):
First sector (2501-20971519, default 4096):
Using default value 4096
Last sector, +sectors or +size{K,M,G} (4096-20971519, default 20971519):
Using default value 20971519
Partition 2 of type Linux and of size 10 GiB is set

Command (m for help): p

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x3c8e6b8d

Device Boot Start End Blocks Id System
/dev/sdb1 2048 2500 226+ 83 Linux
/dev/sdb2 4096 20971519 10483712 83 Linux

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# fdisk -l

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x3c8e6b8d

Device Boot Start End Blocks Id System
/dev/sdb1 2048 2500 226+ 83 Linux
/dev/sdb2 4096 20971519 10483712 83 Linux

Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00013359

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM

Disk /dev/mapper/centos-root: 18.2 GB, 18249416704 bytes, 35643392 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@localhost ~]#
[root@localhost ~]# fdisk -l /dev/sdb

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x3c8e6b8d

Device Boot Start End Blocks Id System
/dev/sdb1 2048 2500 226+ 83 Linux
/dev/sdb2 4096 20971519 10483712 83 Linux
[root@localhost ~]#
[root@localhost ~]# rpm -qa | grep target
selinux-policy-targeted-3.13.1-266.el7.noarch
targetcli-2.1.fb49-1.el7.noarch
scsi-target-utils-1.0.55-4.el7.x86_64
[root@localhost ~]# rpm -ql targetcli-2.1.fb49-1.el7.noarch
/etc/target
/etc/target/backup
/usr/bin/targetcli
/usr/lib/python2.7/site-packages/targetcli
/usr/lib/python2.7/site-packages/targetcli/init.py
/usr/lib/python2.7/site-packages/targetcli/init.pyc
/usr/lib/python2.7/site-packages/targetcli/init.pyo
/usr/lib/python2.7/site-packages/targetcli/ui_backstore.py
/usr/lib/python2.7/site-packages/targetcli/ui_backstore.pyc
/usr/lib/python2.7/site-packages/targetcli/ui_backstore.pyo
/usr/lib/python2.7/site-packages/targetcli/ui_node.py
/usr/lib/python2.7/site-packages/targetcli/ui_node.pyc
/usr/lib/python2.7/site-packages/targetcli/ui_node.pyo
/usr/lib/python2.7/site-packages/targetcli/ui_root.py
/usr/lib/python2.7/site-packages/targetcli/ui_root.pyc
/usr/lib/python2.7/site-packages/targetcli/ui_root.pyo
/usr/lib/python2.7/site-packages/targetcli/ui_target.py
/usr/lib/python2.7/site-packages/targetcli/ui_target.pyc
/usr/lib/python2.7/site-packages/targetcli/ui_target.pyo
/usr/lib/python2.7/site-packages/targetcli/version.py
/usr/lib/python2.7/site-packages/targetcli/version.pyc
/usr/lib/python2.7/site-packages/targetcli/version.pyo
/usr/lib/python2.7/site-packages/targetcli_fb-2.1.fb49-py2.7.egg-info
/usr/lib/python2.7/site-packages/targetcli_fb-2.1.fb49-py2.7.egg-info/PKG-INFO
/usr/lib/python2.7/site-packages/targetcli_fb-2.1.fb49-py2.7.egg-info/SOURCES.txt
/usr/lib/python2.7/site-packages/targetcli_fb-2.1.fb49-py2.7.egg-info/dependency_links.txt
/usr/lib/python2.7/site-packages/targetcli_fb-2.1.fb49-py2.7.egg-info/top_level.txt
/usr/share/doc/targetcli-2.1.fb49
/usr/share/doc/targetcli-2.1.fb49/COPYING
/usr/share/doc/targetcli-2.1.fb49/README.md
/usr/share/man/man8/targetcli.8.gz
[root@localhost ~]# rpm -ql scsi-target-utils-1.0.55-4.el7.x86_64
/etc/sysconfig/tgtd
/etc/tgt/conf.d/sample.conf
/etc/tgt/targets.conf
/etc/tgt/tgtd.conf
/usr/lib/systemd/system/tgtd.service
/usr/sbin/tgt-admin
/usr/sbin/tgt-setup-lun
/usr/sbin/tgtadm
/usr/sbin/tgtd
/usr/sbin/tgtimg
/usr/share/doc/scsi-target-utils-1.0.55
/usr/share/doc/scsi-target-utils-1.0.55/README
/usr/share/doc/scsi-target-utils-1.0.55/README.iscsi
/usr/share/doc/scsi-target-utils-1.0.55/README.iser
/usr/share/doc/scsi-target-utils-1.0.55/README.lu_configuration
/usr/share/doc/scsi-target-utils-1.0.55/README.mmc
/usr/share/doc/scsi-target-utils-1.0.55/README.ssc
/usr/share/man/man5/targets.conf.5.gz
/usr/share/man/man8/tgt-admin.8.gz
/usr/share/man/man8/tgt-setup-lun.8.gz
/usr/share/man/man8/tgtadm.8.gz
[root@localhost ~]#
[root@localhost ~]# cat -n /etc/tgt/targets.conf
1 # This is a sample config file for tgt-admin.
2 #
3 # The "#" symbol disables the processing of a line.
4
5 # Set the driver. If not specified, defaults to "iscsi".
6 default-driver iscsi
7
8 # Set iSNS parameters, if needed
9 #iSNSServerIP 192.168.111.222
10 #iSNSServerPort 3205
11 #iSNSAccessControl On
12 #iSNS On
13
14 # Continue if tgtadm exits with non-zero code (equivalent of
15 # --ignore-errors command line option)
16 #ignore-errors yes
17
[root@localhost ~]# cp /etc/tgt/targets.conf{,.original}
[root@localhost ~]# ls -F /etc/tgt/
conf.d/ targets.conf targets.conf.original tgtd.conf
[root@localhost ~]# gedit /etc/tgt/targets.conf

(gedit:3637): WARNING : 17:42:45.454: Set document metadata failed: Setting attribute metadata::gedit-spell-language not supported

(gedit:3637): WARNING : 17:42:45.454: Set document metadata failed: Setting attribute metadata::gedit-encoding not supported

(gedit:3637): WARNING : 17:42:47.990: Set document metadata failed: Setting attribute metadata::gedit-position not supported
[root@localhost ~]# cat -n /etc/tgt/targets.conf
1 # This is a sample config file for tgt-admin.
2 #
3 # The "#" symbol disables the processing of a line.
4
5 # Set the driver. If not specified, defaults to "iscsi".
6 default-driver iscsi
7
8 # Set iSNS parameters, if needed
9 #iSNSServerIP 192.168.111.222
10 #iSNSServerPort 3205
11 #iSNSAccessControl On
12 #iSNS On
13
14 # Continue if tgtadm exits with non-zero code (equivalent of
15 # --ignore-errors command line option)
16 #ignore-errors yes
17
18 <target iqn.2020-06.com.zstack:iscsitest>
19 backing-store /dev/sdb2
20 initiator-address 192.168.207.0/24
21 write-cache off
22 </target>
[root@localhost ~]# systemctl status tgtd
● tgtd.service - tgtd iSCSI target daemon
Loaded: loaded (/usr/lib/systemd/system/tgtd.service; disabled; vendor preset: disabled)
Active: inactive (dead)
[root@localhost ~]#
[root@localhost ~]# systemctl start tgtd
[root@localhost ~]# systemctl status tgtd
● tgtd.service - tgtd iSCSI target daemon
Loaded: loaded (/usr/lib/systemd/system/tgtd.service; disabled; vendor preset: disabled)
Active: active (running) since Sun 2020-06-07 17:45:21 CST; 3s ago
Process: 3746 ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v ready (code=exited, status=0/SUCCESS)
Process: 3738 ExecStartPost=/usr/sbin/tgt-admin -e -c $TGTD_CONFIG (code=exited, status=0/SUCCESS)
Process: 3737 ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v offline (code=exited, status=0/SUCCESS)
Process: 3731 ExecStartPost=/bin/sleep 5 (code=exited, status=0/SUCCESS)
Main PID: 3730 (tgtd)
Tasks: 1
CGroup: /system.slice/tgtd.service
└─3730 /usr/sbin/tgtd -f

Jun 07 17:45:16 localhost.localdomain systemd[1]: Starting tgtd iSCSI target daemon...
Jun 07 17:45:16 localhost.localdomain tgtd[3730]: tgtd: iser_ib_init(3436) Failed to initialize RDMA; load kernel modules?
Jun 07 17:45:16 localhost.localdomain tgtd[3730]: tgtd: work_timer_start(146) use timer_fd based scheduler
Jun 07 17:45:16 localhost.localdomain tgtd[3730]: tgtd: bs_init_signalfd(267) could not open backing-store module directory /usr/lib64/tgt/backing-store
Jun 07 17:45:16 localhost.localdomain tgtd[3730]: tgtd: bs_init(386) use signalfd notification
Jun 07 17:45:21 localhost.localdomain systemd[1]: Started tgtd iSCSI target daemon.
[root@localhost ~]# systemctl enable tgtd
Created symlink from /etc/systemd/system/multi-user.target.wants/tgtd.service to /usr/lib/systemd/system/tgtd.service.
[root@localhost ~]# netstat -tlunp | grep tgt
tcp 0 0 0.0.0.0:3260 0.0.0.0: LISTEN 3730/tgtd
tcp6 0 0 :::3260 :::
LISTEN 3730/tgtd
[root@localhost ~]#
[root@localhost ~]# partprobe
[root@localhost ~]# systemctl restart tgtd
[root@localhost ~]# systemctl status tgtd
● tgtd.service - tgtd iSCSI target daemon
Loaded: loaded (/usr/lib/systemd/system/tgtd.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2020-06-07 18:18:37 CST; 5s ago
Process: 4468 ExecStop=/usr/sbin/tgtadm --op delete --mode system (code=exited, status=0/SUCCESS)
Process: 4460 ExecStop=/usr/sbin/tgt-admin --update ALL -c /dev/null (code=exited, status=0/SUCCESS)
Process: 4457 ExecStop=/usr/sbin/tgtadm --op update --mode sys --name State -v offline (code=exited, status=0/SUCCESS)
Process: 4503 ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v ready (code=exited, status=0/SUCCESS)
Process: 4475 ExecStartPost=/usr/sbin/tgt-admin -e -c $TGTD_CONFIG (code=exited, status=0/SUCCESS)
Process: 4473 ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v offline (code=exited, status=0/SUCCESS)
Process: 4471 ExecStartPost=/bin/sleep 5 (code=exited, status=0/SUCCESS)
Main PID: 4470 (tgtd)
Tasks: 17
CGroup: /system.slice/tgtd.service
└─4470 /usr/sbin/tgtd -f

Jun 07 18:18:32 localhost.localdomain systemd[1]: Starting tgtd iSCSI target daemon...
Jun 07 18:18:32 localhost.localdomain tgtd[4470]: tgtd: iser_ib_init(3436) Failed to initialize RDMA; load kernel modules?
Jun 07 18:18:32 localhost.localdomain tgtd[4470]: tgtd: work_timer_start(146) use timer_fd based scheduler
Jun 07 18:18:32 localhost.localdomain tgtd[4470]: tgtd: bs_init_signalfd(267) could not open backing-store module directory /usr/lib64/tgt/backing-store
Jun 07 18:18:32 localhost.localdomain tgtd[4470]: tgtd: bs_init(386) use signalfd notification
Jun 07 18:18:37 localhost.localdomain tgtd[4470]: tgtd: device_mgmt(246) sz:15 params:path=/dev/sdb2
Jun 07 18:18:37 localhost.localdomain tgtd[4470]: tgtd: bs_thread_open(408) 16
Jun 07 18:18:37 localhost.localdomain systemd[1]: Started tgtd iSCSI target daemon.
[root@localhost ~]# netstat -tlunp | grep tgt
tcp 0 0 0.0.0.0:3260 0.0.0.0: LISTEN 4470/tgtd
tcp6 0 0 :::3260 :::
LISTEN 4470/tgtd
[root@localhost ~]# tgtadm --mode target --op show
Target 1: iqn.2020-06.com.zstack:iscsitest
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: 10735 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/sdb2
Backing store flags:
Account information:
ACL information:
192.168.207.0/24
[root@localhost ~]#

安裝部署ZStack雲計算服務管理平臺:
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務
ZStack平臺鏈接iSCSI存儲構建雲計算服務

ZStack平臺鏈接iSCSI存儲構建雲計算服務

相關文章
相關標籤/搜索