Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
145bb1e8
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,发现更多精彩内容 >>
提交
145bb1e8
编写于
11月 21, 2008
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Misc tweaks to node device impl
上级
83928c20
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
36 addition
and
29 deletion
+36
-29
ChangeLog
ChangeLog
+11
-0
src/libvirt.c
src/libvirt.c
+3
-0
src/node_device_conf.c
src/node_device_conf.c
+7
-12
src/node_device_conf.h
src/node_device_conf.h
+1
-4
src/node_device_devkit.c
src/node_device_devkit.c
+5
-4
src/node_device_hal.c
src/node_device_hal.c
+8
-9
src/virsh.c
src/virsh.c
+1
-0
未找到文件。
ChangeLog
浏览文件 @
145bb1e8
Fri Nov 21 12:46:14 BST 2008 Daniel P. Berrange <berrange@redhat.com>
Misc tweaks to node device impl
* src/libvirt.c: Log registration of new node device driver impls
* src/node_device_conf.h, src/node_device.c: Merge block capability
into storage. Print vendor/product IDs in hex
* src/node_device_devkit.c: Change block to storage
* src/node_device_hal.c: Merge block cap into storage. Skip
devices without any capabilities listed
* src/virsh.c: Sort device list alphabetically
Fri Nov 21 12:40:14 BST 2008 Daniel P. Berrange <berrange@redhat.com>
Python binding for node device APIs (David Lively)
...
...
src/libvirt.c
浏览文件 @
145bb1e8
...
...
@@ -562,6 +562,9 @@ virRegisterDeviceMonitor(virDeviceMonitorPtr driver)
return
(
-
1
);
}
DEBUG
(
"registering %s as device driver %d"
,
driver
->
name
,
virDeviceMonitorTabCount
);
virDeviceMonitorTab
[
virDeviceMonitorTabCount
]
=
driver
;
return
virDeviceMonitorTabCount
++
;
}
...
...
src/node_device_conf.c
浏览文件 @
145bb1e8
...
...
@@ -43,7 +43,6 @@ VIR_ENUM_IMPL(virNodeDevCap, VIR_NODE_DEV_CAP_LAST,
"usb_device"
,
"usb"
,
"net"
,
"block"
,
"scsi_host"
,
"scsi"
,
"storage"
);
...
...
@@ -221,14 +220,14 @@ char *virNodeDeviceDefFormat(virConnectPtr conn,
data
->
pci_dev
.
slot
);
virBufferVSprintf
(
&
buf
,
" <function>%d</function>
\n
"
,
data
->
pci_dev
.
function
);
virBufferVSprintf
(
&
buf
,
" <product id='
%d
'"
,
virBufferVSprintf
(
&
buf
,
" <product id='
0x%04x
'"
,
data
->
pci_dev
.
product
);
if
(
data
->
pci_dev
.
product_name
)
virBufferEscapeString
(
&
buf
,
">%s</product>
\n
"
,
data
->
pci_dev
.
product_name
);
else
virBufferAddLit
(
&
buf
,
" />
\n
"
);
virBufferVSprintf
(
&
buf
,
" <vendor id='
%d
'"
,
virBufferVSprintf
(
&
buf
,
" <vendor id='
0x%04x
'"
,
data
->
pci_dev
.
vendor
);
if
(
data
->
pci_dev
.
vendor_name
)
virBufferEscapeString
(
&
buf
,
">%s</vendor>
\n
"
,
...
...
@@ -240,14 +239,14 @@ char *virNodeDeviceDefFormat(virConnectPtr conn,
virBufferVSprintf
(
&
buf
,
" <bus>%d</bus>
\n
"
,
data
->
usb_dev
.
bus
);
virBufferVSprintf
(
&
buf
,
" <device>%d</device>
\n
"
,
data
->
usb_dev
.
device
);
virBufferVSprintf
(
&
buf
,
" <product id='
%d
'"
,
virBufferVSprintf
(
&
buf
,
" <product id='
0x%04x
'"
,
data
->
usb_dev
.
product
);
if
(
data
->
usb_dev
.
product_name
)
virBufferEscapeString
(
&
buf
,
">%s</product>
\n
"
,
data
->
usb_dev
.
product_name
);
else
virBufferAddLit
(
&
buf
,
" />
\n
"
);
virBufferVSprintf
(
&
buf
,
" <vendor id='
%d
'"
,
virBufferVSprintf
(
&
buf
,
" <vendor id='
0x%04x
'"
,
data
->
usb_dev
.
vendor
);
if
(
data
->
usb_dev
.
vendor_name
)
virBufferEscapeString
(
&
buf
,
">%s</vendor>
\n
"
,
...
...
@@ -280,10 +279,6 @@ char *virNodeDeviceDefFormat(virConnectPtr conn,
virBufferVSprintf
(
&
buf
,
" <capability type='%s'/>
\n
"
,
subtyp
);
}
break
;
case
VIR_NODE_DEV_CAP_BLOCK
:
virBufferVSprintf
(
&
buf
,
" <device>%s</device>
\n
"
,
data
->
block
.
device
);
break
;
case
VIR_NODE_DEV_CAP_SCSI_HOST
:
virBufferVSprintf
(
&
buf
,
" <host>%d</host>
\n
"
,
data
->
scsi_host
.
host
);
...
...
@@ -299,6 +294,8 @@ char *virNodeDeviceDefFormat(virConnectPtr conn,
data
->
scsi
.
type
);
break
;
case
VIR_NODE_DEV_CAP_STORAGE
:
virBufferVSprintf
(
&
buf
,
" <block>%s</block>
\n
"
,
data
->
storage
.
block
);
if
(
data
->
storage
.
bus
)
virBufferVSprintf
(
&
buf
,
" <bus>%s</bus>
\n
"
,
data
->
storage
.
bus
);
...
...
@@ -380,15 +377,13 @@ void virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
VIR_FREE
(
data
->
net
.
interface
);
VIR_FREE
(
data
->
net
.
address
);
break
;
case
VIR_NODE_DEV_CAP_BLOCK
:
VIR_FREE
(
data
->
block
.
device
);
break
;
case
VIR_NODE_DEV_CAP_SCSI_HOST
:
break
;
case
VIR_NODE_DEV_CAP_SCSI
:
VIR_FREE
(
data
->
scsi
.
type
);
break
;
case
VIR_NODE_DEV_CAP_STORAGE
:
VIR_FREE
(
data
->
storage
.
block
);
VIR_FREE
(
data
->
storage
.
bus
);
VIR_FREE
(
data
->
storage
.
drive_type
);
VIR_FREE
(
data
->
storage
.
model
);
...
...
src/node_device_conf.h
浏览文件 @
145bb1e8
...
...
@@ -34,7 +34,6 @@ enum virNodeDevCapType {
VIR_NODE_DEV_CAP_USB_DEV
,
/* USB device */
VIR_NODE_DEV_CAP_USB_INTERFACE
,
/* USB interface */
VIR_NODE_DEV_CAP_NET
,
/* Network device */
VIR_NODE_DEV_CAP_BLOCK
,
/* Block device */
VIR_NODE_DEV_CAP_SCSI_HOST
,
/* SCSI Host Bus Adapter */
VIR_NODE_DEV_CAP_SCSI
,
/* SCSI device */
VIR_NODE_DEV_CAP_STORAGE
,
/* Storage device */
...
...
@@ -106,9 +105,6 @@ struct _virNodeDevCapsDef {
char
*
interface
;
enum
virNodeDevNetCapType
subtype
;
/* LAST -> no subtype */
}
net
;
struct
{
char
*
device
;
}
block
;
struct
{
unsigned
host
;
}
scsi_host
;
...
...
@@ -122,6 +118,7 @@ struct _virNodeDevCapsDef {
struct
{
unsigned
long
long
size
;
unsigned
long
long
removable_media_size
;
char
*
block
;
char
*
bus
;
char
*
drive_type
;
char
*
model
;
...
...
src/node_device_devkit.c
浏览文件 @
145bb1e8
...
...
@@ -31,6 +31,7 @@
#include "event.h"
#include "memory.h"
#include "uuid.h"
#include "logging.h"
#include "node_device.h"
...
...
@@ -133,12 +134,12 @@ static int gather_net_cap(DevkitDevice *dkdev,
}
static
int
gather_
block
_cap
(
DevkitDevice
*
dkdev
,
union
_virNodeDevCapData
*
d
)
static
int
gather_
storage
_cap
(
DevkitDevice
*
dkdev
,
union
_virNodeDevCapData
*
d
)
{
const
char
*
device
=
devkit_device_get_device_file
(
dkdev
);
if
(
device
&&
((
d
->
block
.
device
=
strdup
(
device
))
==
NULL
))
if
(
device
&&
((
d
->
storage
.
block
=
strdup
(
device
))
==
NULL
))
return
-
1
;
return
0
;
...
...
@@ -158,7 +159,7 @@ static caps_tbl_entry caps_tbl[] = {
{
"pci"
,
VIR_NODE_DEV_CAP_PCI_DEV
,
gather_pci_cap
},
{
"usb"
,
VIR_NODE_DEV_CAP_USB_DEV
,
gather_usb_cap
},
{
"net"
,
VIR_NODE_DEV_CAP_NET
,
gather_net_cap
},
{
"block"
,
VIR_NODE_DEV_CAP_
BLOCK
,
gather_block
_cap
},
{
"block"
,
VIR_NODE_DEV_CAP_
STORAGE
,
gather_storage
_cap
},
// TODO: more caps!
};
...
...
src/node_device_hal.c
浏览文件 @
145bb1e8
...
...
@@ -211,14 +211,6 @@ static int gather_net_cap(LibHalContext *ctx, const char *udi,
}
static
int
gather_block_cap
(
LibHalContext
*
ctx
,
const
char
*
udi
,
union
_virNodeDevCapData
*
d
)
{
(
void
)
get_str_prop
(
ctx
,
udi
,
"block.device"
,
&
d
->
block
.
device
);
return
0
;
}
static
int
gather_scsi_host_cap
(
LibHalContext
*
ctx
,
const
char
*
udi
,
union
_virNodeDevCapData
*
d
)
{
...
...
@@ -243,6 +235,7 @@ static int gather_storage_cap(LibHalContext *ctx, const char *udi,
union
_virNodeDevCapData
*
d
)
{
int
val
;
(
void
)
get_str_prop
(
ctx
,
udi
,
"block.device"
,
&
d
->
storage
.
block
);
(
void
)
get_str_prop
(
ctx
,
udi
,
"storage.bus"
,
&
d
->
storage
.
bus
);
(
void
)
get_str_prop
(
ctx
,
udi
,
"storage.drive_type"
,
&
d
->
storage
.
drive_type
);
(
void
)
get_str_prop
(
ctx
,
udi
,
"storage.model"
,
&
d
->
storage
.
model
);
...
...
@@ -307,7 +300,6 @@ static caps_tbl_entry caps_tbl[] = {
{
"usb"
,
VIR_NODE_DEV_CAP_USB_INTERFACE
,
gather_usb_cap
},
{
"usb_device"
,
VIR_NODE_DEV_CAP_USB_DEV
,
gather_usb_device_cap
},
{
"net"
,
VIR_NODE_DEV_CAP_NET
,
gather_net_cap
},
{
"block"
,
VIR_NODE_DEV_CAP_BLOCK
,
gather_block_cap
},
{
"scsi_host"
,
VIR_NODE_DEV_CAP_SCSI_HOST
,
gather_scsi_host_cap
},
{
"scsi"
,
VIR_NODE_DEV_CAP_SCSI
,
gather_scsi_cap
},
{
"storage"
,
VIR_NODE_DEV_CAP_STORAGE
,
gather_storage_cap
},
...
...
@@ -438,6 +430,13 @@ static void dev_create(char *udi)
rv
=
gather_capabilities
(
ctx
,
udi
,
&
dev
->
def
->
caps
);
if
(
rv
!=
0
)
goto
failure
;
if
(
dev
->
def
->
caps
==
NULL
)
{
virNodeDeviceDefFree
(
dev
->
def
);
VIR_FREE
(
dev
);
VIR_FREE
(
udi
);
return
;
}
if
(
VIR_REALLOC_N
(
driverState
->
devs
.
objs
,
driverState
->
devs
.
count
+
1
)
<
0
)
goto
failure
;
...
...
src/virsh.c
浏览文件 @
145bb1e8
...
...
@@ -4462,6 +4462,7 @@ cmdNodeListDevices (vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
free
(
devices
);
return
FALSE
;
}
qsort
(
&
devices
[
0
],
num_devices
,
sizeof
(
char
*
),
namesorter
);
for
(
i
=
0
;
i
<
num_devices
;
i
++
)
{
vshPrint
(
ctl
,
"%s
\n
"
,
devices
[
i
]);
free
(
devices
[
i
]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录