ubuntu server 14.04 编译安装xen4.4.2配置vtpm(三)——创建DomU(a PV VM)
2016-07-28 16:15
615 查看
为了创建的半虚拟化VM能上网,在domain0中需设置网桥:
#vi /etc/network/interface
修改如下:
List your existingvolume groups (VG) and choose where you'd like to create the new logicalvolume.这里用的是逻辑盘创建,如果你的没有(即安装Ubuntuserver的时候没有用lvm)你可以用dd命令创建磁盘。
$ sudo vgs
Create the logical volume (LV).
$ sudo lvcreate -L10G -n lv_vm_ubuntu /dev/<VGNAME>
Confirm that the new LV was successfully created.
$ sudo lvs
#vi /etc/network/interface
修改如下:
# The loopback network interfaces auto lo iface lo inet loopback #The primary network interface #auto eth0 #iface eth0 inet dhcp auto lo eth0 xenbr0 iface lo inet loopback iface xenbr0 inet dhcp bridge_ports eth0 iface eth0 inet manual注意这里先创建配置文件ubud1.cfg不带vtpm的VM,然后再添加进去。你也可以从vtpmmgr.cfg->vtpm.cfg->ubund1.cfg顺序启动。不过由于没有硬件tpm,创建vtpmmgr.cfg就会报错,解决方法后面讲。
List your existingvolume groups (VG) and choose where you'd like to create the new logicalvolume.这里用的是逻辑盘创建,如果你的没有(即安装Ubuntuserver的时候没有用lvm)你可以用dd命令创建磁盘。
$ sudo vgs
Create the logical volume (LV).
$ sudo lvcreate -L10G -n lv_vm_ubuntu /dev/<VGNAME>
Confirm that the new LV was successfully created.
$ sudo lvs
Get NetbootImages
$ sudo mkdir -p /var/lib/xen/images/ubuntu-netboot/trusty14LTS $ cd /var/lib/xen/images/ubuntu-netboot/trusty14LTS 下载镜像进行安装:http://mirrors.163.com或者http://mirrors.aliyun.com $ wget http://mirrors.163.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/xen/vmlinuz $ wget http://mirrors.163.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/xen/initrd.gz[/code]Set Up InitialGuest Configuration
$ cd /etc/xen $ cp xlexample.pvlinux ubud1.cfg $ vi ubud1.cfg name = "ubud1" kernel = "/var/lib/xen/images/ubuntu-netboot/trusty14LTS/vmlinuz" ramdisk = "/var/lib/xen/images/ubuntu-netboot/trusty14LTS/initrd.gz" #bootloader = "/usr/lib/xen-4.4/bin/pygrub" memory = 1024 vcpus = 1 # Custom option for Open vSwitch vif = [ '' ] disk = [ '/dev/<VGNAME>/lv_vm_ubuntu,raw,xvda,rw' ] # You may also consider some other options # [[http://xenbits.xen.org/docs/4.4-testing/man/xl.cfg.5.html]]
然后启动ubund1.cfg进行domainU的安装:注意这里一定联网哦!
$ sudo xl create -c /etc/xen/ubud1.cfg
Once installed and back to command line, modify guestconfiguration to use the pygrub bootloader. These lines will change$ vi /etc/xen/ubud1.cfg #kernel = "/var/lib/xen/images/ubuntu-netboot/trusty14LTS/vmlinuz" #ramdisk = "/var/lib/xen/images/ubuntu-netboot/trusty14LTS/initrd.gz" bootloader = "/usr/lib/xen-4.4/bin/pygrub"
Now let's restart theVM with the new bootloader. (If the VM didn't shutdown after the install above,you may manually shut it down.)
$ sudo xl shutdownubud1
$ sudo xl create -c /etc/xen/ubud1.cfg
回到domain0按
Ctrl+]
再回到domainU输入:
$ sudo xl consoleubud1好了,下面开始说一下关于vtpm的事情,分析源码发现用户DomainU发送一个命令比如:tpm_version。这个命令根本没有传入到vtpmmgr域中(而根据xen的前后端思想,命令应该传送到vtpmmgr然后传入物理tpm芯片。),而分析源码发现:该命令直接传入vtpm域的main_loop函数中,在这个函数中调用了tpm-emulator中的命令。直接执行并且返回了,而没有往下层传命令。而这个tpm-emulator是编译xen的时候自动下载,并且编译到vtpm域中的。有兴趣的可以看一下源码:
而如何启动vtpm域,是应该先启动vtpmmgr域的,你可以把启动vtpmmgr域时(cd /etc/xen xl create -c vtpmmgr.cfg)报错的代码注释掉,让vtpmmgr域启动,然后再配置好vtpm.cfg启动就ok了。
在xen4.6版本中:/stubdom/vtpm/vtpm.c 300行左右的tpm_handle_command函数(这个是调用的tpm-emulato中的函数)。
相关文章推荐
- Windows Azure VM上配置FTP服务器
- vmware 打开虚拟机时提示“该虚拟机似乎正在被使用”解决
- 搭建CloudStack
- 使用 Docker 搭建 Java Web 运行环境
- VM 9 安装64位系统,出现的问题
- rhel5的xen内核无法使用串口的原因和解决方法
- xen
- 有关top命令中的%st,sar命令中的%steal .
- Vmcentos共享ADSL拔号上网
- VPS虚拟化架构介绍与参考
- vm 键盘图
- 虚拟化技术漫谈
- Xen 支持的虚拟机类型
- 使用 ionice 限制 Xen 虚拟机磁盘 IO
- Remove the “host currently has no management network redundancy” warning
- Oracle VM Server 安装
- 在 Oracle VM 和 Oracle Enterprise Linux 上构建您自己的 Oracle 扩展 RAC 集群
- VMWare ESXi 5 Move VM to Different Datastore
- centos6上安装配置XEN--转载
- XEN--转载自鸟哥的linux私房菜