Fix VCPU hotplug Remove access to outdated docs (bz 522823, bz 524805)

Update VM state text in manager view (bz 526182) Update translations
    (bz 493795)
This commit is contained in:
Cole Robinson 2009-09-29 19:37:26 +00:00
parent a8a375285f
commit 04277a7d86
7 changed files with 148647 additions and 390 deletions

View File

@ -0,0 +1,19 @@
# HG changeset patch
# User Cole Robinson <crobinso@redhat.com>
# Date 1253823268 14400
# Node ID d78b7e7131439dc9f22c8e7391e82c5f29888fe8
# Parent cfcd19d057ddc973a129e7816cd4ea39f0d4365a
Fix vcpu hotplug.
diff -r cfcd19d057dd -r d78b7e713143 src/virtManager/domain.py
--- a/src/virtManager/domain.py Thu Sep 24 11:41:49 2009 -0400
+++ b/src/virtManager/domain.py Thu Sep 24 16:14:28 2009 -0400
@@ -1355,7 +1355,7 @@
self._change_cdrom(result, dev_id_info)
def hotplug_vcpu(self, vcpus):
- self.vm.setVcpus()
+ self.vm.setVcpus(int(vcpus))
def hotplug_vcpus(self, vcpus):
vcpus = int(vcpus)

View File

