[libvirt-sandbox/f19] Fix compat with 3.11 kernels & allow mac addr choice
Daniel P. Berrange
berrange at fedoraproject.org
Tue Oct 1 15:31:14 UTC 2013
commit 4d408d0e84c74d916c1f42402b9402869d4cb72c
Author: Daniel P. Berrange <berrange at redhat.com>
Date: Tue Oct 1 16:17:10 2013 +0100
Fix compat with 3.11 kernels & allow mac addr choice
Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
.gitignore | 2 +
0001-Always-set-earlyprintk-kernel-arg.patch | 32 +++
0002-Don-t-overmount-root-in-QEMU-sandboxes.patch | 27 ++
...ted-strcmp-test-in-mount-options-for-QEMU.patch | 28 ++
0004-Force-9p-version-to-version-9p2000.u.patch | 48 ++++
...support-for-configuring-NIC-mac-addresses.patch | 267 ++++++++++++++++++++
0006-S-is-not-supported-by-virt-sandbox.patch | 25 ++
libvirt-sandbox.spec | 19 ++-
update-patches.pl | 110 ++++++++
9 files changed, 557 insertions(+), 1 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index f727ee0..251f703 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,5 @@
x86_64/
*.src.rpm
.build*.log
+*~
+
diff --git a/0001-Always-set-earlyprintk-kernel-arg.patch b/0001-Always-set-earlyprintk-kernel-arg.patch
new file mode 100644
index 0000000..3714075
--- /dev/null
+++ b/0001-Always-set-earlyprintk-kernel-arg.patch
@@ -0,0 +1,32 @@
+From 2babb5499c41054e0c9e5f8712f57a2cc716cfb2 Mon Sep 17 00:00:00 2001
+From: "Daniel P. Berrange" <berrange at 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 at redhat.com>
+(cherry picked from commit b14ce17bb357d5b7f99562c91dafb521f6985b40)
+---
+ 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 c94a641..18ebcea 100644
+--- a/libvirt-sandbox/libvirt-sandbox-builder-machine.c
++++ b/libvirt-sandbox/libvirt-sandbox-builder-machine.c
+@@ -207,10 +207,10 @@ 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_str_equal(getenv("LIBVIRT_SANDBOX_DEBUG"), "2"))
+- g_string_append(str, " debug loglevel=10 earlyprintk=ttyS0");
++ g_string_append(str, " debug loglevel=10");
+ else
+ g_string_append(str, " quiet loglevel=0");
+
diff --git a/0002-Don-t-overmount-root-in-QEMU-sandboxes.patch b/0002-Don-t-overmount-root-in-QEMU-sandboxes.patch
new file mode 100644
index 0000000..9d4821e
--- /dev/null
+++ b/0002-Don-t-overmount-root-in-QEMU-sandboxes.patch
@@ -0,0 +1,27 @@
+From e593f55e0634b95e045fdff7ab2ddbbf6ce84b41 Mon Sep 17 00:00:00 2001
+From: "Daniel P. Berrange" <berrange at 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 at 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 f09c6d9..079f83f 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);
diff --git a/0003-Fix-inverted-strcmp-test-in-mount-options-for-QEMU.patch b/0003-Fix-inverted-strcmp-test-in-mount-options-for-QEMU.patch
new file mode 100644
index 0000000..cb967c4
--- /dev/null
+++ b/0003-Fix-inverted-strcmp-test-in-mount-options-for-QEMU.patch
@@ -0,0 +1,28 @@
+From 2a742067eac4db8b2c33809bbb9a9423123f971a Mon Sep 17 00:00:00 2001
+From: "Daniel P. Berrange" <berrange at 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 at 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 079f83f..b7e4c6f 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);
diff --git a/0004-Force-9p-version-to-version-9p2000.u.patch b/0004-Force-9p-version-to-version-9p2000.u.patch
new file mode 100644
index 0000000..3edc4c1
--- /dev/null
+++ b/0004-Force-9p-version-to-version-9p2000.u.patch
@@ -0,0 +1,48 @@
+From 9df128272ac576bf9194ae4374c0e678884e76bf Mon Sep 17 00:00:00 2001
+From: "Daniel P. Berrange" <berrange at 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 at 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 18ebcea..d78d755 100644
+--- a/libvirt-sandbox/libvirt-sandbox-builder-machine.c
++++ b/libvirt-sandbox/libvirt-sandbox-builder-machine.c
+@@ -278,7 +278,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 b7e4c6f..f72148a 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();
diff --git a/0005-Add-support-for-configuring-NIC-mac-addresses.patch b/0005-Add-support-for-configuring-NIC-mac-addresses.patch
new file mode 100644
index 0000000..bfca3a5
--- /dev/null
+++ b/0005-Add-support-for-configuring-NIC-mac-addresses.patch
@@ -0,0 +1,267 @@
+From 1120aff4808a433bfee38ddc8e5068f899ef2b12 Mon Sep 17 00:00:00 2001
+From: "Daniel P. Berrange" <berrange at redhat.com>
+Date: Tue, 9 Jul 2013 12:19:05 +0100
+Subject: [PATCH] Add support for configuring NIC mac addresses
+
+Allow config of NIC mac addresses via a 'mac' parameter on
+the command line eg
+
+ virt-sandbox -c qemu:///session -N mac=02:04:05:05:05:06 /bin/sh
+
+(and also for virt-sandbox-service)
+
+Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
+(cherry picked from commit e799f01b5ddb2c5182f6f2a668638292d1bbcbb8)
+---
+ bin/virt-sandbox-service-create.pod | 5 +++
+ bin/virt-sandbox.c | 5 +++
+ .../libvirt-sandbox-builder-container.c | 7 +++-
+ libvirt-sandbox/libvirt-sandbox-builder-machine.c | 6 +++-
+ libvirt-sandbox/libvirt-sandbox-config-network.c | 40 ++++++++++++++++++++++
+ libvirt-sandbox/libvirt-sandbox-config-network.h | 4 +++
+ libvirt-sandbox/libvirt-sandbox-config.c | 10 ++++++
+ libvirt-sandbox/libvirt-sandbox.sym | 2 ++
+ 8 files changed, 77 insertions(+), 2 deletions(-)
+
+diff --git a/bin/virt-sandbox-service-create.pod b/bin/virt-sandbox-service-create.pod
+index 942c919..8e3b114 100644
+--- a/bin/virt-sandbox-service-create.pod
++++ b/bin/virt-sandbox-service-create.pod
+@@ -91,6 +91,11 @@ where 'source' is the name of any libvirt virtual network.
+ Set the name of the network to connect the interface to. C<NETWORK>
+ is the name of any libvirt virtual network. See also B<virsh net-list>
+
++=item mac=NN:NN:NN:NN:NN:NN
++
++Set the MAC address of the network interface, where each NN is a pair
++of hex digits.
++
+ =item address=IP-ADDRESS/PREFIX%BROADCAST
+
+ Configure the network interface with the static IPv4 or IPv6 address
+diff --git a/bin/virt-sandbox.c b/bin/virt-sandbox.c
+index f1db8c1..883e6c0 100644
+--- a/bin/virt-sandbox.c
++++ b/bin/virt-sandbox.c
+@@ -352,6 +352,11 @@ where 'source' is the name of any libvirt virtual network.
+ Set the name of the network to connect the interface to. C<NETWORK>
+ is the name of any libvirt virtual network. See also B<virsh net-list>
+
++=item mac=NN:NN:NN:NN:NN:NN
++
++Set the MAC address of the network interface, where each NN is a pair
++of hex digits.
++
+ =item address=IP-ADDRESS/PREFIX%BROADCAST
+
+ Configure the network interface with the static IPv4 or IPv6 address
+diff --git a/libvirt-sandbox/libvirt-sandbox-builder-container.c b/libvirt-sandbox/libvirt-sandbox-builder-container.c
+index d4e9bda..9fa870d 100644
+--- a/libvirt-sandbox/libvirt-sandbox-builder-container.c
++++ b/libvirt-sandbox/libvirt-sandbox-builder-container.c
+@@ -323,7 +323,7 @@ static gboolean gvir_sandbox_builder_container_construct_devices(GVirSandboxBuil
+
+ tmp = networks = gvir_sandbox_config_get_networks(config);
+ while (tmp) {
+- const gchar *source;
++ const gchar *source, *mac;
+ GVirSandboxConfigNetwork *network = GVIR_SANDBOX_CONFIG_NETWORK(tmp->data);
+
+ iface = gvir_config_domain_interface_network_new();
+@@ -333,6 +333,11 @@ static gboolean gvir_sandbox_builder_container_construct_devices(GVirSandboxBuil
+ else
+ gvir_config_domain_interface_network_set_source(iface, "default");
+
++ mac = gvir_sandbox_config_network_get_mac(network);
++ if (mac)
++ gvir_config_domain_interface_set_mac(GVIR_CONFIG_DOMAIN_INTERFACE(iface),
++ mac);
++
+ gvir_config_domain_add_device(domain,
+ GVIR_CONFIG_DOMAIN_DEVICE(iface));
+ g_object_unref(iface);
+diff --git a/libvirt-sandbox/libvirt-sandbox-builder-machine.c b/libvirt-sandbox/libvirt-sandbox-builder-machine.c
+index d78d755..2ad30ab 100644
+--- a/libvirt-sandbox/libvirt-sandbox-builder-machine.c
++++ b/libvirt-sandbox/libvirt-sandbox-builder-machine.c
+@@ -542,7 +542,7 @@ static gboolean gvir_sandbox_builder_machine_construct_devices(GVirSandboxBuilde
+
+ tmp = networks = gvir_sandbox_config_get_networks(config);
+ while (tmp) {
+- const gchar *source;
++ const gchar *source, *mac;
+ GVirSandboxConfigNetwork *network = GVIR_SANDBOX_CONFIG_NETWORK(tmp->data);
+
+ source = gvir_sandbox_config_network_get_source(network);
+@@ -554,6 +554,10 @@ static gboolean gvir_sandbox_builder_machine_construct_devices(GVirSandboxBuilde
+ iface = GVIR_CONFIG_DOMAIN_INTERFACE(gvir_config_domain_interface_user_new());
+ }
+
++ mac = gvir_sandbox_config_network_get_mac(network);
++ if (mac)
++ gvir_config_domain_interface_set_mac(iface, mac);
++
+ gvir_config_domain_interface_set_model(iface,
+ "virtio");
+
+diff --git a/libvirt-sandbox/libvirt-sandbox-config-network.c b/libvirt-sandbox/libvirt-sandbox-config-network.c
+index 173ac36..0283f8a 100644
+--- a/libvirt-sandbox/libvirt-sandbox-config-network.c
++++ b/libvirt-sandbox/libvirt-sandbox-config-network.c
+@@ -44,6 +44,7 @@ struct _GVirSandboxConfigNetworkPrivate
+ {
+ gboolean dhcp;
+ gchar *source;
++ gchar *mac;
+ GList *routes;
+ GList *addrs;
+ };
+@@ -55,6 +56,7 @@ enum {
+ PROP_0,
+ PROP_DHCP,
+ PROP_SOURCE,
++ PROP_MAC,
+ };
+
+ enum {
+@@ -81,6 +83,10 @@ static void gvir_sandbox_config_network_get_property(GObject *object,
+ g_value_set_string(value, priv->source);
+ break;
+
++ case PROP_MAC:
++ g_value_set_string(value, priv->mac);
++ break;
++
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ }
+@@ -105,6 +111,11 @@ static void gvir_sandbox_config_network_set_property(GObject *object,
+ priv->source = g_value_dup_string(value);
+ break;
+
++ case PROP_MAC:
++ g_free(priv->mac);
++ priv->mac = g_value_dup_string(value);
++ break;
++
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ }
+@@ -117,6 +128,7 @@ static void gvir_sandbox_config_network_finalize(GObject *object)
+ GVirSandboxConfigNetworkPrivate *priv = config->priv;
+
+ g_free(priv->source);
++ g_free(priv->mac);
+ g_list_foreach(priv->addrs, (GFunc)g_object_unref, NULL);
+ g_list_foreach(priv->routes, (GFunc)g_object_unref, NULL);
+
+@@ -155,6 +167,18 @@ static void gvir_sandbox_config_network_class_init(GVirSandboxConfigNetworkClass
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
++ g_object_class_install_property(object_class,
++ PROP_MAC,
++ g_param_spec_string("mac",
++ "MAC",
++ "MAC address",
++ NULL,
++ G_PARAM_READABLE |
++ G_PARAM_WRITABLE |
++ G_PARAM_STATIC_NAME |
++ G_PARAM_STATIC_NICK |
++ G_PARAM_STATIC_BLURB));
++
+ g_type_class_add_private(klass, sizeof(GVirSandboxConfigNetworkPrivate));
+ }
+
+@@ -198,6 +222,22 @@ const gchar *gvir_sandbox_config_network_get_source(GVirSandboxConfigNetwork *co
+ }
+
+
++void gvir_sandbox_config_network_set_mac(GVirSandboxConfigNetwork *config,
++ const gchar *mac)
++{
++ GVirSandboxConfigNetworkPrivate *priv = config->priv;
++ g_free(priv->mac);
++ priv->mac = g_strdup(mac);
++}
++
++
++const gchar *gvir_sandbox_config_network_get_mac(GVirSandboxConfigNetwork *config)
++{
++ GVirSandboxConfigNetworkPrivate *priv = config->priv;
++ return priv->mac;
++}
++
++
+ void gvir_sandbox_config_network_set_dhcp(GVirSandboxConfigNetwork *config,
+ gboolean dhcp)
+ {
+diff --git a/libvirt-sandbox/libvirt-sandbox-config-network.h b/libvirt-sandbox/libvirt-sandbox-config-network.h
+index 1c588ef..9ad8577 100644
+--- a/libvirt-sandbox/libvirt-sandbox-config-network.h
++++ b/libvirt-sandbox/libvirt-sandbox-config-network.h
+@@ -65,6 +65,10 @@ void gvir_sandbox_config_network_set_source(GVirSandboxConfigNetwork *config,
+ const gchar *network);
+ const gchar *gvir_sandbox_config_network_get_source(GVirSandboxConfigNetwork *config);
+
++void gvir_sandbox_config_network_set_mac(GVirSandboxConfigNetwork *config,
++ const gchar *mac);
++const gchar *gvir_sandbox_config_network_get_mac(GVirSandboxConfigNetwork *config);
++
+ void gvir_sandbox_config_network_set_dhcp(GVirSandboxConfigNetwork *config,
+ gboolean dhcp);
+ gboolean gvir_sandbox_config_network_get_dhcp(GVirSandboxConfigNetwork *config);
+diff --git a/libvirt-sandbox/libvirt-sandbox-config.c b/libvirt-sandbox/libvirt-sandbox-config.c
+index 10082bb..6f7c6ff 100644
+--- a/libvirt-sandbox/libvirt-sandbox-config.c
++++ b/libvirt-sandbox/libvirt-sandbox-config.c
+@@ -888,6 +888,9 @@ gboolean gvir_sandbox_config_add_network_opts(GVirSandboxConfig *config,
+ } else if (g_str_has_prefix(param, "source=")) {
+ gvir_sandbox_config_network_set_source(net,
+ param + strlen("source="));
++ } else if (g_str_has_prefix(param, "mac=")) {
++ gvir_sandbox_config_network_set_mac(net,
++ param + strlen("mac="));
+ } else if (g_str_has_prefix(param, "address=")) {
+ GVirSandboxConfigNetworkAddress *addr;
+ GInetAddress *primaryaddr;
+@@ -1618,6 +1621,11 @@ static GVirSandboxConfigNetwork *gvir_sandbox_config_load_config_network(GKeyFil
+ gvir_sandbox_config_network_set_source(config, str1);
+ g_free(str1);
+
++ str1 = g_key_file_get_string(file, key, "mac", NULL);
++ if (str1)
++ gvir_sandbox_config_network_set_mac(config, str1);
++ g_free(str1);
++
+ g_free(key);
+ key = NULL;
+
+@@ -1941,6 +1949,8 @@ static void gvir_sandbox_config_save_config_network(GVirSandboxConfigNetwork *co
+ g_key_file_set_boolean(file, key, "dhcp", gvir_sandbox_config_network_get_dhcp(config));
+ if (gvir_sandbox_config_network_get_source(config))
+ g_key_file_set_string(file, key, "source", gvir_sandbox_config_network_get_source(config));
++ if (gvir_sandbox_config_network_get_mac(config))
++ g_key_file_set_string(file, key, "mac", gvir_sandbox_config_network_get_mac(config));
+ g_key_file_set_uint64(file, key, "addresses", j);
+ g_key_file_set_uint64(file, key, "routes", k);
+ g_free(key);
+diff --git a/libvirt-sandbox/libvirt-sandbox.sym b/libvirt-sandbox/libvirt-sandbox.sym
+index 716de66..09f863d 100644
+--- a/libvirt-sandbox/libvirt-sandbox.sym
++++ b/libvirt-sandbox/libvirt-sandbox.sym
+@@ -55,11 +55,13 @@ LIBVIRT_SANDBOX_0.2.0 {
+ gvir_sandbox_config_network_add_route;
+ gvir_sandbox_config_network_get_type;
+ gvir_sandbox_config_network_get_dhcp;
++ gvir_sandbox_config_network_get_mac;
+ gvir_sandbox_config_network_get_source;
+ gvir_sandbox_config_network_get_routes;
+ gvir_sandbox_config_network_get_addresses;
+ gvir_sandbox_config_network_new;
+ gvir_sandbox_config_network_set_dhcp;
++ gvir_sandbox_config_network_set_mac;
+ gvir_sandbox_config_network_set_source;
+
+ gvir_sandbox_config_network_address_get_type;
diff --git a/0006-S-is-not-supported-by-virt-sandbox.patch b/0006-S-is-not-supported-by-virt-sandbox.patch
new file mode 100644
index 0000000..e311a27
--- /dev/null
+++ b/0006-S-is-not-supported-by-virt-sandbox.patch
@@ -0,0 +1,25 @@
+From 4d073041f96975fc8acfb459958844339da57ea7 Mon Sep 17 00:00:00 2001
+From: Dan Walsh <dwalsh at redhat.com>
+Date: Thu, 15 Aug 2013 07:56:46 -0400
+Subject: [PATCH] -S is not supported by virt-sandbox
+
+-S option has been removed from virt-sandbox, should be removed from man page.
+
+(cherry picked from commit 43f348a9a8d96dfa145a7883bed9fc6b1deca683)
+---
+ bin/virt-sandbox.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/bin/virt-sandbox.c b/bin/virt-sandbox.c
+index 883e6c0..7e299ef 100644
+--- a/bin/virt-sandbox.c
++++ b/bin/virt-sandbox.c
+@@ -263,8 +263,6 @@ virt-sandbox - Run cmd under a virtual machine sandbox
+
+ virt-sandbox [OPTIONS...] COMMAND [CMDARG1 [CMDARG2 [...]]]
+
+-virt-sandbox [OPTIONS...] -S
+-
+ =head1 DESCRIPTION
+
+ Run the C<cmd> application within a tightly confined virtual machine. The
diff --git a/libvirt-sandbox.spec b/libvirt-sandbox.spec
index 35afaac..d8b2501 100644
--- a/libvirt-sandbox.spec
+++ b/libvirt-sandbox.spec
@@ -15,12 +15,18 @@
Name: libvirt-sandbox
Version: 0.2.0
-Release: 1%{?dist}%{?extra_release}
+Release: 2%{?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-Always-set-earlyprintk-kernel-arg.patch
+Patch2: 0002-Don-t-overmount-root-in-QEMU-sandboxes.patch
+Patch3: 0003-Fix-inverted-strcmp-test-in-mount-options-for-QEMU.patch
+Patch4: 0004-Force-9p-version-to-version-9p2000.u.patch
+Patch5: 0005-Add-support-for-configuring-NIC-mac-addresses.patch
+Patch6: 0006-S-is-not-supported-by-virt-sandbox.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libvirt-gobject-devel >= 0.0.9
BuildRequires: gobject-introspection-devel
@@ -67,6 +73,12 @@ the libvirt sandbox
%prep
%setup -q
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
%build
@@ -129,6 +141,11 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/gtk-doc/html/Libvirt-sandbox
%changelog
+* Tue May 7 2013 Daniel P. Berrange <berrange at redhat.com> - 0.2.0-2
+- Fix booting QEMU sandboxes with Linux 3.11 kernel
+- Remove bogus -S arg from man page (rhbz #997024)
+- Allow mac addr to be specified (rhbz #977537)
+
* Tue May 7 2013 Daniel P. Berrange <berrange at redhat.com> - 0.2.0-1
- Update to 0.2.0 release
diff --git a/update-patches.pl b/update-patches.pl
new file mode 100755
index 0000000..d758c2c
--- /dev/null
+++ b/update-patches.pl
@@ -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;
+
+ at 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`;
More information about the scm-commits
mailing list