Fix broken cs.po which crashed gettext

Fix offline attach fallback if hotplug fails
Offer to attach spicevmc if switching to spice
This commit is contained in:
Cole Robinson 2011-04-07 08:57:57 -04:00
parent 0adbf0380c
commit 47893da839
4 changed files with 490 additions and 2 deletions

View File

@ -0,0 +1,18 @@
commit cb56316cf3702f03b05e30f406ff3028e45f7bfb
Author: Cole Robinson <crobinso@redhat.com>
Date: Tue Apr 5 16:21:42 2011 -0400
cs.po: Busted Plural-forms crashes python gettext
diff --git a/po/cs.po b/po/cs.po
index d1808a7..cc13a1b 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -16,7 +16,6 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: \n"
#: ../src/virt-manager.desktop.in.in.h:1
msgid "Manage virtual machines"

View File

@ -0,0 +1,20 @@
commit 4922222c2c7b13704b6f461aedbee9ec06c01b5b
Author: Cole Robinson <crobinso@redhat.com>
Date: Tue Apr 5 16:15:05 2011 -0400
addhw: Fix nonhotplug to running guest
diff --git a/src/virtManager/addhardware.py b/src/virtManager/addhardware.py
index 885c8b9..7fa5b6e 100644
--- a/src/virtManager/addhardware.py
+++ b/src/virtManager/addhardware.py
@@ -938,7 +938,8 @@ class vmmAddHardware(vmmGObjectUI):
"Would you like to make the device available after the "
"next VM shutdown?")),
dialog_type=gtk.MESSAGE_WARNING,
- buttons=gtk.BUTTONS_YES_NO)
+ buttons=gtk.BUTTONS_YES_NO,
+ async=False)
if not res:
return (False, None)

436
virt-manager-spicevmc.patch Normal file
View File