@ -0,0 +1,152 @@
# HG changeset patch
# User Cole Robinson <crobinso@redhat.com>
# Date 1254248737 14400
# Node ID 65951459abe9efb9fc5f58a243ddcfd49deba0a5
# Parent 59f3d7a2ec289145c41437b7f12bcd730e17f340
Hide access to help docs: they are out of date to the point of uselessness.
diff -r 59f3d7a2ec28 -r 65951459abe9 src/virtManager/addhardware.py
--- a/src/virtManager/addhardware.py Tue Sep 29 14:02:28 2009 -0400
+++ b/src/virtManager/addhardware.py Tue Sep 29 14:25:37 2009 -0400
@@ -115,6 +115,9 @@
"char_telnet_focus_in": (self.update_doc, "protocol"),
})
+ # XXX: Help docs useless/out of date
+ self.window.get_widget("create-help").hide()
+
self.set_initial_state()
def update_doc(self, ignore1, ignore2, param):
diff -r 59f3d7a2ec28 -r 65951459abe9 src/virtManager/clone.py
--- a/src/virtManager/clone.py Tue Sep 29 14:02:28 2009 -0400
+++ b/src/virtManager/clone.py Tue Sep 29 14:25:37 2009 -0400
@@ -129,6 +129,9 @@
"on_clone_help_clicked" : self.show_help,
})
+ # XXX: Help docs useless/out of date
+ self.window.get_widget("clone-help").hide()
+
self.set_initial_state()
def show(self):
diff -r 59f3d7a2ec28 -r 65951459abe9 src/virtManager/createnet.py
--- a/src/virtManager/createnet.py Tue Sep 29 14:02:28 2009 -0400
+++ b/src/virtManager/createnet.py Tue Sep 29 14:25:37 2009 -0400
@@ -68,6 +68,9 @@
"on_create_help_clicked": self.show_help,
})
+ # XXX: Help docs useless/out of date
+ self.window.get_widget("create-help").hide()
+
self.set_initial_state()
def show(self):
diff -r 59f3d7a2ec28 -r 65951459abe9 src/virtManager/createpool.py
--- a/src/virtManager/createpool.py Tue Sep 29 14:02:28 2009 -0400
+++ b/src/virtManager/createpool.py Tue Sep 29 14:25:37 2009 -0400
@@ -88,6 +88,9 @@
"on_pool_build_focus_in_event": (self.update_build_doc)
})
+ # XXX: Help docs useless/out of date
+ self.window.get_widget("pool-help").hide()
+
self.set_initial_state()
def show(self):
diff -r 59f3d7a2ec28 -r 65951459abe9 src/virtManager/createvol.py
--- a/src/virtManager/createvol.py Tue Sep 29 14:02:28 2009 -0400
+++ b/src/virtManager/createvol.py Tue Sep 29 14:25:37 2009 -0400
@@ -72,6 +72,10 @@
format_list.add_attribute(text2, 'text', 1)
self.window.get_widget("vol-info-view").modify_bg(gtk.STATE_NORMAL,
gtk.gdk.color_parse("grey"))
+
+ # XXX: Help docs useless/out of date
+ self.window.get_widget("pool-help").hide()
+
self.reset_state()
diff -r 59f3d7a2ec28 -r 65951459abe9 src/virtManager/details.py
--- a/src/virtManager/details.py Tue Sep 29 14:02:28 2009 -0400
+++ b/src/virtManager/details.py Tue Sep 29 14:25:37 2009 -0400
@@ -313,6 +313,9 @@
"on_security_model_changed": self.security_model_changed,
})
+ # XXX: Help docs useless/out of date
+ self.window.get_widget("help1").hide()
+
self.vm.connect("status-changed", self.update_widget_states)
self.vm.connect("resources-sampled", self.refresh_resources)
self.vm.connect("config-changed", self.refresh_vm_info)
@@ -575,7 +578,7 @@
if self.is_visible():
self.topwin.present()
return
- self.topwin.show_all()
+ self.topwin.show()
self.topwin.present()
self.engine.increment_window_counter()
diff -r 59f3d7a2ec28 -r 65951459abe9 src/virtManager/host.py
--- a/src/virtManager/host.py Tue Sep 29 14:02:28 2009 -0400
+++ b/src/virtManager/host.py Tue Sep 29 14:25:37 2009 -0400
@@ -169,6 +169,9 @@
"on_config_autoconnect_toggled": self.toggle_autoconnect,
})
+ # XXX: Help docs useless/out of date
+ self.window.get_widget("help1").hide()
+
self.conn.connect("resources-sampled", self.refresh_resources)
self.reset_state()
diff -r 59f3d7a2ec28 -r 65951459abe9 src/virtManager/manager.py
--- a/src/virtManager/manager.py Tue Sep 29 14:02:28 2009 -0400
+++ b/src/virtManager/manager.py Tue Sep 29 14:25:37 2009 -0400
@@ -188,6 +188,7 @@
filename = self.config.get_icon_dir() + "/%s" % iconfile
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(filename, l, w)
image = gtk.image_new_from_pixbuf(pixbuf)
+ image.show_all()
self.window.get_widget(widget).set_icon_widget(image)
set_toolbar_image("vm-new", "vm_new_wizard.png", 28, 28)
@@ -356,6 +357,9 @@
"on_menu_help_activate": self.show_help,
})
+ # XXX: Help docs useless/out of date
+ self.window.get_widget("menu_help").hide()
+
self.vm_selected(None)
self.window.get_widget("vm-list").get_selection().connect("changed", self.vm_selected)
@@ -391,7 +395,8 @@
if self.is_visible():
win.present()
return
- win.show_all()
+ win.show()
+ win.present()
self.engine.increment_window_counter()
if self.startup_error:
diff -r 59f3d7a2ec28 -r 65951459abe9 src/virtManager/preferences.py
--- a/src/virtManager/preferences.py Tue Sep 29 14:02:28 2009 -0400
+++ b/src/virtManager/preferences.py Tue Sep 29 14:25:37 2009 -0400
@@ -75,6 +75,9 @@
"on_prefs_stats_enable_net_toggled": self.change_net_poll,
})
+ # XXX: Help docs useless/out of date
+ self.window.get_widget("prefs-help").hide()
+
def close(self, ignore1=None, ignore2=None):
self.topwin.hide()
return 1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
# HG changeset patch
# User Cole Robinson <crobinso@redhat.com>
# Date 1254247348 14400
# Node ID 59f3d7a2ec289145c41437b7f12bcd730e17f340
# Parent 6d219a6db4fbcb343d41a959dac7a8623f3dcbb3
manager: Actually update VM state text when state changes
diff -r 6d219a6db4fb -r 59f3d7a2ec28 src/virtManager/manager.py
--- a/src/virtManager/manager.py Tue Sep 29 14:00:50 2009 -0400
+++ b/src/virtManager/manager.py Tue Sep 29 14:02:28 2009 -0400
@@ -584,6 +584,7 @@
row[ROW_STATUS] = vm.run_status()
row[ROW_STATUS_ICON] = vm.run_status_icon_large()
row[ROW_IS_VM_RUNNING] = vm.is_active()
+ row[ROW_MARKUP] = self._build_vm_markup(vm, row)
model.row_changed(row.path, row.iter)

