Windows P2V migration temporary recipe
by Greg Scott
These are the current steps we followed to set up and run Windows P2V migrations. Note that development is proceeding rapidly and the versions of all pieces below will likely be obsolete soon.
*************************************************************
Windows RHEV P2V Cookbook 2011-1122
1. Install 32 bit Fedora 14 as a virtual machine or physical host. You will use this system to
build a .ISO file to burn to CD. Later in the process, you'll boot a source physical machine from
this CD.
2. Install 64 bit Fedora 16 as another virtual machine or physical host. This will become your migration
server.
3 - Download and install virt-v2v on both the 32 and 64 bit systems. (yum install virt-v2v).
Virt-v2v is a package to migrate virtual machines from one virtual environment to either libvirt or RHEV. It
also includes the P2V extensions.
4 - Download, install, and run virt-p2v-image-builder (yum install virt-p2v-image-builder) on the 32 bit
system. virt-p2v-image-builder is a tool that builds a .ISO file for source physical machines to boot from.
Do this on the 32 bit system so it builds a 32 bit kernel so you can use it to boot 32 bit hardware. Burn the
.ISO file to a CD. You won't need the 32 bit system any more.
All subsequent Fedora operations will happen on the 64 bit system.
5. On the 64 bit Fedora system, edit /etc/yum.repos.d/fedora-updates-testing.repo; change "enabled=0" to
"enabled=1"
6. yum install and/or update libguestfs. This downloads and installs libguestfs-1.14.2-1.fc16.x86_64 and all
its dependencies. (Much easier than downloading all the RPMs by hand.)
7. Go to the link Matt provided:
http://koji.fedoraproject.org/koji/taskinfo?taskID=3531688
and install Matt's temporary bleeding edge version of virt-v2v. Edit /usr/bin/virt-p2v-server and uncomment
the line setting $ENV{'LIBGUESTFS_TRACE'} = 1;
7 - Edit the target profile on the Fedora system (/etc/virt-v2v.conf). This describes the environment to
migrate into. The .conf file is separated into sections. Copy the appropriate section, paste it in the
bottom, remove the comment markers, and customize with correct names of objects for this site.
8. From RHEL 6 supplementary RHN channel or other suitable source, download and install a copy of virtio-win-
1.3.3-0.el6.noarch.rpm on the Fedora migration server.
9. Install libguestfs-winsupport on a RHEL 6.1 or newer system. On that RHEL 6 system do:
cd /var/lib/virt-v2v/software
tar -cvf firstboot.tar windows
10. Copy firstboot.tar to /var/lib/virt-v2v/software on the Fedora migration server.
11. On the Fedora migration server:
cd /var/lib/virt-v2v/software
tar -xvf firstboot.tar
This should set up the following:
[root@Fedora16-64P2V software]# pwd
/var/lib/virt-v2v/software
[root@Fedora16-64P2V software]# ls -al -R
.:
total 4312
drwxr-xr-x. 3 root root 4096 Nov 22 10:49 .
drwxr-xr-x. 3 root root 4096 Nov 22 10:25 ..
-rw-r--r--. 1 root root 4403200 Nov 22 10:48 firstboot.tar
drwxr-xr-x. 2 root root 4096 Jun 23 05:53 windows
./windows:
total 4304
drwxr-xr-x. 2 root root 4096 Jun 23 05:53 .
drwxr-xr-x. 3 root root 4096 Nov 22 10:49 ..
-rw-r--r--. 1 root root 994 Feb 14 2011 firstboot.bat
-rw-r--r--. 1 root root 4324584 Feb 14 2011 rhev-apt.exe
-rw-r--r--. 1 root root 68928 Feb 14 2011 rhsrvany.exe
[root@Fedora16-64P2V software]#
12. Now try a P2V. Boot the source Windows system from the CD created earlier, connect to the Fedora
migration server IP Address, select the profile you made and start the migration. This should create a
virtual machine and virtual disk images in the RHEV Exports staging area.
13. When the migration finishes, use RHEV Manager to import the newly migrated virtual machine into the RHEV
environment.
12 years, 8 months
[hivex][PATCH] Increase filetime printing resolution to sub-second
by Alex Nelson
Signed-off-by: Alex Nelson <ajnelson(a)cs.ucsc.edu>
---
xml/hivexml.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/xml/hivexml.c b/xml/hivexml.c
index 5030c24..98b90c5 100644
--- a/xml/hivexml.c
+++ b/xml/hivexml.c
@@ -185,6 +185,8 @@ filetime_to_8601 (int64_t windows_ticks)
char *ret;
time_t t;
struct tm *tm;
+ int64_t sub_seconds;
+ size_t ftd; /* # chars formatted so far. */
if (windows_ticks == 0LL)
return NULL;
@@ -194,16 +196,28 @@ filetime_to_8601 (int64_t windows_ticks)
if (tm == NULL)
return NULL;
- ret = malloc (TIMESTAMP_BUF_LEN);
+ sub_seconds = windows_ticks % WINDOWS_TICK;
+ /* Trim trailing zeroes from fractional part. */
+ while (sub_seconds % 10 == 0 && sub_seconds > 0) {
+ sub_seconds /= 10;
+ }
+
+ ret = calloc (TIMESTAMP_BUF_LEN, sizeof (char));
if (ret == NULL) {
- perror ("malloc");
+ perror ("calloc");
exit (EXIT_FAILURE);
}
- if (strftime (ret, TIMESTAMP_BUF_LEN, "%FT%TZ", tm) == 0) {
+ if (strftime (ret, TIMESTAMP_BUF_LEN, "%FT%T", tm) == 0) {
perror ("strftime");
exit (EXIT_FAILURE);
}
+ ftd = strlen (ret);
+
+ if (snprintf (ret + ftd, TIMESTAMP_BUF_LEN - ftd, ".%" PRIi64 "Z", sub_seconds) == 0) {
+ perror ("snprintf");
+ exit (EXIT_FAILURE);
+ }
return ret;
}
--
1.7.6.4
12 years, 9 months
[hivex][PATCH 2/8] generator: Add new return type to ABI: RLenValue
by Alex Nelson
RLenValue is similar to RLenType, though with one less argument. This
required adding additional conversion functions for several languages'
bindings.
Signed-off-by: Alex Nelson <ajnelson(a)cs.ucsc.edu>
---
generator/generator.ml | 78 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 78 insertions(+), 0 deletions(-)
diff --git a/generator/generator.ml b/generator/generator.ml
index def516f..7ece245 100755
--- a/generator/generator.ml
+++ b/generator/generator.ml
@@ -51,6 +51,7 @@ and ret =
| RNodeList (* Returns hive_node_h* or NULL. *)
| RValue (* Returns hive_value_h or 0. *)
| RValueList (* Returns hive_value_h* or NULL. *)
+ | RLenValue (* Returns offset and length of value. *)
| RString (* Returns char* or NULL. *)
| RStringList (* Returns char** or NULL. *)
| RLenType (* See hivex_value_type. *)
@@ -888,6 +889,7 @@ and generate_c_prototype ?(extern = false) name style =
| RValueList -> pr "hive_value_h *"
| RString -> pr "char *"
| RStringList -> pr "char **"
+ | RLenValue -> pr "hive_value_h "
| RLenType -> pr "int "
| RLenTypeVal -> pr "char *"
| RInt32 -> pr "int32_t "
@@ -909,6 +911,7 @@ and generate_c_prototype ?(extern = false) name style =
) (snd style);
(match fst style with
| RLenType | RLenTypeVal -> pr ", hive_type *t, size_t *len"
+ | RLenValue -> pr ", size_t *len"
| _ -> ()
);
pr ");\n"
@@ -1111,6 +1114,10 @@ On error this returns NULL and sets errno.\n\n"
pr "\
Returns 0 on success.
On error this returns -1 and sets errno.\n\n"
+ | RLenValue ->
+ pr "\
+Returns a value handle.
+On error this returns 0 and sets errno.\n\n"
| RLenTypeVal ->
pr "\
The value is returned as an array of bytes (of length C<len>).
@@ -1622,6 +1629,7 @@ and generate_ocaml_prototype ?(is_external = false) name style =
| RString -> pr "string"
| RStringList -> pr "string array"
| RLenType -> pr "hive_type * int"
+ | RLenValue -> pr "value * int"
| RLenTypeVal -> pr "hive_type * string"
| RInt32 -> pr "int32"
| RInt64 -> pr "int64"
@@ -1685,6 +1693,7 @@ static hive_type HiveType_val (value);
static value Val_hive_type (hive_type);
static value copy_int_array (size_t *);
static value copy_type_len (size_t, hive_type);
+static value copy_len_value (size_t, hive_value_h);
static value copy_type_value (const char *, size_t, hive_type);
static void raise_error (const char *) Noreturn;
static void raise_closed (const char *) Noreturn;
@@ -1707,6 +1716,7 @@ static void raise_closed (const char *) Noreturn;
let c_params =
match fst style with
| RLenType | RLenTypeVal -> c_params @ [["&t"; "&len"]]
+ | RLenValue -> c_params @ [["&len"]]
| _ -> c_params in
let c_params = List.concat c_params in
@@ -1779,6 +1789,11 @@ static void raise_closed (const char *) Noreturn;
pr " size_t len;\n";
pr " hive_type t;\n";
"-1"
+ | RLenValue ->
+ pr " errno = 0;";
+ pr " hive_value_h r;\n";
+ pr " size_t len;\n";
+ "0 && errno != 0"
| RLenTypeVal ->
pr " char *r;\n";
pr " size_t len;\n";
@@ -1859,6 +1874,7 @@ static void raise_closed (const char *) Noreturn;
pr " for (int i = 0; r[i] != NULL; ++i) free (r[i]);\n";
pr " free (r);\n"
| RLenType -> pr " rv = copy_type_len (len, t);\n"
+ | RLenValue -> pr " rv = copy_len_value (len, r);\n"
| RLenTypeVal ->
pr " rv = copy_type_value (r, len, t);\n";
pr " free (r);\n"
@@ -1981,6 +1997,20 @@ copy_type_len (size_t len, hive_type t)
}
static value
+copy_len_value (size_t len, hive_value_h r)
+{
+ CAMLparam0 ();
+ CAMLlocal2 (v, rv);
+
+ rv = caml_alloc (2, 0);
+ v = Val_int (len);
+ Store_field (rv, 0, v);
+ v = Val_int (r);
+ Store_field (rv, 1, v);
+ CAMLreturn (rv);
+}
+
+static value
copy_type_value (const char *r, size_t len, hive_type t)
{
CAMLparam0 ();
@@ -2170,6 +2200,7 @@ sub open {
| RString
| RStringList
| RLenType
+ | RLenValue
| RLenTypeVal
| RInt32
| RInt64 -> ()
@@ -2244,6 +2275,7 @@ and generate_perl_prototype name style =
| RString -> pr "$string = "
| RStringList -> pr "@strings = "
| RLenType -> pr "($type, $len) = "
+ | RLenValue -> pr "($len, $value) = "
| RLenTypeVal -> pr "($type, $data) = "
| RInt32 -> pr "$int32 = "
| RInt64 -> pr "$int64 = "
@@ -2467,6 +2499,7 @@ DESTROY (h)
| RValueList
| RStringList
| RLenType
+ | RLenValue
| RLenTypeVal -> pr "void\n"
| RInt32 -> pr "SV *\n"
| RInt64 -> pr "SV *\n"
@@ -2639,6 +2672,22 @@ DESTROY (h)
pr " PUSHs (sv_2mortal (newSViv (type)));\n";
pr " PUSHs (sv_2mortal (newSViv (len)));\n";
+ | RLenValue ->
+ pr "PREINIT:\n";
+ pr " hive_value_h r;\n";
+ pr " size_t len;\n";
+ pr " PPCODE:\n";
+ pr " errno = 0;\n";
+ pr " r = hivex_%s (%s, &len);\n"
+ name (String.concat ", " c_params);
+ free_args ();
+ pr " if (r == 0 && errno)\n";
+ pr " croak (\"%%s: \", \"%s\", strerror (errno));\n"
+ name;
+ pr " EXTEND (SP, 2);\n";
+ pr " PUSHs (sv_2mortal (newSViv (len)));\n";
+ pr " PUSHs (sv_2mortal (newSViv (r)));\n";
+
| RLenTypeVal ->
pr "PREINIT:\n";
pr " char *r;\n";
@@ -2877,6 +2926,15 @@ put_len_type (size_t len, hive_type t)
}
static PyObject *
+put_len_val (size_t len, hive_value_h value)
+{
+ PyObject *r = PyTuple_New (2);
+ PyTuple_SetItem (r, 0, PyLong_FromLongLong ((long) len));
+ PyTuple_SetItem (r, 1, PyLong_FromLongLong ((long) value));
+ return r;
+}
+
+static PyObject *
put_val_type (char *val, size_t len, hive_type t)
{
PyObject *r = PyTuple_New (2);
@@ -2916,6 +2974,11 @@ put_val_type (char *val, size_t len, hive_type t)
pr " size_t len;\n";
pr " hive_type t;\n";
"-1"
+ | RLenValue ->
+ pr " errno = 0;\n";
+ pr " int r;\n";
+ pr " size_t len;\n";
+ "0 && errno != 0"
| RLenTypeVal ->
pr " char *r;\n";
pr " size_t len;\n";
@@ -2940,6 +3003,7 @@ put_val_type (char *val, size_t len, hive_type t)
let c_params =
match fst style with
| RLenType | RLenTypeVal -> c_params @ ["&t"; "&len"]
+ | RLenValue -> c_params @ ["&len"]
| _ -> c_params in
List.iter (
@@ -3084,6 +3148,8 @@ put_val_type (char *val, size_t len, hive_type t)
pr " free_strings (r);\n"
| RLenType ->
pr " py_r = put_len_type (len, t);\n"
+ | RLenValue ->
+ pr " py_r = put_len_val (len, r);\n"
| RLenTypeVal ->
pr " py_r = put_val_type (r, len, t);\n";
pr " free (r);\n"
@@ -3294,6 +3360,7 @@ get_values (VALUE valuesv, size_t *nr_values)
| RString -> "string"
| RStringList -> "list"
| RLenType -> "hash"
+ | RLenValue -> "integer"
| RLenTypeVal -> "hash"
| RInt32 -> "integer"
| RInt64 -> "integer" in
@@ -3392,6 +3459,11 @@ get_values (VALUE valuesv, size_t *nr_values)
pr " size_t len;\n";
pr " hive_type t;\n";
"-1"
+ | RLenValue ->
+ pr " errno = 0;\n";
+ pr " hive_value_h r;\n";
+ pr " size_t len;\n";
+ "0 && errno != 0"
| RLenTypeVal ->
pr " char *r;\n";
pr " size_t len;\n";
@@ -3416,6 +3488,7 @@ get_values (VALUE valuesv, size_t *nr_values)
let c_params =
match ret with
| RLenType | RLenTypeVal -> c_params @ [["&t"; "&len"]]
+ | RLenValue -> c_params @ [["&len"]]
| _ -> c_params in
let c_params = List.concat c_params in
@@ -3497,6 +3570,11 @@ get_values (VALUE valuesv, size_t *nr_values)
pr " rb_hash_aset (rv, ID2SYM (rb_intern (\"len\")), INT2NUM (len));\n";
pr " rb_hash_aset (rv, ID2SYM (rb_intern (\"type\")), INT2NUM (t));\n";
pr " return rv;\n"
+ | RLenValue ->
+ pr " VALUE rv = rb_hash_new ();\n";
+ pr " rb_hash_aset (rv, ID2SYM (rb_intern (\"len\")), INT2NUM (len));\n";
+ pr " rb_hash_aset (rv, ID2SYM (rb_intern (\"off\")), ULL2NUM (r));\n";
+ pr " return rv;\n"
| RLenTypeVal ->
pr " VALUE rv = rb_hash_new ();\n";
pr " rb_hash_aset (rv, ID2SYM (rb_intern (\"len\")), INT2NUM (len));\n";
--
1.7.4.4
12 years, 9 months
P2Vs seem to require a very robust Ethernet
by Greg Scott
Now that we can gather diagnostic info, I think I know why our P2Vs kept
failing last week. Another one just died right in front of my eyes. I
think either the Ethernet or NFS server at this site occasionally
"blips" offline when it gets busy and that messes up P2V migrations.
The RHEV export domain is an NFS share offered by an old Storagetek NAS,
connected over a 10/100 Ethernet. All of us would prefer a gb Ethernet
but this is what we have available.
First, an extract from /var/log/messages showing the start and end times
for virt-p2v-server, about 3 1/2 hours.
[root@Fedora16-64P2V log]# tail /var/log/messages -c 1000
16-64P2V systemd-logind[704]: Removed session 16.
Nov 22 19:04:46 Fedora16-64P2V systemd-logind[704]: New session 17 of
user root.
Nov 22 19:04:48 Fedora16-64P2V virt-v2v[1733]: p2v-server started.
Nov 22 20:01:01 Fedora16-64P2V systemd-logind[704]: New session 18 of
user root.
Nov 22 20:01:02 Fedora16-64P2V systemd-logind[704]: Removed session 18.
Nov 22 21:01:01 Fedora16-64P2V systemd-logind[704]: New session 19 of
user root.
Nov 22 21:01:01 Fedora16-64P2V systemd-logind[704]: Removed session 19.
Nov 22 22:01:02 Fedora16-64P2V systemd-logind[704]: New session 20 of
user root.
Nov 22 22:01:02 Fedora16-64P2V systemd-logind[704]: Removed session 20.
Nov 22 22:33:44 Fedora16-64P2V virt-v2v[1733]: FATAL: Error receiving
data:
Nov 22 22:33:44 Fedora16-64P2V systemd-logind[704]: Removed session 17.
Nov 22 22:33:44 Fedora16-64P2V virt-v2v[1733]: WARNING: Error messages
were written to /var/log/virt-p2v-server.1322010288.log.
Nov 22 22:33:44 Fedora16-64P2V virt-v2v[1733]: p2v-server exited.
[root@Fedora16-64P2V log]#
Next, the output from the trace log file from virt-p2v-server:
[root@Fedora16-64P2V log]# more virt-p2v-server.1322010288.log
virt-v2v: Error receiving data:
[root@Fedora16-64P2V log]#
Before it blew up, I was watching network usage of my RHEV host with the
Fedora migration server VM and it consistently pegged above 90%+. I've
never seen an Ethernet that saturated before. The iftop utility on my
Fedora guest migration server showed data consistently flying at 69-90+
Mb per second.
- Greg Scott
12 years, 9 months
[PATCH] hivex: Added gnulib includes from builddir, as suggested by the Gnulib documentation; link hivexml against libgnu.
by Hilko Bengen
Since some modules (`getopt', for example) may copy files
into the build directory, `top_builddir/lib' is needed as well as
`top_srcdir/lib'. -- GNU Gnulib manual, section 2.2 Initial import
This fixes an in-tree build failure on a Debian/sid system (see
below). hivexml could be built out-of-tree, but it turned out that due
to a missing include path, in this case the system's getopt
implementation was used insted of Gnulib's.
make[2]: Entering directory `«SRCDIR»/xml'
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -DLOCALEBASEDIR=\""/usr/local/share/locale"\" -I../gnulib/lib -I../lib -I/usr/include/libxml2 -g -O2 -MT hivexml-hivexml.o -MD -MP -MF .deps/hivexml-hivexml.Tpo -c -o hivexml-hivexml.o `test -f 'hivexml.c' || echo './'`hivexml.c
mv -f .deps/hivexml-hivexml.Tpo .deps/hivexml-hivexml.Po
/bin/bash ../libtool --tag=CC --mode=link gcc -std=gnu99 -DLOCALEBASEDIR=\""/usr/local/share/locale"\" -I../gnulib/lib -I../lib -I/usr/include/libxml2 -g -O2 -o hivexml hivexml-hivexml.o ../lib/libhivex.la -lxml2
libtool: link: gcc -std=gnu99 -DLOCALEBASEDIR=\"/usr/local/share/locale\" -I../gnulib/lib -I../lib -I/usr/include/libxml2 -g -O2 -o .libs/hivexml hivexml-hivexml.o ../lib/.libs/libhivex.so /usr/lib/libxml2.so
hivexml-hivexml.o: In function `main':
«SRCDIR»/xml/hivexml.c:96: undefined reference to `rpl_getopt'
«SRCDIR»/xml/hivexml.c:110: undefined reference to `rpl_optind'
«SRCDIR»/xml/hivexml.c:154: undefined reference to `rpl_optind'
collect2: ld returned 1 exit status
make[2]: *** [hivexml] Error 1
make[2]: Leaving directory `«SRCDIR»/xml'
---
lib/Makefile.am | 5 ++++-
sh/Makefile.am | 1 +
xml/Makefile.am | 3 ++-
xml/hivexml.c | 2 ++
4 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/Makefile.am b/lib/Makefile.am
index cfd2e05..a339a00 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -39,7 +39,10 @@ libhivex_la_LDFLAGS = \
$(LTLIBINTL) \
$(LTLIBTHREAD)
libhivex_la_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
-libhivex_la_CPPFLAGS = -I$(top_srcdir)/gnulib/lib -I$(srcdir)
+libhivex_la_CPPFLAGS = \
+ -I$(top_srcdir)/gnulib/lib \
+ -I$(top_builddir)/gnulib/lib \
+ -I$(srcdir)
include_HEADERS = hivex.h
diff --git a/sh/Makefile.am b/sh/Makefile.am
index 0898370..a6f5ae6 100644
--- a/sh/Makefile.am
+++ b/sh/Makefile.am
@@ -38,6 +38,7 @@ hivexsh_SOURCES = \
hivexsh_LDADD = ../lib/libhivex.la ../gnulib/lib/libgnu.la $(LIBREADLINE)
hivexsh_CFLAGS = \
-I$(top_srcdir)/gnulib/lib \
+ -I$(top_builddir)/gnulib/lib \
-I$(top_srcdir)/lib \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
$(WARN_CFLAGS) $(WERROR_CFLAGS)
diff --git a/xml/Makefile.am b/xml/Makefile.am
index b2af45d..67ba248 100644
--- a/xml/Makefile.am
+++ b/xml/Makefile.am
@@ -23,10 +23,11 @@ bin_PROGRAMS = hivexml
hivexml_SOURCES = \
hivexml.c
-hivexml_LDADD = ../lib/libhivex.la $(LIBXML2_LIBS)
+hivexml_LDADD = ../lib/libhivex.la ../gnulib/lib/libgnu.la $(LIBXML2_LIBS)
hivexml_CFLAGS = \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/gnulib/lib \
+ -I$(top_builddir)/gnulib/lib \
-I$(top_srcdir)/lib \
$(LIBXML2_CFLAGS) \
$(WARN_CFLAGS) $(WERROR_CFLAGS)
diff --git a/xml/hivexml.c b/xml/hivexml.c
index 5030c24..d38e9d4 100644
--- a/xml/hivexml.c
+++ b/xml/hivexml.c
@@ -32,6 +32,8 @@
#include <libintl.h>
#endif
+#include <getopt.h>
+
#include <libxml/xmlwriter.h>
#include "hivex.h"
--
1.7.7.3
12 years, 9 months
[PATCH 0/2] MD device inspection
by Matthew Booth
These patches are rebased on top of current master. In addition, I've made the
following changes:
* Fixed whitespace error.
* Functions return -1 on error.
* Added a debug message when guest contains md devices, but nothing was parsed
from mdadm.conf.
12 years, 9 months
[PATCH] out of tree build: ruby (second take)
by Hilko Bengen
---
ruby/Rakefile.in | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/ruby/Rakefile.in b/ruby/Rakefile.in
index da9f3f1..2587476 100644
--- a/ruby/Rakefile.in
+++ b/ruby/Rakefile.in
@@ -24,10 +24,10 @@ require 'rake/gempackagetask'
PKG_NAME='@PACKAGE_NAME@'
PKG_VERSION='@PACKAGE_VERSION@'
-EXT_CONF='@srcdir(a)/ext/hivex/extconf.rb'
+EXT_CONF='@abs_srcdir(a)/ext/hivex/extconf.rb'
MAKEFILE='@builddir@/ext/hivex/Makefile'
HIVEX_MODULE='@builddir(a)/ext/hivex/_hivex.so'
-HIVEX_SRC='@srcdir(a)/ext/hivex/_hivex.c'
+HIVEX_SRC='@abs_srcdir(a)/ext/hivex/_hivex.c'
CLEAN.include [ "@builddir(a)/ext/**/*.o", HIVEX_MODULE,
"@builddir@/ext/**/depend" ]
@@ -38,13 +38,13 @@ CLOBBER.include [ "@builddir(a)/config.save", "@builddir(a)/ext/**/mkmf.log",
# Build locally
file MAKEFILE => EXT_CONF do |t|
- unless sh "top_srcdir=$(pwd)/@top_srcdir@; top_builddir=$(pwd)/@top_builddir@; export ARCHFLAGS=\"-arch $(uname -m)\"; cd #{File::dirname(EXT_CONF)}; ruby #{File::basename(EXT_CONF)} --with-_hivex-include=$top_srcdir/lib --with-_hivex-lib=$top_builddir/lib/.libs"
+ unless sh "top_srcdir=$(pwd)/@top_srcdir@; top_builddir=$(pwd)/@top_builddir@; export ARCHFLAGS=\"-arch $(uname -m)\"; mkdir -p @builddir@/ext/hivex; cd @builddir@/ext/hivex; ruby #{EXT_CONF} --with-_hivex-include=$top_srcdir/lib --with-_hivex-lib=$top_builddir/lib/.libs"
$stderr.puts "Failed to run extconf"
break
end
end
file HIVEX_MODULE => [ MAKEFILE, HIVEX_SRC ] do |t|
- Dir::chdir(File::dirname(EXT_CONF)) do
+ Dir::chdir("@builddir@/ext/hivex") do
unless sh "make"
$stderr.puts "make failed"
break
@@ -61,19 +61,19 @@ end
task :test => :build
RDOC_FILES = FileList[
- "README.rdoc",
- "lib/**/*.rb",
- "ext/**/*.[ch]"
+ "@srcdir(a)/README.rdoc",
+ "@srcdir(a)/lib/**/*.rb",
+ "@srcdir(a)/ext/**/*.[ch]"
]
Rake::RDocTask.new do |rd|
- rd.main = "README.rdoc"
+ rd.main = "@srcdir(a)/README.rdoc"
rd.rdoc_dir = "doc/site/api"
rd.rdoc_files.include(RDOC_FILES)
end
Rake::RDocTask.new(:ri) do |rd|
- rd.main = "README.rdoc"
+ rd.main = "@srcdir(a)/README.rdoc"
rd.rdoc_dir = "doc/ri"
rd.options << "--ri-system"
rd.rdoc_files.include(RDOC_FILES)
@@ -82,7 +82,7 @@ end
# Package tasks
PKG_FILES = FileList[
- "Rakefile", "COPYING", "README", "NEWS", "README.rdoc",
+ "Rakefile", "COPYING", "README", "NEWS", "@srcdir(a)/README.rdoc",
"lib/**/*.rb",
"ext/**/*.[ch]", "ext/**/MANIFEST", "ext/**/extconf.rb",
"tests/**/*",
--
1.7.7.3
12 years, 9 months
[PATCH] out of tree build: ruby
by Hilko Bengen
---
ruby/Rakefile.in | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/ruby/Rakefile.in b/ruby/Rakefile.in
index da9f3f1..99a195d 100644
--- a/ruby/Rakefile.in
+++ b/ruby/Rakefile.in
@@ -27,7 +27,7 @@ PKG_VERSION='@PACKAGE_VERSION@'
EXT_CONF='@srcdir(a)/ext/hivex/extconf.rb'
MAKEFILE='@builddir@/ext/hivex/Makefile'
HIVEX_MODULE='@builddir(a)/ext/hivex/_hivex.so'
-HIVEX_SRC='@srcdir(a)/ext/hivex/_hivex.c'
+HIVEX_SRC='@abs_srcdir(a)/ext/hivex/_hivex.c'
CLEAN.include [ "@builddir(a)/ext/**/*.o", HIVEX_MODULE,
"@builddir@/ext/**/depend" ]
@@ -38,13 +38,13 @@ CLOBBER.include [ "@builddir(a)/config.save", "@builddir(a)/ext/**/mkmf.log",
# Build locally
file MAKEFILE => EXT_CONF do |t|
- unless sh "top_srcdir=$(pwd)/@top_srcdir@; top_builddir=$(pwd)/@top_builddir@; export ARCHFLAGS=\"-arch $(uname -m)\"; cd #{File::dirname(EXT_CONF)}; ruby #{File::basename(EXT_CONF)} --with-_hivex-include=$top_srcdir/lib --with-_hivex-lib=$top_builddir/lib/.libs"
+ unless sh "top_srcdir=$(pwd)/@top_srcdir@; top_builddir=$(pwd)/@top_builddir@; export ARCHFLAGS=\"-arch $(uname -m)\"; mkdir -p @builddir@/ext/guestfs; cd @builddir@/hivex; ruby #(EXT_CONF} --with-_hivex-include=$top_srcdir/lib --with-_hivex-lib=$top_builddir/lib/.libs"
$stderr.puts "Failed to run extconf"
break
end
end
file HIVEX_MODULE => [ MAKEFILE, HIVEX_SRC ] do |t|
- Dir::chdir(File::dirname(EXT_CONF)) do
+ Dir::chdir("@builddir@/ext/hivex") do
unless sh "make"
$stderr.puts "make failed"
break
@@ -61,19 +61,19 @@ end
task :test => :build
RDOC_FILES = FileList[
- "README.rdoc",
- "lib/**/*.rb",
- "ext/**/*.[ch]"
+ "@srcdir(a)/README.rdoc",
+ "@srcdir(a)/lib/**/*.rb",
+ "@srcdir(a)/ext/**/*.[ch]"
]
Rake::RDocTask.new do |rd|
- rd.main = "README.rdoc"
+ rd.main = "@srcdir(a)/README.rdoc"
rd.rdoc_dir = "doc/site/api"
rd.rdoc_files.include(RDOC_FILES)
end
Rake::RDocTask.new(:ri) do |rd|
- rd.main = "README.rdoc"
+ rd.main = "@srcdir(a)/README.rdoc"
rd.rdoc_dir = "doc/ri"
rd.options << "--ri-system"
rd.rdoc_files.include(RDOC_FILES)
@@ -82,7 +82,7 @@ end
# Package tasks
PKG_FILES = FileList[
- "Rakefile", "COPYING", "README", "NEWS", "README.rdoc",
+ "Rakefile", "COPYING", "README", "NEWS", "@srcdir(a)/README.rdoc",
"lib/**/*.rb",
"ext/**/*.[ch]", "ext/**/MANIFEST", "ext/**/extconf.rb",
"tests/**/*",
--
1.7.7.3
12 years, 9 months
[PATCH] NFC: Cleanup iteration over fstab entries in inspect_fs_unix.c
by Matthew Booth
Select non-comment labels using an augeas path to return the correct nodes in
the first instance, rather than applying a regular expression to all results.
Iterate over returned matches using a char** iterator.
Use asprintf() to ensure the path string buffer is the correct size.
---
src/inspect_fs_unix.c | 53 +++++++++++++++++++++++-------------------------
1 files changed, 25 insertions(+), 28 deletions(-)
diff --git a/src/inspect_fs_unix.c b/src/inspect_fs_unix.c
index 0fa3e83..27a27e5 100644
--- a/src/inspect_fs_unix.c
+++ b/src/inspect_fs_unix.c
@@ -110,7 +110,6 @@ compile_regexps (void)
COMPILE (re_scientific_linux_no_minor,
"Scientific Linux.*release (\\d+)", 0);
COMPILE (re_major_minor, "(\\d+)\\.(\\d+)", 0);
- COMPILE (re_aug_seq, "/\\d+$", 0);
COMPILE (re_xdev, "^/dev/(h|s|v|xv)d([a-z]+)(\\d*)$", 0);
COMPILE (re_cciss, "^/dev/(cciss/c\\d+d\\d+)(?:p(\\d+))?$", 0);
COMPILE (re_mdN, "^(/dev/md\\d+)$", 0);
@@ -132,7 +131,6 @@ free_regexps (void)
pcre_free (re_scientific_linux);
pcre_free (re_scientific_linux_no_minor);
pcre_free (re_major_minor);
- pcre_free (re_aug_seq);
pcre_free (re_xdev);
pcre_free (re_cciss);
pcre_free (re_mdN);
@@ -725,47 +723,46 @@ check_fstab (guestfs_h *g, struct inspect_fs *fs)
Hash_table *md_map;
if (!map_md_devices (g, &md_map)) return -1;
- char **lines = guestfs_aug_ls (g, "/files/etc/fstab");
- if (lines == NULL) goto error;
+ char **entries = guestfs_aug_match (g, "/files/etc/fstab/*"
+ "[label() != '#comment']");
+ if (entries == NULL) goto error;
- if (lines[0] == NULL) {
+ if (entries[0] == NULL) {
error (g, _("could not parse /etc/fstab or empty file"));
goto error;
}
- size_t i;
char augpath[256];
- for (i = 0; lines[i] != NULL; ++i) {
- /* Ignore comments. Only care about sequence lines which
- * match m{/\d+$}.
- */
- if (match (g, lines[i], re_aug_seq)) {
- snprintf (augpath, sizeof augpath, "%s/spec", lines[i]);
- char *spec = guestfs_aug_get (g, augpath);
- if (spec == NULL) goto error;
-
- snprintf (augpath, sizeof augpath, "%s/file", lines[i]);
- char *mp = guestfs_aug_get (g, augpath);
- if (mp == NULL) {
- free (spec);
- goto error;
- }
-
- int r = add_fstab_entry (g, fs, spec, mp, md_map);
+ for (char **entry = entries; *entry != NULL; entry++) {
+ int len;
+
+ len = snprintf(augpath, sizeof(augpath), "%s/spec", *entry);
+ if (len < 0 || (size_t)len >= sizeof(augpath)) g->abort_cb();
+ char *spec = guestfs_aug_get (g, augpath);
+ if (spec == NULL) goto error;
+
+ len = snprintf(augpath, sizeof(augpath), "%s/file", *entry);
+ if (len < 0 || (size_t)len >= sizeof(augpath)) g->abort_cb();
+ char *mp = guestfs_aug_get (g, augpath);
+ if (mp == NULL) {
free (spec);
- free (mp);
-
- if (r == -1) goto error;
+ goto error;
}
+
+ int r = add_fstab_entry (g, fs, spec, mp, md_map);
+ free (spec);
+ free (mp);
+
+ if (r == -1) goto error;
}
hash_free (md_map);
- guestfs___free_string_list (lines);
+ guestfs___free_string_list (entries);
return 0;
error:
hash_free (md_map);
- if (lines) guestfs___free_string_list (lines);
+ if (entries) guestfs___free_string_list (entries);
return -1;
}
--
1.7.7.3
12 years, 9 months
Re: [Libguestfs] [virt-tools-list] virt-v2v rhev import error
by Richard W.M. Jones
On Tue, Nov 22, 2011 at 08:03:15PM +0000, Wandell, Doug wrote:
> Image is a prebuilt VMWare image from Layer7. Downloaded and converted under RHEL6 like this:
>
> virt-convert --arch=x86_64 SSG_64bit_VirtualAppliance_v6.1/ SSG_64bit_VirtualAppliance_v6.1.xml
> qemu-img convert -O qcow2 SSG_64bit_VirtualAppliance_v6.1.raw SSG_64bit_VirtualAppliance_v6.1.qcow2
>
> No problem. I then manually created an xml definition for libvirt and defined it. Machine boots and runs fine. However, when I go to import into RHEV, I get the following. Note there appear to be 4 different errors here, so i'm not sure where to start:
>
>
> root@rhel6host >virt-v2v -i libvirtxml -o rhev -osd our-netapp:/vol/virt_kvm/import-data layer7box.xml
> SSG_64bit_VirtualAppliance_v6.1.qcow2: 100% [======*=======================================================================================================================================================]0m00s LefSSG_64bit_VirtualAppliance_v6.1.qcow2: 100% [===================================================*==========================================================================================================]0m00s LefSSG_64bit_VirtualAppliance_v6.1.qcow2: 101% [===============================================================================================*==============================================================]0m00s LefSSG_64bit_VirtualAppliance_v6.1.qcow2: 101% [============================================================================================================================================*=================]0m00s LefSSG_64bit_VirtualAppliance_v6.1.qcow2: 101% [===========================*===================================================================================================================================]0m00s LeSSG_64bit_VirtualAppliance_v6.1.qcow2: 101% [========================================================================*======================================================================================]0m00s LeSSG_64bit_VirtualAppliance_v6.1.qcow2: 101% [=====================================================================================================================*=========================================]0m00s LeSSG_64bit_VirtualAppliance_v6.1.qcow2: 101% [====*===========================================================================================================================================================]0m00s LSSG_64bit_VirtualAppliance_v6.1.qcow2: 102% [==================================*=============================================================================================================================]0m00s LSSG_64bit_VirtualAppliance_v6.1.qcow2: 100% [=============================================================================================================================================================]D 0h00m32s
> find: failed to restore initial working directory: Permission denied
> Using CPU model "cpu64-rhel6"
> unknown filesystem label SWAP-sda5
> Error running rpm -qa: command_lines: command_lines: rpm: No such file or directory at /usr/share/perl5/vendor_perl/Sys/VirtV2V/GuestfsHandle.pm line 188.
> at /usr/lib64/perl5/vendor_perl/Sys/Guestfs/Lib.pm line 1022
> virt-v2v: Unable to find any valid modprobe configuration
>
>
> Not sure where to start here. Thanks,
This isn't the right list for virt-v2v questions. That would be
libguestfs(a)redhat.com.
However the larger problem here is that doing offline conversions like
this isn't the way to use virt-v2v. Virt-v2v needs to connect to the
ESX server, and won't work in any other configuration.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/
12 years, 9 months