Truy vấn danh sách các cụm

Một phần của tài liệu Phát triển dịch vụ quản lý và phân phối tài nguyên trong điện toán đám mây (Trang 41)

Mô tả Liệt kê danh sách tên của các cụm dữ liệu có trong một trung tâm dữ liệu căn cứ theo tên của trung tâm dữ liệu.

URI http://servername/provisioning/dcs/{dcname}/clusters

Phương thức GET

Kiểu dữ liệu đầu vào Tham số đường dẫn (path param). Dữ liệu đầu vào dcname: tên datacenter cần lấy dữ liệu. Kiểu dữ liệu đầu ra Application/xml

Dữ liệu đầu ra Danh sách tên các datacenter: HTTP/1.1 200 Ok

Server: Apache-Tomcat/6.0

Last-Modified: Thu, 11 Oct 2011 14:45:35 GMT Location: http://localhost:8080/provisioning/dc/VM- DC01/clusters

Date: Fri, 12 Oct 2011 12:00:28 GMT

Content-Type: application/xml; charset=UTF-8

<clusters> <cluster>

<name>Cluster01</name>

</cluster> <cluster>

<name>Cluster02</name>

</cluster> <cluster>

<name>Cluster03</name>

</cluster>

</clusters>

 200 Ok: nếu giao dịch thành công.

 404 Not found: nếu tên datacenter không đúng.  500 Server error: nếu có lỗi xảy ra ở máy chủ.

Bảng 6: Chức năng truy vấn danh sách các cụm

4.4.3. Truy vấn danh sách Resource Pool

Mô tả Liệt kê danh sách tên của các Resource Pool có trong một cụm dữ liệu căn cứ theo tên của trung tâm dữ liệu và tên của cụm dữ liệu chứa chúng.

URI http://servername/provisioning/dcs/{dcname}/cluster/{cna

me}/rps

Phương thức GET

Kiểu dữ liệu đầu vào Các tham số đường dẫn (path params)

Dữ liệu đầu vào  dcname: tên của datacenter cần lấy dữ liệu.

 cname: tên của cụm dữ liệu chứa các vùng dữ liệu cần lấy ra.

Kiểu dữ liệu đầu ra Application/xml

Dữ liệu đầu ra Danh sách tên các datacenter: HTTP/1.1 200 Ok

Server: Apache-Tomcat/6.0 (adsbygoogle = window.adsbygoogle || []).push({});

Last-Modified: Thu, 11 Oct 2011 14:45:35 GMT Location: http://localhost:8080/provisioning/dc/VM- DC01/cluster/Cluster01/rps

Date: Fri, 12 Oct 2011 12:00:28 GMT

Content-Type: application/xml; charset=UTF-8

<resourcePools> <resourcePool> <name>RP001</name> </resourcePool> <resourcePool> <name>RP002</name> </resourcePool> <resourcePool> <name>RP003</name> </resourcePool> </resourcePools>

Trạng thái dữ liệu đầu ra Mã dữ liệu trả về:

 200 Ok: nếu giao dịch thành công.

 404 Not found: nếu tên datacenter và/hoặc tên cụm dữ liệu không đúng.

 500 Server error: nếu có lỗi xảy ra ở máy chủ.

Bảng 7: chức năng truy vấn danh sách Resource Pool

4.4.4. Truy vấn thông tin chi tiết của một Resource Pool

Mô tả Lấy ra thông tin chi tiết của một Resource Pool căn cứ vào tên datacenter, tên cụm dữ liệu và tên Resource Pool cần lấy thông tin.

Các thông tin cần lấy ra là:

 Các thông tin về tài nguyên được gán cho Resource Pool đó như bộ nhớ, CPU. Bao gồm các thông tin: kích thước, dung lượng được gán (reservation), giới hạn (limit), tài nguyên được phép vượt quá (overhead).

 Các thông tin về tài nguyên đã tiêu thụ (usage) và còn sẵn sang (available) của Resource Pool.  Danh sách các máy ảo thuộc Resource Pool đó và