View File

@ -8,7 +8,7 @@
Name: virt-manager
Version: 0.8.0
Release: 5%{_extra_release}
Release: 6%{_extra_release}
Summary: Virtual Machine Manager
Group: Applications/Emulators
@ -40,6 +40,14 @@ Patch8: %{name}-%{version}-stats-logging.patch
Patch9: %{name}-%{version}-refresh-disk-space.patch
# Offer to fix disk permission issues (bz 517379)
Patch10: %{name}-%{version}-fix-path-perms.patch
# Fix VCPU hotplug
Patch11: %{name}-%{version}-fix-vcpu-hotplug.patch
# Remove access to outdated docs (bz 522823, bz 524805)
Patch12: %{name}-%{version}-hide-help-docs.patch
# Update VM state text in manager view (bz 526182)
Patch13: %{name}-%{version}-update-vm-state.patch
# Update translations (bz 493795)
Patch14: %{name}-%{version}-update-translations.patch
# These two are just the oldest version tested
Requires: pygtk2 >= 1.99.12-6
@ -117,6 +125,10 @@ cp %{SOURCE3} pixmaps
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%build
%configure
@ -190,6 +202,12 @@ fi
%{_datadir}/dbus-1/services/%{name}.service
%changelog
* Tue Sep 29 2009 Cole Robinson <crobinso@redhat.com> - 0.8.0-6.fc13
- Fix VCPU hotplug
- Remove access to outdated docs (bz 522823, bz 524805)
- Update VM state text in manager view (bz 526182)
- Update translations (bz 493795)
* Thu Sep 24 2009 Cole Robinson <crobinso@redhat.com> - 0.8.0-5.fc12
- Refresh host disk space in create wizard (bz 502777)
- Offer to fix disk permission issues (bz 517379)

View File