@ -0,0 +1,436 @@
commit 6fa885e5831e637976487e39c877ab3a80325ee8
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date: Tue Apr 5 01:35:31 2011 +0200
addhardware: allow setting the char device target name
diff --git a/src/virtManager/addhardware.py b/src/virtManager/addhardware.py
index a8ceb78..91ece33 100644
--- a/src/virtManager/addhardware.py
+++ b/src/virtManager/addhardware.py
@@ -54,6 +54,7 @@ char_widget_mappings = {
"bind_port" : "char-bind-port",
"bind_host" : "char-bind-host",
"protocol" : "char-use-telnet",
+ "target_name" : "char-target-name",
}
def get_list_selection(widget):
@@ -117,6 +118,7 @@ class vmmAddHardware(vmmGObjectUI):
"char_host_focus_in": (self.update_doc, "source_host"),
"char_bind_host_focus_in": (self.update_doc, "bind_host"),
"char_telnet_focus_in": (self.update_doc, "protocol"),
+ "char_name_focus_in": (self.update_doc, "target_name"),
})
util.bind_escape_key_close(self)
@@ -443,6 +445,7 @@ class vmmAddHardware(vmmGObjectUI):
self.window.get_widget("char-bind-host").set_text("127.0.0.1")
self.window.get_widget("char-bind-port").get_adjustment().value = 4556
self.window.get_widget("char-use-telnet").set_active(False)
+ self.window.get_widget("char-target-name").set_text("com.redhat.spice.0")
# Hide all notebook pages, so the wizard isn't as big as the largest
# page
@@ -1143,6 +1146,7 @@ class vmmAddHardware(vmmGObjectUI):
bind_host = self.window.get_widget("char-bind-host").get_text()
source_port = self.window.get_widget("char-port").get_adjustment().value
bind_port = self.window.get_widget("char-bind-port").get_adjustment().value
+ target_name = self.window.get_widget("char-target-name").get_text()
if self.window.get_widget("char-use-telnet").get_active():
protocol = VirtualCharDevice.CHAR_PROTOCOL_TELNET
@@ -1156,6 +1160,7 @@ class vmmAddHardware(vmmGObjectUI):
"bind_port": bind_port,
"bind_host": bind_host,
"protocol": protocol,
+ "target_name": target_name,
}
try:
diff --git a/src/vmm-add-hardware.glade b/src/vmm-add-hardware.glade
index bbd3a42..c5087a1 100644
--- a/src/vmm-add-hardware.glade
+++ b/src/vmm-add-hardware.glade
@@ -1504,7 +1504,7 @@ to connect to the virtual machine.</property>
<child>
<widget class="GtkTable" id="char-param-table">
<property name="visible">True</property>
- <property name="n_rows">5</property>
+ <property name="n_rows">6</property>
<property name="n_columns">2</property>
<property name="column_spacing">8</property>
<property name="row_spacing">8</property>
@@ -1520,6 +1520,34 @@ to connect to the virtual machine.</property>
</packing>
</child>
<child>
+ <widget class="GtkEntry" id="char-target-name">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <signal name="focus_in_event" handler="char_name_focus_in"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="target-name-label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Name:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">char-use-telnet</property>
+ </widget>
+ <packing>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkCheckButton" id="char-use-telnet">
<property name="visible">True</property>
<property name="can_focus">True</property>
commit ce9a125728b6622008849dd9c35309e36104913e
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date: Tue Apr 5 01:35:32 2011 +0200
addhardware: fix adding and removing a channel device
diff --git a/src/virtManager/addhardware.py b/src/virtManager/addhardware.py
index 91ece33..885c8b9 100644
--- a/src/virtManager/addhardware.py
+++ b/src/virtManager/addhardware.py
@@ -286,19 +286,6 @@ class vmmAddHardware(vmmGObjectUI):
video_dev = self.window.get_widget("video-model")
uihelpers.build_video_combo(self.vm, video_dev)
- # Char device type
- char_devtype = self.window.get_widget("char-device-type")
- # Type name, desc
- char_devtype_model = gtk.ListStore(str, str)
- char_devtype.set_model(char_devtype_model)
- text = gtk.CellRendererText()
- char_devtype.pack_start(text, True)
- char_devtype.add_attribute(text, 'text', 1)
- for t in VirtualCharDevice.char_types:
- desc = VirtualCharDevice.get_char_type_desc(t)
- row = [t, desc + " (%s)" % t]
- char_devtype_model.append(row)
-
# Character dev mode
char_mode = self.window.get_widget("char-mode")
# Mode name, desc
@@ -358,6 +345,10 @@ class vmmAddHardware(vmmGObjectUI):
self.vm.is_hvm(),
_("Not supported for this guest type."),
"parallel")
+ add_hw_option("Channel", gtk.STOCK_CONNECT, PAGE_CHAR,
+ self.vm.is_hvm(),
+ _("Not supported for this guest type."),
+ "channel")
add_hw_option("USB Host Device", "system-run", PAGE_HOSTDEV,
self.vm.get_connection().is_nodedev_capable(),
_("Connection does not support host device enumeration"),
@@ -688,6 +679,23 @@ class vmmAddHardware(vmmGObjectUI):
def get_hw_selection(self):
return get_list_selection(self.window.get_widget("hardware-list"))
+ def update_char_device_type_model(self):
+ # Char device type
+ char_devtype = self.window.get_widget("char-device-type")
+ dev_type = self.get_char_type()
+ # Type name, desc
+ char_devtype_model = gtk.ListStore(str, str)
+ char_devtype.clear()
+ char_devtype.set_model(char_devtype_model)
+ text = gtk.CellRendererText()
+ char_devtype.pack_start(text, True)
+ char_devtype.add_attribute(text, 'text', 1)
+ for t in VirtualCharDevice.char_types_for_dev_type[dev_type]:
+ desc = VirtualCharDevice.get_char_type_desc(t)
+ row = [t, desc + " (%s)" % t]
+ char_devtype_model.append(row)
+ char_devtype.set_active(0)
+
def hw_selected(self, src=None):
ignore = src
self._dev = None
@@ -707,6 +715,7 @@ class vmmAddHardware(vmmGObjectUI):
self.window.get_widget("hardware-info").set_text(msg)
if page == PAGE_CHAR:
+ self.update_char_device_type_model()
devtype = self.window.get_widget("char-device-type")
self.change_char_device_type(devtype)
@@ -814,6 +823,8 @@ class vmmAddHardware(vmmGObjectUI):
if label == "parallel":
return VirtualDevice.VIRTUAL_DEV_PARALLEL
+ elif label == "channel":
+ return VirtualDevice.VIRTUAL_DEV_CHANNEL
return VirtualDevice.VIRTUAL_DEV_SERIAL
def dev_to_title(self, page):
@@ -849,6 +860,9 @@ class vmmAddHardware(vmmGObjectUI):
def change_char_device_type(self, src):
self.update_doc(None, None, "char_type")
+ idx = src.get_active()
+ if idx < 0:
+ return
chartype = self.get_char_type()
devtype = src.get_model()[src.get_active()][0]
@@ -863,7 +877,6 @@ class vmmAddHardware(vmmGObjectUI):
self.window.get_widget(widget_name).set_sensitive(make_visible)
has_mode = self._dev.supports_property("source_mode")
-
if has_mode and self.window.get_widget("char-mode").get_active() == -1:
self.window.get_widget("char-mode").set_active(0)
diff --git a/src/virtManager/details.py b/src/virtManager/details.py
index 69e2b1a..ca21c2d 100644
--- a/src/virtManager/details.py
+++ b/src/virtManager/details.py
@@ -2752,7 +2752,7 @@ class vmmDetails(vmmGObjectUI):
port = chardev.target_port
label = devtype.capitalize()
- if devtype != "console":
+ if devtype not in ["console", "channel"]:
# Don't show port for console
label += " %s" % (int(port) + 1)
diff --git a/src/virtManager/domain.py b/src/virtManager/domain.py
index 9730233..7fc66ed 100644
--- a/src/virtManager/domain.py
+++ b/src/virtManager/domain.py
@@ -46,6 +46,7 @@ def compare_device(origdev, newdev, idx):
"console" : ["char_type", "target_type", "target_port"],
"graphics" : ["type", "vmmindex"],
"controller" : ["type", "index"],
+ "channel" : ["char_type", "target_name"],
}
if id(origdev) == id(newdev):
@@ -713,8 +714,9 @@ class vmmDomainBase(vmmLibvirtObject):
serials = self._build_device_list("serial")
parallels = self._build_device_list("parallel")
consoles = self._build_device_list("console")
+ channels = self._build_device_list("channel")
- for devicelist in [serials, parallels, consoles]:
+ for devicelist in [serials, parallels, consoles, channels]:
devs.extend(devicelist)
# Don't display <console> if it's just a duplicate of <serial>
commit 127e065d9ee7c5bee0f221352e51fb51ccff1626
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date: Tue Apr 5 01:35:33 2011 +0200
details: show char device target name
diff --git a/src/virtManager/details.py b/src/virtManager/details.py
index ca21c2d..8e6e50e 100644
--- a/src/virtManager/details.py
+++ b/src/virtManager/details.py
@@ -2495,6 +2495,7 @@ class vmmDetails(vmmGObjectUI):
target_port = chardev.target_port
dev_type = chardev.char_type or "pty"
src_path = chardev.source_path
+ target_name = chardev.target_name
primary = hasattr(chardev, "virtmanager_console_dup")
typelabel = ""
@@ -2518,6 +2519,7 @@ class vmmDetails(vmmGObjectUI):
self.window.get_widget("char-type").set_markup(typelabel)
self.window.get_widget("char-dev-type").set_text(dev_type)
self.window.get_widget("char-source-path").set_text(src_path or "-")
+ self.window.get_widget("char-target-name").set_text(target_name or "-")
def refresh_hostdev_page(self):
hostdev = self.get_hw_selection(HW_LIST_COL_DEVICE)
diff --git a/src/vmm-details.glade b/src/vmm-details.glade
index d0d3837..d23c3da 100644
--- a/src/vmm-details.glade
+++ b/src/vmm-details.glade
@@ -4681,7 +4681,7 @@ I/O:</property>
<widget class="GtkTable" id="table37">
<property name="visible">True</property>
<property name="border_width">3</property>
- <property name="n_rows">2</property>
+ <property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="column_spacing">8</property>
<property name="row_spacing">4</property>
@@ -4689,7 +4689,7 @@ I/O:</property>
<widget class="GtkLabel" id="label503">
<property name="visible">True</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">Device Type:</property>
+ <property name="label" translatable="yes">Device type:</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -4700,7 +4700,7 @@ I/O:</property>
<widget class="GtkLabel" id="label505">
<property name="visible">True</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">Source Path:</property>
+ <property name="label" translatable="yes">Source path:</property>
</widget>
<packing>
<property name="top_attach">1</property>
@@ -4710,6 +4710,19 @@ I/O:</property>
</packing>
</child>
<child>
+ <widget class="GtkLabel" id="label505">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Target name:</property>
+ </widget>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkLabel" id="char-dev-type">
<property name="visible">True</property>
<property name="xalign">0</property>
@@ -4739,6 +4752,22 @@ I/O:</property>
<property name="y_options"></property>
</packing>
</child>
+ <child>
+ <widget class="GtkLabel" id="char-target-name">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">label508</property>
+ <property name="selectable">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
</widget>
</child>
</widget>
commit 69ba897ac35731bf6cfca00a3e8ac30485a9855d
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date: Tue Apr 5 01:35:34 2011 +0200
details: propose to add or remove Spice agent when switching
crobinso: Improve metric for deciding to ask about add/remove agent
diff --git a/src/virtManager/details.py b/src/virtManager/details.py
index 8e6e50e..eb5a9e5 100644
--- a/src/virtManager/details.py
+++ b/src/virtManager/details.py
@@ -1850,17 +1850,54 @@ class vmmDetails(vmmGObjectUI):
(dev_id_info, nettype, source)])
# Graphics options
+ def _do_change_spicevmc(self, gdev, newgtype):
+ has_multi_spice = (len(filter(
+ lambda dev: dev.type == dev.TYPE_SPICE,
+ self.vm.get_graphics_devices())) > 1)
+ has_spicevmc = bool(filter(
+ (lambda dev:
+ (dev.dev_type == dev.DEV_CHANNEL and
+ dev.char_type == dev.CHAR_SPICEVMC)),
+ self.vm.get_char_devices()))
+ fromspice = (gdev.type == "spice")
+ tospice = (newgtype == "spice")
+
+ if fromspice and tospice:
+ return False
+ if not fromspice and not tospice:
+ return False
+
+ print tospice, fromspice, has_spicevmc, has_multi_spice
+
+ if tospice and has_spicevmc:
+ return False
+ if fromspice and not has_spicevmc:
+ return False
+
+ if fromspice and has_multi_spice:
+ # Don't offer to remove if there are other spice displays
+ return False
+
+ msg = (_("You are switching graphics type to %(gtype)s, "
+ "would you like to %(action)s Spice agent channels?") %
+ {"gtype": newgtype,
+ "action": fromspice and "remove" or "add"})
+ return self.err.yes_no(msg)
+
def config_graphics_apply(self, dev_id_info):
gtype = self.get_combo_label_value("gfx-type")
passwd = self.window.get_widget("gfx-password").get_text() or None
keymap = self.get_combo_label_value("gfx-keymap")
+ change_spicevmc = self._do_change_spicevmc(dev_id_info, gtype)
+
return self._change_config_helper([self.vm.define_graphics_password,
self.vm.define_graphics_keymap,
self.vm.define_graphics_type],
[(dev_id_info, passwd),
(dev_id_info, keymap),
- (dev_id_info, gtype)],
+ (dev_id_info, gtype,
+ change_spicevmc)],
[self.vm.hotplug_graphics_password],
[(dev_id_info, passwd)])
diff --git a/src/virtManager/domain.py b/src/virtManager/domain.py
index 7fc66ed..a4d2f5c 100644
--- a/src/virtManager/domain.py
+++ b/src/virtManager/domain.py
@@ -26,6 +26,7 @@ import threading
import gobject
import virtinst
+from virtinst.VirtualCharDevice import VirtualCharSpicevmcDevice
from virtManager import util
import virtinst.support as support
@@ -450,9 +451,20 @@ class vmmDomainBase(vmmLibvirtObject):
def change(editdev):
editdev.keymap = newval
return self._redefine_device(change, devobj)
- def define_graphics_type(self, devobj, newval):
+ def define_graphics_type(self, devobj, newval, spicevmc):
def change(editdev):
editdev.type = newval
+ if spicevmc:
+ guest = self._get_guest_to_define()
+ if newval == "spice":
+ guest.add_device(VirtualCharSpicevmcDevice(guest.conn))
+ else:
+ channels = guest.get_devices("channel")
+ channels = filter(lambda x: x.char_type ==
+ virtinst.VirtualCharDevice.CHAR_SPICEVMC, channels)
+ for dev in channels:
+ guest.remove_device(dev)
+
return self._redefine_device(change, devobj)
def define_sound_model(self, devobj, newmodel):