các thông tin tài nguyên của các máy ảo.

 Danh sách các Resource Pool con chứa trong nó.

URI http://servername/provisioning/dcs/{dcname}/cluster/{cna

me}/rp/{rpname}

Phương thức GET

Kiểu dữ liệu đầu vào Các tham số đường dẫn (path params)

Dữ liệu đầu vào  dcname: tên của datacenter cần lấy dữ liệu.

 cname: tên của cụm dữ liệu chứa các vùng dữ liệu cần lấy ra.

Kiểu dữ liệu đầu ra Application/xml

Dữ liệu đầu ra Danh sách tên các datacenter: HTTP/1.1 200 Ok

Server: Apache-Tomcat/6.0

Last-Modified: Thu, 11 Oct 2011 14:45:35 GMT Location: http://localhost:8080/provisioning/dc/VM- DC01/cluster/Cluster01/rp/RP001

Date: Fri, 12 Oct 2011 12:00:28 GMT

Content-Type: application/xml; charset=UTF-8

<resourcePool> <cpuResource> <limit>9200</limit> <reservation>0</reservation> <reservationUsed>0</reservationUsed> <unreserved>9200</unreserved> </cpuResource> <memoryResource> <limit>9200</limit> <reservation>0</reservation> <reservationUsed>0</reservationUsed> <unreserved>9200</unreserved> </memoryResource> <virtualMachine> <name>RP001.VM001</name> <memory>1024</memory> <numCPU>1</numCPU> <diskSize>15360</diskSize> <state>powerOn</state> <guest>

<guestOsFullName>Ubuntu Linux (32- bit)</guestOsFullName> (adsbygoogle = window.adsbygoogle || []).push({});

<guestOsId>ubuntuGuest</guestOsId> <nicSetting>

<ip>192.168.122.1</ip>

<macAddress>00:50:56:ae:3c:c5</macAddress> </nicSetting> </guest> <cpuResource> <limit>9200</limit> <reservation>0</reservation> <reservationUsed>0</reservationUsed> <unreserved>9200</unreserved> </cpuResource> <memoryResource> <limit>9200</limit> <reservation>0</reservation> <reservationUsed>0</reservationUsed> <unreserved>9200</unreserved> </memoryResource> </virtualMachine> <virtualMachine> <name>RP001.VM002</name> <memory>1024</memory> <numCPU>1</numCPU> <diskSize>15360</diskSize> <state>powerOn</state> <guest>

<guestOsFullName>Microsoft Windows XP Professional (32-bit)</guestOsFullName>

<guestOsId>winXPProGuest</guestOsId> <nicSetting>

<ip>192.168.11.99</ip>

</nicSetting> </guest> <cpuResource> <limit>9200</limit> <reservation>0</reservation> <reservationUsed>0</reservationUsed> <unreserved>9200</unreserved> </cpuResource> <memoryResource> <limit>9200</limit> <reservation>0</reservation> <reservationUsed>0</reservationUsed> <unreserved>9200</unreserved> </memoryResource> </virtualMachine> <resourcePool> <name>RP001</name> </resourcePool> <resourcePool> <name>RP001</name> </resourcePool> <resourcePool> <name>RP001</name> </resourcePool> </resourcePool>

Trạng thái dữ liệu đầu ra Mã dữ liệu trả về:

 200 Ok: nếu giao dịch thành công.

 404 Not found: nếu tên datacenter, tên cụm dữ liệu và/hoặc tên Resource Pool không đúng.  500 Server error: nếu có lỗi xảy ra ở máy chủ.

Bảng 8: Chức năng truy vấn thông tin chi tiết của một Resource Pool

4.4.5. Tạo mới một Resource Pool

Mô tả Tạo mới một Resource Pool với các tham số đầu vào là tên Resource Pool và các giá trị của tài nguyên được gán.

URI http://servername/provisioning/dcs/{dcname}/cluster/{cna

me}/rp/{rpname}

Phương thức POST

