mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-30 23:20:10 +00:00
Merge pull request #812 from brauner/2016-02-10/quiet_lxc_copy
silence lxc-copy as well when asked
This commit is contained in:
commit
cd30b4fa22
@ -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,12 +172,14 @@ 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) {
|
||||||
|
if (!my_args.quiet)
|
||||||
fprintf(stderr, "You lack access to %s\n", my_args.lxcpath[0]);
|
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)) {
|
||||||
|
if (!my_args.quiet)
|
||||||
printf("Error: You must provide a NEWNAME for the clone.\n");
|
printf("Error: You must provide a NEWNAME for the clone.\n");
|
||||||
exit(ret);
|
exit(ret);
|
||||||
}
|
}
|
||||||
@ -196,11 +199,13 @@ int main(int argc, char *argv[])
|
|||||||
exit(ret);
|
exit(ret);
|
||||||
|
|
||||||
if (!c->may_control(c)) {
|
if (!c->may_control(c)) {
|
||||||
|
if (!my_args.quiet)
|
||||||
fprintf(stderr, "Insufficent privileges to control %s\n", c->name);
|
fprintf(stderr, "Insufficent privileges to control %s\n", c->name);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!c->is_defined(c)) {
|
if (!c->is_defined(c)) {
|
||||||
|
if (!my_args.quiet)
|
||||||
fprintf(stderr, "Error: container %s is not defined\n", c->name);
|
fprintf(stderr, "Error: container %s is not defined\n", c->name);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -348,6 +353,7 @@ 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) {
|
||||||
|
if (!my_args.quiet)
|
||||||
fprintf(stderr, "clone failed\n");
|
fprintf(stderr, "clone failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -414,6 +420,7 @@ 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;
|
||||||
|
|
||||||
|
if (!my_args.quiet)
|
||||||
printf("Created %s as %s of %s\n", arg->name, "clone", arg->newname);
|
printf("Created %s as %s of %s\n", arg->name, "clone", arg->newname);
|
||||||
|
|
||||||
if (!arg->daemonize && arg->argc) {
|
if (!arg->daemonize && arg->argc) {
|
||||||
@ -507,6 +514,7 @@ static uint64_t get_fssize(char *s)
|
|||||||
|
|
||||||
ret = strtoull(s, &end, 0);
|
ret = strtoull(s, &end, 0);
|
||||||
if (end == s) {
|
if (end == s) {
|
||||||
|
if (!my_args.quiet)
|
||||||
fprintf(stderr, "Invalid blockdev size '%s', using default size\n", s);
|
fprintf(stderr, "Invalid blockdev size '%s', using default size\n", s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -525,6 +533,7 @@ 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 {
|
||||||
|
if (!my_args.quiet)
|
||||||
fprintf(stderr, "Invalid blockdev unit size '%c' in '%s', " "using default size\n", *end, s);
|
fprintf(stderr, "Invalid blockdev unit size '%c' in '%s', " "using default size\n", *end, s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user