wiki:GTD_Cloud_One_oper

Version 7 (modified by rock, 16 years ago) (diff)

--

OpenNEbula Operation

1. Requirement


2. System Configuration

2.1 NIS Setup

// Server
$ sudo groupadd xen
$ sudo useradd -m -G xen oneadmin
$ cd /var/yp ; sudo make
$ id oneadmin
uid=1001(oneadmin) gid=1002(oneadmin) groups=1002(oneadmin),1001(xen)

// Client, create local group "rootxen" include local root & shared GID 
$ echo "rootxen:x:<xen_gid>:root >> /etc/group
($ echo "rootxen:x:1001:root >> /etc/group)

2.2 SSH Setup

// Server
$ su oneadmin
$ ssh-keygen

// Client (cp id_rsa.pub from Server)
$ echo /home/oneadmin/.ssh/id_rsa.pub >> authorized_keys

3. Host Add & VM submit

3.1 Add Host

$ onehost create xen101 im_xen vmm_xen tm_ssh
$ onehost list
 HID NAME                      RVM   TCPU   FCPU   ACPU    TMEM    FMEM STAT
   0 xen101                      0    400    400    400 6216704  130048   on

3.2 Submit vm

  • Create Image (Using xen-tools)
    $ sudo vim /etc/xen-tools
    $ sudo xen-create-image --hostname test1 --ip 140.X.X.X 
    
  • Configuration
    $ vim /home/images/domains/test1/test1.cfg
    MEMORY=128
    CPU=4
    OS=[
         kernel="/boot/vmlinuz-2.6.18.8",
         initrd="/boot/initrd.img-2.6.18.8",
         root="sda1",
         boot="hd"]
    DISK=[
         source="/home/images/domains/vm01/disk.img",
         target="sda1",
         readonly=no]
    NIC=[mac="00:16:3e:01:01:03"]
    
    
  • Submit vm
    $ sudo onevm submit test1.cfg
    $ sudo onevm list
      ID     NAME STAT CPU     MEM        HOSTNAME        TIME
       0    one-0 runn   0  131072             one 00 00:05:24
    
    $ sudo xm list
    Name                                        ID   Mem VCPUs      State   Time(s)
    Domain-0                                     0  5840     4     r-----    307.8
    one-0                                        2   128     1     -b----      1.6
    
    $ sudo xm console one-0
    

1.指令介紹

  • OpenNEbula 提供類似XEN指令的方式來管理虛擬機器,OpenNEbula也可以支援Amazon EC2和KVM(Kenrel-based Virtual Machine)的虛擬機器,不過在此處是以OpenNEbula來管理Cluster環境上得XEN虛擬機器。OpenNEbula主要有三個指令:
    • onehost: 用來增加、刪除和監控實體機器 (也就是可以監控所有位於Cluster上的Dom0)
    • onevm: 用來submit、控制和監控位於實體機器上的虛擬機器 (也就是可以監控所有位於Cluster上Dom0的虛擬機器)
    • pnevnet: to add, delete and monitor hosts (尚未使用過)


2.Programming with OpenNEbula

  • OpenNEbula 提供一些API讓Client可以透過自行撰寫的程式碼來管理虛擬機器,它採用XML-RPC機制來完成動作。


Reference