Kiểu dữ liệu đầu vào Các tham số đường dẫn (path params)

Xâu dữ liệu đầu vào định dạng application/xml. Dữ liệu đầu vào Các tham số đường dẫn:

 dcname: tên của datacenter cần lấy dữ liệu.

liệu cần lấy ra.

 Rpname: tên của Resource Pool cần tạo. Xâu dữ liệu đầu vào định dạng XML:

POST http://localhost:8080/provisioning/dc/VM- DC01/cluster/Cluster01/rp/{rpname} HTTP/1.1 Accept: application/xml Accept-Language: en-us <resourcePool> <name>RP001</name> <cpuResource> <expandableReservation>false</expandableReservation> <limit>7523</limit> <reservation>2385</reservation> <shareLevel>Custom</shareLevel> <shareValue>21920</shareValue> </cpuResource> <memoryResource> <expandableReservation>true</expandableReservation> <limit>2453</limit> <reservation>777</reservation> <shareLevel>Custom</shareLevel> <shareValue>21920</shareValue> </memoryResource> </resourcePool> Kiểu dữ liệu đầu ra Application/xml

Dữ liệu đầu ra Danh sách tên các datacenter: HTTP/1.1 200 Ok

Server: Apache-Tomcat/6.0

Last-Modified: Thu, 11 Oct 2011 14:45:35 GMT Location: http://localhost:8080/provisioning/dc/VM- DC01/cluster/Cluster01/rps

Date: Fri, 12 Oct 2011 12:00:28 GMT

Content-Type: application/xml; charset=UTF-8

<resourcePools> <resourcePool> <name>RP001</name> </resourcePool> <resourcePool> <name>RP002</name> </resourcePool> <resourcePool> <name>RP003</name> </resourcePool> </resourcePools>

Trạng thái dữ liệu đầu ra Mã dữ liệu trả về:

 200 Ok: nếu giao dịch thành công. (adsbygoogle = window.adsbygoogle || []).push({});

 404 Not found: nếu tên datacenter và/hoặc tên cụm dữ liệu không đúng.

 500 Server error: nếu có lỗi xảy ra ở máy chủ.

4.4.6. Cấu hình lại một Resource Pool

Mô tả Thay đổi thông tin cấu hình của một Resource Pool đã được tạo với các dữ liệu đầu vào là tên Resource Pool và các giá trị của tài nguyên được gán.

URI http://servername/provisioning/dcs/{dcname}/cluster/{cna

me}/rp/{rpname}

Phương thức PUT

Kiểu dữ liệu đầu vào Các tham số đường dẫn (path params)

Xâu dữ liệu đầu vào định dạng application/xml. Dữ liệu đầu vào Các tham số đường dẫn:

 dcname: tên của datacenter cần lấy dữ liệu.

 cname: tên của cụm dữ liệu chứa các vùng dữ liệu cần lấy ra.

 Rpname: tên của Resource Pool cần thay đổi cấu hình.

Xâu dữ liệu đầu vào định dạng XML:

PUT http://localhost:8080/provisioning/dc/VM- DC01/cluster/Cluster01/rp/RP001 HTTP/1.1 Accept: application/xml Accept-Language: en-us <resourcePool> <name>RP001_renamed</name> <cpuResource> <expandableReservation>false</expandableReservation> <limit>7523</limit> <reservation>2385</reservation> <shareLevel>Normal</shareLevel> </cpuResource> <memoryResource> <expandableReservation>true</expandableReservation> <limit>2453</limit> <reservation>777</reservation> <shareLevel>Custom</shareLevel> <shareValue>21920</shareValue> </memoryResource> </resourcePool> Kiểu dữ liệu đầu ra Application/xml

Dữ liệu đầu ra Danh sách tên các datacenter: HTTP/1.1 200 Ok

Server: Apache-Tomcat/6.0

Last-Modified: Thu, 11 Oct 2011 14:45:35 GMT Location: http://localhost:8080/provisioning/dc/VM- DC01/cluster/Cluster01/rps

