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
cd30b4fa
Commit
cd30b4fa
authored
Feb 09, 2016
by
Serge Hallyn
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #812 from brauner/2016-02-10/quiet_lxc_copy
silence lxc-copy as well when asked
parents
2fa8e2cd
c89f1f75
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
8 deletions
+17
-8
lxc_copy.c
src/lxc/lxc_copy.c
+17
-8
No files found.
src/lxc/lxc_copy.c
View file @
cd30b4fa
...
@@ -127,6 +127,7 @@ Options :\n\
...
@@ -127,6 +127,7 @@ Options :\n\
.
parser
=
my_parser
,
.
parser
=
my_parser
,
.
task
=
CLONE
,
.
task
=
CLONE
,
.
daemonize
=
1
,
.
daemonize
=
1
,
.
quiet
=
false
,
};
};
static
struct
mnts
*
add_mnt
(
struct
mnts
**
mnts
,
unsigned
int
*
num
,
static
struct
mnts
*
add_mnt
(
struct
mnts
**
mnts
,
unsigned
int
*
num
,
...
@@ -171,13 +172,15 @@ int main(int argc, char *argv[])
...
@@ -171,13 +172,15 @@ int main(int argc, char *argv[])
if
(
geteuid
())
{
if
(
geteuid
())
{
if
(
access
(
my_args
.
lxcpath
[
0
],
O_RDWR
)
<
0
)
{
if
(
access
(
my_args
.
lxcpath
[
0
],
O_RDWR
)
<
0
)
{
fprintf
(
stderr
,
"You lack access to %s
\n
"
,
my_args
.
lxcpath
[
0
]);
if
(
!
my_args
.
quiet
)
fprintf
(
stderr
,
"You lack access to %s
\n
"
,
my_args
.
lxcpath
[
0
]);
exit
(
ret
);
exit
(
ret
);
}
}
}
}
if
(
!
my_args
.
newname
&&
!
(
my_args
.
task
==
DESTROY
))
{
if
(
!
my_args
.
newname
&&
!
(
my_args
.
task
==
DESTROY
))
{
printf
(
"Error: You must provide a NEWNAME for the clone.
\n
"
);
if
(
!
my_args
.
quiet
)
printf
(
"Error: You must provide a NEWNAME for the clone.
\n
"
);
exit
(
ret
);
exit
(
ret
);
}
}
...
@@ -196,12 +199,14 @@ int main(int argc, char *argv[])
...
@@ -196,12 +199,14 @@ int main(int argc, char *argv[])
exit
(
ret
);
exit
(
ret
);
if
(
!
c
->
may_control
(
c
))
{
if
(
!
c
->
may_control
(
c
))
{
fprintf
(
stderr
,
"Insufficent privileges to control %s
\n
"
,
c
->
name
);
if
(
!
my_args
.
quiet
)
fprintf
(
stderr
,
"Insufficent privileges to control %s
\n
"
,
c
->
name
);
goto
out
;
goto
out
;
}
}
if
(
!
c
->
is_defined
(
c
))
{
if
(
!
c
->
is_defined
(
c
))
{
fprintf
(
stderr
,
"Error: container %s is not defined
\n
"
,
c
->
name
);
if
(
!
my_args
.
quiet
)
fprintf
(
stderr
,
"Error: container %s is not defined
\n
"
,
c
->
name
);
goto
out
;
goto
out
;
}
}
...
@@ -348,7 +353,8 @@ static int do_clone(struct lxc_container *c, char *newname, char *newpath,
...
@@ -348,7 +353,8 @@ static int do_clone(struct lxc_container *c, char *newname, char *newpath,
clone
=
c
->
clone
(
c
,
newname
,
newpath
,
flags
,
bdevtype
,
NULL
,
fssize
,
clone
=
c
->
clone
(
c
,
newname
,
newpath
,
flags
,
bdevtype
,
NULL
,
fssize
,
args
);
args
);
if
(
!
clone
)
{
if
(
!
clone
)
{
fprintf
(
stderr
,
"clone failed
\n
"
);
if
(
!
my_args
.
quiet
)
fprintf
(
stderr
,
"clone failed
\n
"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -414,7 +420,8 @@ static int do_clone_ephemeral(struct lxc_container *c,
...
@@ -414,7 +420,8 @@ static int do_clone_ephemeral(struct lxc_container *c,
if
(
!
clone
->
save_config
(
clone
,
NULL
))
if
(
!
clone
->
save_config
(
clone
,
NULL
))
goto
destroy_and_put
;
goto
destroy_and_put
;
printf
(
"Created %s as %s of %s
\n
"
,
arg
->
name
,
"clone"
,
arg
->
newname
);
if
(
!
my_args
.
quiet
)
printf
(
"Created %s as %s of %s
\n
"
,
arg
->
name
,
"clone"
,
arg
->
newname
);
if
(
!
arg
->
daemonize
&&
arg
->
argc
)
{
if
(
!
arg
->
daemonize
&&
arg
->
argc
)
{
clone
->
want_daemonize
(
clone
,
true
);
clone
->
want_daemonize
(
clone
,
true
);
...
@@ -507,7 +514,8 @@ static uint64_t get_fssize(char *s)
...
@@ -507,7 +514,8 @@ static uint64_t get_fssize(char *s)
ret
=
strtoull
(
s
,
&
end
,
0
);
ret
=
strtoull
(
s
,
&
end
,
0
);
if
(
end
==
s
)
{
if
(
end
==
s
)
{
fprintf
(
stderr
,
"Invalid blockdev size '%s', using default size
\n
"
,
s
);
if
(
!
my_args
.
quiet
)
fprintf
(
stderr
,
"Invalid blockdev size '%s', using default size
\n
"
,
s
);
return
0
;
return
0
;
}
}
while
(
isblank
(
*
end
))
while
(
isblank
(
*
end
))
...
@@ -525,7 +533,8 @@ static uint64_t get_fssize(char *s)
...
@@ -525,7 +533,8 @@ static uint64_t get_fssize(char *s)
}
else
if
(
*
end
==
't'
||
*
end
==
'T'
)
{
}
else
if
(
*
end
==
't'
||
*
end
==
'T'
)
{
ret
*=
1024ULL
*
1024ULL
*
1024ULL
*
1024ULL
;
ret
*=
1024ULL
*
1024ULL
*
1024ULL
*
1024ULL
;
}
else
{
}
else
{
fprintf
(
stderr
,
"Invalid blockdev unit size '%c' in '%s', "
"using default size
\n
"
,
*
end
,
s
);
if
(
!
my_args
.
quiet
)
fprintf
(
stderr
,
"Invalid blockdev unit size '%c' in '%s', "
"using default size
\n
"
,
*
end
,
s
);
return
0
;
return
0
;
}
}
...
...
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