Chúng ta đã dùng khá nhiều VM trên các nền HĐH khác nhau, Virtual Box, MS Hyper-V cũng vậy, xong hầu hết xu hướng của người quản trị/ người dùng/ lập trình viên đều ,muốn quản lý chúng 1 cách tập trung, cần nhiều tài nguyên hơn để thử nghiệm, nâng cấp. Do vậy, chúng ta cần chuyển chúng sang vSphere Hypervisor VMware hoặc vSphere ESXi.
Các version software mà chúng ta dùng:
- VirutualBox >= 4.3
- vSphere Client >= 5.0
- VMware ESXi Hypervisor >= 5.0
Xuất ra Vm từ Virtual Box:
Để xuất ra được VM, bạn phải shut down máy ảo và chọn menu “File” > “Export Appliance”. Tiếp theo đặt tên máy ảo
On the following screen, select a destination for the output file and choose the OVA format and choose “OVF 1.0” format from the drop down and check the write manifest file box.
Click “Next” and then click “Export”. Depending on the size of the machine this could take a while.
Preparing to Import the VM
Once the export is complete you can try deploy the OVA to ESXi but you will receive the following error, “The OVF package requires unsupported hardware. Details: Line 25: Unsupported hardware family ‘virtualbox-2.2’.”.
Cách 1:
Chủ động làm lại ổ cứng ảo VMDK, nếu có bộ cài iSO để cài lại trên chuẩn ổ cứng VMDK.
Lưu ý: do 1 số HĐH là cũ như Linux Kernel 2.2/2.4 32/64bit không tương thích với các giao thức mới (SATA/ SCSI) của Computer Machine, thường chỉ chạy với chuẩn cũ IDE
Hãy tắt các device không cần thiết như: audio, serial ports, usb, share folder:
Bước tiếp theo là stop máy VM và chọn Export Appliance
Bước cuối cùng cần sửa lại nội dung cho file OVF tương thích với việc Deploy vào ESXi Host:
Giải nén file OVA bằng 7z tạo thành thư mục chứa 2 files: ovf và vmdk, hãy mở nội dung file ovf bằng notepad++
Sửa tham số virtualbox-2.2 thành vmx-07.
Lưu ý: một số OS như: Linux OpenSuSe x64 thì chỉ có VMX-11 mới support. hoặc bạn sẽ phải chỉnh General trong Virtualbox cấu hình thành Other Linux x64 để khi sang vSphere chỉnh lại HĐH tương thích sau.
Lưu lại file OVF sau khi sửa:
Cuối cùng là mở vSphere ESXi và deploy VM bằng file ovf.
———————————————————-
Cách 2: cách cũ và hay bị phát sinh việc sửa cấu hình VM trong virtualbox
Dùng 7Zip” để giải nén “extract the OVA”. bấm “OK” để giải nén và bỏ qua các lỗi.
Tạo 1 bản sao lưu tránh sửa nhầm lệnh trong OVF file và dùng notepad++.
thay đổi dòng nội dung:
<vssd:VirtualSystemType>virtualbox-2.2</vssd:VirtualSystemType>
thành dòng:
<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
Deploy VM trên vSphere client:
Hãy chọn file “Deploy OVF Template”.”đảm bảo là chọn OVF file không chọn OVA file”.
Nếu bạn nhận được các lỗi sau: hardware error: “The OVF package requires unsupported hardware. Details: Line 74: OVF hardware element ‘ResourceType’ with instance ID ‘6’. No support for the virtual hardware device type ’35’.”
Để fix lỗi này, mỡ lại file OVF file và xóa <item> có viết cả đoạn tham số XML liên quan tới sound card:
<Item> <rasd:AddressOnParent>3</rasd:AddressOnParent> <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> <rasd:Caption>sound</rasd:Caption> <rasd:Description>Sound Card</rasd:Description> <rasd:ElementName>sound</rasd:ElementName> <rasd:InstanceID>6</rasd:InstanceID> <rasd:ResourceSubType>ensoniq1371</rasd:ResourceSubType> <rasd:ResourceType>35</rasd:ResourceType> </Item>
Còn lỗi message khác : Line 66: OVF hardware element ‘ResourceType’ with instance ID ‘5’: No support for the virtual hardware device type ’20’
Bạn vẫn phải mở lại file OVF và sửa lại nội dung ở item Instance 5:
<Item>
<rasd:Address>0</rasd:Address>
<rasd:Caption>sataController0</rasd:Caption>
<rasd:Description>SATA Controller</rasd:Description>
<rasd:ElementName>sataController0</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:ResourceSubType>AHCI</rasd:ResourceSubType>
<rasd:ResourceType>20</rasd:ResourceType>
</Item>
Cần phải chuyển kiểu kết nối ổ cứng ảo SATA controllers, sang dạng SCSI (Instance Id needs to be unique for all the elements):
<Item> <rasd:Caption>scsiController0</rasd:Caption> <rasd:Description>SCSI Controller</rasd:Description> <rasd:InstanceId>12</rasd:InstanceId> <rasd:ResourceType>6</rasd:ResourceType> <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType> <rasd:Address>1</rasd:Address> <rasd:BusNumber>1</rasd:BusNumber> </Item>
Hãy thay đổi kiểu kết nối ổ cứng ảo bằng ID của SCSI controller:
<Item> <rasd:Caption>disk1</rasd:Caption> <rasd:Description>Disk Image</rasd:Description> <rasd:InstanceId>11</rasd:InstanceId> <rasd:ResourceType>17</rasd:ResourceType> <rasd:HostResource>/disk/vmdisk1</rasd:HostResource> <rasd:Parent>12</rasd:Parent> <rasd:AddressOnParent>0</rasd:AddressOnParent> </Item
Sau khi đã sửa xong nội dung file OVF, bạn có thể chạy lại deploy vSphere client để cấu hình VM:
Máy ảo của bạn sẽ trải qua 4 lần bấm Next:
-
Bấm “Next” nhập tên máy ảo
-
Bấm “Next” và định dạng đúng kiểu ổ Virtual Disk formatting bạn muốn
-
Bấm “Next” và kiểm tra mạng
-
Bấm “Next” và bấm “Finish”
Bạn sẽ cần vài phút để deploy VM, có thể bạn phải chỉnh Memory, CPU, Network để đảm bảo phù hợp tài nguyên cho VM.
Bây giờ thì các VM hoàn toàn có thể tắt trên VirtualBox, và hãy để chúng chạy trên vSphere VMware với sự tương thích của nhiều OS, chạy VM trên VMware là lợi thế của bạn,
Chúc bạn thành công và tận dụng cơ hôi ảo hóa tập trung.