Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
1ea88abd
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看板
提交
1ea88abd
编写于
5月 21, 2013
作者:
O
Osier Yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
src/lxc: Remove the whitespace before ";"
上级
77e2d377
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
41 addition
and
41 deletion
+41
-41
src/lxc/lxc_cgroup.c
src/lxc/lxc_cgroup.c
+2
-2
src/lxc/lxc_container.c
src/lxc/lxc_container.c
+12
-12
src/lxc/lxc_controller.c
src/lxc/lxc_controller.c
+14
-14
src/lxc/lxc_driver.c
src/lxc/lxc_driver.c
+2
-2
src/lxc/lxc_hostdev.c
src/lxc/lxc_hostdev.c
+2
-2
src/lxc/lxc_process.c
src/lxc/lxc_process.c
+9
-9
未找到文件。
src/lxc/lxc_cgroup.c
浏览文件 @
1ea88abd
...
...
@@ -427,7 +427,7 @@ static int virLXCCgroupSetupDeviceACL(virDomainDefPtr def,
}
}
for
(
i
=
0
;
i
<
def
->
ndisks
;
i
++
)
{
for
(
i
=
0
;
i
<
def
->
ndisks
;
i
++
)
{
if
(
def
->
disks
[
i
]
->
type
!=
VIR_DOMAIN_DISK_TYPE_BLOCK
)
continue
;
...
...
@@ -445,7 +445,7 @@ static int virLXCCgroupSetupDeviceACL(virDomainDefPtr def,
}
}
for
(
i
=
0
;
i
<
def
->
nfss
;
i
++
)
{
for
(
i
=
0
;
i
<
def
->
nfss
;
i
++
)
{
if
(
def
->
fss
[
i
]
->
type
!=
VIR_DOMAIN_FS_TYPE_BLOCK
)
continue
;
...
...
src/lxc/lxc_container.c
浏览文件 @
1ea88abd
...
...
@@ -353,7 +353,7 @@ static int lxcContainerRenameAndEnableInterfaces(bool privNet,
size_t
i
;
char
*
newname
=
NULL
;
for
(
i
=
0
;
i
<
nveths
;
i
++
)
{
for
(
i
=
0
;
i
<
nveths
;
i
++
)
{
if
(
virAsprintf
(
&
newname
,
"eth%zu"
,
i
)
<
0
)
{
virReportOOMError
();
rc
=
-
1
;
...
...
@@ -475,7 +475,7 @@ static int lxcContainerUnmountSubtree(const char *prefix,
if
(
lxcContainerGetSubtree
(
prefix
,
&
mounts
,
&
nmounts
)
<
0
)
goto
cleanup
;
for
(
i
=
0
;
i
<
nmounts
;
i
++
)
{
for
(
i
=
0
;
i
<
nmounts
;
i
++
)
{
VIR_DEBUG
(
"Umount %s"
,
mounts
[
i
]);
if
(
umount
(
mounts
[
i
])
<
0
)
{
char
ebuf
[
1024
];
...
...
@@ -509,7 +509,7 @@ static int lxcContainerUnmountSubtree(const char *prefix,
ret
=
0
;
cleanup:
for
(
i
=
0
;
i
<
nmounts
;
i
++
)
for
(
i
=
0
;
i
<
nmounts
;
i
++
)
VIR_FREE
(
mounts
[
i
]);
VIR_FREE
(
mounts
);
...
...
@@ -689,7 +689,7 @@ static int lxcContainerMountBasicFS(char *sec_mount_options)
VIR_DEBUG
(
"Mounting basic filesystems sec_mount_options=%s"
,
sec_mount_options
);
for
(
i
=
0
;
i
<
ARRAY_CARDINALITY
(
mnts
)
;
i
++
)
{
for
(
i
=
0
;
i
<
ARRAY_CARDINALITY
(
mnts
)
;
i
++
)
{
const
char
*
srcpath
=
NULL
;
VIR_DEBUG
(
"Processing %s -> %s"
,
...
...
@@ -849,7 +849,7 @@ static int lxcContainerPopulateDevices(char **ttyPaths, size_t nttyPaths)
};
/* Populate /dev/ with a few important bits */
for
(
i
=
0
;
i
<
ARRAY_CARDINALITY
(
devs
)
;
i
++
)
{
for
(
i
=
0
;
i
<
ARRAY_CARDINALITY
(
devs
)
;
i
++
)
{
dev_t
dev
=
makedev
(
devs
[
i
].
maj
,
devs
[
i
].
min
);
if
(
mknod
(
devs
[
i
].
path
,
S_IFCHR
,
dev
)
<
0
||
chmod
(
devs
[
i
].
path
,
devs
[
i
].
mode
))
{
...
...
@@ -860,7 +860,7 @@ static int lxcContainerPopulateDevices(char **ttyPaths, size_t nttyPaths)
}
}
for
(
i
=
0
;
i
<
ARRAY_CARDINALITY
(
links
)
;
i
++
)
{
for
(
i
=
0
;
i
<
ARRAY_CARDINALITY
(
links
)
;
i
++
)
{
if
(
symlink
(
links
[
i
].
src
,
links
[
i
].
dst
)
<
0
)
{
virReportSystemError
(
errno
,
_
(
"Failed to symlink device %s to %s"
),
...
...
@@ -890,7 +890,7 @@ static int lxcContainerPopulateDevices(char **ttyPaths, size_t nttyPaths)
}
}
for
(
i
=
0
;
i
<
nttyPaths
;
i
++
)
{
for
(
i
=
0
;
i
<
nttyPaths
;
i
++
)
{
char
*
tty
;
if
(
virAsprintf
(
&
tty
,
"/dev/tty%zu"
,
i
+
1
)
<
0
)
{
virReportOOMError
();
...
...
@@ -1356,7 +1356,7 @@ static int lxcContainerMountAllFS(virDomainDefPtr vmDef,
VIR_DEBUG
(
"Mounting all non-root filesystems"
);
/* Pull in rest of container's mounts */
for
(
i
=
0
;
i
<
vmDef
->
nfss
;
i
++
)
{
for
(
i
=
0
;
i
<
vmDef
->
nfss
;
i
++
)
{
if
(
STREQ
(
vmDef
->
fss
[
i
]
->
dst
,
"/"
))
continue
;
...
...
@@ -1460,7 +1460,7 @@ static int lxcContainerSetupAllDisks(virDomainDefPtr vmDef,
size_t
i
;
VIR_DEBUG
(
"Setting up disks"
);
for
(
i
=
0
;
i
<
vmDef
->
ndisks
;
i
++
)
{
for
(
i
=
0
;
i
<
vmDef
->
ndisks
;
i
++
)
{
if
(
lxcContainerSetupDisk
(
vmDef
,
vmDef
->
disks
[
i
],
securityDriver
)
<
0
)
return
-
1
;
...
...
@@ -1702,7 +1702,7 @@ static int lxcContainerSetupAllHostdevs(virDomainDefPtr vmDef,
size_t
i
;
VIR_DEBUG
(
"Setting up hostdevs"
);
for
(
i
=
0
;
i
<
vmDef
->
nhostdevs
;
i
++
)
{
for
(
i
=
0
;
i
<
vmDef
->
nhostdevs
;
i
++
)
{
virDomainHostdevDefPtr
def
=
vmDef
->
hostdevs
[
i
];
switch
(
def
->
mode
)
{
case
VIR_DOMAIN_HOSTDEV_MODE_SUBSYS
:
...
...
@@ -1840,7 +1840,7 @@ static int lxcContainerResolveSymlinks(virDomainDefPtr vmDef)
char
*
newroot
;
size_t
i
;
for
(
i
=
0
;
i
<
vmDef
->
nfss
;
i
++
)
{
for
(
i
=
0
;
i
<
vmDef
->
nfss
;
i
++
)
{
virDomainFSDefPtr
fs
=
vmDef
->
fss
[
i
];
if
(
!
fs
->
src
)
continue
;
...
...
@@ -2070,7 +2070,7 @@ lxcNeedNetworkNamespace(virDomainDefPtr def)
return
true
;
if
(
def
->
features
&
(
1
<<
VIR_DOMAIN_FEATURE_PRIVNET
))
return
true
;
for
(
i
=
0
;
i
<
def
->
nhostdevs
;
i
++
)
{
for
(
i
=
0
;
i
<
def
->
nhostdevs
;
i
++
)
{
if
(
def
->
hostdevs
[
i
]
->
mode
==
VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES
&&
def
->
hostdevs
[
i
]
->
source
.
caps
.
type
==
VIR_DOMAIN_HOSTDEV_CAPS_TYPE_NET
)
return
true
;
...
...
src/lxc/lxc_controller.c
浏览文件 @
1ea88abd
...
...
@@ -199,7 +199,7 @@ static int virLXCControllerCloseLoopDevices(virLXCControllerPtr ctrl)
{
size_t
i
;
for
(
i
=
0
;
i
<
ctrl
->
nloopDevs
;
i
++
)
for
(
i
=
0
;
i
<
ctrl
->
nloopDevs
;
i
++
)
VIR_FORCE_CLOSE
(
ctrl
->
loopDevFds
[
i
]);
return
0
;
...
...
@@ -251,11 +251,11 @@ static void virLXCControllerFree(virLXCControllerPtr ctrl)
virObjectUnref
(
ctrl
->
securityManager
);
for
(
i
=
0
;
i
<
ctrl
->
nveths
;
i
++
)
for
(
i
=
0
;
i
<
ctrl
->
nveths
;
i
++
)
VIR_FREE
(
ctrl
->
veths
[
i
]);
VIR_FREE
(
ctrl
->
veths
);
for
(
i
=
0
;
i
<
ctrl
->
nconsoles
;
i
++
)
for
(
i
=
0
;
i
<
ctrl
->
nconsoles
;
i
++
)
virLXCControllerConsoleClose
(
&
(
ctrl
->
consoles
[
i
]));
VIR_FREE
(
ctrl
->
consoles
);
...
...
@@ -450,7 +450,7 @@ static int virLXCControllerSetupLoopDevices(virLXCControllerPtr ctrl)
size_t
i
;
int
ret
=
-
1
;
for
(
i
=
0
;
i
<
ctrl
->
def
->
nfss
;
i
++
)
{
for
(
i
=
0
;
i
<
ctrl
->
def
->
nfss
;
i
++
)
{
virDomainFSDefPtr
fs
=
ctrl
->
def
->
fss
[
i
];
int
fd
;
...
...
@@ -487,7 +487,7 @@ static int virLXCControllerSetupLoopDevices(virLXCControllerPtr ctrl)
}
}
for
(
i
=
0
;
i
<
ctrl
->
def
->
ndisks
;
i
++
)
{
for
(
i
=
0
;
i
<
ctrl
->
def
->
ndisks
;
i
++
)
{
virDomainDiskDefPtr
disk
=
ctrl
->
def
->
disks
[
i
];
int
fd
;
...
...
@@ -1067,7 +1067,7 @@ static int virLXCControllerMain(virLXCControllerPtr ctrl)
virResetLastError
();
for
(
i
=
0
;
i
<
ctrl
->
nconsoles
;
i
++
)
{
for
(
i
=
0
;
i
<
ctrl
->
nconsoles
;
i
++
)
{
if
((
ctrl
->
consoles
[
i
].
epollFd
=
epoll_create1
(
EPOLL_CLOEXEC
))
<
0
)
{
virReportSystemError
(
errno
,
"%s"
,
_
(
"Unable to create epoll fd"
));
...
...
@@ -1115,7 +1115,7 @@ cleanup:
virMutexDestroy
(
&
lock
);
cleanup2:
for
(
i
=
0
;
i
<
ctrl
->
nconsoles
;
i
++
)
for
(
i
=
0
;
i
<
ctrl
->
nconsoles
;
i
++
)
virLXCControllerConsoleClose
(
&
(
ctrl
->
consoles
[
i
]));
return
rc
;
...
...
@@ -1138,7 +1138,7 @@ static int virLXCControllerMoveInterfaces(virLXCControllerPtr ctrl)
size_t
i
;
virDomainDefPtr
def
=
ctrl
->
def
;
for
(
i
=
0
;
i
<
ctrl
->
nveths
;
i
++
)
{
for
(
i
=
0
;
i
<
ctrl
->
nveths
;
i
++
)
{
if
(
virNetDevSetNamespace
(
ctrl
->
veths
[
i
],
ctrl
->
initpid
)
<
0
)
return
-
1
;
}
...
...
@@ -1175,7 +1175,7 @@ static int virLXCControllerDeleteInterfaces(virLXCControllerPtr ctrl)
size_t
i
;
int
ret
=
0
;
for
(
i
=
0
;
i
<
ctrl
->
nveths
;
i
++
)
{
for
(
i
=
0
;
i
<
ctrl
->
nveths
;
i
++
)
{
if
(
virNetDevVethDelete
(
ctrl
->
veths
[
i
])
<
0
)
ret
=
-
1
;
}
...
...
@@ -1371,7 +1371,7 @@ virLXCControllerSetupConsoles(virLXCControllerPtr ctrl,
{
size_t
i
;
for
(
i
=
0
;
i
<
ctrl
->
nconsoles
;
i
++
)
{
for
(
i
=
0
;
i
<
ctrl
->
nconsoles
;
i
++
)
{
VIR_DEBUG
(
"Opening tty on private %s"
,
ctrl
->
devptmx
);
if
(
lxcCreateTty
(
ctrl
->
devptmx
,
&
ctrl
->
consoles
[
i
].
contFd
,
...
...
@@ -1568,7 +1568,7 @@ virLXCControllerRun(virLXCControllerPtr ctrl)
if
(
virLXCControllerDaemonHandshake
(
ctrl
)
<
0
)
goto
cleanup
;
for
(
i
=
0
;
i
<
ctrl
->
nconsoles
;
i
++
)
for
(
i
=
0
;
i
<
ctrl
->
nconsoles
;
i
++
)
if
(
virLXCControllerConsoleSetNonblocking
(
&
(
ctrl
->
consoles
[
i
]))
<
0
)
goto
cleanup
;
...
...
@@ -1582,7 +1582,7 @@ cleanup:
VIR_FORCE_CLOSE
(
containerhandshake
[
0
]);
VIR_FORCE_CLOSE
(
containerhandshake
[
1
]);
for
(
i
=
0
;
i
<
ctrl
->
nconsoles
;
i
++
)
for
(
i
=
0
;
i
<
ctrl
->
nconsoles
;
i
++
)
VIR_FREE
(
containerTTYPaths
[
i
]);
VIR_FREE
(
containerTTYPaths
);
...
...
@@ -1739,7 +1739,7 @@ int main(int argc, char *argv[])
ctrl
->
veths
=
veths
;
ctrl
->
nveths
=
nveths
;
for
(
i
=
0
;
i
<
nttyFDs
;
i
++
)
{
for
(
i
=
0
;
i
<
nttyFDs
;
i
++
)
{
if
(
virLXCControllerAddConsole
(
ctrl
,
ttyFDs
[
i
])
<
0
)
goto
cleanup
;
ttyFDs
[
i
]
=
-
1
;
...
...
@@ -1801,7 +1801,7 @@ cleanup:
virPidFileDelete
(
LXC_STATE_DIR
,
name
);
if
(
ctrl
)
virLXCControllerDeleteInterfaces
(
ctrl
);
for
(
i
=
0
;
i
<
nttyFDs
;
i
++
)
for
(
i
=
0
;
i
<
nttyFDs
;
i
++
)
VIR_FORCE_CLOSE
(
ttyFDs
[
i
]);
VIR_FREE
(
ttyFDs
);
...
...
src/lxc/lxc_driver.c
浏览文件 @
1ea88abd
...
...
@@ -2191,7 +2191,7 @@ lxcDomainInterfaceStats(virDomainPtr dom,
}
/* Check the path is one of the domain's network interfaces. */
for
(
i
=
0
;
i
<
vm
->
def
->
nnets
;
i
++
)
{
for
(
i
=
0
;
i
<
vm
->
def
->
nnets
;
i
++
)
{
if
(
vm
->
def
->
nets
[
i
]
->
ifname
&&
STREQ
(
vm
->
def
->
nets
[
i
]
->
ifname
,
path
))
{
ret
=
0
;
...
...
@@ -2544,7 +2544,7 @@ lxcDomainOpenConsole(virDomainPtr dom,
}
if
(
dev_name
)
{
for
(
i
=
0
;
i
<
vm
->
def
->
nconsoles
;
i
++
)
{
for
(
i
=
0
;
i
<
vm
->
def
->
nconsoles
;
i
++
)
{
if
(
vm
->
def
->
consoles
[
i
]
->
info
.
alias
&&
STREQ
(
vm
->
def
->
consoles
[
i
]
->
info
.
alias
,
dev_name
))
{
chr
=
vm
->
def
->
consoles
[
i
];
...
...
src/lxc/lxc_hostdev.c
浏览文件 @
1ea88abd
...
...
@@ -232,7 +232,7 @@ virLXCPrepareHostUSBDevices(virLXCDriverPtr driver,
/* Loop 1: build temporary list
*/
for
(
i
=
0
;
i
<
nhostdevs
;
i
++
)
{
for
(
i
=
0
;
i
<
nhostdevs
;
i
++
)
{
virDomainHostdevDefPtr
hostdev
=
hostdevs
[
i
];
bool
required
=
true
;
virUSBDevicePtr
usb
;
...
...
@@ -287,7 +287,7 @@ int virLXCPrepareHostDevices(virLXCDriverPtr driver,
return
0
;
/* Sanity check for supported configurations only */
for
(
i
=
0
;
i
<
def
->
nhostdevs
;
i
++
)
{
for
(
i
=
0
;
i
<
def
->
nhostdevs
;
i
++
)
{
virDomainHostdevDefPtr
dev
=
def
->
hostdevs
[
i
];
switch
(
dev
->
mode
)
{
...
...
src/lxc/lxc_process.c
浏览文件 @
1ea88abd
...
...
@@ -261,7 +261,7 @@ static void virLXCProcessCleanup(virLXCDriverPtr driver,
virLXCDomainReAttachHostDevices
(
driver
,
vm
->
def
);
for
(
i
=
0
;
i
<
vm
->
def
->
nnets
;
i
++
)
{
for
(
i
=
0
;
i
<
vm
->
def
->
nnets
;
i
++
)
{
virDomainNetDefPtr
iface
=
vm
->
def
->
nets
[
i
];
vport
=
virDomainNetGetActualVirtPortProfile
(
iface
);
if
(
iface
->
ifname
)
{
...
...
@@ -433,7 +433,7 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn,
int
ret
=
-
1
;
size_t
i
;
for
(
i
=
0
;
i
<
def
->
nnets
;
i
++
)
{
for
(
i
=
0
;
i
<
def
->
nnets
;
i
++
)
{
char
*
veth
=
NULL
;
/* If appropriate, grab a physical device from the configured
* network's pool of devices, or resolve bridge device name
...
...
@@ -536,7 +536,7 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn,
cleanup:
if
(
ret
<
0
)
{
for
(
i
=
0
;
i
<
def
->
nnets
;
i
++
)
{
for
(
i
=
0
;
i
<
def
->
nnets
;
i
++
)
{
virDomainNetDefPtr
iface
=
def
->
nets
[
i
];
virNetDevVPortProfilePtr
vport
=
virDomainNetGetActualVirtPortProfile
(
iface
);
if
(
vport
&&
vport
->
virtPortType
==
VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH
)
...
...
@@ -851,7 +851,7 @@ virLXCProcessBuildControllerCmd(virLXCDriverPtr driver,
}
virCommandAddArgList
(
cmd
,
"--name"
,
vm
->
def
->
name
,
NULL
);
for
(
i
=
0
;
i
<
nttyFDs
;
i
++
)
{
for
(
i
=
0
;
i
<
nttyFDs
;
i
++
)
{
virCommandAddArg
(
cmd
,
"--console"
);
virCommandAddArgFormat
(
cmd
,
"%d"
,
ttyFDs
[
i
]);
virCommandPreserveFD
(
cmd
,
ttyFDs
[
i
]);
...
...
@@ -864,7 +864,7 @@ virLXCProcessBuildControllerCmd(virLXCDriverPtr driver,
virCommandAddArgFormat
(
cmd
,
"%d"
,
handshakefd
);
virCommandAddArg
(
cmd
,
"--background"
);
for
(
i
=
0
;
i
<
nveths
;
i
++
)
{
for
(
i
=
0
;
i
<
nveths
;
i
++
)
{
virCommandAddArgList
(
cmd
,
"--veth"
,
veths
[
i
],
NULL
);
}
...
...
@@ -1131,7 +1131,7 @@ int virLXCProcessStart(virConnectPtr conn,
virReportOOMError
();
goto
cleanup
;
}
for
(
i
=
0
;
i
<
vm
->
def
->
nconsoles
;
i
++
)
for
(
i
=
0
;
i
<
vm
->
def
->
nconsoles
;
i
++
)
ttyFDs
[
i
]
=
-
1
;
/* If you are using a SecurityDriver with dynamic labelling,
...
...
@@ -1152,7 +1152,7 @@ int virLXCProcessStart(virConnectPtr conn,
vm
->
def
,
NULL
)
<
0
)
goto
cleanup
;
for
(
i
=
0
;
i
<
vm
->
def
->
nconsoles
;
i
++
)
{
for
(
i
=
0
;
i
<
vm
->
def
->
nconsoles
;
i
++
)
{
char
*
ttyPath
;
if
(
vm
->
def
->
consoles
[
i
]
->
source
.
type
!=
VIR_DOMAIN_CHR_TYPE_PTY
)
{
virReportError
(
VIR_ERR_CONFIG_UNSUPPORTED
,
"%s"
,
...
...
@@ -1334,7 +1334,7 @@ cleanup:
virReportSystemError
(
errno
,
"%s"
,
_
(
"could not close logfile"
));
rc
=
-
1
;
}
for
(
i
=
0
;
i
<
nveths
;
i
++
)
{
for
(
i
=
0
;
i
<
nveths
;
i
++
)
{
if
(
rc
!=
0
)
ignore_value
(
virNetDevVethDelete
(
veths
[
i
]));
VIR_FREE
(
veths
[
i
]);
...
...
@@ -1361,7 +1361,7 @@ cleanup:
VIR_FREE
(
vm
->
def
->
seclabels
[
0
]
->
imagelabel
);
}
}
for
(
i
=
0
;
i
<
nttyFDs
;
i
++
)
for
(
i
=
0
;
i
<
nttyFDs
;
i
++
)
VIR_FORCE_CLOSE
(
ttyFDs
[
i
]);
VIR_FREE
(
ttyFDs
);
VIR_FORCE_CLOSE
(
handshakefds
[
0
]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录