เมื่อสักพักก่อน ผมให้ second review ของ XenServer Xen-appliance พร้อม paid support จาก Citrix ซึ่งมาพร้อม capabilities ที่ useful และ handy บางอย่าง รวมถึง remote management ผ่าน XenCenter ทั้งหมดเป็น handsome product (ผลิตภัณฑ์ที่ดูดี/สมบูรณ์) พร้อม corporate price tag สำหรับผู้ที่จ่ายได้
หนึ่งใน problems (so to speak) กับ XenServer คือ ไม่ allow (อนุญาต) ให้คุณ add local storage repositories คือ local disk หนึ่งหรือมากกว่า ผ่าน XenCenter ใช่ คุณอาจ not supposed to (ไม่ควร) เก็บ VMs บน local disk ทั้งเพื่อ redundancy และ performance แต่คุณ just might (อาจจะ) อยากทำ ไม่เป็นไร มา unlimit (ปลดล็อกข้อจำกัด) ตัวเอง
งานที่มีอยู่ (Task at hand)
สิ่งที่เราอยาก achieve คือ successful configuration ของ local storage repository บน local disk ของเรา ซึ่ง share เหมือนกัน resources กับ server รวมถึง main storage LVM และ small standard share สำหรับ root จะทำอย่างไร?
มี two or three ways ที่คุณลองได้ ผมจะ mention (กล่าวถึง) ทั้งหมด โปรดสังเกต all solutions ที่นี่ somewhat ugly และ complex และต้องใช้ command line คุณ probably not like them (น่าจะไม่ชอบ) และ prefer (ชอบ) ใช้ Xen หรือ KVM setup ของตัวเองกับ full local storage control อยู่ดี แต่หากคุณ care (สนใจ/แคร์)
Option 1: Mount local directory
นี่คือ simplest task หากคุณมี local directory พร้อม ISO images เช่น /vm/iso ซึ่งคุณ populated (เติมข้อมูล) ด้วย scp command ตัวอย่าง คุณต้องการให้ repository นั้น visible ใน XenCenter อย่างไรก็ตาม ตามที่กล่าวมา program ไม่ allow adding local storage ผ่าน GUI interface
สิ่งที่คุณทำได้คือ issue (รัน) คำสั่งต่อไปนี้:
xe sr-create name-label=<NAME> type=iso
device-config:legacy_mode=true
device-config:location=<ISODIR> content-type=iso
และกับ generic fields populated:
xe sr-create name-label=Local type=iso
device-config:legacy_mode=true
device-config:location=/vm/iso content-type=iso
เมื่อรันคำสั่งนั้น หากสำเร็จ จะ return UUID สำหรับ created storage repository โปรดสังเกต คุณสามารถ repeat คำสั่งเดิมได้หลายครั้ง และทุกครั้งจะ create new storage repository ซึ่งจะแสดงใน GUI หลังจากนั้นเป็น separate entry
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
คุณทำได้จาก local shell หลัง connect via SSH:
และจากนั้น เมื่อพยายาม install VM คุณจะพบ Local listed สังเกต two identical entries จะแสดงขึ้นหากคุณรันคำสั่งเดิมสองครั้ง โปรด note (บันทึก) ไว้ เพราะอาจ confuse (สับสน) คุณ ไม่แน่ใจว่าเป็น bug หรือไม่ แต่เป็นอย่างนี้
Option 2: ทำงานกับ LVM และ not recommended (ไม่แนะนำ)
นี่คือ far more difficult และ complex setup เกี่ยวกับ LVM storage ที่ครอบคลุม local disks ของคุณ ซึ่งใช้ contain VM configurations และ disks
สิ่งที่คุณอยากทำคือ create new LVM บน disk ของคุณ และ add เป็น storage สำหรับ OS images หรืออะไรก็ตามที่คุณต้องการ คุณจะต้องใช้ LVM commands โชคดี LVM flexible และ allow ทำ drastic changes (การเปลี่ยนแปลงรุนแรง) on-the-fly เช่น resizing, allocation, addition และ removal ของ volume groups และ volumes โดยไม่ต้อง reboot
Procedure elaborated ใน rich detail ในหนึ่งใน posts บน Citrix forums สำหรับรายละเอียด hop below (กระโดดลงด้านล่าง) ไปที่ More Reading section อย่างไรก็ตาม สิ่งที่คุณต้องทำคือ find unallocated disk space และ create new volume group หรือ resize existing one แล้ว create new one จาก freed space จากนั้น create volume, format และสุดท้าย mount เพื่อใช้งาน
Option 3: Existing default ISO dir
คุณยังสามารถใช้ existing /opt/xensource/packages/iso directory สำหรับเก็บ ISO images ได้ แม้จะ somewhat small (ค่อนข้างเล็ก) และอาจ accommodate (รองรับ) ได้แค่ small number of files วิธี hack คือคุณสามารถ symbolically link directory นี้ไปยัง disk หรือ partition อื่นที่คุณอยากเก็บ images
Adding new disks virtually identical (เหมือนกันเกือบหมด) กับที่เราทำใน first step Add disk, ตรวจสอบว่า detected, สร้าง partition table และ format แล้ว mount บน mount point ในระบบ สุดท้าย create new storage repository:
xe sr-create type=iso device-config:legacy_mode=true
device-config:location=/path/to/mntpoint
และ refresh list of available repositories:
xe sr-scan uuid=<SR UUID>
และนั่นคือ all ในกิจการนี้
อ่านเพิ่มเติม (More reading)
คุณหา more info ได้ใน forum posts ต่อไปนี้:
https://forums.citrix.com/message.jspa?messageID=1399366
https://forums.citrix.com/thread.jspa?threadID=257054
และ unrelated - ใช้ Linux Samba sharing เพื่อ fake Windows CIFS post จริงเป็นภาษาสเปน แต่ explanations และ images self-explanatory (อธิบายตัวเองได้) คุณไม่ต้องการ translations จริงๆ นั่นคือ bonus thingie สำหรับคุณ
สรุป
การเพิ่ม storage repositories แบบนี้อาจดู awfully complex (ซับซ้อนอย่างน่ากลัว) โดยเฉพาะหากคุณเคยใช้ KVM storage management หรือรัน Xen จาก command line ก่อน LVM เพิ่ม operational flexibility (ความยืดหยุ่นในการดำเนินงาน) มาก แต่ทำให้ administration (การบริหาร) less accessible (เข้าถึงยากขึ้น) สำหรับ most users อีกทั้ง lack of filesystem transparency (ความโปร่งใสของ filesystem) สร้างปัญหาเมื่อคุณต้อง figure out (หาวิธี) special, custom setup ใน standard Linux คุณแค่ mount new filesystem ที่ไหนสักแห่ง และเสร็จสิ้น underlying system จะ figure out protocols หรือ drivers ที่ต้องการ แต่ที่นี่ distinction (ความแตกต่าง) ของ XenServer เปลี่ยน simple task ให้กลายเป็น big project
By all means (ด้วยทุกวิธี) local storage ไม่เคยเป็น good idea สำหรับเก็บ VMs เพราะทำให้ backups, recovery และ accessibility across data center คุ้มครุ่น (cumbersome) มากขึ้น รวมถึง introduce (นำเข้า) capacity และ performance penalty โดยเฉพาะเมื่อ scaling out แต่มัน highlight (เน้นย้ำ) ว่า XenServer ถูก design อย่างไร ด้วย tutorial นี้ในมือ mission (ภารกิจ) ของคุณอาจ tad simpler (ง่ายขึ้นนิดหน่อย) หลังจากนั้น อย่างน้อย คุณเรียนรู้เกี่ยวกับ remote access และ command line use และสัมผัส LVM management สั้นๆ ควร handy (มีประโยชน์/สะดวก)
หากคุณมี ideas หรือ requests อื่นๆ ping (ติดต่อ) ผม
ขอแสดงความนับถือ