[PATCH [WIP] 0/3] tests: Define common test functions.
by Richard W.M. Jones
There's a lot of common code in the tests, eg:
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network"
exit 77
fi
These commits (work in progress) create a common set of test functions
for skipping tests etc.
Rich.
7 years, 10 months
[PATCH v3 00/10] Introducing virt-builder-repository
by Cédric Bosdonnat
Hi guys,
Here is a v3 of the series, including changes to answer Richard's
comments.
Cédric Bosdonnat (10):
mllib: factorize code to add Checksum.get_checksum function
Move xml and xpath_helpers OCAML code to mllib
mllib: add Xml.parse_file helper
lib/osinfo.c: Extract xml processing into a callback
lib: extract osinfo DB traversing API
mllib: ocaml wrapper for lib/osinfo
builder: rename docs test script
builder: add Index.write_entry function
builder: add a template parameter to get_index
Add a virt-builder-repository tool
.gitignore | 3 +
builder/Makefile.am | 86 +++-
builder/builder.ml | 2 +-
builder/index.mli | 3 +
builder/index_parser.ml | 72 ++-
builder/index_parser.mli | 8 +-
builder/repository_main.ml | 487 +++++++++++++++++++++
.../{test-virt-builder-docs.sh => test-docs.sh} | 3 +
builder/virt-builder-repository.pod | 183 ++++++++
docs/C_SOURCE_FILES | 2 +-
lib/Makefile.am | 2 +
lib/osinfo-iso.c | 464 ++++++++++++++++++++
lib/osinfo.c | 479 ++------------------
lib/osinfo.h | 27 ++
mllib/Makefile.am | 18 +-
mllib/checksums.ml | 25 +-
mllib/checksums.mli | 9 +
mllib/osinfo-c.c | 100 +++++
mllib/osinfo.ml | 26 ++
mllib/osinfo.mli | 31 ++
{v2v => mllib}/xml-c.c | 47 +-
{v2v => mllib}/xml.ml | 49 ++-
{v2v => mllib}/xml.mli | 3 +
{v2v => mllib}/xpath_helpers.ml | 0
{v2v => mllib}/xpath_helpers.mli | 0
v2v/Makefile.am | 17 +-
v2v/test-harness/Makefile.am | 3 +-
v2v/test-harness/dummy.c | 2 +
28 files changed, 1631 insertions(+), 520 deletions(-)
create mode 100644 builder/repository_main.ml
rename builder/{test-virt-builder-docs.sh => test-docs.sh} (89%)
create mode 100644 builder/virt-builder-repository.pod
create mode 100644 lib/osinfo-iso.c
create mode 100644 lib/osinfo.h
create mode 100644 mllib/osinfo-c.c
create mode 100644 mllib/osinfo.ml
create mode 100644 mllib/osinfo.mli
rename {v2v => mllib}/xml-c.c (90%)
rename {v2v => mllib}/xml.ml (79%)
rename {v2v => mllib}/xml.mli (97%)
rename {v2v => mllib}/xpath_helpers.ml (100%)
rename {v2v => mllib}/xpath_helpers.mli (100%)
create mode 100644 v2v/test-harness/dummy.c
--
2.11.0
7 years, 10 months
[PATCH 1/2] dib: preserve xattrs and SELinux attributes when exporting as tar
by Pino Toscano
When extracting the content of the guest as tar, save also the extended
attributes and the SELinux attributes. This makes sure guests exported
as tar, tgz, and as docker image will work fine afterwards.
This is what disk-image-create does as well.
---
dib/output_format_docker.ml | 3 ++-
dib/output_format_tar.ml | 3 ++-
dib/output_format_tgz.ml | 4 ++--
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/dib/output_format_docker.ml b/dib/output_format_docker.ml
index 5303cf9..903ac65 100644
--- a/dib/output_format_docker.ml
+++ b/dib/output_format_docker.ml
@@ -38,7 +38,8 @@ let docker_run_fs (g : Guestfs.guestfs) _ temp_dir =
| Some t -> t in
message (f_"Importing the image to docker as '%s'") docker_target;
let dockertmp = Filename.temp_file ~temp_dir "docker." ".tar" in
- g#tar_out ~excludes:[| "./sys/*"; "./proc/*" |] "/" dockertmp;
+ g#tar_out ~excludes:[| "./sys/*"; "./proc/*" |] ~xattrs:true ~selinux:true
+ "/" dockertmp;
let cmd = [ "sudo"; "docker"; "import"; dockertmp; docker_target ] in
if run_command cmd <> 0 then exit 1
diff --git a/dib/output_format_tar.ml b/dib/output_format_tar.ml
index d8d5bfa..132532d 100644
--- a/dib/output_format_tar.ml
+++ b/dib/output_format_tar.ml
@@ -23,7 +23,8 @@ open Output_format
let tar_run_fs (g : Guestfs.guestfs) filename _ =
message (f_"Compressing the image as tar");
- g#tar_out ~excludes:[| "./sys/*"; "./proc/*" |] "/" filename
+ g#tar_out ~excludes:[| "./sys/*"; "./proc/*" |] ~xattrs:true ~selinux:true
+ "/" filename
let fmt = {
defaults with
diff --git a/dib/output_format_tgz.ml b/dib/output_format_tgz.ml
index a74a4a6..155afb5 100644
--- a/dib/output_format_tgz.ml
+++ b/dib/output_format_tgz.ml
@@ -23,8 +23,8 @@ open Output_format
let tgz_run_fs (g : Guestfs.guestfs) filename _ =
message (f_"Compressing the image as tar.gz");
- g#tar_out ~excludes:[| "./sys/*"; "./proc/*" |] ~compress:"gzip"
- "/" filename
+ g#tar_out ~excludes:[| "./sys/*"; "./proc/*" |] ~xattrs:true ~selinux:true
+ ~compress:"gzip" "/" filename
let fmt = {
defaults with
--
2.9.3
7 years, 10 months
How to make a Google Compute Engine boot image with guestfish?
by Andrew Stuart
wow - guestfish has a dizzying array of options and functionality - looks awesome.
I feel a bit like I’m asking for homework help, but perhaps someone might be willing to save me a weekend (or more) of trial and error by pointing me in the right direction….. I’ve done so much fiddling with this sort of stuff that I know a little insider guidance can be a *huge* help and time saver. And if it is considered rude or lazy to ask straight up for help then please accept my apologies and I’ll set out on the grinding road to find the commands that work.
Background:
I have a zipfile containing a kernel and an initramfs. These are all that is needed to boot an in-memory operating system.
I want to put these into an image suitable for booting on Google Compute Engine, using syslinux or extlinux.
Google’s requirements for such images are described here (and summarised at the bottom of this email)
https://cloud.google.com/compute/docs/images/import-existing-image
This is a script that does something very similar what I need (although without an initramfs), but it seems to me that guestfish might be able to do so in a much more straightforward manner:
https://github.com/Solo5/solo5/blob/master/tools/mkimage/solo5-mkimage.sh
So my question, does anyone know off the top of their head the right incantation to get guestfish to take my kernel and initramfs files and put them into a syslinux/extlinux Google Compute Engine “disk.raw” 10G MBR sparse bootable image, equivalent to the solo5 script above, and compliant with the Google requirements below? I’m hoping that there’s a simple one or two commands to do so.
An important constraint is that I will be scripting this and running it on a server that I am not permitted to run “mount” on.
thanks heaps! And if I’ve broken etiquette by not first grinding it out before asking, then I apologise.
Andrew
Requirements
To import your boot disks to Compute Engine, your existing boot disks must meet the following requirements:
• If you built a custom operating system kernel, it must meet the hardware and kernel configuration requirements. Most stock Linux distributions already meet these requirements, so this requirement is only for advanced users who build their own custom operating systems to run on Compute Engine.
• The boot disk must be no larger than 2048GB (2TB).
• The boot disk that you import must have a functional MBR partition table or a hybrid configuration of a GPT partition table with an MBR bootloader.
• The primary partition on the boot disk can be in any format that you like as long as it boots properly from the MBR bootloader.
• The bootloader on the boot disk must not have quiet, rhgb, or splashimage= kernel command line arguments. Compute Engine does not support splash screens on boot. You can remove these values from the GRUB config during the bootloader configuration step.
The image file that you import must meet the following requirements:
• The disk image file name must be disk.raw.
• The RAW image file must have a size in an increment of 1 GB. For example, the file must be either 10 GB or 11 GB but not 10.5 GB.
• The compressed file must be a .tar.gz file that uses gzip compression and the GNU tar format.
7 years, 10 months
[PATCH v4 0/5] hivex: handle corrupted hives better.
by Dawid Zamirski
The following patches address issues when dealing with hives that have
corrupted data in them but are otherwise readable/writable. Those were
found on some rather rare Windows installations that seem to work fine
but current hivex fails to even open.
Those patches change hivex to simply log and ignore such "corrupted"
regions instead of aborting because the caller might be looking at keys
that are perfectly readable/writable (e.g. to identify Windows version
from HKLM/Software/Microsoft/Windows NT/CurrentVersion) and other
"corrupted" and irrelevant keys might prevent one from doing so.
Changes in v4:
* rebase on current master
* add HIVEX_OPEN_UNSAFE flag to be used as a guard to enable changes
made in these series. This is because heuristic approach is not
guaranteed to be always accurate/safe nor is tolerating corrupted
blocks when traversing nodes. It's better to have this behavior
optional.
* make the "hbin" while loop seek by 4k again and also check against
h->size as well as h->endpages - same as the outer loop.
* made hivesh and hivesregedit take -u and --unsafe arguments
respectively, and also be more forgiving when errors happen that
we can recover from - as separate patches 4 & 5
Regards,
Dawid Zamirski (5):
add HIVEX_OPEN_UNSAFE flag.
lib: change how hbin sections are read.
lib: allow to walk registry with corrupted blocks
hivexsh: add -u flag for HIVEX_OPEN_UNSAFE.
hivexregedit: allow to pass HIVEX_OPEN_UNSAFE
generator/generator.ml | 8 +++++
lib/handle.c | 68 +++++++++++++++++++++++++++++++++++++------
lib/hivex-internal.h | 1 +
lib/node.c | 46 ++++++++++++++++++++++-------
perl/lib/Win/Hivex/Regedit.pm | 59 +++++++++++++++++++++++++++++++++----
regedit/hivexregedit | 20 +++++++++++--
sh/hivexsh.c | 26 +++++++++++++----
7 files changed, 193 insertions(+), 35 deletions(-)
--
2.9.3
7 years, 10 months
[PATCH v2 0/2] hivex: handle corrupted hives better
by Dawid Zamirski
The following patches address issues when dealing with hives that have
corrupted data in them but are otherwise readable/writable. Those were
found on some rather rare Windows installations that seem to work fine
but current hivex fails to even open.
Those patches change hivex to simply log and ignore such "corrupted"
regions instead of aborting because the caller might be looking at keys
that are perfectly readable/writable (e.g. to identify Windows version
from HKLM/Software/Microsoft/Windows NT/CurrentVersion) and other
"corrupted" and irrelevant keys might prevent one from doing so.
Changes in v2:
* fixed code formatting
* added more debug statements
* do not depend on bad_root_block variable, instead report error and
exit if root block is corrupted
* handle the missed case where check_child_is_nk_block was still
returning instead of skipping faulty block with debug message
Regards,
Dawid Zamirski (2):
lib: change how hbin sections are read.
lib: allow to walk registry with corrupted blocks
lib/handle.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++---------
lib/node.c | 21 ++++++++++++---------
2 files changed, 58 insertions(+), 18 deletions(-)
--
2.9.3
7 years, 10 months
[PATCH v3 0/2] hivex: handle corrupted hives better
by Dawid Zamirski
The following patches address issues when dealing with hives that have
corrupted data in them but are otherwise readable/writable. Those were
found on some rather rare Windows installations that seem to work fine
but current hivex fails to even open.
Those patches change hivex to simply log and ignore such "corrupted"
regions instead of aborting because the caller might be looking at keys
that are perfectly readable/writable (e.g. to identify Windows version
from HKLM/Software/Microsoft/Windows NT/CurrentVersion) and other
"corrupted" and irrelevant keys might prevent one from doing so.
Changes in v3:
* rebase on current master
* fix GCC7 -Wunsafe-loop-optimizations warning by incrementing the "off"
variable by 1 rather than 0x1000, the latter was assuming "garbage" data
in between "hbins" would be aligned on 4096 bytes which does not have to
be true and GCC7 is correct.
Regards,
Dawid Zamirski (2):
lib: change how hbin sections are read.
lib: allow to walk registry with corrupted blocks
lib/handle.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++---------
lib/node.c | 21 ++++++++++++---------
2 files changed, 58 insertions(+), 18 deletions(-)
--
2.9.3
7 years, 10 months