Joshua_Pu

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

6. 接下来要挂载存储了, oVirt里面存储分三块:

Data Domain

存储运行的虚拟机, 虚拟机的硬盘存在这个数据域里

ISO Domain

存放 ISO 镜像

Export Domain

用于虚拟机的导出

 

 

 

 

 

其中, Data 域最最重要, 直接影响到运行中的虚拟机的高可用性, 所以这个用 GlusterFS 来做存储, 其他的都可以用 NFS

# 在 oVirt 中使用 gluster 有两种方式, 一种是 ovirt 自己管理 gluster 主机, 另外一种是直接使用外部分享过来的 gluster volume

# 为了统一管理各个平台的存储, 这里使用外部分享的方式, 也就是使用我们之前就做好了的 gluster1.joshua.com:/ovirt

# 首先, 对于 ovirt 使用的卷, 在 gluster 的 Volume 参数里,要将用户更改为 36:36, 不然会因为权限问题导致无法使用

$ gluster volume set ovirt storage.owner-uid=36

$ gluster volume set ovirt storage.owner-gid=36

 

# 然后, 在 host1 和 host2 上写两条短域名的解析, 个人猜测系统访问 glsuter1 的时候不用 gluster1.joshua.com 而是直接使用了 gluster1 这个域名, 然后被 search domain 默认加上了 ovirt.joshua.com, 于是就解析不到了

$ cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.1.201 gluster1

192.168.1.202 gluster2

192.168.1.203 gluster3

# 接着在三个节点上都要看看这三个包有没有安装

$ ansible glsuterfs -m yum -a "name=glusterfs"

$ ansible glsuterfs -m yum -a "name=glusterfs-fuse"

$ ansible glsuterfs -m yum -a "name=glusterfs-cli"

 

# 可以测试一下是否能挂载

$ mount -t glusterfs gluster1.joshua.com:/ovirt /mnt

$ df -hT

$ umount /mnt

 

# 然后去添加 data Domain

# 额外, 挂载参数可以加上:

# backup-volfile-servers=gluster2.joshua.com:gluster3.joshua.com - 高可用

# acl - setfacl支持     _netdev - 对RHEL7以下的系统的兼容

Manage Domain 
Data Center 
Domain Function 
Storage Type 
Host to Use 
Joshua-DC (V4) 
Data (Master) 
Glu sterF S 
host2.ovirt.joshua.com 
Name 
Description 
Comment 
data-gluster 
For data integrity make sure that the server is configured with Quorum (both client and server Quorum) 
Use managed gluster 
volume 
Path 
VFS Type 
Mount Options 
Advanced Parameters 
glusterlJoshua.com:/ovid 
glusteffs 
OK 
Cancel

 

# 可以看到 data-gluster 已经挂载到主机上了

Networks Storage Virtual Machines Irnport Domain Manage Domain Remove System All Colapse A" System e Data Centers Joshua-DC Storage O data-gluster -SJletworks Templates V O Clusters 0 cluo Hosts O host2.ovi1t.joshu VMS a External Providers O ovirt-image-repository Errata Active User Sessions Hosts New Dornain General Size. Available: Used: Allocated: Templates Domain Name data-gluster Data Center Comment Virtual Machines 34 34 < 1 GB < 1 GB 0% Domain Type Data (Master) Templates Storage Type GiusterFS Disk Snapshots Format Leases Cross Data Center Status Active Remote Data Sync Setup Total Space 34 Permissions Free Space 34 GB Disks Disk Profiles Events Description Events Over Allocation Ratio: 300kmarks ast Message: Warning Low Space Indicator: Critical Space Action Blocker: Dec 6, 2017 10:12:46 AM User admin@intemal-authz logged in.

 

 

7. 用 NFS 的方式添加 ISO 以及 Export Domain

# 官网参考: https://www.ovirt.org/documentation/admin-guide/chap-Storage/

# 我们这里单独建一个 VG 给 ISO 以及 Export 用

$ lsblk

NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT

sda               8:0    0   40G  0 disk

├─sda1            8:1    0    1G  0 part /boot

└─sda2            8:2    0   39G  0 part

  └─vg_sys-root 253:0    0   39G  0 lvm  /

sdb               8:16   0   20G  0 disk

sdc               8:32   0   40G  0 disk

sdd               8:48   0   60G  0 disk

sr0              11:0    1  792M  0 rom

$ for i in sd{b,c,d}; do pvcreate /dev/$i; done

  Physical volume "/dev/sdb" successfully created.

  Physical volume "/dev/sdc" successfully created.

  Physical volume "/dev/sdd" successfully created.

$ vgcreate vg_ovirt /dev/sdb /dev/sdc /dev/sdd

$ vgdisplay

  Free  PE / Size       30717 / <119.99 GiB

$ lvcreate -l +30717 -n lv_ovirt vg_ovirt

$ lvs

  LV       VG       Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert

  lv_ovirt vg_ovirt -wi-a----- <119.99g 

$ echo "/dev/vg_ovirt/lv_ovirt /exports xfs defaults 0 0" >> /etc/fstab

$ mkfs.xfs -i size=512 /dev/vg_ovirt/lv_ovirt

$ mount -a

 

# 接下来是 NFS 共享, 官网上有, 偷个懒直接 ctrl c 下来

 

$ yum -y install nfs-utils

$ systemctl daemon-reload && systemctl enable rpcbind.service && systemctl enable nfs-server.service

$ systemctl start rpcbind.service nfs-server.service

$ mkdir /exports/{export,iso}

$ vim /etc/exports

/exports/iso          *(rw,async,no_root_squash)

/exports/export    *(rw,async,no_root_squash)

$ exportfs -r

$ systemctl reload nfs-server.service

$ chown -Rv 36:36 /exports/

$ chmod -Rv 0755 /exports/

 

# 最后, 去 GUI 添加

Manage Domain 
Data Center 
Domain Function 
Storage Type 
Host to Use 
Export Path 
Joshua-DC (V4) 
ISO 
NFS 
host2.ovirt.joshua.com 
ovi1tjoshua.com:Jexpons/iso 
Name 
Description 
Comment 
iso-nfs 
Custom Connection Parameters 
Advanced Parameters

 

New Domain 
Data Center 
Domain Function 
Storage Type 
Host to Use 
Export Path 
Joshua-DC (V4) 
Export 
hostl.ovirt.joshua.com 
Name 
Description 
Comment 
export-nfs 
ovift_joshua.conujexpons/export 
E g.: myserver.mydomain.com:/my/local/path 
Custom Connection Parameters 
Advanced Parameters

 

至此, oVirt 的部署就完成了

posted on 2017-12-07 11:00  Joshua_Pu  阅读(1347)  评论(0编辑  收藏  举报