一.在控制节点安装服务:
yum install samba samba-client samba-swat
启动samba服务:
[[email protected] system(keystone_admin)]# service smb restart
Redirecting to /bin/systemctl restart smb.service
配置samba为远程可访问:
#mkdir /var/smb
#cd /etc/samba/
#cp smb.conf smb.conf.bak
在smb.conf最后添加:
[share] path=/var/smb available = yes browseable = yes public = yes writable = yes
创建账户:
设置root密码:
[[email protected] samba(keystone_admin)]# smbpasswd -a root
New SMB password:
Retype new SMB password:
Added user root.
[[email protected] samba(keystone_admin)]#
Root的密码是lxp
试一下:
在windows输入:
\\192.168.15.180\
就直接出现:
竟然神奇的登录了,而不是/var/smb目录
在这里的/share/文件夹中创建个hello,则在服务器端出现同样的文件
说明smbfs服务安装成功,可以登录。
在计算节点挂载:
#mount -t cifs -o username=root,password=lxp //192.168.15.180/share /var/smb
[[email protected] smb]# mount |grep cifs
//192.168.15.180/share on /var/smb type cifs (rw,relatime,vers=1.0,cache=strict,username=root,domain=CONTROLLER-RDO,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.15.180,unix,posixpaths,serverino,acl,rsize=1048576,wsize=65536,actimeo=1)
OK,挂载成功
二.在计算节点--将cinder-volume后端配置为smbfs
Cinder.conf:
[DEFAULT] enabled_backends=smbfs [smbfs] volume_driver=cinder.volume.drivers.smbfs.SmbfsDriver smbfs_mount_options = username=root,password=lxp smbfs_mount_point_base = /var/smb smbfs_shares_config = /etc/cinder/smbfs_shares
/etc/cinder/smbfs_shares:
//192.168.15.180/share
注意:这里的share要和/etc/samba/smb.conf中添加的字段名一致!
重启cinder-volume服务
创建个smbfs的云硬盘:
这里多出来一个文件:
[[email protected] 25696c3e9a8dc1b584b6768a72d7ffb8]# pwd
/var/smb/25696c3e9a8dc1b584b6768a72d7ffb8
[[email protected] 25696c3e9a8dc1b584b6768a72d7ffb8]# ls
hello.txt volume-b978989d-dd51-432f-8b67-04b549a76557
版权声明:本文为博主原创文章,未经博主允许不得转载。