Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
d16d90fd
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,发现更多精彩内容 >>
提交
d16d90fd
编写于
10月 31, 2013
作者:
J
Ján Tomko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a name to virPortAllocator
This allows its error messages to be more specific.
上级
28ea39a0
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
20 addition
and
9 deletion
+20
-9
src/libxl/libxl_driver.c
src/libxl/libxl_driver.c
+2
-1
src/qemu/qemu_driver.c
src/qemu/qemu_driver.c
+6
-3
src/util/virportallocator.c
src/util/virportallocator.c
+8
-2
src/util/virportallocator.h
src/util/virportallocator.h
+2
-1
tests/virportallocatortest.c
tests/virportallocatortest.c
+2
-2
未找到文件。
src/libxl/libxl_driver.c
浏览文件 @
d16d90fd
...
...
@@ -844,7 +844,8 @@ libxlStateInitialize(bool privileged,
/* Allocate bitmap for vnc port reservation */
if
(
!
(
libxl_driver
->
reservedVNCPorts
=
virPortAllocatorNew
(
LIBXL_VNC_PORT_MIN
,
virPortAllocatorNew
(
_
(
"VNC"
),
LIBXL_VNC_PORT_MIN
,
LIBXL_VNC_PORT_MAX
)))
goto
error
;
...
...
src/qemu/qemu_driver.c
浏览文件 @
d16d90fd
...
...
@@ -678,17 +678,20 @@ qemuStateInitialize(bool privileged,
* do this before the config is loaded properly, since the port
* numbers are configurable now */
if
((
qemu_driver
->
remotePorts
=
virPortAllocatorNew
(
cfg
->
remotePortMin
,
virPortAllocatorNew
(
_
(
"display"
),
cfg
->
remotePortMin
,
cfg
->
remotePortMax
))
==
NULL
)
goto
error
;
if
((
qemu_driver
->
webSocketPorts
=
virPortAllocatorNew
(
cfg
->
webSocketPortMin
,
virPortAllocatorNew
(
_
(
"webSocket"
),
cfg
->
webSocketPortMin
,
cfg
->
webSocketPortMax
))
==
NULL
)
goto
error
;
if
((
qemu_driver
->
migrationPorts
=
virPortAllocatorNew
(
cfg
->
migrationPortMin
,
virPortAllocatorNew
(
_
(
"migration"
),
cfg
->
migrationPortMin
,
cfg
->
migrationPortMax
))
==
NULL
)
goto
error
;
...
...
src/util/virportallocator.c
浏览文件 @
d16d90fd
...
...
@@ -31,6 +31,7 @@
#include "virthread.h"
#include "virerror.h"
#include "virfile.h"
#include "virstring.h"
#define VIR_FROM_THIS VIR_FROM_NONE
...
...
@@ -38,6 +39,8 @@ struct _virPortAllocator {
virObjectLockable
parent
;
virBitmapPtr
bitmap
;
char
*
name
;
unsigned
short
start
;
unsigned
short
end
;
};
...
...
@@ -50,6 +53,7 @@ virPortAllocatorDispose(void *obj)
virPortAllocatorPtr
pa
=
obj
;
virBitmapFree
(
pa
->
bitmap
);
VIR_FREE
(
pa
->
name
);
}
static
int
virPortAllocatorOnceInit
(
void
)
...
...
@@ -65,7 +69,8 @@ static int virPortAllocatorOnceInit(void)
VIR_ONCE_GLOBAL_INIT
(
virPortAllocator
)
virPortAllocatorPtr
virPortAllocatorNew
(
unsigned
short
start
,
virPortAllocatorPtr
virPortAllocatorNew
(
const
char
*
name
,
unsigned
short
start
,
unsigned
short
end
)
{
virPortAllocatorPtr
pa
;
...
...
@@ -85,7 +90,8 @@ virPortAllocatorPtr virPortAllocatorNew(unsigned short start,
pa
->
start
=
start
;
pa
->
end
=
end
;
if
(
!
(
pa
->
bitmap
=
virBitmapNew
((
end
-
start
)
+
1
)))
{
if
(
!
(
pa
->
bitmap
=
virBitmapNew
((
end
-
start
)
+
1
))
||
VIR_STRDUP
(
pa
->
name
,
name
)
<
0
)
{
virObjectUnref
(
pa
);
return
NULL
;
}
...
...
src/util/virportallocator.h
浏览文件 @
d16d90fd
...
...
@@ -28,7 +28,8 @@
typedef
struct
_virPortAllocator
virPortAllocator
;
typedef
virPortAllocator
*
virPortAllocatorPtr
;
virPortAllocatorPtr
virPortAllocatorNew
(
unsigned
short
start
,
virPortAllocatorPtr
virPortAllocatorNew
(
const
char
*
name
,
unsigned
short
start
,
unsigned
short
end
);
int
virPortAllocatorAcquire
(
virPortAllocatorPtr
pa
,
...
...
tests/virportallocatortest.c
浏览文件 @
d16d90fd
...
...
@@ -63,7 +63,7 @@ int bind(int sockfd ATTRIBUTE_UNUSED,
static
int
testAllocAll
(
const
void
*
args
ATTRIBUTE_UNUSED
)
{
virPortAllocatorPtr
alloc
=
virPortAllocatorNew
(
5900
,
5909
);
virPortAllocatorPtr
alloc
=
virPortAllocatorNew
(
"test"
,
5900
,
5909
);
int
ret
=
-
1
;
unsigned
short
p1
,
p2
,
p3
,
p4
,
p5
,
p6
,
p7
;
...
...
@@ -136,7 +136,7 @@ cleanup:
static
int
testAllocReuse
(
const
void
*
args
ATTRIBUTE_UNUSED
)
{
virPortAllocatorPtr
alloc
=
virPortAllocatorNew
(
5900
,
5910
);
virPortAllocatorPtr
alloc
=
virPortAllocatorNew
(
"test"
,
5900
,
5910
);
int
ret
=
-
1
;
unsigned
short
p1
,
p2
,
p3
,
p4
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录