Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
4d5383fd
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看板
提交
4d5383fd
编写于
5月 21, 2009
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
public API for domain XML conversions
上级
c9e6c8c0
变更
20
展开全部
隐藏空白更改
内联
并排
Showing
20 changed file
with
1004 addition
and
141 deletion
+1004
-141
ChangeLog
ChangeLog
+15
-0
docs/devhelp/libvirt-libvirt.html
docs/devhelp/libvirt-libvirt.html
+97
-5
docs/devhelp/libvirt-virterror.html
docs/devhelp/libvirt-virterror.html
+6
-2
docs/html/libvirt-libvirt.html
docs/html/libvirt-libvirt.html
+41
-4
docs/html/libvirt-virterror.html
docs/html/libvirt-virterror.html
+2
-2
docs/libvirt-api.xml
docs/libvirt-api.xml
+193
-68
docs/libvirt-refs.xml
docs/libvirt-refs.xml
+401
-58
include/libvirt/libvirt.h
include/libvirt/libvirt.h
+10
-0
include/libvirt/libvirt.h.in
include/libvirt/libvirt.h.in
+10
-0
src/driver.h
src/driver.h
+12
-0
src/libvirt.c
src/libvirt.c
+105
-0
src/libvirt_public.syms
src/libvirt_public.syms
+4
-2
src/lxc_driver.c
src/lxc_driver.c
+2
-0
src/openvz_driver.c
src/openvz_driver.c
+2
-0
src/qemu_driver.c
src/qemu_driver.c
+2
-0
src/remote_internal.c
src/remote_internal.c
+2
-0
src/test.c
src/test.c
+2
-0
src/uml_driver.c
src/uml_driver.c
+2
-0
src/virsh.c
src/virsh.c
+94
-0
src/xen_unified.c
src/xen_unified.c
+2
-0
未找到文件。
ChangeLog
浏览文件 @
4d5383fd
Thu May 21 14:32:22 BST 2009 Daniel P. Berrange <berrange@redhat.com>
Public APIs for domain XML conversions.
* docs/devhelp/libvirt-libvirt.html, docs/devhelp/libvirt-virterror.html,
docs/html/libvirt-libvirt.html, docs/html/libvirt-virterror.html,
docs/libvirt-api.xml, docs/libvirt-refs.xml: Regenerate with new public
APIs
* include/libvirt/libvirt.h, include/libvirt/libvirt.h.in,
src/driver.h, src/libvirt.c, src/libvirt_public.syms: Add
virConnectDomainXMLFromNative and virConnectDomainXMLToNative
* src/lxc_driver.c, src/openvz_driver.c, src/qemu_driver.c,
src/remote_internal.c, src/test.c, src/uml_driver.c,
src/xen_unified.c: Stub out new API entry points
* src/virsh.c: Add domxml-to-native and domxml-from-native commands
Thu May 21 11:52:22 BST 2009 Daniel P. Berrange <berrange@redhat.com>
Thu May 21 11:52:22 BST 2009 Daniel P. Berrange <berrange@redhat.com>
* python/generator.py, python/libvirt_wrap.h, python/types.c: Add
* python/generator.py, python/libvirt_wrap.h, python/types.c: Add
...
...
docs/devhelp/libvirt-libvirt.html
浏览文件 @
4d5383fd
此差异已折叠。
点击以展开。
docs/devhelp/libvirt-virterror.html
浏览文件 @
4d5383fd
...
@@ -107,7 +107,8 @@ void <a href="#virConnResetLastError">virConnResetLastError</a> (<a href="libvi
...
@@ -107,7 +107,8 @@ void <a href="#virConnResetLastError">virConnResetLastError</a> (<a href="libvi
<a
name=
"VIR_FROM_NODEDEV"
>
VIR_FROM_NODEDEV
</a>
= 22 /* Error from node device monitor */
<a
name=
"VIR_FROM_NODEDEV"
>
VIR_FROM_NODEDEV
</a>
= 22 /* Error from node device monitor */
<a
name=
"VIR_FROM_XEN_INOTIFY"
>
VIR_FROM_XEN_INOTIFY
</a>
= 23 /* Error from xen inotify layer */
<a
name=
"VIR_FROM_XEN_INOTIFY"
>
VIR_FROM_XEN_INOTIFY
</a>
= 23 /* Error from xen inotify layer */
<a
name=
"VIR_FROM_SECURITY"
>
VIR_FROM_SECURITY
</a>
= 24 /* Error from security framework */
<a
name=
"VIR_FROM_SECURITY"
>
VIR_FROM_SECURITY
</a>
= 24 /* Error from security framework */
<a
name=
"VIR_FROM_VBOX"
>
VIR_FROM_VBOX
</a>
= 25 /* Error from VirtualBox driver */
<a
name=
"VIR_FROM_VBOX"
>
VIR_FROM_VBOX
</a>
= 25 /* Error from VirtualBox driver */
<a
name=
"VIR_FROM_INTERFACE"
>
VIR_FROM_INTERFACE
</a>
= 26 /* Error when operating on an interface */
};
};
</pre><p/>
</pre><p/>
</div>
</div>
...
@@ -176,7 +177,10 @@ void <a href="#virConnResetLastError">virConnResetLastError</a> (<a href="libvi
...
@@ -176,7 +177,10 @@ void <a href="#virConnResetLastError">virConnResetLastError</a> (<a href="libvi
<a
name=
"VIR_ERR_INVALID_NODE_DEVICE"
>
VIR_ERR_INVALID_NODE_DEVICE
</a>
= 52 /* invalid node device object */
<a
name=
"VIR_ERR_INVALID_NODE_DEVICE"
>
VIR_ERR_INVALID_NODE_DEVICE
</a>
= 52 /* invalid node device object */
<a
name=
"VIR_ERR_NO_NODE_DEVICE"
>
VIR_ERR_NO_NODE_DEVICE
</a>
= 53 /* node device not found */
<a
name=
"VIR_ERR_NO_NODE_DEVICE"
>
VIR_ERR_NO_NODE_DEVICE
</a>
= 53 /* node device not found */
<a
name=
"VIR_ERR_NO_SECURITY_MODEL"
>
VIR_ERR_NO_SECURITY_MODEL
</a>
= 54 /* security model not found */
<a
name=
"VIR_ERR_NO_SECURITY_MODEL"
>
VIR_ERR_NO_SECURITY_MODEL
</a>
= 54 /* security model not found */
<a
name=
"VIR_ERR_OPERATION_INVALID"
>
VIR_ERR_OPERATION_INVALID
</a>
= 55 /* operation is not applicable at this time */
<a
name=
"VIR_ERR_OPERATION_INVALID"
>
VIR_ERR_OPERATION_INVALID
</a>
= 55 /* operation is not applicable at this time */
<a
name=
"VIR_WAR_NO_INTERFACE"
>
VIR_WAR_NO_INTERFACE
</a>
= 56 /* failed to start interface driver */
<a
name=
"VIR_ERR_NO_INTERFACE"
>
VIR_ERR_NO_INTERFACE
</a>
= 57 /* interface driver not running */
<a
name=
"VIR_ERR_INVALID_INTERFACE"
>
VIR_ERR_INVALID_INTERFACE
</a>
= 58 /* invalid interface object */
};
};
</pre><p/>
</pre><p/>
</div>
</div>
...
...
docs/html/libvirt-libvirt.html
浏览文件 @
4d5383fd
此差异已折叠。
点击以展开。
docs/html/libvirt-virterror.html
浏览文件 @
4d5383fd
此差异已折叠。
点击以展开。
docs/libvirt-api.xml
浏览文件 @
4d5383fd
此差异已折叠。
点击以展开。
docs/libvirt-refs.xml
浏览文件 @
4d5383fd
此差异已折叠。
点击以展开。
include/libvirt/libvirt.h
浏览文件 @
4d5383fd
...
@@ -591,6 +591,16 @@ typedef enum {
...
@@ -591,6 +591,16 @@ typedef enum {
char
*
virDomainGetXMLDesc
(
virDomainPtr
domain
,
char
*
virDomainGetXMLDesc
(
virDomainPtr
domain
,
int
flags
);
int
flags
);
char
*
virConnectDomainXMLFromNative
(
virConnectPtr
conn
,
const
char
*
nativeFormat
,
const
char
*
nativeConfig
,
unsigned
int
flags
);
char
*
virConnectDomainXMLToNative
(
virConnectPtr
conn
,
const
char
*
nativeFormat
,
const
char
*
domainXml
,
unsigned
int
flags
);
int
virDomainBlockStats
(
virDomainPtr
dom
,
int
virDomainBlockStats
(
virDomainPtr
dom
,
const
char
*
path
,
const
char
*
path
,
virDomainBlockStatsPtr
stats
,
virDomainBlockStatsPtr
stats
,
...
...
include/libvirt/libvirt.h.in
浏览文件 @
4d5383fd
...
@@ -591,6 +591,16 @@ typedef enum {
...
@@ -591,6 +591,16 @@ typedef enum {
char
*
virDomainGetXMLDesc
(
virDomainPtr
domain
,
char
*
virDomainGetXMLDesc
(
virDomainPtr
domain
,
int
flags
);
int
flags
);
char
*
virConnectDomainXMLFromNative
(
virConnectPtr
conn
,
const
char
*
nativeFormat
,
const
char
*
nativeConfig
,
unsigned
int
flags
);
char
*
virConnectDomainXMLToNative
(
virConnectPtr
conn
,
const
char
*
nativeFormat
,
const
char
*
domainXml
,
unsigned
int
flags
);
int
virDomainBlockStats
(
virDomainPtr
dom
,
int
virDomainBlockStats
(
virDomainPtr
dom
,
const
char
*
path
,
const
char
*
path
,
virDomainBlockStatsPtr
stats
,
virDomainBlockStatsPtr
stats
,
...
...
src/driver.h
浏览文件 @
4d5383fd
...
@@ -152,6 +152,16 @@ typedef int
...
@@ -152,6 +152,16 @@ typedef int
typedef
char
*
typedef
char
*
(
*
virDrvDomainDumpXML
)
(
virDomainPtr
dom
,
(
*
virDrvDomainDumpXML
)
(
virDomainPtr
dom
,
int
flags
);
int
flags
);
typedef
char
*
(
*
virDrvConnectDomainXMLFromNative
)
(
virConnectPtr
conn
,
const
char
*
nativeFormat
,
const
char
*
nativeConfig
,
unsigned
int
flags
);
typedef
char
*
(
*
virDrvConnectDomainXMLToNative
)
(
virConnectPtr
conn
,
const
char
*
nativeFormat
,
const
char
*
domainXml
,
unsigned
int
flags
);
typedef
int
typedef
int
(
*
virDrvListDefinedDomains
)
(
virConnectPtr
conn
,
(
*
virDrvListDefinedDomains
)
(
virConnectPtr
conn
,
char
**
const
names
,
char
**
const
names
,
...
@@ -381,6 +391,8 @@ struct _virDriver {
...
@@ -381,6 +391,8 @@ struct _virDriver {
virDrvDomainGetSecurityLabel
domainGetSecurityLabel
;
virDrvDomainGetSecurityLabel
domainGetSecurityLabel
;
virDrvNodeGetSecurityModel
nodeGetSecurityModel
;
virDrvNodeGetSecurityModel
nodeGetSecurityModel
;
virDrvDomainDumpXML
domainDumpXML
;
virDrvDomainDumpXML
domainDumpXML
;
virDrvConnectDomainXMLFromNative
domainXMLFromNative
;
virDrvConnectDomainXMLToNative
domainXMLToNative
;
virDrvListDefinedDomains
listDefinedDomains
;
virDrvListDefinedDomains
listDefinedDomains
;
virDrvNumOfDefinedDomains
numOfDefinedDomains
;
virDrvNumOfDefinedDomains
numOfDefinedDomains
;
virDrvDomainCreate
domainCreate
;
virDrvDomainCreate
domainCreate
;
...
...
src/libvirt.c
浏览文件 @
4d5383fd
...
@@ -2730,6 +2730,111 @@ error:
...
@@ -2730,6 +2730,111 @@ error:
return
NULL
;
return
NULL
;
}
}
/**
* virConnectDomainXMLFromNative:
* @conn: a connection object
* @nativeFormat: configuration format importing from
* @nativeConfig: the configuration data to import
* @flags: currently unused, pass 0
*
* Reads native configuration data describing a domain, and
* generates libvirt domain XML. The format of the native
* data is hypervisor dependant.
*
* Returns a 0 terminated UTF-8 encoded XML instance, or NULL in case of error.
* the caller must free() the returned value.
*/
char
*
virConnectDomainXMLFromNative
(
virConnectPtr
conn
,
const
char
*
nativeFormat
,
const
char
*
nativeConfig
,
unsigned
int
flags
)
{
DEBUG
(
"conn=%p, format=%s config=%s flags=%u"
,
conn
,
nativeFormat
,
nativeConfig
,
flags
);
virResetLastError
();
if
(
!
VIR_IS_CONNECT
(
conn
))
{
virLibConnError
(
NULL
,
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
return
(
NULL
);
}
if
(
nativeFormat
==
NULL
||
nativeConfig
==
NULL
)
{
virLibConnError
(
conn
,
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
return
(
NULL
);
}
if
(
conn
->
driver
->
domainXMLFromNative
)
{
char
*
ret
;
ret
=
conn
->
driver
->
domainXMLFromNative
(
conn
,
nativeFormat
,
nativeConfig
,
flags
);
if
(
!
ret
)
goto
error
;
return
ret
;
}
virLibConnError
(
conn
,
VIR_ERR_NO_SUPPORT
,
__FUNCTION__
);
error:
/* Copy to connection error object for back compatability */
virSetConnError
(
conn
);
return
NULL
;
}
/**
* virConnectDomainXMLToNative:
* @conn: a connection object
* @nativeFormat: configuration format exporting to
* @domainXml: the domain configuration to export
* @flags: currently unused, pass 0
*
* Reads a domain XML configuration document, and generates
* generates a native configuration file describing the domain.
* The format of the native data is hypervisor dependant.
*
* Returns a 0 terminated UTF-8 encoded native config datafile, or NULL in case of error.
* the caller must free() the returned value.
*/
char
*
virConnectDomainXMLToNative
(
virConnectPtr
conn
,
const
char
*
nativeFormat
,
const
char
*
domainXml
,
unsigned
int
flags
)
{
DEBUG
(
"conn=%p, format=%s xml=%s flags=%u"
,
conn
,
nativeFormat
,
domainXml
,
flags
);
virResetLastError
();
if
(
!
VIR_IS_CONNECT
(
conn
))
{
virLibConnError
(
NULL
,
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
return
(
NULL
);
}
if
(
nativeFormat
==
NULL
||
domainXml
==
NULL
)
{
virLibConnError
(
conn
,
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
return
(
NULL
);
}
if
(
conn
->
driver
->
domainXMLToNative
)
{
char
*
ret
;
ret
=
conn
->
driver
->
domainXMLToNative
(
conn
,
nativeFormat
,
domainXml
,
flags
);
if
(
!
ret
)
goto
error
;
return
ret
;
}
virLibConnError
(
conn
,
VIR_ERR_NO_SUPPORT
,
__FUNCTION__
);
error:
/* Copy to connection error object for back compatability */
virSetConnError
(
conn
);
return
NULL
;
}
/**
/**
* virDomainMigrate:
* virDomainMigrate:
* @domain: a domain object
* @domain: a domain object
...
...
src/libvirt_public.syms
浏览文件 @
4d5383fd
...
@@ -264,8 +264,6 @@ LIBVIRT_0.6.3 {
...
@@ -264,8 +264,6 @@ LIBVIRT_0.6.3 {
virNodeDeviceDestroy;
virNodeDeviceDestroy;
} LIBVIRT_0.6.1;
} LIBVIRT_0.6.1;
# .... define new API here using predicted next version number ....
LIBVIRT_0.6.4 {
LIBVIRT_0.6.4 {
global:
global:
virInterfaceGetConnect;
virInterfaceGetConnect;
...
@@ -283,4 +281,8 @@ LIBVIRT_0.6.4 {
...
@@ -283,4 +281,8 @@ LIBVIRT_0.6.4 {
virInterfaceCreate;
virInterfaceCreate;
virInterfaceDestroy;
virInterfaceDestroy;
virStorageVolCreateXMLFrom;
virStorageVolCreateXMLFrom;
virConnectDomainXMLFromNative;
virConnectDomainXMLToNative;
} LIBVIRT_0.6.3;
} LIBVIRT_0.6.3;
# .... define new API here using predicted next version number ....
src/lxc_driver.c
浏览文件 @
4d5383fd
...
@@ -1457,6 +1457,8 @@ static virDriver lxcDriver = {
...
@@ -1457,6 +1457,8 @@ static virDriver lxcDriver = {
NULL
,
/* domainGetSecurityLabel */
NULL
,
/* domainGetSecurityLabel */
NULL
,
/* nodeGetSecurityModel */
NULL
,
/* nodeGetSecurityModel */
lxcDomainDumpXML
,
/* domainDumpXML */
lxcDomainDumpXML
,
/* domainDumpXML */
NULL
,
/* domainXmlFromNative */
NULL
,
/* domainXmlToNative */
lxcListDefinedDomains
,
/* listDefinedDomains */
lxcListDefinedDomains
,
/* listDefinedDomains */
lxcNumDefinedDomains
,
/* numOfDefinedDomains */
lxcNumDefinedDomains
,
/* numOfDefinedDomains */
lxcDomainStart
,
/* domainCreate */
lxcDomainStart
,
/* domainCreate */
...
...
src/openvz_driver.c
浏览文件 @
4d5383fd
...
@@ -1344,6 +1344,8 @@ static virDriver openvzDriver = {
...
@@ -1344,6 +1344,8 @@ static virDriver openvzDriver = {
NULL
,
/* domainGetSecurityLabel */
NULL
,
/* domainGetSecurityLabel */
NULL
,
/* nodeGetSecurityModel */
NULL
,
/* nodeGetSecurityModel */
openvzDomainDumpXML
,
/* domainDumpXML */
openvzDomainDumpXML
,
/* domainDumpXML */
NULL
,
/* domainXmlFromNative */
NULL
,
/* domainXmlToNative */
openvzListDefinedDomains
,
/* listDefinedDomains */
openvzListDefinedDomains
,
/* listDefinedDomains */
openvzNumDefinedDomains
,
/* numOfDefinedDomains */
openvzNumDefinedDomains
,
/* numOfDefinedDomains */
openvzDomainCreate
,
/* domainCreate */
openvzDomainCreate
,
/* domainCreate */
...
...
src/qemu_driver.c
浏览文件 @
4d5383fd
...
@@ -5224,6 +5224,8 @@ static virDriver qemuDriver = {
...
@@ -5224,6 +5224,8 @@ static virDriver qemuDriver = {
qemudDomainGetSecurityLabel
,
/* domainGetSecurityLabel */
qemudDomainGetSecurityLabel
,
/* domainGetSecurityLabel */
qemudNodeGetSecurityModel
,
/* nodeGetSecurityModel */
qemudNodeGetSecurityModel
,
/* nodeGetSecurityModel */
qemudDomainDumpXML
,
/* domainDumpXML */
qemudDomainDumpXML
,
/* domainDumpXML */
NULL
,
/* domainXmlFromNative */
NULL
,
/* domainXmlToNative */
qemudListDefinedDomains
,
/* listDefinedDomains */
qemudListDefinedDomains
,
/* listDefinedDomains */
qemudNumDefinedDomains
,
/* numOfDefinedDomains */
qemudNumDefinedDomains
,
/* numOfDefinedDomains */
qemudDomainStart
,
/* domainCreate */
qemudDomainStart
,
/* domainCreate */
...
...
src/remote_internal.c
浏览文件 @
4d5383fd
...
@@ -7301,6 +7301,8 @@ static virDriver driver = {
...
@@ -7301,6 +7301,8 @@ static virDriver driver = {
remoteDomainGetSecurityLabel
,
/* domainGetSecurityLabel */
remoteDomainGetSecurityLabel
,
/* domainGetSecurityLabel */
remoteNodeGetSecurityModel
,
/* nodeGetSecurityModel */
remoteNodeGetSecurityModel
,
/* nodeGetSecurityModel */
remoteDomainDumpXML
,
/* domainDumpXML */
remoteDomainDumpXML
,
/* domainDumpXML */
NULL
,
/* domainXmlFromNative */
NULL
,
/* domainXmlToNative */
remoteListDefinedDomains
,
/* listDefinedDomains */
remoteListDefinedDomains
,
/* listDefinedDomains */
remoteNumOfDefinedDomains
,
/* numOfDefinedDomains */
remoteNumOfDefinedDomains
,
/* numOfDefinedDomains */
remoteDomainCreate
,
/* domainCreate */
remoteDomainCreate
,
/* domainCreate */
...
...
src/test.c
浏览文件 @
4d5383fd
...
@@ -3591,6 +3591,8 @@ static virDriver testDriver = {
...
@@ -3591,6 +3591,8 @@ static virDriver testDriver = {
NULL
,
/* domainGetSecurityLabel */
NULL
,
/* domainGetSecurityLabel */
NULL
,
/* nodeGetSecurityModel */
NULL
,
/* nodeGetSecurityModel */
testDomainDumpXML
,
/* domainDumpXML */
testDomainDumpXML
,
/* domainDumpXML */
NULL
,
/* domainXmlFromNative */
NULL
,
/* domainXmlToNative */
testListDefinedDomains
,
/* listDefinedDomains */
testListDefinedDomains
,
/* listDefinedDomains */
testNumOfDefinedDomains
,
/* numOfDefinedDomains */
testNumOfDefinedDomains
,
/* numOfDefinedDomains */
testDomainCreate
,
/* domainCreate */
testDomainCreate
,
/* domainCreate */
...
...
src/uml_driver.c
浏览文件 @
4d5383fd
...
@@ -1854,6 +1854,8 @@ static virDriver umlDriver = {
...
@@ -1854,6 +1854,8 @@ static virDriver umlDriver = {
NULL
,
/* domainGetSecurityLabel */
NULL
,
/* domainGetSecurityLabel */
NULL
,
/* nodeGetSecurityModel */
NULL
,
/* nodeGetSecurityModel */
umlDomainDumpXML
,
/* domainDumpXML */
umlDomainDumpXML
,
/* domainDumpXML */
NULL
,
/* domainXmlFromNative */
NULL
,
/* domainXmlToNative */
umlListDefinedDomains
,
/* listDefinedDomains */
umlListDefinedDomains
,
/* listDefinedDomains */
umlNumDefinedDomains
,
/* numOfDefinedDomains */
umlNumDefinedDomains
,
/* numOfDefinedDomains */
umlDomainStart
,
/* domainCreate */
umlDomainStart
,
/* domainCreate */
...
...
src/virsh.c
浏览文件 @
4d5383fd
...
@@ -2209,6 +2209,98 @@ cmdDumpXML(vshControl *ctl, const vshCmd *cmd)
...
@@ -2209,6 +2209,98 @@ cmdDumpXML(vshControl *ctl, const vshCmd *cmd)
return
ret
;
return
ret
;
}
}
/*
* "domxml-from-native" command
*/
static
const
vshCmdInfo
info_domxmlfromnative
[]
=
{
{
"help"
,
gettext_noop
(
"Convert native config to domain XML"
)},
{
"desc"
,
gettext_noop
(
"Convert native guest configuration format to domain XML format."
)},
{
NULL
,
NULL
}
};
static
const
vshCmdOptDef
opts_domxmlfromnative
[]
=
{
{
"format"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
gettext_noop
(
"source config data format"
)},
{
"config"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
gettext_noop
(
"config data file to import from"
)},
{
NULL
,
0
,
0
,
NULL
}
};
static
int
cmdDomXMLFromNative
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
)
{
int
ret
=
TRUE
;
char
*
format
;
char
*
configFile
;
char
*
configData
;
char
*
xmlData
;
int
flags
=
0
;
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
format
=
vshCommandOptString
(
cmd
,
"format"
,
NULL
);
configFile
=
vshCommandOptString
(
cmd
,
"config"
,
NULL
);
if
(
virFileReadAll
(
configFile
,
1024
*
1024
,
&
configData
)
<
0
)
{
return
FALSE
;
}
xmlData
=
virConnectDomainXMLFromNative
(
ctl
->
conn
,
format
,
configData
,
flags
);
if
(
xmlData
!=
NULL
)
{
printf
(
"%s"
,
xmlData
);
free
(
xmlData
);
}
else
{
ret
=
FALSE
;
}
return
ret
;
}
/*
* "domxml-to-native" command
*/
static
const
vshCmdInfo
info_domxmltonative
[]
=
{
{
"help"
,
gettext_noop
(
"Convert domain XML to native config"
)},
{
"desc"
,
gettext_noop
(
"Convert domain XML config to a native guest configuration format."
)},
{
NULL
,
NULL
}
};
static
const
vshCmdOptDef
opts_domxmltonative
[]
=
{
{
"format"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
gettext_noop
(
"target config data type format"
)},
{
"xml"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
gettext_noop
(
"xml data file to export from"
)},
{
NULL
,
0
,
0
,
NULL
}
};
static
int
cmdDomXMLToNative
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
)
{
int
ret
=
TRUE
;
char
*
format
;
char
*
xmlFile
;
char
*
configData
;
char
*
xmlData
;
int
flags
=
0
;
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
format
=
vshCommandOptString
(
cmd
,
"format"
,
NULL
);
xmlFile
=
vshCommandOptString
(
cmd
,
"xml"
,
NULL
);
if
(
virFileReadAll
(
xmlFile
,
1024
*
1024
,
&
xmlData
)
<
0
)
{
return
FALSE
;
}
configData
=
virConnectDomainXMLToNative
(
ctl
->
conn
,
format
,
xmlData
,
flags
);
if
(
configData
!=
NULL
)
{
printf
(
"%s"
,
configData
);
free
(
configData
);
}
else
{
ret
=
FALSE
;
}
return
ret
;
}
/*
/*
* "domname" command
* "domname" command
*/
*/
...
@@ -6030,6 +6122,8 @@ static const vshCmdDef commands[] = {
...
@@ -6030,6 +6122,8 @@ static const vshCmdDef commands[] = {
{
"domstate"
,
cmdDomstate
,
opts_domstate
,
info_domstate
},
{
"domstate"
,
cmdDomstate
,
opts_domstate
,
info_domstate
},
{
"domblkstat"
,
cmdDomblkstat
,
opts_domblkstat
,
info_domblkstat
},
{
"domblkstat"
,
cmdDomblkstat
,
opts_domblkstat
,
info_domblkstat
},
{
"domifstat"
,
cmdDomIfstat
,
opts_domifstat
,
info_domifstat
},
{
"domifstat"
,
cmdDomIfstat
,
opts_domifstat
,
info_domifstat
},
{
"domxml-from-native"
,
cmdDomXMLFromNative
,
opts_domxmlfromnative
,
info_domxmlfromnative
},
{
"domxml-to-native"
,
cmdDomXMLToNative
,
opts_domxmltonative
,
info_domxmltonative
},
{
"dumpxml"
,
cmdDumpXML
,
opts_dumpxml
,
info_dumpxml
},
{
"dumpxml"
,
cmdDumpXML
,
opts_dumpxml
,
info_dumpxml
},
{
"edit"
,
cmdEdit
,
opts_edit
,
info_edit
},
{
"edit"
,
cmdEdit
,
opts_edit
,
info_edit
},
{
"find-storage-pool-sources"
,
cmdPoolDiscoverSources
,
{
"find-storage-pool-sources"
,
cmdPoolDiscoverSources
,
...
...
src/xen_unified.c
浏览文件 @
4d5383fd
...
@@ -1580,6 +1580,8 @@ static virDriver xenUnifiedDriver = {
...
@@ -1580,6 +1580,8 @@ static virDriver xenUnifiedDriver = {
NULL
,
/* domainGetSecurityLabel */
NULL
,
/* domainGetSecurityLabel */
NULL
,
/* nodeGetSecurityModel */
NULL
,
/* nodeGetSecurityModel */
xenUnifiedDomainDumpXML
,
/* domainDumpXML */
xenUnifiedDomainDumpXML
,
/* domainDumpXML */
NULL
,
/* domainXmlFromNative */
NULL
,
/* domainXmlToNative */
xenUnifiedListDefinedDomains
,
/* listDefinedDomains */
xenUnifiedListDefinedDomains
,
/* listDefinedDomains */
xenUnifiedNumOfDefinedDomains
,
/* numOfDefinedDomains */
xenUnifiedNumOfDefinedDomains
,
/* numOfDefinedDomains */
xenUnifiedDomainCreate
,
/* domainCreate */
xenUnifiedDomainCreate
,
/* domainCreate */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录