Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
51fded0b
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,发现更多精彩内容 >>
提交
51fded0b
编写于
12月 29, 2011
作者:
H
Hu Tao
提交者:
Osier Yang
12月 29, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
domiftune: virDomain{S,G}etInterfaceParameters: the main entry points
* src/libvirt.c: implement the main entry points
上级
85f3493f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
130 addition
and
0 deletion
+130
-0
src/libvirt.c
src/libvirt.c
+130
-0
未找到文件。
src/libvirt.c
浏览文件 @
51fded0b
...
...
@@ -7075,6 +7075,136 @@ error:
return
-
1
;
}
/**
* virDomainSetInterfaceParameters:
* @domain: pointer to domain object
* @device: the interface name or mac address
* @params: pointer to interface parameter objects
* @nparams: number of interface parameter (this value can be the same or
* less than the number of parameters supported)
* @flags: bitwise-OR of virDomainModificationImpact
*
* Currently this function sets bandwidth parameters of interface.
* This function may require privileged access to the hypervisor.
*
* Returns -1 in case of error, 0 in case of success.
*/
int
virDomainSetInterfaceParameters
(
virDomainPtr
domain
,
const
char
*
device
,
virTypedParameterPtr
params
,
int
nparams
,
unsigned
int
flags
)
{
virConnectPtr
conn
;
VIR_DOMAIN_DEBUG
(
domain
,
"device=%s, params=%p, nparams=%d, flags=%x"
,
device
,
params
,
nparams
,
flags
);
virResetLastError
();
if
(
!
VIR_IS_CONNECTED_DOMAIN
(
domain
))
{
virLibDomainError
(
VIR_ERR_INVALID_DOMAIN
,
__FUNCTION__
);
virDispatchError
(
NULL
);
return
-
1
;
}
if
(
domain
->
conn
->
flags
&
VIR_CONNECT_RO
)
{
virLibDomainError
(
VIR_ERR_OPERATION_DENIED
,
__FUNCTION__
);
goto
error
;
}
if
((
nparams
<=
0
)
||
(
params
==
NULL
))
{
virLibDomainError
(
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
goto
error
;
}
if
(
virTypedParameterValidateSet
(
domain
,
params
,
nparams
)
<
0
)
return
-
1
;
conn
=
domain
->
conn
;
if
(
conn
->
driver
->
domainSetInterfaceParameters
)
{
int
ret
;
ret
=
conn
->
driver
->
domainSetInterfaceParameters
(
domain
,
device
,
params
,
nparams
,
flags
);
if
(
ret
<
0
)
goto
error
;
return
ret
;
}
virLibConnError
(
VIR_ERR_NO_SUPPORT
,
__FUNCTION__
);
error:
virDispatchError
(
domain
->
conn
);
return
-
1
;
}
/**
* virDomainGetInterfaceParameters:
* @domain: pointer to domain object
* @device: the interface name or mac address
* @params: pointer to interface parameter objects
* (return value, allocated by the caller)
* @nparams: pointer to number of interface parameter
* @flags: one of virDomainModificationImpact
*
* Get all interface parameters. On input, @nparams gives the size of
* the @params array; on output, @nparams gives how many slots were
* filled with parameter information, which might be less but will not
* exceed the input value.
*
* As a special case, calling with @params as NULL and @nparams as 0 on
* input will cause @nparams on output to contain the number of parameters
* supported by the hypervisor. The caller should then allocate @params
* array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call the
* API again. See virDomainGetMemoryParameters() for an equivalent usage
* example.
*
* This function may require privileged access to the hypervisor. This function
* expects the caller to allocate the @params.
*
* Returns -1 in case of error, 0 in case of success.
*/
int
virDomainGetInterfaceParameters
(
virDomainPtr
domain
,
const
char
*
device
,
virTypedParameterPtr
params
,
int
*
nparams
,
unsigned
int
flags
)
{
virConnectPtr
conn
;
VIR_DOMAIN_DEBUG
(
domain
,
"device=%s, params=%p, nparams=%d, flags=%x"
,
device
,
params
,
(
nparams
)
?
*
nparams
:
-
1
,
flags
);
virResetLastError
();
if
(
!
VIR_IS_CONNECTED_DOMAIN
(
domain
))
{
virLibDomainError
(
VIR_ERR_INVALID_DOMAIN
,
__FUNCTION__
);
virDispatchError
(
NULL
);
return
-
1
;
}
if
((
nparams
==
NULL
)
||
(
*
nparams
<
0
)
||
(
params
==
NULL
&&
*
nparams
!=
0
))
{
virLibDomainError
(
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
goto
error
;
}
if
(
VIR_DRV_SUPPORTS_FEATURE
(
domain
->
conn
->
driver
,
domain
->
conn
,
VIR_DRV_FEATURE_TYPED_PARAM_STRING
))
flags
|=
VIR_TYPED_PARAM_STRING_OKAY
;
conn
=
domain
->
conn
;
if
(
conn
->
driver
->
domainGetInterfaceParameters
)
{
int
ret
;
ret
=
conn
->
driver
->
domainGetInterfaceParameters
(
domain
,
device
,
params
,
nparams
,
flags
);
if
(
ret
<
0
)
goto
error
;
return
ret
;
}
virLibConnError
(
VIR_ERR_NO_SUPPORT
,
__FUNCTION__
);
error:
virDispatchError
(
domain
->
conn
);
return
-
1
;
}
/**
* virDomainMemoryStats:
* @dom: pointer to the domain object
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录