@ -1,193 +0,0 @@
# HG changeset patch
# User Cole Robinson <crobinso@redhat.com>
# Date 1253738317 14400
# Node ID 53cd275974ab35a790b4c4bf1424d0950d5b095e
# Parent aff98f0152935ad7cd57e86c4172a6683e6306c5
VirtualDisk: Add methods for checking/changing path perms for username.
Since libvirtd can now run qemu processes as non-root, the tools need to
try to check directory permissions and make sure they are at least searchable
by a specific username. This simply implements the functions to make that
happen.
diff -r aff98f015293 -r 53cd275974ab virtinst/VirtualDisk.py
--- a/virtinst/VirtualDisk.py Mon Sep 21 15:52:04 2009 -0400
+++ b/virtinst/VirtualDisk.py Wed Sep 23 16:38:37 2009 -0400
@@ -19,9 +19,11 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
-import os, statvfs
+import os, stat, pwd, statvfs
import subprocess
import logging
+import re
+
import urlgrabber.progress as progress
import libvirt
@@ -69,6 +71,46 @@
return fmt
+def _name_uid(user):
+ """
+ Return UID for string username
+ """
+ pwdinfo = pwd.getpwnam(user)
+ return pwdinfo[2]
+
+def _is_dir_searchable(uid, username, path):
+ """
+ Check if passed directory is searchable by uid
+ """
+ try:
+ statinfo = os.stat(path)
+ except OSError:
+ return False
+
+ if uid == statinfo.st_uid:
+ flag = stat.S_IXUSR
+ elif uid == statinfo.st_gid:
+ flag = stat.S_IXGRP
+ else:
+ flag = stat.S_IXOTH
+
+ if bool(statinfo.st_mode & flag):
+ return True
+
+ # Check POSIX ACL (since that is what we use to 'fix' access)
+ cmd = ["getfacl", path]
+ proc = subprocess.Popen(cmd,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ out, err = proc.communicate()
+
+ if proc.returncode != 0:
+ logging.debug("Cmd '%s' failed: %s" % (cmd, err))
+ return False
+
+ return bool(re.search("user:%s:..x" % username, out))
+
+
class VirtualDisk(VirtualDevice):
"""
Builds a libvirt domain disk xml description
@@ -156,6 +198,63 @@
return False
+ @staticmethod
+ def check_path_search_for_user(conn, path, username):
+ """
+ Check if the passed user has search permissions for all the
+ directories in the disk path.
+
+ @return: List of the directories the user cannot search, or empty list
+ @rtype : C{list}
+ """
+ if _util.is_uri_remote(conn.getURI()):
+ return []
+
+ uid = _name_uid(username)
+ fixlist = []
+
+ dirname, base = os.path.split(path)
+ while base:
+ if not _is_dir_searchable(uid, username, dirname):
+ fixlist.append(dirname)
+
+ dirname, base = os.path.split(dirname)
+
+ return fixlist
+
+ @staticmethod
+ def fix_path_search_for_user(conn, path, username):
+ """
+ Try to fix any permission problems found by check_path_search_for_user
+
+ @return: Return a dictionary of entries { broken path : error msg }
+ @rtype : C{dict}
+ """
+ fixlist = VirtualDisk.check_path_search_for_user(conn, path, username)
+ if not fixlist:
+ return []
+
+ fixlist.reverse()
+ errdict = {}
+
+ for dirname in fixlist:
+ try:
+ cmd = ["setfacl", "--modify", "user:%s:x" % username, dirname]
+ proc = subprocess.Popen(cmd,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ out, err = proc.communicate()
+
+ logging.debug("Cmd '%s' output: \nout=%s, \nerr=%s" %
+ (cmd, out, err))
+ if proc.returncode != 0:
+ raise ValueError(err)
+ except Exception, e:
+ errdict[dirname] = str(e)
+
+ return errdict
+
+
def __init__(self, path=None, size=None, transient=False, type=None,
device=DEVICE_DISK, driverName=None, driverType=None,
readOnly=False, sparse=True, conn=None, volObject=None,
# HG changeset patch
# User Cole Robinson <crobinso@redhat.com>
# Date 1253741935 14400
# Node ID a523260ac56eb90e1eda067c2bbd5fc726bb0165
# Parent 53cd275974ab35a790b4c4bf1424d0950d5b095e
VirtualDisk: Teach perms changing functions about a target directory.
diff -r 53cd275974ab -r a523260ac56e virtinst/VirtualDisk.py
--- a/virtinst/VirtualDisk.py Wed Sep 23 16:38:37 2009 -0400
+++ b/virtinst/VirtualDisk.py Wed Sep 23 17:38:55 2009 -0400
@@ -213,7 +213,12 @@
uid = _name_uid(username)
fixlist = []
- dirname, base = os.path.split(path)
+ if os.path.isdir(path):
+ dirname = path
+ base = "-"
+ else:
+ dirname, base = os.path.split(path)
+
while base:
if not _is_dir_searchable(uid, username, dirname):
fixlist.append(dirname)
diff -r 53cd275974ab virtinst/Installer.py
--- a/virtinst/Installer.py Wed Sep 23 16:38:37 2009 -0400
+++ b/virtinst/Installer.py Wed Sep 23 17:32:14 2009 -0400
@@ -141,12 +141,20 @@
return XEN_SCRATCH
if os.path.exists(LIBVIRT_SCRATCH):
return LIBVIRT_SCRATCH
- else:
- scratch = os.path.expanduser("~/.virtinst/boot")
- if not os.path.exists(scratch):
- os.makedirs(scratch, 0750)
- _util.selinux_restorecon(scratch)
- return scratch
+
+ scratch = os.path.expanduser("~/.virtinst/boot")
+ if not os.path.exists(scratch):
+ os.makedirs(scratch, 0751)
+
+ if (self.conn and
+ not _util.is_uri_remote(self.conn.getURI()) and
+ _util.is_qemu_system(self.conn.getURI())):
+ # If we are using local qemu:///system, try to make sure the
+ # download location is searchable by the 'qemu' user
+ VirtualDisk.fix_path_search_for_user(self.conn, scratch, "qemu")
+
+ _util.selinux_restorecon(scratch)
+ return scratch
scratchdir = property(get_scratchdir)
def get_cdrom(self):

View File

@ -1,196 +0,0 @@
# HG changeset patch
# User Cole Robinson <crobinso@redhat.com>
# Date 1253562724 14400
# Node ID aff98f0152935ad7cd57e86c4172a6683e6306c5
# Parent 143b09da8bccc3b6b2069c29073ea5a6ef9ce69b
VirtualDisk: Don't use 'iso' as a qemu driver name (bz 524109)
diff -r 143b09da8bcc -r aff98f015293 tests/testdriver.xml
--- a/tests/testdriver.xml Mon Sep 21 15:47:33 2009 -0400
+++ b/tests/testdriver.xml Mon Sep 21 15:52:04 2009 -0400
@@ -67,6 +67,22 @@
</target>
</volume>
<volume>
+ <name>iso-vol</name>
+ <capacity>1000000</capacity>
+ <allocation>50000</allocation>
+ <target>
+ <format type='iso'/>
+ </target>
+ </volume>
+ <volume>
+ <name>bochs-vol</name>
+ <capacity>1000000</capacity>
+ <allocation>50000</allocation>
+ <target>
+ <format type='bochs'/>
+ </target>
+ </volume>
+ <volume>
<name>testvol1.img</name>
<capacity>1000000</capacity>
<allocation>50000</allocation>
diff -r 143b09da8bcc -r aff98f015293 tests/xmlconfig-xml/misc-qemu-iso-disk.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/xmlconfig-xml/misc-qemu-iso-disk.xml Mon Sep 21 15:52:04 2009 -0400
@@ -0,0 +1,36 @@
+<domain type='xen'>
+ <name>TestGuest</name>
+ <currentMemory>204800</currentMemory>
+ <memory>409600</memory>
+ <uuid>12345678-1234-1234-1234-123456789012</uuid>
+ <os>
+ <type arch='i686'>hvm</type>
+ <loader>/usr/lib/xen/boot/hvmloader</loader>
+ <boot dev='cdrom'/>
+ </os>
+ <features>
+ <acpi/><apic/>
+ </features>
+ <clock offset="utc"/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <vcpu>5</vcpu>
+ <devices>
+ <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source file='/default-pool/iso-vol'/>
+ <target dev='hda' bus='ide'/>
+ </disk>
+ <disk type='block' device='cdrom'>
+ <driver name='qemu'/>
+ <source dev='/dev/loop0'/>
+ <target dev='hdc' bus='ide'/>
+ <readonly/>
+ </disk>
+ <input type='mouse' bus='ps2'/>
+ <graphics type='sdl' display=':3.4' xauth='/testdir/.Xauthority'/>
+ <console type='pty'/>
+ </devices>
+</domain>
diff -r 143b09da8bcc -r aff98f015293 tests/xmlconfig.py
--- a/tests/xmlconfig.py Mon Sep 21 15:47:33 2009 -0400
+++ b/tests/xmlconfig.py Mon Sep 21 15:52:04 2009 -0400
@@ -302,9 +302,15 @@
g.disks.append(get_blkdisk())
self._compare(g, "misc-qemu-driver-name", True)
+ VirtualDisk._get_uri = new_get_uri
g = get_basic_fullyvirt_guest()
g.disks.append(get_filedisk())
self._compare(g, "misc-qemu-driver-type", True)
+
+ VirtualDisk._get_uri = new_get_uri
+ g = get_basic_fullyvirt_guest()
+ g.disks.append(get_filedisk("/default-pool/iso-vol"))
+ self._compare(g, "misc-qemu-iso-disk", True)
finally:
VirtualDisk._get_uri = oldgetdriver
diff -r 143b09da8bcc -r aff98f015293 virtinst/VirtualDisk.py
--- a/virtinst/VirtualDisk.py Mon Sep 21 15:47:33 2009 -0400
+++ b/virtinst/VirtualDisk.py Mon Sep 21 15:52:04 2009 -0400
@@ -55,6 +55,20 @@
except OSError:
return False
+def _qemu_sanitize_drvtype(phystype, fmt):
+ """
+ Sanitize libvirt storage volume format to a valid qemu driver type
+ """
+ raw_list = [ "iso" ]
+
+ if phystype == VirtualDisk.TYPE_BLOCK:
+ return VirtualDisk.DRIVER_QEMU_RAW
+
+ if fmt in raw_list:
+ return VirtualDisk.DRIVER_QEMU_RAW
+
+ return fmt
+
class VirtualDisk(VirtualDevice):
"""
Builds a libvirt domain disk xml description
@@ -490,8 +504,8 @@
http://lists.gnu.org/archive/html/qemu-devel/2008-04/msg00675.html
"""
- drvname = None
- drvtype = None
+ drvname = self._driverName
+ drvtype = self._driverType
if self.conn:
driver = _util.get_uri_driver(self._get_uri())
@@ -499,15 +513,15 @@
drvname = self.DRIVER_QEMU
if self.vol_object:
- drvtype = _util.get_xml_path(self.vol_object.XMLDesc(0),
- "/volume/target/format/@type")
+ fmt = _util.get_xml_path(self.vol_object.XMLDesc(0),
+ "/volume/target/format/@type")
+ if drvname == self.DRIVER_QEMU:
+ drvtype = _qemu_sanitize_drvtype(self.type, fmt)
elif self.vol_install:
if drvname == self.DRIVER_QEMU:
- if self.vol_install.file_type == libvirt.VIR_STORAGE_VOL_FILE:
- drvtype = self.vol_install.format
- else:
- drvtype = self.DRIVER_QEMU_RAW
+ drvtype = _qemu_sanitize_drvtype(self.type,
+ self.vol_install.format)
elif self.__creating_storage():
if drvname == self.DRIVER_QEMU:
@@ -729,8 +743,10 @@
managed_storage = self.__storage_specified()
create_media = self.__creating_storage()
+ self.__set_dev_type()
self.__set_size()
self.__set_format()
+ self.__set_driver()
if not self.selinux_label:
# If we are using existing storage, pull the label from it
@@ -745,9 +761,6 @@
self._selinux_label = context or ""
- # Set driverName + driverType
- self.__set_driver()
-
# If not creating the storage, our job is easy
if not create_media:
# Make sure we have access to the local path
@@ -757,7 +770,6 @@
raise ValueError(_("The path '%s' must be a file or a "
"device, not a directory") % self.path)
- self.__set_dev_type()
return True
@@ -770,7 +782,6 @@
if self.type is self.TYPE_BLOCK:
raise ValueError, _("Local block device path '%s' must "
"exist.") % self.path
- self.set_type(self.TYPE_FILE, validate=False)
# Path doesn't exist: make sure we have write access to dir
if not os.access(os.path.dirname(self.path), os.R_OK):
@@ -782,9 +793,6 @@
if not os.access(os.path.dirname(self.path), os.W_OK):
raise ValueError, _("No write access to directory '%s'") % \
os.path.dirname(self.path)
- else:
- # Set dev type from existing storage
- self.__set_dev_type()
# Applicable for managed or local storage
ret = self.is_size_conflict()