[PATCH 1/2] mllib: curl: add optional tmpdir parameter
by Pino Toscano
Add a new optional parameter for the Curl ADT, so temporary files can be
created in a specified directory (which is supposed to be temporary, and
disposed only when the application quits).
---
mllib/curl.ml | 16 +++++++++++-----
mllib/curl.mli | 2 +-
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/mllib/curl.ml b/mllib/curl.ml
index 376406e..7d07125 100644
--- a/mllib/curl.ml
+++ b/mllib/curl.ml
@@ -25,6 +25,7 @@ let quote = Filename.quote
type t = {
curl : string;
args : args;
+ tmpdir : string option;
}
and args = (string * string option) list
@@ -40,12 +41,13 @@ let args_of_proxy = function
| SystemProxy -> []
| ForcedProxy url -> [ "proxy", Some url; "noproxy", Some "" ]
-let create ?(curl = "curl") ?(proxy = SystemProxy) args =
+let create ?(curl = "curl") ?(proxy = SystemProxy) ?tmpdir args =
let args = safe_args @ args_of_proxy proxy @ args in
- { curl = curl; args = args }
+ { curl = curl; args = args; tmpdir = tmpdir }
-let run { curl = curl; args = args } =
- let config_file, chan = Filename.open_temp_file "guestfscurl" ".conf" in
+let run { curl = curl; args = args; tmpdir = tmpdir } =
+ let config_file, chan = Filename.open_temp_file ?temp_dir:tmpdir
+ "guestfscurl" ".conf" in
List.iter (
function
| name, None -> fprintf chan "%s\n" name
@@ -71,7 +73,11 @@ let run { curl = curl; args = args } =
let cmd = sprintf "%s -q --config %s" (quote curl) (quote config_file) in
let lines = external_command ~echo_cmd:false cmd in
- Unix.unlink config_file;
+ (* Remove the temporary configuration only when not created under
+ * a proper temporary directory.
+ *)
+ if tmpdir = None then
+ Unix.unlink config_file;
lines
let to_string { curl = curl; args = args } =
diff --git a/mllib/curl.mli b/mllib/curl.mli
index f045572..c0c2fb0 100644
--- a/mllib/curl.mli
+++ b/mllib/curl.mli
@@ -27,7 +27,7 @@ type proxy =
| SystemProxy (** Use the system settings. *)
| ForcedProxy of string (** The proxy is forced to the specified URL. *)
-val create : ?curl:string -> ?proxy:proxy -> args -> t
+val create : ?curl:string -> ?proxy:proxy -> ?tmpdir:string -> args -> t
(** Create a curl command handle.
The curl arguments are a list of key, value pairs corresponding
--
2.7.4
8 years
virt-builder and Ubuntu 16.04 Xenial no access issue
by P J P
Hello,
I created an Ubuntu 16.04 Xenial guest using virt-builder(1) with
# virt-builder ubuntu-16.04
-o /var/lib/libvirt/images/ubuntu-16.04.qcow2
--size 10G --format qcow2
--firstboot-command 'dpkg-reconfigure openssh-server'
--arch x86_64
And imported it to libvirt with
# virt-install --import --name ubuntu-xenial --ram 2048
--disk path=/var/lib/libvirt/images/ubuntu-16.04.qcow2,format=qcow2
--os-variant fedora23
--graphics none
These successfully create the Ubuntu guest and import it as well. But
- when I tried to access it using 'virsh console', it connects and shows a
blank screen. No interaction whatsoever.
- When I tried to access it via ssh, it did not accept the root password that
virt-builder had displayed before exiting.
- I tried to reset root user password with virt-customize(1), but even that
did not help.
In short, we have an Ubuntu guest that is not accessible anyhow.
I've reserved a beaker machine and have installed Ubuntu guest as above.
$ ssh root(a)ibm-x3550m4-7.gsslab.rdu2.redhat.com + r3dhatd0tc0m
Please feel free to have a look at it. Thank you.
--
- P J P
47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F
8 years, 1 month
[PATCH] customize: Test that the --root-password parameter works.
by Richard W.M. Jones
This is the second half of the patch series posted yesterday (see:
"[PATCH 0/2] builder: Add test that a serial console is set up for
guest templates we supply.").
This checks that our code to change passwords works on real guests.
It creates a real guest using virt-builder with the --root-password
option, then boots it up and tries to log in with the root password.
Interaction with the guest is afforded by the perl Expect module.
Rich.
8 years, 1 month
[PATCH 0/2] builder: Add test that a serial console is set up for guest templates we supply.
by Richard W.M. Jones
The first of two sets of patches.
This checks that the templates we supply have the serial console
enabled, or in two cases, that the serial console can be enabled by
fiddling with some grub config.
The second set of patches (to follow) will test that the --password
and --root-password options work. This implementation of this is
quite complex.
Rich.
8 years, 1 month
repodata
by Denis Müller
Hello,
we would like to sync all files from http://oirase.annexia.org/virt-p2v/ with Foreman/Katello.
Is it possible to provide "repodata" for this public directory? Without it we can not sync it.
Greets,
Denis
8 years, 1 month
[PATCH] tar-in: Add workaround because tar doesn't restore capabilities (RHBZ#1384241).
by Richard W.M. Jones
Current GNU tar does not restore all extended attributes. In
particular only user.* capabilities are restored (although all
are saved in the tarball).
To restore capabilities, SELinux security attributes, and other things
we need to use --xattrs-include=*
For further information on the tar bug, see:
https://bugzilla.redhat.com/show_bug.cgi?id=771927
---
daemon/tar.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/daemon/tar.c b/daemon/tar.c
index c5d9524..2ebd2fe 100644
--- a/daemon/tar.c
+++ b/daemon/tar.c
@@ -190,7 +190,11 @@ do_tar_in (const char *dir, const char *compress, int xattrs, int selinux, int a
str_tar,
dir, filter,
chown_supported ? "" : "--no-same-owner ",
- xattrs ? "--xattrs " : "",
+ /* --xattrs-include=* is a workaround for a bug
+ * in tar, and hopefully won't be required
+ * forever. See RHBZ#771927.
+ */
+ xattrs ? "--xattrs --xattrs-include='*' " : "",
selinux ? "--selinux " : "",
acls ? "--acls " : "",
error_file) == -1) {
--
2.9.3
8 years, 1 month
guestmount issue with change directory (cd)
by Pierre Neyron
Hello,
I've got a strange behavior with guestmount: I've a root directory with
mod/owner = drwx------ root root. I cannot change directory to it as a
regular user (as normal), but I can list its content (not normally
normal) and I can change directory to a subdirectory in it which is mod
drwxr-xr-x.
E.g:
$ mkdir /tmp/mnt
$ guestmount --ro -i -a test.qcow2 /tmp/mnt/
$ cd /tmp/mnt
$ ls -ld root/
drwx------ 4 root root 4096 Oct 14 19:21 root/
$ ls -l root/
total 4
drwxr-xr-x 2 root root 4096 Oct 14 19:21 subdir
$ cd root
bash: cd: root: Permission denied
$ cd root/subdir
$ pwd
/tmp/mnt/root/subdir
Also tar is ok as well:
$ cd /tmp/mnt
$ tar cf /tmp/tar.tar .
$ tar tf /tmp/tar.tar | grep -e "^./root/subdir/$"
./root/subdir/
This is for sure some fuse magic to allow the regular user to list files
just as if he is root (after all, guestmount did not require to be root
in the first place). I'm very ok with that since this is very useful,
but then I would expect `cd root' to be OK as well ?
I'm using
$ guestmount -V
guestmount 1.32.7
Best regards,
PS: @moderators: sorry for the noise with cancelled messages, I fixed
typos... :/
--
Pierre
8 years, 1 month
Re: [Libguestfs] Quick question regarding the "--firstboot" parameter within virt-sysprep
by Richard W.M. Jones
On Fri, Oct 07, 2016 at 04:42:21PM -0400, Charlie Drage wrote:
> I apologize if this is not the appropriate place to contact you..
Adding the mailing list.
> Got a weird issue!
>
> So when I use --firstboot via virt-sysprep on a host, it's totally fine.
>
> However..
>
> In this scenario:
> 1. virt-sysprep an offline image
> 2. transfer said image from one node to another
> 3. bring it up via libvirt
>
> It errors out with:
> === Running /usr/lib/virt-sysprep/scripts/0001--tmp-292-firstboot ===
> /etc/init.d/virt-sysprep-firstboot: 35: /etc/init.d/virt-sysprep-firstboot:
> /usr/lib/virt-sysprep/scripts-done/0001--tmp-292-firstboot: not found
>
> My question is! When applying this "firstboot" script, is it required that
> it's brought up on the same host that virt-sysprep'd it?
No, there's no such requirement.
This could be a bug, but it's hard to say. What version of
virt-sysprep? What guest type & version?
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
8 years, 1 month
[PATCH v4 0/3] New API - find_block
by Matteo Cafasso
Patch ready for merging.
v4:
- check return code of tsk_fs_attr_walk
- pass TSK_FS_FILE_WALK_FLAG_NOSPARSE as additional flag to tsk_fs_attr_walk
After discussing with TSK authors the behaviour is clear. [1]
In case of COMPRESSED blocks, the callback will be called for all the attributes no matter whether they are on disk or not (sparse). In such cases, the block address will be 0. [2]
So we do not have to enforce the blocks to be RAW as we would be missing COMPRESSED ones (NTFS only).
[1] https://github.com/sleuthkit/sleuthkit/pull/721
[2] http://www.sleuthkit.org/sleuthkit/docs/api-docs/4.2/group__fslib.html#ga...
Matteo Cafasso (3):
New API: internal_find_block
New API: find_block
find_block: added API tests
daemon/tsk.c | 96 ++++++++++++++++++++++++++++++++++++++++++++
generator/actions.ml | 25 ++++++++++++
src/MAX_PROC_NR | 2 +-
src/tsk.c | 17 ++++++++
tests/tsk/Makefile.am | 1 +
tests/tsk/test-find-block.sh | 66 ++++++++++++++++++++++++++++++
6 files changed, 206 insertions(+), 1 deletion(-)
create mode 100755 tests/tsk/test-find-block.sh
--
2.9.3
8 years, 1 month
[PATCH v3 0/2] New tool: virt-tail.
by Richard W.M. Jones
Since v2:
- Fix the things that Pino mentioned, except the recursion.
- Implement Windows support.
For Windows support to be sane, I had to inline the add_and_mount code.
Rich.
8 years, 1 month