Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
e63d75bc
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e63d75bc
编写于
5月 05, 2011
作者:
M
Michal Privoznik
提交者:
Laine Stump
5月 27, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
interface: implement public APIs for libvirt transactional network changes
上级
b1f102ed
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
180 addition
and
2 deletion
+180
-2
src/libvirt.c
src/libvirt.c
+180
-2
未找到文件。
src/libvirt.c
浏览文件 @
e63d75bc
...
...
@@ -8506,7 +8506,18 @@ error:
* @xml: the XML description for the interface, preferably in UTF-8
* @flags: and OR'ed set of extraction flags, not used yet
*
* Define an interface (or modify existing interface configuration)
* Define an interface (or modify existing interface configuration).
*
* Normally this change in the interface configuration is immediately
* permanent/persistent, but if virInterfaceChangeBegin() has been
* previously called (i.e. if an interface config transaction is
* open), the new interface definition will only become permanent if
* virInterfaceChangeCommit() is called prior to the next reboot of
* the system running libvirtd. Prior to that time, it can be
* explicitly removed using virInterfaceChangeRollback(), or will be
* automatically removed during the next reboot of the system running
* libvirtd.
*
* Returns NULL in case of error, a pointer to the interface otherwise
*/
...
...
@@ -8553,6 +8564,16 @@ error:
* Undefine an interface, ie remove it from the config.
* This does not free the associated virInterfacePtr object.
*
* Normally this change in the interface configuration is
* permanent/persistent, but if virInterfaceChangeBegin() has been
* previously called (i.e. if an interface config transaction is
* open), the removal of the interface definition will only become
* permanent if virInterfaceChangeCommit() is called prior to the next
* reboot of the system running libvirtd. Prior to that time, the
* definition can be explicitly restored using
* virInterfaceChangeRollback(), or will be automatically restored
* during the next reboot of the system running libvirtd.
*
* Returns 0 in case of success, -1 in case of error
*/
int
...
...
@@ -8593,8 +8614,13 @@ error:
* @iface: pointer to a defined interface
* @flags: and OR'ed set of extraction flags, not used yet
*
* Activate an interface (i
e call "ifup")
* Activate an interface (i
.e. call "ifup").
*
* If there was an open network config transaction at the time this
* interface was defined (that is, if virInterfaceChangeBegin() had
* been called), the interface will be brought back down (and then
* undefined) if virInterfaceChangeRollback() is called.
p *
* Returns 0 in case of success, -1 in case of error
*/
int
...
...
@@ -8640,6 +8666,13 @@ error:
* This does not remove the interface from the config, and
* does not free the associated virInterfacePtr object.
*
* If there is an open network config transaction at the time this
* interface is destroyed (that is, if virInterfaceChangeBegin() had
* been called), and if the interface is later undefined and then
* virInterfaceChangeRollback() is called, the restoral of the
* interface definition will also bring the interface back up.
*
* Returns 0 in case of success and -1 in case of failure.
*/
int
...
...
@@ -8737,6 +8770,151 @@ virInterfaceFree(virInterfacePtr iface)
return
0
;
}
/**
* virInterfaceChangeBegin:
* @conn: pointer to hypervisor connection
* @flags: flags, not used yet
*
* This functions creates a restore point to which one can return
* later by calling virInterfaceChangeRollback(). This function should
* be called before any transaction with interface configuration.
* Once knowing, new configuration works, it can be commited via
* virInterfaceChangeCommit(), which frees the restore point.
*
* If virInterfaceChangeBegin() is called when a transaction is
* already opened, this function will fail, and a
* VIR_ERR_INVALID_OPERATION will be logged.
*
* Returns 0 in case of success and -1 in case of failure.
*/
int
virInterfaceChangeBegin
(
virConnectPtr
conn
,
unsigned
int
flags
)
{
VIR_DEBUG
(
"conn=%p, flags=%d"
,
conn
,
flags
);
virResetLastError
();
if
(
!
VIR_IS_CONNECT
(
conn
))
{
virLibConnError
(
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
virDispatchError
(
NULL
);
return
-
1
;
}
if
(
conn
->
flags
&
VIR_CONNECT_RO
)
{
virLibInterfaceError
(
VIR_ERR_OPERATION_DENIED
,
__FUNCTION__
);
goto
error
;
}
if
(
conn
->
interfaceDriver
&&
conn
->
interfaceDriver
->
interfaceChangeBegin
)
{
int
ret
;
ret
=
conn
->
interfaceDriver
->
interfaceChangeBegin
(
conn
,
flags
);
if
(
ret
<
0
)
goto
error
;
return
ret
;
}
virLibConnError
(
VIR_ERR_NO_SUPPORT
,
__FUNCTION__
);
error:
virDispatchError
(
conn
);
return
-
1
;
}
/**
* virInterfaceChangeCommit:
* @conn: pointer to hypervisor connection
* @flags: flags, not used yet
*
* This commits the changes made to interfaces and frees the restore point
* created by virInterfaceChangeBegin().
*
* If virInterfaceChangeCommit() is called when a transaction is not
* opened, this function will fail, and a VIR_ERR_INVALID_OPERATION
* will be logged.
*
* Returns 0 in case of success and -1 in case of failure.
*/
int
virInterfaceChangeCommit
(
virConnectPtr
conn
,
unsigned
int
flags
)
{
VIR_DEBUG
(
"conn=%p, flags=%d"
,
conn
,
flags
);
virResetLastError
();
if
(
!
VIR_IS_CONNECT
(
conn
))
{
virLibConnError
(
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
virDispatchError
(
NULL
);
return
-
1
;
}
if
(
conn
->
flags
&
VIR_CONNECT_RO
)
{
virLibInterfaceError
(
VIR_ERR_OPERATION_DENIED
,
__FUNCTION__
);
goto
error
;
}
if
(
conn
->
interfaceDriver
&&
conn
->
interfaceDriver
->
interfaceChangeCommit
)
{
int
ret
;
ret
=
conn
->
interfaceDriver
->
interfaceChangeCommit
(
conn
,
flags
);
if
(
ret
<
0
)
goto
error
;
return
ret
;
}
virLibConnError
(
VIR_ERR_NO_SUPPORT
,
__FUNCTION__
);
error:
virDispatchError
(
conn
);
return
-
1
;
}
/**
* virInterfaceChangeRollback:
* @conn: pointer to hypervisor connection
* @flags: flags, not used yet
*
* This cancels changes made to interfaces settings by restoring previous
* state created by virInterfaceChangeBegin().
*
* If virInterfaceChangeRollback() is called when a transaction is not
* opened, this function will fail, and a VIR_ERR_INVALID_OPERATION
* will be logged.
*
* Returns 0 in case of success and -1 in case of failure.
*/
int
virInterfaceChangeRollback
(
virConnectPtr
conn
,
unsigned
int
flags
)
{
VIR_DEBUG
(
"conn=%p, flags=%d"
,
conn
,
flags
);
virResetLastError
();
if
(
!
VIR_IS_CONNECT
(
conn
))
{
virLibConnError
(
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
virDispatchError
(
NULL
);
return
-
1
;
}
if
(
conn
->
flags
&
VIR_CONNECT_RO
)
{
virLibInterfaceError
(
VIR_ERR_OPERATION_DENIED
,
__FUNCTION__
);
goto
error
;
}
if
(
conn
->
interfaceDriver
&&
conn
->
interfaceDriver
->
interfaceChangeRollback
)
{
int
ret
;
ret
=
conn
->
interfaceDriver
->
interfaceChangeRollback
(
conn
,
flags
);
if
(
ret
<
0
)
goto
error
;
return
ret
;
}
virLibConnError
(
VIR_ERR_NO_SUPPORT
,
__FUNCTION__
);
error:
virDispatchError
(
conn
);
return
-
1
;
}
/**
* virStoragePoolGetConnect:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录