Hồi trước tôi review XenServer lần 2 – Xen-appliance có paid support từ Citrix, với capability hữu ích, kể cả remote management qua XenCenter. Handsome product, corporate price tag cho người chịu được.
Vấn đề với XenServer: không cho thêm local storage repositories (local disk) qua XenCenter. Đúng, bạn không nên giữ VM trên local disk (redundancy, performance), nhưng bạn có thể muốn, tại sao bị giới hạn? Hãy unlimit.
Nhiệm vụ
Muốn cấu hình thành công local storage repository trên local disk, chia sẻ resource với server, bao gồm main storage LVM và small standard share cho root. Làm sao?
Có 2-3 cách. Sẽ nhắc tất cả. Lưu ý: tất cả solutions hơi ugly, complex, yêu cầu command line. Bạn có thể không thích, thích KVM/Xen setup với full local storage control. Vẫn nếu quan tâm.
Option 1: Mount local directory
Simplest task. Nếu có local directory chứa ISO, ví dụ /vm/iso, populated qua scp, muốn repository visible trong XenCenter. Nhưng XenCenter KHÔNG cho thêm local storage qua GUI.
Chạy lệnh:
xe sr-create name-label=<NAME> type=iso device-config:legacy_mode=true device-config:location=<ISODIR> content-type=iso
Với field generic:
xe sr-create name-label=Local type=iso device-config:legacy_mode=true device-config:location=/vm/iso content-type=iso
Nếu thành công, trả về UUID cho storage repository tạo. Có thể lặp lệnh bao nhiêu lần, mỗi lần tạo repository mới, hiện trong GUI như entry riêng.
xe sr-create name-label=Local type=iso device-config:legacy_mode=true device-config:location=/vm/iso content-type=iso 3476e496-185f-9eba-0f89-bb822db31ebd
Chạy từ local shell sau SSH:
Sau đó cài VM, sẽ thấy Local listed. Chú ý hai entry identical nếu chạy lệnh hai lần, có thể confuse. Không chắc là bug, nhưng works như vậy.
Option 2: Làm việc với LVM (không khuyến nghị)
Setup khó, phức tạp hơn. Làm việc với LVM storage spanning local disks, chứa VM config và disk.
Muốn tạo LVM mới trên disk, add as storage cho OS image hoặc gì cần. Dùng LVM commands. May mắn LVM flexible, cho phép thay đổi drastic on-the-fly: resize, allocation, add/remove volume groups/volumes, không reboot.
Procedure chi tiết trong post Citrix forums; details ở More Reading. Tóm tắt: tìm unallocated disk space, tạo volume group mới. Hoặc resize existing, tạo mới từ freed space. Tạo volume, format, mount để dùng.
Screenshots ugly activity:
Option 3: Existing default ISO dir
Có thể dùng /opt/xensource/packages/iso sẵn có cho ISO image, dù nhỏ, chỉ chứa vài file. Hack: symbolic link directory này đến disk/partition khác muốn lưu image.
Thêm disk mới gần như identical bước 1. Add disk, ensure detected, tạo partition table, format. Mount trên mount point. Tạo storage repository mới:
xe sr-create type=iso device-config:legacy_mode=true device-config:location=/path/to/mntpoint
Refresh list repository:
xe sr-scan uuid=<SR UUID>
Xong phần này.
Tài liệu tham khảo thêm
- https://forums.citrix.com/message.jspa?messageID=1399366
- https://forums.citrix.com/thread.jspa?threadID=257054
- Unrelated – dùng Linux Samba sharing fake Windows CIFS. Post bằng Spanish, nhưng giải thích và hình tự giải thích. Không cần dịch. Bonus cho bạn.
Kết luận
Thêm storage repository cách này có vẻ awfully complex, nhất là nếu dùng KVM storage management hoặc chạy Xen command line trước. LVM thêm operational flexibility, nhưng làm administration kém accessible cho hầu hết user. Thêm nữa, lack of filesystem transparency tạo vấn đề khi cần custom setup đặc biệt. Có loại repository mới? Standard Linux: mount filesystem mới ở đâu đó, xong, problem solved. Hệ thống dưới tự lo protocol/driver. Ở đây, distinction với XenServer biến simple task thành big project.
Local storage không bao giờ tốt cho giữ VM, vì backup, recovery, accessibility across datacenter cumbersome, cũng như capacity/performance penalty khi scale out, nhưng highlight cách XenServer thiết kế. Với tutorial này, mission có thể simpler. Ít nhất học remote access, command line, chạm nhẹ LVM management. Should come handy.
Nếu có idea/request khác, ping me.
Cheers.