Date: Fri, 12 Oct 2011 12:00:28 GMT

Content-Type: application/xml; charset=UTF-8

<resourcePools> <resourcePool> <name>RP001</name> </resourcePool> <resourcePool> <name>RP002</name> </resourcePool> <resourcePool> <name>RP003</name> </resourcePool> </resourcePools>

Trạng thái dữ liệu đầu ra Mã dữ liệu trả về:

 200 Ok: nếu giao dịch thành công.

 404 Not found: nếu tên datacenter và/hoặc tên cụm dữ liệu không đúng.

 500 Server error: nếu có lỗi xảy ra ở máy chủ.

Bảng 10: Chức năng cấu hình lại một Resource Pool

4.4.7. Xóa một Resource Pool

Mô tả Xóa một Resource Pool theo tên datacenter, tên cụm dữ liệu và tên của Resource Pool cần xóa.

URI http://servername/provisioning/dcs/{dcname}/cluster/{cna

me}/rp{rpname}

Kiểu dữ liệu đầu vào Các tham số đường dẫn (path params) (adsbygoogle = window.adsbygoogle || []).push({});

Dữ liệu đầu vào  dcname: tên của datacenter cần lấy dữ liệu.

 cname: tên của cụm dữ liệu chứa các vùng dữ liệu cần lấy ra.

 rpname: tên của Resource Pool cần xóa. Kiểu dữ liệu đầu ra Không có

Dữ liệu đầu ra Không có

Trạng thái dữ liệu đầu ra Mã dữ liệu trả về:

 200 Ok: nếu giao dịch thành công.

 404 Not found: nếu tên datacenter và/hoặc tên cụm dữ liệu không đúng.

 500 Server error: nếu có lỗi xảy ra ở máy chủ.

Bảng 11: Chức năng xóa một Resource Pool

4.4.8. Truy vấn danh sách các mẫu máy ảo

Mô tả Liệt kê danh sách tên mẫu máy ảo (templates) để sử dụng cho việc nhân bản máy.

URI http://servername/provisioning/templates

Kiểu dữ liệu đầu vào Không có Dữ liệu đầu vào Không có

Kiểu dữ liệu đầu ra Application/xml Dữ liệu đầu ra HTTP/1.1 200 Ok

Server: Apache-Tomcat/6.0

Last-Modified: Thu, 11 Oct 2011 14:45:35 GMT

Location: http://localhost:8080/provisioning/templates

Date: Fri, 12 Oct 2011 12:00:28 GMT

Content-Type: application/xml; charset=UTF-8

<virtualMachines> <virtualMachine> <name>Ubuntu_template</name> <numCpu>1</numCpu> <memorySize>2048</memorySize> <diskSize>2048</diskSize> <guest>

<guestOsId>ubuntuGuest</guestOsId> <guestOsFullName> Ubuntu Linux (32- bit)</guestOsFullName>

<guestFamily>linuxGuest</guestFamily> </guest>

</virtualMachine>

<virtualMachine>

<name>WinXP_template</name> <memory>1024</memory> <numCPU>1</numCPU>

<diskSize>15360</diskSize>

<guest>

<guestOsId>winXPProGuest</guestOsId> <guestOsFullName>Microsoft Windows XP Professional (32-bit)</guestOsFullName>

<guestFamily>windowsGuest</guestFamily> </guest>

</virtualMachine> </virtualMachines> Trạng thái dữ liệu đầu ra Mã dữ liệu trả về: (adsbygoogle = window.adsbygoogle || []).push({});

 200 Ok: nếu giao dịch thành công.

 500 Server error: nếu có lỗi xảy ra ở máy chủ.

Bảng 12: Chức năng truy vấn danh sách các mẫu máy ảo

4.4.9. Truy vấn danh sách các máy ảo

Mô tả Liệt kê danh sách máy ảo và trạng thái của chúng có trong một Resource Pool căn cứ vào tên datacenter, tên cụm dữ liệu và tên Resource Pool.