View File

@ -2,8 +2,8 @@
%define _package virt-manager
%define _version 0.8.7
%define _release 2
%define virtinst_version 0.500.6
%define _release 3
%define virtinst_version 0.500.6-2
%define qemu_user "qemu"
%define preferred_distros "fedora,rhel"
@ -35,6 +35,12 @@ Source0: http://virt-manager.org/download/sources/%{name}/%{name}-%{version}.tar
Patch1: %{name}-fix-config-options.patch
# Fix lockup as non-root (bz 692570)
Patch2: %{name}-gconf-after-fork.patch
# Fix broken cs.po which crashed gettext
Patch3: %{name}-fix-broken-cspo.patch
# Fix offline attach fallback if hotplug fails
Patch4: %{name}-fix-hotplug-fallback.patch
# Offer to attach spicevmc if switching to spice
Patch5: %{name}-spicevmc.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@ -101,6 +107,9 @@ management API.
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
%if %{qemu_user}
@ -209,6 +218,11 @@ fi
%{_datadir}/dbus-1/services/%{name}.service
%changelog
* Thu Apr 07 2011 Cole Robinson <crobinso@redhat.com> - 0.8.7-3.fc16
- Fix broken cs.po which crashed gettext
- Fix offline attach fallback if hotplug fails
- Offer to attach spicevmc if switching to spice
* Thu Mar 31 2011 Cole Robinson <crobinso@redhat.com> - 0.8.7-2.fc16
- Fix using spice as default graphics type
- Fix lockup as non-root (bz 692570)