Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
ad70b324
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ad70b324
编写于
1月 23, 2009
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support QEMU disk format specification in XML
上级
5f0c7201
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
78 addition
and
13 deletion
+78
-13
ChangeLog
ChangeLog
+9
-0
src/qemu_conf.c
src/qemu_conf.c
+36
-13
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.args
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.args
+1
-0
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml
+29
-0
tests/qemuxml2argvtest.c
tests/qemuxml2argvtest.c
+2
-0
tests/qemuxml2xmltest.c
tests/qemuxml2xmltest.c
+1
-0
未找到文件。
ChangeLog
浏览文件 @
ad70b324
Fri Jan 23 16:20:03 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
* src/qemu_conf.c: Support driver format for setting disk
file types
* tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c,
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.args,
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml:
Add tests for <driver name='qemu' type='qcow2'/>
Fri Jan 23 17:13:47 +0100 2009 Jim Meyering <meyering@redhat.com>
.cvsignore: Add explicit list of generated files.
...
...
src/qemu_conf.c
浏览文件 @
ad70b324
...
...
@@ -48,6 +48,8 @@
#include "xml.h"
#include "nodeinfo.h"
#define VIR_FROM_THIS VIR_FROM_QEMU
VIR_ENUM_DECL
(
virDomainDiskQEMUBus
)
VIR_ENUM_IMPL
(
virDomainDiskQEMUBus
,
VIR_DOMAIN_DISK_BUS_LAST
,
"ide"
,
...
...
@@ -862,6 +864,18 @@ int qemudBuildCommandLine(virConnectPtr conn,
ADD_ARG_LIT
(
vm
->
def
->
os
.
bootloader
);
}
for
(
i
=
0
;
i
<
vm
->
def
->
ndisks
;
i
++
)
{
virDomainDiskDefPtr
disk
=
vm
->
def
->
disks
[
i
];
if
(
disk
->
driverName
!=
NULL
&&
!
STREQ
(
disk
->
driverName
,
"qemu"
))
{
qemudReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"unsupported driver name '%s' for disk '%s'"
),
disk
->
driverName
,
disk
->
src
);
goto
error
;
}
}
/* If QEMU supports -drive param instead of old -hda, -hdb, -cdrom .. */
if
(
qemuCmdFlags
&
QEMUD_CMD_FLAG_DRIVE
)
{
int
bootCD
=
0
,
bootFloppy
=
0
,
bootDisk
=
0
;
...
...
@@ -884,8 +898,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
}
for
(
i
=
0
;
i
<
vm
->
def
->
ndisks
;
i
++
)
{
char
opt
[
PATH_MAX
]
;
c
onst
char
*
media
=
NULL
;
virBuffer
opt
=
VIR_BUFFER_INITIALIZER
;
c
har
*
optstr
;
int
bootable
=
0
;
virDomainDiskDefPtr
disk
=
vm
->
def
->
disks
[
i
];
int
idx
=
virDiskNameToIndex
(
disk
->
dst
);
...
...
@@ -912,7 +926,6 @@ int qemudBuildCommandLine(virConnectPtr conn,
case
VIR_DOMAIN_DISK_DEVICE_CDROM
:
bootable
=
bootCD
;
bootCD
=
0
;
media
=
"media=cdrom,"
;
break
;
case
VIR_DOMAIN_DISK_DEVICE_FLOPPY
:
bootable
=
bootFloppy
;
...
...
@@ -924,18 +937,28 @@ int qemudBuildCommandLine(virConnectPtr conn,
break
;
}
snprintf
(
opt
,
PATH_MAX
,
"file=%s,if=%s,%sindex=%d%s%s"
,
disk
->
src
?
disk
->
src
:
""
,
bus
,
media
?
media
:
""
,
idx
,
bootable
&&
disk
->
device
==
VIR_DOMAIN_DISK_DEVICE_DISK
?
",boot=on"
:
""
,
disk
->
shared
&&
!
disk
->
readonly
?
",cache=off"
:
""
);
virBufferVSprintf
(
&
opt
,
"file=%s"
,
disk
->
src
?
disk
->
src
:
""
);
virBufferVSprintf
(
&
opt
,
",if=%s"
,
bus
);
if
(
disk
->
device
==
VIR_DOMAIN_DISK_DEVICE_CDROM
)
virBufferAddLit
(
&
opt
,
",media=cdrom"
);
virBufferVSprintf
(
&
opt
,
",index=%d"
,
idx
);
if
(
bootable
&&
disk
->
device
==
VIR_DOMAIN_DISK_DEVICE_DISK
)
virBufferAddLit
(
&
opt
,
",boot=on"
);
if
(
disk
->
shared
&&
!
disk
->
readonly
)
virBufferAddLit
(
&
opt
,
",cache=off"
);
if
(
disk
->
driverType
)
virBufferVSprintf
(
&
opt
,
",fmt=%s"
,
disk
->
driverType
);
if
(
virBufferError
(
&
opt
))
{
virReportOOMError
(
conn
);
goto
error
;
}
optstr
=
virBufferContentAndReset
(
&
opt
);
ADD_ARG_LIT
(
"-drive"
);
ADD_ARG
_LIT
(
opt
);
ADD_ARG
(
optstr
);
}
}
else
{
for
(
i
=
0
;
i
<
vm
->
def
->
ndisks
;
i
++
)
{
...
...
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.args
0 → 100644
浏览文件 @
ad70b324
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -pidfile /nowhere/QEMUGuest1.pid -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,boot=on,fmt=qcow2 -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2,fmt=raw -net none -serial none -parallel none -usb
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml
0 → 100644
浏览文件 @
ad70b324
<domain
type=
'qemu'
>
<name>
QEMUGuest1
</name>
<uuid>
c7a5fdbd-edaf-9455-926a-d65c16db1809
</uuid>
<memory>
219200
</memory>
<currentMemory>
219200
</currentMemory>
<vcpu>
1
</vcpu>
<os>
<type
arch=
'i686'
machine=
'pc'
>
hvm
</type>
<boot
dev=
'hd'
/>
</os>
<clock
offset=
'utc'
/>
<on_poweroff>
destroy
</on_poweroff>
<on_reboot>
restart
</on_reboot>
<on_crash>
destroy
</on_crash>
<devices>
<emulator>
/usr/bin/qemu
</emulator>
<disk
type=
'block'
device=
'disk'
>
<driver
name=
'qemu'
type=
'qcow2'
/>
<source
dev=
'/dev/HostVG/QEMUGuest1'
/>
<target
dev=
'hda'
bus=
'ide'
/>
</disk>
<disk
type=
'block'
device=
'cdrom'
>
<driver
name=
'qemu'
type=
'raw'
/>
<source
dev=
'/dev/HostVG/QEMUGuest2'
/>
<target
dev=
'hdc'
bus=
'ide'
/>
<readonly/>
</disk>
</devices>
</domain>
tests/qemuxml2argvtest.c
浏览文件 @
ad70b324
...
...
@@ -194,6 +194,8 @@ mymain(int argc, char **argv)
QEMUD_CMD_FLAG_DRIVE_BOOT
);
DO_TEST
(
"disk-drive-boot-cdrom"
,
QEMUD_CMD_FLAG_DRIVE
|
QEMUD_CMD_FLAG_DRIVE_BOOT
);
DO_TEST
(
"disk-drive-fmt-qcow"
,
QEMUD_CMD_FLAG_DRIVE
|
QEMUD_CMD_FLAG_DRIVE_BOOT
);
DO_TEST
(
"disk-usb"
,
0
);
DO_TEST
(
"graphics-vnc"
,
0
);
DO_TEST
(
"graphics-sdl"
,
0
);
...
...
tests/qemuxml2xmltest.c
浏览文件 @
ad70b324
...
...
@@ -97,6 +97,7 @@ mymain(int argc, char **argv)
DO_TEST
(
"disk-many"
);
DO_TEST
(
"disk-xenvbd"
);
DO_TEST
(
"disk-usb"
);
DO_TEST
(
"disk-drive-fmt-qcow"
);
DO_TEST
(
"graphics-vnc"
);
DO_TEST
(
"graphics-sdl"
);
DO_TEST
(
"graphics-sdl-fullscreen"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录