URI http://servername/provisioning/dc/{dcname}/cluster/{cnam

Phương thức GET

Kiểu dữ liệu đầu vào Các tham số đường dẫn (path params).

Dữ liệu đầu vào  dcname: tên của datacenter cần lấy dữ liệu.

 cname: tên của cụm dữ liệu chứa các vùng dữ liệu cần lấy ra.

 rpname: tên của Resource Pool cần lấy thông tin. Kiểu dữ liệu đầu ra Application/xml

Dữ liệu đầu ra HTTP/1.1 200 Ok

Server: Apache-Tomcat/6.0

Last-Modified: Thu, 11 Oct 2011 14:45:35 GMT Location:

http://localhost:8080/provisioning/dc/{dcname}/cluster/{c name}/rp/{rpname}/vms

Date: Fri, 12 Oct 2011 12:00:28 GMT

Content-Type: application/xml; charset=UTF-8

<virtualMachines> <virtualMachine> <name>Ubuntu_template</name> <numCpu>1</numCpu> <memorySize>2048</memorySize> <diskSize>2048</diskSize> <state>powerOn</state> <guest>

<guestOsId>ubuntuGuest</guestOsId> <guestOsFullName> Ubuntu Linux (32- bit)</guestOsFullName>

<guestFamily>linuxGuest</guestFamily> <nicSetting>

<ip>192.168.11.99</ip>

<macAddress>00:50:56:ae:01:08</macAddress> </nicSetting>

</guest>

</virtualMachine>

<virtualMachine>

<name>WinXP_template</name> <memory>1024</memory> <numCPU>1</numCPU>

<diskSize>15360</diskSize>

<state>powerOff</state>

<guest>

<guestOsId>winXPProGuest</guestOsId> <guestOsFullName>Microsoft Windows XP Professional (32-bit)</guestOsFullName> (adsbygoogle = window.adsbygoogle || []).push({});

<guestFamily>windowsGuest</guestFamily> <nicSetting>

<ip>192.168.11.99</ip>

<macAddress>00:50:56:ae:01:08</macAddress> </nicSetting>

</guest> </virtualMachine> </virtualMachines>

Trạng thái dữ liệu đầu ra Mã dữ liệu trả về:

 200 Ok: nếu giao dịch thành công.

 404 Not found: nếu tên datacenter, tên cụm dữ liệu và/hoặc tên Resource Pool không đúng.  500 Server error: nếu có lỗi xảy ra ở máy chủ.

Bảng 13: Chức năng truy vấn danh sách các máy ảo

4.4.10. Truy vấn thông tin của một máy ảo

Mô tả Truy vấn thông tin của một máy ảo với các thông tin về bộ nhớ, dung lượng ổ đĩa cứng, số lượng CPU và thông tin về hệ điều hành căn cứ vào tên của máy ảo.

URI http://servername/provisioning/vm/{vmname}

Phương thức GET

Kiểu dữ liệu đầu vào Tham số đường dẫn (path param).

Dữ liệu đầu vào vmname: tên của máy ảo cần lấy dữ liệu. Kiểu dữ liệu đầu ra Application/xml

Dữ liệu đầu ra HTTP/1.1 200 Ok

Server: Apache-Tomcat/6.0

Last-Modified: Thu, 11 Oct 2011 14:45:35 GMT

Location: http://localhost:8080/provisioning/vm/VM_001

Date: Fri, 12 Oct 2011 12:00:28 GMT

Content-Type: application/xml; charset=UTF-8

<virtualMachine> <name>VM_001</name> <numCpu>2</numCpu> <memorySize>2048</memorySize> <diskSize>4096</diskSize> <state>powerOn</state> <guest>

<guestOsId>ubuntuGuest</guestOsId> <guestOsFullName> Ubuntu Linux (32- bit)</guestOsFullName>

<guestFamily>linuxGuest</guestFamily> <nicSetting>

<ip>192.168.122.1</ip>

<macAddress>00:50:56:ae:3c:c5</macAddress> </nicSetting>

