Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
162a857a
Unverified
Commit
162a857a
authored
Jul 24, 2017
by
Christian Brauner
Committed by
Stéphane Graber
Aug 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rbd: rbd non-functional changes
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
85914b67
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
lxcrbd.c
src/lxc/bdev/lxcrbd.c
+13
-10
No files found.
src/lxc/bdev/lxcrbd.c
View file @
162a857a
...
@@ -75,20 +75,21 @@ int rbd_create(struct bdev *bdev, const char *dest, const char *n,
...
@@ -75,20 +75,21 @@ int rbd_create(struct bdev *bdev, const char *dest, const char *n,
if
(
ret
<
0
||
ret
>=
len
)
if
(
ret
<
0
||
ret
>=
len
)
return
-
1
;
return
-
1
;
/
/ fssize is in bytes.
/
* fssize is in bytes */
size
=
specs
->
fssize
;
size
=
specs
->
fssize
;
if
(
!
size
)
if
(
!
size
)
size
=
DEFAULT_FS_SIZE
;
size
=
DEFAULT_FS_SIZE
;
/
/ in megabytes for rbd tool
/
* in megabytes for rbd tool */
ret
=
snprintf
(
sz
,
24
,
"%"
PRIu64
,
size
/
1024
/
1024
);
ret
=
snprintf
(
sz
,
24
,
"%"
PRIu64
,
size
/
1024
/
1024
);
if
(
ret
<
0
||
ret
>=
24
)
if
(
ret
<
0
||
ret
>=
24
)
exit
(
1
);
exit
(
1
);
if
((
pid
=
fork
())
<
0
)
if
((
pid
=
fork
())
<
0
)
return
-
1
;
return
-
1
;
if
(
!
pid
)
{
if
(
!
pid
)
{
execlp
(
"rbd"
,
"rbd"
,
"create"
,
"--pool"
,
rbdpool
,
rbdname
,
"--size"
,
sz
,
(
char
*
)
NULL
);
execlp
(
"rbd"
,
"rbd"
,
"create"
,
"--pool"
,
rbdpool
,
rbdname
,
"--size"
,
sz
,
(
char
*
)
NULL
);
exit
(
1
);
exit
(
1
);
}
}
if
(
wait_for_pid
(
pid
)
<
0
)
if
(
wait_for_pid
(
pid
)
<
0
)
...
@@ -97,7 +98,8 @@ int rbd_create(struct bdev *bdev, const char *dest, const char *n,
...
@@ -97,7 +98,8 @@ int rbd_create(struct bdev *bdev, const char *dest, const char *n,
if
((
pid
=
fork
())
<
0
)
if
((
pid
=
fork
())
<
0
)
return
-
1
;
return
-
1
;
if
(
!
pid
)
{
if
(
!
pid
)
{
execlp
(
"rbd"
,
"rbd"
,
"map"
,
"--pool"
,
rbdpool
,
rbdname
,
(
char
*
)
NULL
);
execlp
(
"rbd"
,
"rbd"
,
"map"
,
"--pool"
,
rbdpool
,
rbdname
,
(
char
*
)
NULL
);
exit
(
1
);
exit
(
1
);
}
}
if
(
wait_for_pid
(
pid
)
<
0
)
if
(
wait_for_pid
(
pid
)
<
0
)
...
@@ -136,7 +138,7 @@ int rbd_destroy(struct bdev *orig)
...
@@ -136,7 +138,7 @@ int rbd_destroy(struct bdev *orig)
if
((
pid
=
fork
())
<
0
)
if
((
pid
=
fork
())
<
0
)
return
-
1
;
return
-
1
;
if
(
!
pid
)
{
if
(
!
pid
)
{
execlp
(
"rbd"
,
"rbd"
,
"unmap"
,
src
,
(
char
*
)
NULL
);
execlp
(
"rbd"
,
"rbd"
,
"unmap"
,
src
,
(
char
*
)
NULL
);
exit
(
1
);
exit
(
1
);
}
}
if
(
wait_for_pid
(
pid
)
<
0
)
if
(
wait_for_pid
(
pid
)
<
0
)
...
@@ -147,12 +149,11 @@ int rbd_destroy(struct bdev *orig)
...
@@ -147,12 +149,11 @@ int rbd_destroy(struct bdev *orig)
return
-
1
;
return
-
1
;
if
(
!
pid
)
{
if
(
!
pid
)
{
rbdfullname
=
alloca
(
strlen
(
src
)
-
8
);
rbdfullname
=
alloca
(
strlen
(
src
)
-
8
);
strcpy
(
rbdfullname
,
&
src
[
9
]
);
strcpy
(
rbdfullname
,
&
src
[
9
]
);
execlp
(
"rbd"
,
"rbd"
,
"rm"
,
rbdfullname
,
(
char
*
)
NULL
);
execlp
(
"rbd"
,
"rbd"
,
"rm"
,
rbdfullname
,
(
char
*
)
NULL
);
exit
(
1
);
exit
(
1
);
}
}
return
wait_for_pid
(
pid
);
return
wait_for_pid
(
pid
);
}
}
int
rbd_detect
(
const
char
*
path
)
int
rbd_detect
(
const
char
*
path
)
...
@@ -173,7 +174,9 @@ int rbd_mount(struct bdev *bdev)
...
@@ -173,7 +174,9 @@ int rbd_mount(struct bdev *bdev)
src
=
lxc_storage_get_path
(
bdev
->
src
,
bdev
->
type
);
src
=
lxc_storage_get_path
(
bdev
->
src
,
bdev
->
type
);
if
(
!
file_exists
(
src
))
{
if
(
!
file_exists
(
src
))
{
// if blkdev does not exist it should be mapped, because it is not persistent on reboot
/* If blkdev does not exist it should be mapped, because it is
* not persistent on reboot.
*/
ERROR
(
"Block device %s is not mapped."
,
bdev
->
src
);
ERROR
(
"Block device %s is not mapped."
,
bdev
->
src
);
return
-
1
;
return
-
1
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment