ZStack平台连接iSCSI存储构建云计算服务
目前中国大陆的云计算服务解决方案供应商的软件产品或方案几乎都是在开源产品OpenStack做的换皮式包装,这就继承了OpenStack的天生缺陷,但供应商的做法是进行软件和硬件的绑定,进行定制化维保,这虽然一定解决了“要不要随着新版本升级”的问题,但并没有从根本上解决OpenStack的产品稳定性与安全性问题。这类典型供应商有华为、中兴、深信服等,他们的商业营销噱头是“提供超融合服务”或者“提供超融合解决方案”。
另一类云计算服务供应商侧重于提供基于OpenStack的本土化服务,绝大部分最终沦为了人力资源外包服务项目,对承接的维保项目进行驻点维护。目前在这方面做得比较受认可、且被央企收购的产品是易捷行云的EasyStack,还有红帽公司二次封装的Red_Hat_Enterprise_Linux_OpenStack_Platform,这二者都提供了商业收费的技术支持服务,但使用和维护这类产品依旧存在较大技术成本。
国大陆的云计算服务解决方案市场上还有一类侧重于产品技术推进的供应商,他们把云计算服务的软件体系封装了成稳定产品,提供普惠性的产品级的销售服务和售后服务,典型的厂商是ZStack。尽管ZStack一再宣称并非基于OpenStack深度定制,但ZStack的总设计师张鑫曾长期服务于CloudStack项目和Ctrix的虚拟化项目,而这二者又和OpenStack的关系讳莫如深,难免在技术方向和设计思路上有点儿藕断丝连。所幸ZStack也是一个开源项目,从目前产品的主要功能上看,有可能借鉴了AWS的思路,新版本中重点强调了它的计费服务功能。
以下展示如何通过搭建ZStack云计算平台连接iSCSI存储服务后构建成一个私有云环境的云计算服务平台。
首先搭建好一个可以对外提供存储服务的iSCSI存储服务器,能提供iSCSI服务的软件产品有很多,这里选择的是CentOS7系统中提供的iSCSI服务程序 scsi-target-utils。
其次,准备一台配置不低于4核心CPU、8GB内存、50GB硬盘的主机,用于部署ZStack平台。在对ZStack平台完成资源初始化后即可对外提供虚拟计算机服务,也就是阿里云或腾讯云针对个人提供的云主机服务。
以下是实验操作过程:
配置iSCSI存储服务器
CentOS71908安装配置iSCSI服务端
先执行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 6
查看防火墙与SELinux状态:
[ ~]$ su - root
Password:
Last login: Sun Jun 7 16:08:45 CST 2020 on pts/0
[ ~]# ls -F
anaconda-ks.cfg initial-setup-ks.cfg
[ ~]# 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)
[ ~]# sestatus
SELinux status: disabled
[ ~]#
[ ~]# 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
[ ~]# mkdir -p /root/iscsishare
[ ~]# 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 k
Transaction Summary
Install 1 Package
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
Installed:
tree.x86_64 0:1.6.0-10.el7
Complete!
[ ~]# tree /root/
/root/
├── anaconda-ks.cfg
├── initial-setup-ks.cfg
└── iscsishare
1 directory, 2 files
[ ~]# 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!
[ ~]# 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
[ ~]#
添加一块新硬盘到服务器
[ ~]$ su - root
Password:
Last login: Sun Jun 7 17:07:22 CST 2020 on pts/0
[ ~]# 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
[ ~]# 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
[ ~]# 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
[ ~]# 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
[ ~]#
在sdb设备上创建分区
[ ~]# 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
[ ~]# 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.
[ ~]# 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
[ ~]#
[ ~]# 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
[ ~]#
[ ~]# 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
[ ~]# 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
[ ~]# 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
[ ~]#
[ ~]# 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
[ ~]# cp /etc/tgt/targets.conf{,.original}
[ ~]# ls -F /etc/tgt/
conf.d/ targets.conf targets.conf.original tgtd.conf
[ ~]# 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
[ ~]# 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>
[ ~]# systemctl status tgtd
● tgtd.service - tgtd iSCSI target daemon
Loaded: loaded (/usr/lib/systemd/system/tgtd.service; disabled; vendor preset: disabled)
Active: inactive (dead)
[ ~]#
[ ~]# systemctl start tgtd
[ ~]# 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.
[ ~]# systemctl enable tgtd
Created symlink from /etc/systemd/system/multi-user.target.wants/tgtd.service to /usr/lib/systemd/system/tgtd.service.
[ ~]# 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
[ ~]#
[ ~]# partprobe
[ ~]# systemctl restart tgtd
[ ~]# 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.
[ ~]# 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
[ ~]# 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
[ ~]#
安装部署ZStack云计算服务管理平台: