Compare commits
2 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9337f603fe | ||
|
|
b583257283 |
9 changed files with 378 additions and 2 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -2,3 +2,5 @@
|
|||
x86_64/
|
||||
*.src.rpm
|
||||
.build*.log
|
||||
*~
|
||||
|
||||
|
|
|
|||
75
0001-Fix-docs-for-virt-sandbox-mount-command.patch
Normal file
75
0001-Fix-docs-for-virt-sandbox-mount-command.patch
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
From 1596fcfc96ff08e64e7d862b1b74dd69862f4208 Mon Sep 17 00:00:00 2001
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Tue, 29 Jan 2013 17:00:58 +0000
|
||||
Subject: [PATCH] Fix docs for virt-sandbox mount command
|
||||
|
||||
(cherry picked from commit 75f26e52e52fe9bba013494d0f1b4ff8b9c280b3)
|
||||
---
|
||||
bin/virt-sandbox.c | 46 ++++++++++++++++++++++++++++------------------
|
||||
1 file changed, 28 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/bin/virt-sandbox.c b/bin/virt-sandbox.c
|
||||
index 55039c3..d33ecfb 100644
|
||||
--- a/bin/virt-sandbox.c
|
||||
+++ b/bin/virt-sandbox.c
|
||||
@@ -289,32 +289,42 @@ but this will need to be changed if more than one sandbox is to
|
||||
be run concurrently. This is used as the name of the libvirt
|
||||
virtual machine or container.
|
||||
|
||||
-=item B<-b DST-GUEST-DIR=SRC-GUEST-DIR>, B<--guest-bind DST-GUEST-DIR=SRC-GUEST-DIR>
|
||||
+=item B<-m TYPE:DST=SRC>, B<--mount TYPE:DST=SRC>
|
||||
|
||||
-Binds the guest location B<SRC-GUEST-DIR> to the location B<DST-GUEST-DIR>
|
||||
-such that their contents are indistinguishable. This option may be
|
||||
-repeated multiple times
|
||||
+Sets up a mount inside the sandbox at B<DST> backed by B<SRC>. The
|
||||
+meaning of B<SRC> depends on the value of C<TYPE> specified:
|
||||
|
||||
-=item B<-B DST-GUEST-DIR=SRC-HOST-DIR>, B<--guest-bind DST-GUEST-DIR=SRC-HOST-DIR>
|
||||
+=over 4
|
||||
+
|
||||
+=item B<host-bind>
|
||||
|
||||
-Binds the host location B<SRC-HOST-DIR> to the location B<DST-GUEST-DIR>
|
||||
-such that their contents are indistinguishable. If C<SRC-HOST-DIR> is the
|
||||
-empty string, then a temporary (empty) directory is created on the host
|
||||
-before starting the sandbox and deleted afterwards. The C<--include> option
|
||||
+If B<TYPE> is B<host-bind>, then B<SRC> is interpreted as the path
|
||||
+to a directory on the host filesystem. If C<SRC> is the empty string,
|
||||
+then a temporary (empty) directory is created on the host before
|
||||
+starting the sandbox and deleted afterwards. The C<--include> option
|
||||
is useful for populating these temporary directories with copies of host
|
||||
-files. This option may be repeated multiple times.
|
||||
+files.
|
||||
+
|
||||
+=item B<host-image>
|
||||
|
||||
-=item B<-m DST-GUEST-DIR=SRC-HOST-FILE>, B<--host-image DST-GUEST-DIR=SRC-HOST-FILE>
|
||||
+If B<TYPE> is B<host-image>, then B<SRC> is interpreted as the path
|
||||
+to a disk image file on the host filesystem. The image should be
|
||||
+formatted with a filesystem that can be auto-detected by the sandbox,
|
||||
+such as B<ext3>, B<ext4>, etc. The disk image itself should be a raw
|
||||
+file, not qcow2 or any other special format
|
||||
|
||||
-Treats the host file B<SRC-HOST-FILE> as a virtual disk image and mounts it in
|
||||
-the guest at B<DST-GUEST-DIR>. The disk image should be in raw format. This option
|
||||
-may be repeated multiple times.
|
||||
+=item B<guest-bind>
|
||||
+
|
||||
+If B<TYPE> is B<host-image>, then B<SRC> is interpreted as the path
|
||||
+to another directory in the container filesystem.
|
||||
+
|
||||
+=back
|
||||
|
||||
-=item B<-i HOST-PATH>, B<--include=HOST-PATH>
|
||||
+Some examples
|
||||
|
||||
-Copy this file from the host into the same location in the guest.
|
||||
-This is used to populate content for mount overrides. This may
|
||||
-be repeated multiple times.
|
||||
+ -m host-bind:/tmp=/var/lib/sandbox/demo/tmp
|
||||
+ -m host-image:/=/var/lib/sandbox/demo.img
|
||||
+ -m guest-bind:/home=/tmp/home
|
||||
|
||||
=item B<-I HOST-PATH>, B<--includefile=HOST-PATH>
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
From 657ead2e460b78fefd152163fe4208b3cee0d40f Mon Sep 17 00:00:00 2001
|
||||
From: Dan Walsh <dwalsh@redhat.com>
|
||||
Date: Fri, 8 Feb 2013 15:09:22 -0500
|
||||
Subject: [PATCH] better wording when connecting to a console patch from
|
||||
Michael Scherer.
|
||||
|
||||
"Escape character is '^]'." is the message show by telnet as well as the one of virt-sandbox-service when connecting to the console of a service. But the keyboard shortcut doesn't do the same thing ( ie, on telnet, you have a prompt ).
|
||||
|
||||
While telnet is likely to be unheard from newer admins, I think a better message could be :
|
||||
Type 'Ctrl + ]' to detach from the console.
|
||||
|
||||
(cherry picked from commit 4b218ec94f6a3c20f8e23e2cca9737c41091c358)
|
||||
---
|
||||
bin/virt-sandbox-service | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/bin/virt-sandbox-service b/bin/virt-sandbox-service
|
||||
index 1ad9eaa..3555085 100755
|
||||
--- a/bin/virt-sandbox-service
|
||||
+++ b/bin/virt-sandbox-service
|
||||
@@ -734,7 +734,7 @@ def stop(args):
|
||||
def connect(args):
|
||||
print """\
|
||||
Connected to %s.
|
||||
-Escape character is '^]'.
|
||||
+Type 'Ctrl + ]' to detach from the console.
|
||||
""" % ( args.name )
|
||||
os.execl("/usr/libexec/virt-sandbox-service-util", "virt-sandbox-service-util","-a", args.name)
|
||||
# container = Container(args.name, args.uri)
|
||||
34
0003-Always-set-earlyprintk-kernel-arg.patch
Normal file
34
0003-Always-set-earlyprintk-kernel-arg.patch
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
From 2b6b398a8c87ca0b36fccf67116afec58df5a4ff Mon Sep 17 00:00:00 2001
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Mon, 30 Sep 2013 15:13:06 +0100
|
||||
Subject: [PATCH] Always set earlyprintk kernel arg
|
||||
|
||||
If the initrd fails and prints to stderr, this goes to /dev/null
|
||||
unless earlyprintk is enabled. We always want to see initrd
|
||||
errors, so we should always have earlyprintk set.
|
||||
|
||||
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
(cherry picked from commit b14ce17bb357d5b7f99562c91dafb521f6985b40)
|
||||
|
||||
Conflicts:
|
||||
libvirt-sandbox/libvirt-sandbox-builder-machine.c
|
||||
---
|
||||
libvirt-sandbox/libvirt-sandbox-builder-machine.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libvirt-sandbox/libvirt-sandbox-builder-machine.c b/libvirt-sandbox/libvirt-sandbox-builder-machine.c
|
||||
index 958b546..24e700a 100644
|
||||
--- a/libvirt-sandbox/libvirt-sandbox-builder-machine.c
|
||||
+++ b/libvirt-sandbox/libvirt-sandbox-builder-machine.c
|
||||
@@ -172,9 +172,9 @@ static gchar *gvir_sandbox_builder_machine_cmdline(GVirSandboxConfig *config G_G
|
||||
gchar *tmp;
|
||||
|
||||
/* Now kernel args */
|
||||
- g_string_append(str, " console=ttyS0");
|
||||
+ g_string_append(str, " console=ttyS0 earlyprintk=ttyS0");
|
||||
if (getenv("LIBVIRT_SANDBOX_DEBUG"))
|
||||
- g_string_append(str, " debug loglevel=10 earlyprintk=ttyS0");
|
||||
+ g_string_append(str, " debug loglevel=10");
|
||||
else
|
||||
g_string_append(str, " quiet loglevel=0");
|
||||
|
||||
27
0004-Don-t-overmount-root-in-QEMU-sandboxes.patch
Normal file
27
0004-Don-t-overmount-root-in-QEMU-sandboxes.patch
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
From 8a023b6e74da654c500d6884547eb4d0c0c7c8cc Mon Sep 17 00:00:00 2001
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Tue, 1 Oct 2013 13:51:34 +0100
|
||||
Subject: [PATCH] Don't overmount '/root' in QEMU sandboxes
|
||||
|
||||
If the user wants to replace '/root' they can do that
|
||||
explicitly. Don't overmount it ourselves. This fixes
|
||||
an inconsistency between LXC & QEMU setups.
|
||||
|
||||
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
(cherry picked from commit 6ae67143e69f435b564164bfa67a174be7bc9702)
|
||||
---
|
||||
libvirt-sandbox/libvirt-sandbox-init-qemu.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/libvirt-sandbox/libvirt-sandbox-init-qemu.c b/libvirt-sandbox/libvirt-sandbox-init-qemu.c
|
||||
index 38ed284..4d866e7 100644
|
||||
--- a/libvirt-sandbox/libvirt-sandbox-init-qemu.c
|
||||
+++ b/libvirt-sandbox/libvirt-sandbox-init-qemu.c
|
||||
@@ -284,7 +284,6 @@ main(int argc ATTR_UNUSED, char **argv ATTR_UNUSED)
|
||||
/* Main special filesystems */
|
||||
mount_other("/dev", "tmpfs", 0755);
|
||||
mount_other_opts("/dev/pts", "devpts", "gid=5,mode=620,ptmxmode=000", 0755);
|
||||
- mount_other("/root", "tmpfs", 0755);
|
||||
mount_other("/sys", "sysfs", 0755);
|
||||
mount_other("/proc", "proc", 0755);
|
||||
//mount_other("/selinux", "selinuxfs", 0755);
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
From 52fdacec1661966366a2812936dd07d971614d23 Mon Sep 17 00:00:00 2001
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Tue, 1 Oct 2013 13:52:36 +0100
|
||||
Subject: [PATCH] Fix inverted strcmp test in mount options for QEMU
|
||||
|
||||
The QEMU init binary intended to set nosuid & nodev on any
|
||||
tmpfs filesystem. Due to a backwards strcmp test, it set
|
||||
those flaws on everything except tmpfs.
|
||||
|
||||
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
(cherry picked from commit 8234b949106190f7df4c5b500c1520611eb8a603)
|
||||
---
|
||||
libvirt-sandbox/libvirt-sandbox-init-qemu.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libvirt-sandbox/libvirt-sandbox-init-qemu.c b/libvirt-sandbox/libvirt-sandbox-init-qemu.c
|
||||
index 4d866e7..845ddd1 100644
|
||||
--- a/libvirt-sandbox/libvirt-sandbox-init-qemu.c
|
||||
+++ b/libvirt-sandbox/libvirt-sandbox-init-qemu.c
|
||||
@@ -382,7 +382,7 @@ main(int argc ATTR_UNUSED, char **argv ATTR_UNUSED)
|
||||
else
|
||||
mount_mkfile(target, 644);
|
||||
} else {
|
||||
- if (strcmp(type, "tmpfs"))
|
||||
+ if (strcmp(type, "tmpfs") == 0)
|
||||
flags |= MS_NOSUID | MS_NODEV;
|
||||
|
||||
mount_mkdir(target, 0755);
|
||||
48
0006-Force-9p-version-to-version-9p2000.u.patch
Normal file
48
0006-Force-9p-version-to-version-9p2000.u.patch
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
From acb5067fb5326eb4d4784d843c657d0c507f7380 Mon Sep 17 00:00:00 2001
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Tue, 1 Oct 2013 13:54:10 +0100
|
||||
Subject: [PATCH] Force 9p version to version=9p2000.u
|
||||
|
||||
With 9p version=9p2000.L, we tickle two bugs in QEMU's code.
|
||||
|
||||
One breaks most calls with ENODEV on FS_IOC_GETVERSION ioctls.
|
||||
|
||||
The other breaks xattr checks due to inverted errno.
|
||||
|
||||
In addition with 9p2000.L we see extra permission checks
|
||||
on dirs, which prevents the guest from over-mounting dirs
|
||||
like /root that are restricted on the user running QEMU.
|
||||
|
||||
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
(cherry picked from commit f4087aa0e993f59772d3bda53038888af7f43b5e)
|
||||
---
|
||||
libvirt-sandbox/libvirt-sandbox-builder-machine.c | 2 +-
|
||||
libvirt-sandbox/libvirt-sandbox-init-qemu.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libvirt-sandbox/libvirt-sandbox-builder-machine.c b/libvirt-sandbox/libvirt-sandbox-builder-machine.c
|
||||
index 24e700a..9529f40 100644
|
||||
--- a/libvirt-sandbox/libvirt-sandbox-builder-machine.c
|
||||
+++ b/libvirt-sandbox/libvirt-sandbox-builder-machine.c
|
||||
@@ -242,7 +242,7 @@ static gboolean gvir_sandbox_builder_machine_write_mount_cfg(GVirSandboxConfig *
|
||||
if (GVIR_SANDBOX_IS_CONFIG_MOUNT_HOST_BIND(mconfig)) {
|
||||
source = g_strdup_printf("sandbox:mount%zu", nHostBind++);
|
||||
fstype = "9p";
|
||||
- options = g_strdup("trans=virtio");
|
||||
+ options = g_strdup("trans=virtio,version=9p2000.u");
|
||||
} else if (GVIR_SANDBOX_IS_CONFIG_MOUNT_HOST_IMAGE(mconfig)) {
|
||||
source = g_strdup_printf("vd%c", (char)('a' + nHostImage++));
|
||||
fstype = "ext3";
|
||||
diff --git a/libvirt-sandbox/libvirt-sandbox-init-qemu.c b/libvirt-sandbox/libvirt-sandbox-init-qemu.c
|
||||
index 845ddd1..87dc897 100644
|
||||
--- a/libvirt-sandbox/libvirt-sandbox-init-qemu.c
|
||||
+++ b/libvirt-sandbox/libvirt-sandbox-init-qemu.c
|
||||
@@ -165,7 +165,7 @@ mount_9pfs(const char *src, const char *dst, int mode, int readonly)
|
||||
if (readonly)
|
||||
flags |= MS_RDONLY;
|
||||
|
||||
- if (mount(src, dst, "9p", flags, "trans=virtio") < 0) {
|
||||
+ if (mount(src, dst, "9p", flags, "trans=virtio,version=9p2000.u") < 0) {
|
||||
fprintf(stderr, "libvirt-sandbox-init-qemu: %s: cannot mount %s on %s (9p): %s\n",
|
||||
__func__, src, dst, strerror(errno));
|
||||
exit_poweroff();
|
||||
|
|
@ -13,12 +13,18 @@
|
|||
|
||||
Name: libvirt-sandbox
|
||||
Version: 0.1.1
|
||||
Release: 1%{?dist}%{?extra_release}
|
||||
Release: 3%{?dist}%{?extra_release}
|
||||
Summary: libvirt application sandbox framework
|
||||
Group: Development/Tools
|
||||
License: LGPLv2+
|
||||
URL: http://libvirt.org/
|
||||
Source0: ftp://libvirt.org/libvirt/sandbox/%{name}-%{version}.tar.gz
|
||||
Patch1: 0001-Fix-docs-for-virt-sandbox-mount-command.patch
|
||||
Patch2: 0002-better-wording-when-connecting-to-a-console-patch-fr.patch
|
||||
Patch3: 0003-Always-set-earlyprintk-kernel-arg.patch
|
||||
Patch4: 0004-Don-t-overmount-root-in-QEMU-sandboxes.patch
|
||||
Patch5: 0005-Fix-inverted-strcmp-test-in-mount-options-for-QEMU.patch
|
||||
Patch6: 0006-Force-9p-version-to-version-9p2000.u.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: libvirt-gobject-devel >= 0.0.9
|
||||
%if %{with_introspection}
|
||||
|
|
@ -26,7 +32,9 @@ BuildRequires: gobject-introspection-devel
|
|||
%endif
|
||||
BuildRequires: libselinux-devel
|
||||
BuildRequires: glibc-static
|
||||
Requires: glib2-devel >= 2.32.0
|
||||
BuildRequires: glib2-devel >= 2.32.0
|
||||
Requires: pygobject3-base
|
||||
Requires: libselinux-python
|
||||
|
||||
%package libs
|
||||
Group: Development/Libraries
|
||||
|
|
@ -57,6 +65,12 @@ the libvirt sandbox
|
|||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
|
||||
%build
|
||||
|
||||
|
|
@ -126,6 +140,15 @@ rm -rf $RPM_BUILD_ROOT
|
|||
%{_datadir}/gtk-doc/html/Libvirt-sandbox
|
||||
|
||||
%changelog
|
||||
* Tue Oct 1 2013 Daniel P. Berrange <berrange@redhat.com> - 0.1.1-3
|
||||
- Fix booting QEMU sandboxes with Linux 3.11 kernel
|
||||
|
||||
* Tue Oct 1 2013 Daniel P. Berrange <berrange@redhat.com> - 0.1.1-2
|
||||
- Fix docs about mount args to virt-sandbox (rhbz #909652)
|
||||
- Clarify message about console escape key (rhbz #887676)
|
||||
- Add missing deps on pygobject3-base & libselinux-python (rhbz #887657)
|
||||
- Fix dep on glib-devel to be a BuildRequires only (rhbz #885427)
|
||||
|
||||
* Mon Dec 10 2012 Daniel P. Berrange <berrange@redhat.com> - 0.1.1-1
|
||||
- Update to 0.1.1 release
|
||||
|
||||
|
|
|
|||
110
update-patches.pl
Executable file
110
update-patches.pl
Executable file
|
|
@ -0,0 +1,110 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Update the local patches and RPM spec with patches from
|
||||
# an upstream tree with matching branch name.
|
||||
#
|
||||
# For example
|
||||
#
|
||||
# - Checkout upstream GIT repo for libvirt-sandbox
|
||||
# - Create a branch name matching current RHEL (eg rhel-6.4)
|
||||
# - Populate the branch by cherry-picking patches from master
|
||||
#
|
||||
# This script will then
|
||||
#
|
||||
# - Setup the upstream GIT repo as a remote named 'upstream'
|
||||
# - Extract version number from RPM spec
|
||||
# - Look for a tag 'v$VERSION' in upstream GIT
|
||||
# - Run 'git format-patches v$VERSION..upstream/rhel-6.4'
|
||||
# - Re-write the RPM spec to update all PatchNNN and %patchNNN lines
|
||||
#
|
||||
# The only manual step required is to fill in the changelog
|
||||
#
|
||||
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $gitupstream = "git://libvirt.org/libvirt-sandbox.git";
|
||||
my $rpmspec = "libvirt-sandbox.spec";
|
||||
|
||||
open SPEC, "$rpmspec" or die "cannot read $rpmspec: $!";
|
||||
my @spec = <SPEC>;
|
||||
close SPEC;
|
||||
|
||||
my $version;
|
||||
|
||||
foreach my $line (@spec) {
|
||||
if ($line =~ /^Version:\s*(\S+)\s*$/) {
|
||||
$version = $1;
|
||||
}
|
||||
}
|
||||
|
||||
die "cannot find Version: line in RPM spec"
|
||||
unless $version;
|
||||
|
||||
my $gittag = "v" . $version;
|
||||
my $gitbranch = $gittag . "-maint";
|
||||
|
||||
my $haveupstream;
|
||||
|
||||
open GIT, "-|", "git", "remote" or die "cannot run git remote: $!";
|
||||
while (<GIT>) {
|
||||
if (/upstream/) {
|
||||
$haveupstream = 1;
|
||||
}
|
||||
}
|
||||
|
||||
close GIT;
|
||||
|
||||
unless ($haveupstream) {
|
||||
`git remote add upstream $gitupstream`;
|
||||
}
|
||||
|
||||
`git fetch upstream`;
|
||||
|
||||
|
||||
$haveupstream = 0;
|
||||
|
||||
open GIT, "-|", "git", "branch", "-a" or die "cannot find git branch -a: $!";
|
||||
while (<GIT>) {
|
||||
if (m,upstream/$gitbranch,) {
|
||||
$haveupstream = 1;
|
||||
}
|
||||
}
|
||||
close GIT;
|
||||
|
||||
die "cannot find upstream/$gitbranch" unless $haveupstream;
|
||||
|
||||
`git format-patch --no-signature -N $gittag..upstream/$gitbranch`;
|
||||
|
||||
opendir DH, "." or die "cannot read current directory: $!";
|
||||
|
||||
my @patches
|
||||
= grep {
|
||||
/^\d\d\d.*\.patch/
|
||||
} readdir(DH);
|
||||
|
||||
closedir DH;
|
||||
|
||||
@patches = sort @patches;
|
||||
|
||||
open SPEC, ">$rpmspec" or die "cannot update $rpmspec: $!";
|
||||
|
||||
foreach my $line (@spec) {
|
||||
print SPEC $line unless $line =~ /(Patch|%patch)/;
|
||||
|
||||
my $i;
|
||||
if ($line =~ /Source0/) {
|
||||
for ($i = 0 ; $i <= $#patches ; $i++) {
|
||||
printf SPEC "Patch%d: %s\n", $i+1, $patches[$i];
|
||||
}
|
||||
} elsif ($line =~ /%setup/) {
|
||||
for ($i = 0 ; $i <= $#patches ; $i++) {
|
||||
printf SPEC "%%patch%d -p1\n", $i+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close SPEC or die "cannot save $rpmspec: $!";
|
||||
|
||||
`git add *.patch $rpmspec`;
|
||||
Loading…
Add table
Add a link
Reference in a new issue