</guest> </virtualMachine>

Trạng thái dữ liệu đầu ra Mã dữ liệu trả về:

 200 Ok: nếu giao dịch thành công.

 404 Not found: nếu tên máy ảo không đúng.  500 Server error: nếu có lỗi xảy ra ở máy chủ.

Bảng 14: Chức năng truy vấn thông tin của một máy ảo (adsbygoogle = window.adsbygoogle || []).push({});

4.4.11. Tạo mới máy ảo

Mô tả Tạo mới một máy ảo với các thông tin về bộ nhớ, kích thước ổ cứng, số lượng CPU và tên của hệ điều hành chạy trên máy ảo.

URI http://servername/provisioning/vm

Phương thức POST

Kiểu dữ liệu đầu vào Xâu dữ liệu đầu vào dưới định dạng application/xml. Dữ liệu đầu vào POST http://localhost:8080/provisioning/vm HTTP/1.1

Accept: application/xml Accept-Language: en-us <virtualMachine> <name>VM_001</name> <numCpu>1</numCpu> <memorySize>2048</memorySize> <diskSize>2048</diskSize> <guest>

<guestOsId>ubuntuGuest</guestOsId> </guest>

</virtualMachine> Kiểu dữ liệu đầu ra Application/xml Dữ liệu đầu ra HTTP/1.1 200 Ok

Server: Apache-Tomcat/6.0

Last-Modified: Thu, 11 Oct 2011 14:45:35 GMT Location: http://localhost:8080/provisioning/vm

Date: Fri, 12 Oct 2011 12:00:28 GMT

Content-Type: application/xml; charset=UTF-8

<virtualMachine> <name>VM_001</name> <numCpu>1</numCpu> <memorySize>2048</memorySize> <diskSize>2048</diskSize> <guest>

<guestOsId>ubuntuGuest</guestOsId> </guest>

Trạng thái dữ liệu đầu ra Mã dữ liệu trả về:

 200 Ok: nếu giao dịch thành công.

 405 Method Not Allowed: nếu tên máy ảo mới đã tồn tại.

 500 Server error: nếu có lỗi xảy ra ở máy chủ.

Bảng 15: Chức năng tạo mới máy ảo

4.4.12. Cấu hình lại máy ảo

Mô tả Cấu hình lại máy ảo với các thông tin về bộ nhớ, thêm ổ đĩa cứng, số lượng CPU.

URI http://servername/provisioning/vm/{vmname}

Phương thức PUT

Kiểu dữ liệu đầu vào Xâu dữ liệu đầu vào dưới định dạng application/xml.

Dữ liệu đầu vào PUT http://localhost:8080/provisioning/vm/VM_001 HTTP/1.1 Accept: application/xml Accept-Language: en-us <virtualMachine> <numCpu>2</numCpu> <memorySize>2048</memorySize> <diskSize>2048</diskSize> </virtualMachine>

Kiểu dữ liệu đầu ra Application/xml Dữ liệu đầu ra HTTP/1.1 200 Ok

Server: Apache-Tomcat/6.0

Last-Modified: Thu, 11 Oct 2011 14:45:35 GMT

Location: http://localhost:8080/provisioning/vm/VM_001

Date: Fri, 12 Oct 2011 12:00:28 GMT (adsbygoogle = window.adsbygoogle || []).push({});

Content-Type: application/xml; charset=UTF-8

<virtualMachine> <name>VM_001</name> <numCpu>2</numCpu> <memorySize>2048</memorySize> <diskSize>4096</diskSize> <guest>

<guestOsId>ubuntuGuest</guestOsId> <guestOsFullName> Ubuntu Linux (32- bit)</guestOsFullName>

<guestFamily>linuxGuest</guestFamily> </guest>

Trạng thái dữ liệu đầu ra Mã dữ liệu trả về:

Một phần của tài liệu Phát triển dịch vụ quản lý và phân phối tài nguyên trong điện toán đám mây (Trang 41)