This commit is contained in:
parent
b427d337f4
commit
ad2e0bd97c
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Aug 3 10:46:58 MDT 2007 - chuck@novell.com
|
||||
|
||||
- Update to changeset 544.
|
||||
- Properly attach and detach CDs to running VM. (#289393)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jul 2 11:11:50 MDT 2007 - ccoffing@novell.com
|
||||
|
||||
|
@ -19,19 +19,18 @@ License: GPL v2 or later
|
||||
Group: System/Monitoring
|
||||
Autoreqprov: yes
|
||||
Version: 0.4.0
|
||||
Release: 27
|
||||
Release: 37
|
||||
Summary: Virtual Machine Manager
|
||||
Source0: virt-manager.tar.bz2
|
||||
Source1: virtinst.tar.bz2
|
||||
Source2: rhpl-exception.py
|
||||
Patch10: virtman-desktop.diff
|
||||
Patch11: virtman-install.diff
|
||||
Patch12: virtman-type-register.diff
|
||||
Patch13: virtman-console-keys.diff
|
||||
Patch14: virtman-detach-yast.diff
|
||||
Patch15: virtman-limit-popup.diff
|
||||
Patch16: virtman-edit.diff
|
||||
Patch17: virtman-wrong-port.diff
|
||||
Patch11: virtman-type-register.diff
|
||||
Patch12: virtman-console-keys.diff
|
||||
Patch13: virtman-detach-yast.diff
|
||||
Patch14: virtman-install.diff
|
||||
Patch15: virtman-edit.diff
|
||||
Patch100: virtman-limit-popup.diff
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
ExclusiveArch: %ix86 x86_64
|
||||
Requires: python-gtk
|
||||
@ -47,8 +46,8 @@ Requires: gconf2
|
||||
%gconf_schemas_prereq
|
||||
|
||||
%description
|
||||
Virt Manager provides a graphical tool for administering virtual
|
||||
machines.
|
||||
Virtual Machine Manager provides a graphical tool for administering
|
||||
virtual machines.
|
||||
|
||||
|
||||
|
||||
@ -67,8 +66,6 @@ Authors:
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
%patch15 -p1
|
||||
#%patch16 -p1 # re-port... or not?
|
||||
%patch17 -p1
|
||||
|
||||
%build
|
||||
intltoolize
|
||||
@ -118,8 +115,12 @@ test ! -z "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" && rm -rf $RPM_BUILD_ROO
|
||||
%{_datadir}/virt-manager/vncViewer/*.py
|
||||
%{_datadir}/applications/YaST2/virt-manager.desktop
|
||||
%{_datadir}/dbus-1/services/virt-manager.service
|
||||
%{_mandir}/man1/virt-manager.1*
|
||||
|
||||
%changelog
|
||||
* Fri Aug 03 2007 - chuck@novell.com
|
||||
- Update to changeset 544.
|
||||
- Properly attach and detach CDs to running VM. (#289393)
|
||||
* Mon Jul 02 2007 - ccoffing@novell.com
|
||||
- Update to changeset 508.
|
||||
- Include virtinst, to support virtual device add/remove.
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:03b848122376a73dfba52377c9899d1d9471f395b2f7cf2cc1d642e8cf5b6114
|
||||
size 1043510
|
||||
oid sha256:eed79ad6c7e0d07b058686b863a1b203409e1c749565ca5e5e605060aac240eb
|
||||
size 972359
|
||||
|
@ -5,10 +5,9 @@ Index: virt-manager--devel/src/virt-manager.desktop.in.in
|
||||
@@ -1,9 +1,15 @@
|
||||
[Desktop Entry]
|
||||
_Name=Virtual Machine Manager
|
||||
-_Comment=The virtual machine management tool
|
||||
_Comment=Manage virtual machines
|
||||
-Icon=::ICONDIR::/::PACKAGE::-icon.svg
|
||||
-Exec=::PACKAGE::
|
||||
+GenericName=The virtual machine management tool
|
||||
+Icon=yast-vm-management
|
||||
+Exec=/usr/bin/virt-manager -c xen
|
||||
Type=Application
|
||||
|
@ -39,7 +39,7 @@ Index: virt-manager--devel/src/virtManager/engine.py
|
||||
===================================================================
|
||||
--- virt-manager--devel.orig/src/virtManager/engine.py
|
||||
+++ virt-manager--devel/src/virtManager/engine.py
|
||||
@@ -277,7 +277,7 @@ class vmmEngine:
|
||||
@@ -285,7 +285,7 @@ class vmmEngine:
|
||||
return self.connections[uri]["windowDetails"][uuid]
|
||||
|
||||
def show_manager(self, uri):
|
||||
|
@ -1,45 +1,73 @@
|
||||
Index: virt-manager-0.3.1/src/virtManager/details.py
|
||||
Index: virt-manager--devel/src/virtManager/details.py
|
||||
===================================================================
|
||||
--- virt-manager-0.3.1.orig/src/virtManager/details.py
|
||||
+++ virt-manager-0.3.1/src/virtManager/details.py
|
||||
@@ -23,6 +23,10 @@ import gtk.glade
|
||||
import libvirt
|
||||
--- virt-manager--devel.orig/src/virtManager/details.py
|
||||
+++ virt-manager--devel/src/virtManager/details.py
|
||||
@@ -24,6 +24,12 @@ import libvirt
|
||||
import sparkline
|
||||
import logging
|
||||
import traceback
|
||||
+import os
|
||||
+from subprocess import *
|
||||
+
|
||||
+import xen.install
|
||||
+import xen.install.gui
|
||||
+import vmdisks
|
||||
+import vminstall
|
||||
+from vminstall.gtk.disk_widgets import DisksWidget, DiskEditWidget
|
||||
|
||||
class vmmDetails(gobject.GObject):
|
||||
__gsignals__ = {
|
||||
@@ -44,6 +48,7 @@ class vmmDetails(gobject.GObject):
|
||||
from virtManager.error import vmmErrorDialog
|
||||
from virtManager.addhardware import vmmAddHardware
|
||||
@@ -31,6 +37,17 @@ from virtManager.addhardware import vmmA
|
||||
import virtinst
|
||||
import urlgrabber.progress as progress
|
||||
|
||||
+def run(args):
|
||||
+ try:
|
||||
+ p = Popen(args=args, stdin=None, stdout=PIPE, stderr=STDOUT, close_fds=True)
|
||||
+ (pid, status) = os.waitpid(p.pid, 0)
|
||||
+ output = p.stdout.read()
|
||||
+ if status:
|
||||
+ raise RuntimeError(output)
|
||||
+ except OSError, e:
|
||||
+ raise RuntimeError(str(e))
|
||||
+ return output
|
||||
+
|
||||
# Columns in hw list model
|
||||
HW_LIST_COL_LABEL = 0
|
||||
HW_LIST_COL_STOCK_ID = 1
|
||||
@@ -69,12 +86,7 @@ class vmmDetails(gobject.GObject):
|
||||
topwin = self.window.get_widget("vmm-details")
|
||||
topwin.hide()
|
||||
topwin.set_title(self.vm.get_name() + " " + topwin.get_title())
|
||||
-
|
||||
- # Don't allowing changing network/disks for Dom0
|
||||
- if self.vm.is_management_domain():
|
||||
- self.window.get_widget("add-hardware-button").set_sensitive(False)
|
||||
- else:
|
||||
- self.window.get_widget("add-hardware-button").set_sensitive(True)
|
||||
+ self.topwin = topwin
|
||||
|
||||
self.window.get_widget("overview-name").set_text(self.vm.get_name())
|
||||
self.window.get_widget("overview-uuid").set_text(self.vm.get_uuid())
|
||||
@@ -129,15 +134,14 @@ class vmmDetails(gobject.GObject):
|
||||
self.window.get_widget("details-toolbar").hide()
|
||||
@@ -119,10 +131,6 @@ class vmmDetails(gobject.GObject):
|
||||
"on_config_maxmem_changed": self.config_maxmem_changed,
|
||||
"on_config_memory_apply_clicked": self.config_memory_apply,
|
||||
"on_details_help_activate": self.show_help,
|
||||
-
|
||||
- "on_config_disk_remove_clicked": self.remove_disk,
|
||||
- "on_config_network_remove_clicked": self.remove_network,
|
||||
- "on_add_hardware_button_clicked": self.add_hardware,
|
||||
})
|
||||
|
||||
def show(self):
|
||||
- dialog = self.window.get_widget("vmm-details")
|
||||
- dialog.show_all()
|
||||
+ self.topwin.show_all()
|
||||
self.window.get_widget("overview-network-traffic-text").hide()
|
||||
self.window.get_widget("overview-network-traffic-label").hide()
|
||||
self.window.get_widget("overview-disk-usage-bar").hide()
|
||||
self.window.get_widget("overview-disk-usage-text").hide()
|
||||
self.window.get_widget("overview-disk-usage-label").hide()
|
||||
self.network_traffic_graph.hide()
|
||||
- dialog.present()
|
||||
+ self.topwin.present()
|
||||
self.vm.connect("status-changed", self.update_widget_states)
|
||||
@@ -134,6 +142,8 @@ class vmmDetails(gobject.GObject):
|
||||
|
||||
def activate_performance_page(self):
|
||||
self.window.get_widget("details-pages").set_current_page(0)
|
||||
@@ -146,11 +150,11 @@ class vmmDetails(gobject.GObject):
|
||||
self.pixbuf_processor = gtk.gdk.pixbuf_new_from_file(config.get_icon_dir() + "/icon_cpu.png")
|
||||
self.pixbuf_memory = gtk.gdk.pixbuf_new_from_file(config.get_icon_dir() + "/icon_cpu.png")
|
||||
+ self.pixbuf_disk = gtk.gdk.pixbuf_new_from_file(config.get_icon_dir() + "/icon_hdd.png")
|
||||
+ self.pixbuf_network = gtk.gdk.pixbuf_new_from_file(config.get_icon_dir() + "/icon_ethernet.png")
|
||||
self.prepare_hw_list()
|
||||
self.hw_selected()
|
||||
|
||||
@@ -166,11 +176,11 @@ class vmmDetails(gobject.GObject):
|
||||
self.window.get_widget("details-pages").set_current_page(1)
|
||||
|
||||
def close(self,ignore1=None,ignore2=None):
|
||||
@ -53,33 +81,102 @@ Index: virt-manager-0.3.1/src/virtManager/details.py
|
||||
return 1
|
||||
return 0
|
||||
|
||||
@@ -387,45 +391,109 @@ class vmmDetails(gobject.GObject):
|
||||
@@ -192,10 +202,10 @@ class vmmDetails(gobject.GObject):
|
||||
self.refresh_config_memory()
|
||||
pagenum = 1
|
||||
elif pagetype == HW_LIST_TYPE_DISK:
|
||||
- self.refresh_disk_page()
|
||||
+ self.populate_disk_list()
|
||||
pagenum = 2
|
||||
elif pagetype == HW_LIST_TYPE_NIC:
|
||||
- self.refresh_network_page()
|
||||
+ self.populate_network_list()
|
||||
pagenum = 3
|
||||
|
||||
self.window.get_widget("hw-panel").set_current_page(pagenum)
|
||||
@@ -328,9 +338,6 @@ class vmmDetails(gobject.GObject):
|
||||
if details.get_current_page() == 0:
|
||||
self.refresh_summary()
|
||||
else:
|
||||
- # Add / remove new devices
|
||||
- self.repopulate_hw_list()
|
||||
-
|
||||
# Now refresh desired page
|
||||
hw_list = self.window.get_widget("hw-list")
|
||||
selection = hw_list.get_selection()
|
||||
@@ -343,10 +350,10 @@ class vmmDetails(gobject.GObject):
|
||||
self.refresh_config_cpu()
|
||||
elif pagetype == HW_LIST_TYPE_MEMORY:
|
||||
self.refresh_config_memory()
|
||||
- elif pagetype == HW_LIST_TYPE_DISK:
|
||||
- self.refresh_disk_page()
|
||||
- elif pagetype == HW_LIST_TYPE_NIC:
|
||||
- self.refresh_network_page()
|
||||
+ #elif pagetype == HW_LIST_TYPE_DISK:
|
||||
+ # self.refresh_disk_page()
|
||||
+ #elif pagetype == HW_LIST_TYPE_NIC:
|
||||
+ # self.refresh_network_page()
|
||||
|
||||
def refresh_summary(self):
|
||||
self.window.get_widget("overview-cpu-usage-text").set_text("%d %%" % self.vm.cpu_time_percentage())
|
||||
@@ -400,18 +407,6 @@ class vmmDetails(gobject.GObject):
|
||||
|
||||
self.window.get_widget("state-vm-memory").set_text("%d MB" % (self.vm.get_memory()/1024))
|
||||
|
||||
- def refresh_disk_page(self):
|
||||
- # get the currently selected line
|
||||
- vmlist = self.window.get_widget("hw-list")
|
||||
- selection = vmlist.get_selection()
|
||||
- active = selection.get_selected()
|
||||
- if active[1] != None:
|
||||
- diskinfo = active[0].get_value(active[1], HW_LIST_COL_DEVICE)
|
||||
- self.window.get_widget("disk-source-type").set_text(diskinfo[0])
|
||||
- self.window.get_widget("disk-source-path").set_text(diskinfo[1])
|
||||
- self.window.get_widget("disk-target-type").set_text(diskinfo[2])
|
||||
- self.window.get_widget("disk-target-device").set_text(diskinfo[3])
|
||||
-
|
||||
def refresh_network_page(self):
|
||||
vmlist = self.window.get_widget("hw-list")
|
||||
selection = vmlist.get_selection()
|
||||
@@ -458,36 +453,227 @@ class vmmDetails(gobject.GObject):
|
||||
self.window.get_widget("config-memory-apply").set_sensitive(False)
|
||||
|
||||
|
||||
+ def add_cdrom(self, button):
|
||||
+ return self.add_disk(True)
|
||||
+
|
||||
+ def add_harddisk(self, button):
|
||||
+ return self.add_disk(False)
|
||||
+
|
||||
+ def add_disk(self, is_cdrom):
|
||||
+ disks = self.disks_widget.get_disks()
|
||||
+ unused_vdevs = xen.install.get_unused_vdevs(self.options.full_virt, disks)
|
||||
+ if len(unused_vdevs) == 0:
|
||||
+ return
|
||||
+ name = self.vm.get_name()
|
||||
+
|
||||
- def remove_disk(self, src):
|
||||
- vmlist = self.window.get_widget("hw-list")
|
||||
- selection = vmlist.get_selection()
|
||||
- active = selection.get_selected()
|
||||
- if active[1] != None:
|
||||
- diskinfo = active[0].get_value(active[1], HW_LIST_COL_DEVICE)
|
||||
-
|
||||
- vbd = virtinst.VirtualDisk(path=diskinfo[1], type=diskinfo[0], device=diskinfo[2])
|
||||
- xml = vbd.get_xml_config(diskinfo[3])
|
||||
-
|
||||
- self.vm.remove_device(xml)
|
||||
-
|
||||
- def remove_network(self, src):
|
||||
- vmlist = self.window.get_widget("hw-list")
|
||||
- selection = vmlist.get_selection()
|
||||
- active = selection.get_selected()
|
||||
- if active[1] != None:
|
||||
- netinfo = active[0].get_value(active[1], HW_LIST_COL_DEVICE)
|
||||
-
|
||||
- vnic = None
|
||||
- if netinfo[0] == "bridge":
|
||||
- vnic = virtinst.VirtualNetworkInterface(type=netinfo[0], bridge=netinfo[1], macaddr=netinfo[3])
|
||||
- elif netinfo[0] == "network":
|
||||
- vnic = virtinst.VirtualNetworkInterface(type=netinfo[0], network=netinfo[1], macaddr=netinfo[3])
|
||||
+ def get_disk_editor(self):
|
||||
+ w = gtk.Window()
|
||||
+ self.add_disk_window = w
|
||||
+ w.set_modal(True)
|
||||
+ w.set_transient_for(self.topwin)
|
||||
+ w.set_title(xen.install.msg.title_disk)
|
||||
+ self.disk_editor = xen.install.gui.DiskEditWidget()
|
||||
+ disk_edit_widget = self.disk_editor.get_widget()
|
||||
+ w.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
|
||||
+ w.set_title(vminstall.msg.title_disk)
|
||||
+ w.set_border_width(10)
|
||||
+ disk_editor = DiskEditWidget()
|
||||
+ vbox = gtk.VBox()
|
||||
+ w.add(vbox)
|
||||
+ vbox.pack_start(disk_edit_widget, False)
|
||||
+ vbox.pack_start(disk_editor.get_widget(), False)
|
||||
+ bbox = gtk.HButtonBox()
|
||||
+ bbox.set_layout(gtk.BUTTONBOX_END)
|
||||
+ cancel_button = gtk.Button(stock=gtk.STOCK_CANCEL)
|
||||
@ -87,34 +184,72 @@ Index: virt-manager-0.3.1/src/virtManager/details.py
|
||||
+ ok_button = gtk.Button(stock=gtk.STOCK_OK)
|
||||
+ bbox.pack_start(ok_button)
|
||||
+ vbox.pack_start(bbox, False)
|
||||
+
|
||||
+ ok_button.connect("clicked", self.do_add_disk)
|
||||
+ cancel_button.connect("clicked", self.do_cancel_disk)
|
||||
+
|
||||
+ if is_cdrom:
|
||||
+ cdrom = self.disk_editor.default_cdrom()
|
||||
+ disk = xen.install.XenDisk(pdev=cdrom, vdev=unused_vdevs[0],
|
||||
+ vdevType=xen.install.XenDisk.DEVICE_CDROM,
|
||||
+ options=self.options, disk_group=disks)
|
||||
+ else:
|
||||
+ disk = xen.install.XenDisk(pdev=None, vdev=unused_vdevs[0],
|
||||
+ vdevType=xen.install.XenDisk.DEVICE_DISK,
|
||||
+ mb=4096, sparse=True,
|
||||
+ options=self.options, disk_group=disks)
|
||||
+ self.disk_editor.set(disk)
|
||||
+ w.show_all()
|
||||
+ w.present()
|
||||
+ def _cancel_disk(button):
|
||||
+ w.destroy()
|
||||
+ cancel_button.connect("clicked", _cancel_disk)
|
||||
+ return (w, disk_editor, ok_button)
|
||||
+
|
||||
+ def do_add_disk(self, button):
|
||||
+ def error_box(self, parent, text=vminstall.msg.error):
|
||||
+ parent.present()
|
||||
+ message_box = gtk.MessageDialog(parent, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, text)
|
||||
+ message_box.run()
|
||||
+ message_box.destroy()
|
||||
+
|
||||
+ def add_cdrom(self, button):
|
||||
+ return self.add_disk(True)
|
||||
+ def add_harddisk(self, button):
|
||||
+ return self.add_disk(False)
|
||||
+ def add_disk(self, is_cdrom):
|
||||
+ disks = self.disks_widget.get_disks()
|
||||
+ disk = self.disk_editor.get()
|
||||
+ self.xen_add_disk(disk)
|
||||
+ disks.append(disk)
|
||||
+ self.disks_widget.set_disks(disks)
|
||||
+ self.add_disk_window.destroy()
|
||||
+ unused_vdevs = vmdisks.disks.get_unused_vdevs(self.options.full_virt, disks)
|
||||
+ if len(unused_vdevs) == 0:
|
||||
+ return
|
||||
+ (w, disk_editor, ok_button) = self.get_disk_editor()
|
||||
+ def _add_disk(button):
|
||||
+ try:
|
||||
+ disk = disk_editor.get()
|
||||
+ self.xen_add_disk(disk)
|
||||
+ except vminstall.DiskResourceError, e:
|
||||
+ self.error_box(w, e.title)
|
||||
+ except:
|
||||
+ self.error_box(w)
|
||||
+ else:
|
||||
+ disks.append(disk)
|
||||
+ self.disks_widget.set_disks(disks)
|
||||
+ w.destroy()
|
||||
+ ok_button.connect("clicked", _add_disk)
|
||||
+ if is_cdrom:
|
||||
+ cdrom = disk_editor.default_cdrom()
|
||||
+ disk = vmdisks.Disk(pdev=cdrom, vdev=unused_vdevs[0],
|
||||
+ vdevType=vmdisks.Disk.DEVICE_CDROM,
|
||||
+ full_virt=self.options, vmname=self.options.vmname, disk_group=disks)
|
||||
+ else:
|
||||
+ disk = vmdisks.Disk(pdev=None, vdev=unused_vdevs[0],
|
||||
+ vdevType=vmdisks.Disk.DEVICE_DISK,
|
||||
+ args={'sparse':True},
|
||||
+ full_virt=self.options, vmname=self.options.vmname, disk_group=disks)
|
||||
+ disk_editor.set(disk)
|
||||
+
|
||||
+ def do_cancel_disk(self, button):
|
||||
+ self.add_disk_window.destroy()
|
||||
+ def edit_disk(self, button):
|
||||
+ (disk, index) = self.disks_widget.get_selected()
|
||||
+ (w, disk_editor, ok_button) = self.get_disk_editor()
|
||||
+ disk_editor.set(disk)
|
||||
+ def _edit_disk(button):
|
||||
+ try:
|
||||
+ disk = disk_editor.get()
|
||||
+ self.xen_edit_disk(disk)
|
||||
+ except vminstall.DiskResourceError, e:
|
||||
+ self.error_box(w, e.title)
|
||||
+ except:
|
||||
+ self.error_box(w)
|
||||
else:
|
||||
- vnic = virtinst.VirtualNetworkInterface(type=netinfo[0], macaddr=netinfo[3])
|
||||
+ self.disks_widget.set_index(index, disk)
|
||||
+ w.destroy()
|
||||
+ ok_button.connect("clicked", _edit_disk)
|
||||
+ disk_editor.set(disk)
|
||||
+
|
||||
+ def xen_add_disk(self, disk):
|
||||
+ disk.setup()
|
||||
@ -122,77 +257,238 @@ Index: virt-manager-0.3.1/src/virtManager/details.py
|
||||
+ mode = 'w'
|
||||
+ if disk.ro:
|
||||
+ mode = 'r'
|
||||
+ xfd = os.popen('xm block-attach %s "%s:%s" %s %s' % (self.vm.get_id(), disk.get_driver(),
|
||||
+ disk.pdev, disk.vdev, mode))
|
||||
+ status = xfd.close()
|
||||
+ vdev = disk.get_vdev()
|
||||
+ if disk.get_vdevtype() == disk.DEVICE_CDROM:
|
||||
+ vdev += ':cdrom'
|
||||
+ try:
|
||||
+ run(['/usr/sbin/xm', 'block-attach', str(self.vm.get_id()),
|
||||
+ '%s:%s' % (disk.get_driver(), disk.pdev), vdev, mode])
|
||||
+ except RuntimeError, e:
|
||||
+ logging.error("Failed to attach disk: %s" % str(e))
|
||||
+ raise
|
||||
+ else:
|
||||
+ # FIXME
|
||||
+ pass
|
||||
+
|
||||
+ raise NotImplementedError
|
||||
|
||||
- xml = vnic.get_xml_config()
|
||||
- self.vm.remove_device(xml)
|
||||
+ def xen_remove_disk(self, disk):
|
||||
+ if self.vm.is_active():
|
||||
+ xfd = os.popen('xm block-detach %s %s -f' % (self.vm.get_id(), disk.vdev))
|
||||
+ status = xfd.close()
|
||||
+ try:
|
||||
+ run(['/usr/sbin/xm', 'block-detach', str(self.vm.get_id()), disk.vdev, '-f'])
|
||||
+ except RuntimeError, e:
|
||||
+ logging.error("Failed to remove disk: %s" % str(e))
|
||||
+ raise
|
||||
+ else:
|
||||
+ # FIXME
|
||||
+ pass
|
||||
+ raise NotImplementedError
|
||||
|
||||
def prepare_disk_list(self):
|
||||
- disks = self.window.get_widget("storage-view")
|
||||
- disksModel = gtk.TreeStore(str,str,str,str)
|
||||
- disks.set_model(disksModel)
|
||||
-
|
||||
- diskType_col = gtk.TreeViewColumn("Type")
|
||||
- diskType_text = gtk.CellRendererText()
|
||||
- diskType_col.pack_start(diskType_text, True)
|
||||
- diskType_col.add_attribute(diskType_text, 'text', 0)
|
||||
-
|
||||
- diskSrc_col = gtk.TreeViewColumn("Source")
|
||||
- diskSrc_text = gtk.CellRendererText()
|
||||
- diskSrc_col.pack_start(diskSrc_text, True)
|
||||
- diskSrc_col.add_attribute(diskSrc_text, 'text', 1)
|
||||
-
|
||||
- diskDevice_col = gtk.TreeViewColumn("Device")
|
||||
- diskDevice_text = gtk.CellRendererText()
|
||||
- diskDevice_col.pack_start(diskDevice_text, True)
|
||||
- diskDevice_col.add_attribute(diskDevice_text, 'text', 2)
|
||||
-
|
||||
- diskDst_col = gtk.TreeViewColumn(_("Destination"))
|
||||
- diskDst_text = gtk.CellRendererText()
|
||||
- diskDst_col.pack_start(diskDst_text, True)
|
||||
- diskDst_col.add_attribute(diskDst_text, 'text', 3)
|
||||
-
|
||||
- disks.append_column(diskType_col)
|
||||
- disks.append_column(diskSrc_col)
|
||||
- disks.append_column(diskDevice_col)
|
||||
- disks.append_column(diskDst_col)
|
||||
+ self.disks_widget = xen.install.gui.DisksWidget(allow_reorder=False,
|
||||
+ remove_fn=self.xen_remove_disk,
|
||||
+ def xen_edit_disk(self, disk):
|
||||
+ if self.vm.is_active():
|
||||
+ try:
|
||||
+ from xen.util import blkif
|
||||
+ devid = blkif.blkdev_name_to_number(disk.get_vdev())
|
||||
+ run(['/usr/bin/xenstore-write',
|
||||
+ '/local/domain/0/backend/vbd/%d/%d/params' % (self.vm.get_id(), devid),
|
||||
+ disk.get_pdev()])
|
||||
+ except RuntimeError, e:
|
||||
+ logging.error("Failed to change CD media: %s" % str(e))
|
||||
+ raise
|
||||
+ else:
|
||||
+ raise NotImplementedError
|
||||
+
|
||||
+ def disk_selected(self, src=None):
|
||||
+ (disk, index) = self.disks_widget.get_selected()
|
||||
+ # FIXME: Abstract access to the buttons
|
||||
+ def button(name):
|
||||
+ return self.disks_widget.glade.get_widget(name)
|
||||
+ cdrom_button = button('button-new-cdrom')
|
||||
+ disk_button = button('button-new-harddisk')
|
||||
+ edit_button = button('button-edit-disk')
|
||||
+ remove_button = button('button-delete-disk')
|
||||
+ active = self.vm.is_active()
|
||||
+ cdrom_button.set_sensitive(active)
|
||||
+ disk_button.set_sensitive(active)
|
||||
+ if disk is None:
|
||||
+ edit_button.set_sensitive(False)
|
||||
+ remove_button.set_sensitive(False)
|
||||
+ else:
|
||||
+ edit_button.set_sensitive(active and disk.get_vdevtype() == disk.DEVICE_CDROM)
|
||||
+ remove_button.set_sensitive(active)
|
||||
+
|
||||
+ def prepare_disk_list(self):
|
||||
+ self.disks_widget = DisksWidget(allow_reorder=False,
|
||||
+ add_cdrom_fn=self.add_cdrom,
|
||||
+ add_harddisk_fn=self.add_harddisk)
|
||||
+ add_harddisk_fn=self.add_harddisk,
|
||||
+ edit_fn=self.edit_disk,
|
||||
+ remove_fn=self.xen_remove_disk)
|
||||
+ notebook = self.window.get_widget("hw-panel")
|
||||
+ notebook.remove_page(2)
|
||||
+ notebook.insert_page(self.disks_widget.get_widget(), None, 2)
|
||||
+ self.disks_widget.disks_view.view.get_selection().connect("changed", self.disk_selected)
|
||||
+ class Options:
|
||||
+ pass
|
||||
+ self.options = Options()
|
||||
+ self.options.full_virt = self.vm.vm.OSType() == 'hvm'
|
||||
+ self.options.name = self.vm.get_name()
|
||||
|
||||
def populate_disk_list(self):
|
||||
diskList = self.vm.get_disk_devices()
|
||||
-
|
||||
- disks = self.window.get_widget("storage-view")
|
||||
- disksModel = disks.get_model()
|
||||
- disksModel.clear()
|
||||
+ self.options.vmname = self.vm.get_name()
|
||||
+ # This is to work around a libvirt bug; once libvirt is updated,
|
||||
+ # remove this. If the VM is not running, libvirt assumes it is
|
||||
+ # paravirtual. This can cause problems (such as failure to detach
|
||||
+ # a disk) if the VM is started and turns out it was actually FV.
|
||||
+ if self.vm.is_active():
|
||||
+ self.options.full_virt = self.vm.vm.OSType() == 'hvm'
|
||||
+ else:
|
||||
+ self.options.full_virt = False
|
||||
+ for d in self.vm.get_disk_devices():
|
||||
+ if d[3].startswith('hd'):
|
||||
+ self.options.full_virt = True
|
||||
+ break
|
||||
+
|
||||
+ def populate_disk_list(self):
|
||||
+ diskList = self.vm.get_disk_devices()
|
||||
+ disks = []
|
||||
for d in diskList:
|
||||
- disksModel.append(None, d)
|
||||
+ disks.append(xen.install.XenDisk(d[1], d[3], options=self.options,
|
||||
+ disk_group=disks))
|
||||
+ max_disks = len(xen.install.get_possible_vdevs(self.options.full_virt))
|
||||
+ for d in diskList:
|
||||
+ disks.append(vmdisks.Disk(d[1], vdev=d[3], vdevType=d[2],
|
||||
+ full_virt=self.options, vmname=self.options.vmname, disk_group=disks))
|
||||
+ max_disks = len(vmdisks.get_possible_vdevs(self.options.full_virt))
|
||||
+ self.disks_widget.set_max_disks(max_disks)
|
||||
+ self.disks_widget.set_disks(disks)
|
||||
+ self.disk_selected()
|
||||
+
|
||||
+ def prepare_network_list(self):
|
||||
+ nets = self.window.get_widget("network-view")
|
||||
+ netsModel = gtk.TreeStore(str,str,str,str)
|
||||
+ nets.set_model(netsModel)
|
||||
+
|
||||
+ netType_col = gtk.TreeViewColumn("Type")
|
||||
+ netType_text = gtk.CellRendererText()
|
||||
+ netType_col.pack_start(netType_text, True)
|
||||
+ netType_col.add_attribute(netType_text, 'text', 0)
|
||||
+
|
||||
+ netSrc_col = gtk.TreeViewColumn("Source")
|
||||
+ netSrc_text = gtk.CellRendererText()
|
||||
+ netSrc_col.pack_start(netSrc_text, True)
|
||||
+ netSrc_col.add_attribute(netSrc_text, 'text', 1)
|
||||
+
|
||||
+ netDevice_col = gtk.TreeViewColumn("Device")
|
||||
+ netDevice_text = gtk.CellRendererText()
|
||||
+ netDevice_col.pack_start(netDevice_text, True)
|
||||
+ netDevice_col.add_attribute(netDevice_text, 'text', 2)
|
||||
+
|
||||
+ netDst_col = gtk.TreeViewColumn(_("MAC address"))
|
||||
+ netDst_text = gtk.CellRendererText()
|
||||
+ netDst_col.pack_start(netDst_text, True)
|
||||
+ netDst_col.add_attribute(netDst_text, 'text', 3)
|
||||
+
|
||||
+ nets.append_column(netType_col)
|
||||
+ nets.append_column(netSrc_col)
|
||||
+ nets.append_column(netDevice_col)
|
||||
+ nets.append_column(netDst_col)
|
||||
+
|
||||
+ def populate_network_list(self):
|
||||
+ netList = self.vm.get_network_devices()
|
||||
+
|
||||
+ nets = self.window.get_widget("network-view")
|
||||
+ netsModel = nets.get_model()
|
||||
+ netsModel.clear()
|
||||
+ for d in netList:
|
||||
+ netsModel.append(None, d)
|
||||
|
||||
def prepare_network_list(self):
|
||||
nets = self.window.get_widget("network-view")
|
||||
def prepare_hw_list(self):
|
||||
hw_list_model = gtk.ListStore(str, str, int, gtk.gdk.Pixbuf, int, gobject.TYPE_PYOBJECT)
|
||||
@@ -504,94 +690,11 @@ class vmmDetails(gobject.GObject):
|
||||
hwCol.add_attribute(hw_img, 'pixbuf', HW_LIST_COL_PIXBUF)
|
||||
self.window.get_widget("hw-list").append_column(hwCol)
|
||||
|
||||
- self.populate_hw_list()
|
||||
-
|
||||
- def populate_hw_list(self):
|
||||
- hw_list_model = self.window.get_widget("hw-list").get_model()
|
||||
hw_list_model.clear()
|
||||
hw_list_model.append(["Processor", None, 0, self.pixbuf_processor, HW_LIST_TYPE_CPU, []])
|
||||
hw_list_model.append(["Memory", None, 0, self.pixbuf_memory, HW_LIST_TYPE_MEMORY, []])
|
||||
- self.repopulate_hw_list()
|
||||
-
|
||||
- def repopulate_hw_list(self):
|
||||
- hw_list = self.window.get_widget("hw-list")
|
||||
- hw_list_model = hw_list.get_model()
|
||||
-
|
||||
- # Populate list of disks
|
||||
- currentDisks = {}
|
||||
- for disk in self.vm.get_disk_devices():
|
||||
- missing = True
|
||||
- insertAt = 0
|
||||
- currentDisks[disk[3]] = 1
|
||||
- for row in hw_list_model:
|
||||
- if row[HW_LIST_COL_TYPE] == HW_LIST_TYPE_DISK and row[HW_LIST_COL_DEVICE][3] == disk[3]:
|
||||
- # Update metadata
|
||||
- row[HW_LIST_COL_DEVICE] = disk
|
||||
- missing = False
|
||||
- # The insert position must be *before* any NICs
|
||||
- if row[HW_LIST_COL_TYPE] != HW_LIST_TYPE_NIC:
|
||||
- insertAt = insertAt + 1
|
||||
-
|
||||
- # Add in row
|
||||
- if missing:
|
||||
- stock = gtk.STOCK_HARDDISK
|
||||
- if disk[2] == "cdrom":
|
||||
- stock = gtk.STOCK_CDROM
|
||||
- elif disk[2] == "floppy":
|
||||
- stock = gtk.STOCK_FLOPPY
|
||||
- hw_list_model.insert(insertAt, ["Disk %s" % disk[3], stock, gtk.ICON_SIZE_LARGE_TOOLBAR, None, HW_LIST_TYPE_DISK, disk])
|
||||
-
|
||||
- # Populate list of NICs
|
||||
- currentNICs = {}
|
||||
- nic_number = 0
|
||||
- for nic in self.vm.get_network_devices():
|
||||
- missing = True
|
||||
- insertAt = 0
|
||||
- currentNICs[nic[3]] = 1
|
||||
- for row in hw_list_model:
|
||||
- if row[HW_LIST_COL_TYPE] == HW_LIST_TYPE_NIC and row[HW_LIST_COL_DEVICE][3] == nic[3]:
|
||||
- # Update metadata
|
||||
- row[HW_LIST_COL_DEVICE] = nic
|
||||
- missing = False
|
||||
-
|
||||
- # Insert position is at end....
|
||||
- # XXX until we add support for Mice, etc
|
||||
- insertAt = insertAt + 1
|
||||
-
|
||||
- # Add in row
|
||||
- if missing:
|
||||
- hw_list_model.insert(insertAt, ["NIC %s" % nic[3][-9:], gtk.STOCK_NETWORK, gtk.ICON_SIZE_LARGE_TOOLBAR, None, HW_LIST_TYPE_NIC, nic])
|
||||
-
|
||||
- # Now remove any no longer current devs
|
||||
- devs = range(len(hw_list_model))
|
||||
- devs.reverse()
|
||||
- for i in devs:
|
||||
- iter = hw_list_model.iter_nth_child(None, i)
|
||||
- row = hw_list_model[i]
|
||||
- removeIt = False
|
||||
-
|
||||
- if row[HW_LIST_COL_TYPE] == HW_LIST_TYPE_DISK and not currentDisks.has_key(row[HW_LIST_COL_DEVICE][3]):
|
||||
- removeIt = True
|
||||
- elif row[HW_LIST_COL_TYPE] == HW_LIST_TYPE_NIC and not currentNICs.has_key(row[HW_LIST_COL_DEVICE][3]):
|
||||
- removeIt = True
|
||||
-
|
||||
- if removeIt:
|
||||
- # Re-select the first row, if we're viewing the device
|
||||
- # we're about to remove
|
||||
- (selModel, selIter) = hw_list.get_selection().get_selected()
|
||||
- selType = selModel.get_value(selIter, HW_LIST_COL_TYPE)
|
||||
- selInfo = selModel.get_value(selIter, HW_LIST_COL_DEVICE)
|
||||
- if selType == row[HW_LIST_COL_TYPE] and selInfo[3] == row[HW_LIST_COL_DEVICE][3]:
|
||||
- hw_list.get_selection().select_iter(selModel.iter_nth_child(None, 0))
|
||||
-
|
||||
- # Now actually remove it
|
||||
- hw_list_model.remove(iter)
|
||||
-
|
||||
-
|
||||
- def add_hardware(self, src):
|
||||
- if self.addhw is None:
|
||||
- self.addhw = vmmAddHardware(self.config, self.vm)
|
||||
-
|
||||
- self.addhw.show()
|
||||
-
|
||||
+ hw_list_model.append(["Disk", None, 0, self.pixbuf_disk, HW_LIST_TYPE_DISK, []])
|
||||
+ hw_list_model.append(["Network", None, 0, self.pixbuf_network, HW_LIST_TYPE_NIC, []])
|
||||
|
||||
+ self.prepare_disk_list()
|
||||
+ self.prepare_network_list()
|
||||
|
@ -1,7 +1,7 @@
|
||||
Index: virt-manager-0.4.0/src/virtManager/engine.py
|
||||
Index: virt-manager--devel/src/virtManager/engine.py
|
||||
===================================================================
|
||||
--- virt-manager-0.4.0.orig/src/virtManager/engine.py
|
||||
+++ virt-manager-0.4.0/src/virtManager/engine.py
|
||||
--- virt-manager--devel.orig/src/virtManager/engine.py
|
||||
+++ virt-manager--devel/src/virtManager/engine.py
|
||||
@@ -32,7 +32,7 @@ from virtManager.manager import vmmManag
|
||||
from virtManager.details import vmmDetails
|
||||
from virtManager.console import vmmConsole
|
||||
@ -20,7 +20,7 @@ Index: virt-manager-0.4.0/src/virtManager/engine.py
|
||||
self.connections = {}
|
||||
|
||||
self.timer = None
|
||||
@@ -162,8 +162,7 @@ class vmmEngine:
|
||||
@@ -169,8 +169,7 @@ class vmmEngine:
|
||||
for name in [ "windowManager", "windowHost"]:
|
||||
if conn[name] != None and conn[name].is_visible():
|
||||
ct += 1
|
||||
@ -30,7 +30,7 @@ Index: virt-manager-0.4.0/src/virtManager/engine.py
|
||||
return ct
|
||||
|
||||
def change_timer_interval(self,ignore1,ignore2,ignore3,ignore4):
|
||||
@@ -295,14 +294,21 @@ class vmmEngine:
|
||||
@@ -302,14 +301,21 @@ class vmmEngine:
|
||||
self.connections[uri]["windowManager"] = manager
|
||||
self.connections[uri]["windowManager"].show()
|
||||
|
||||
@ -59,10 +59,10 @@ Index: virt-manager-0.4.0/src/virtManager/engine.py
|
||||
|
||||
def get_connection(self, uri, readOnly=None):
|
||||
if not(self.connections.has_key(uri)):
|
||||
Index: virt-manager-0.4.0/src/virtManager/createnet.py
|
||||
Index: virt-manager--devel/src/virtManager/createnet.py
|
||||
===================================================================
|
||||
--- virt-manager-0.4.0.orig/src/virtManager/createnet.py
|
||||
+++ virt-manager-0.4.0/src/virtManager/createnet.py
|
||||
--- virt-manager--devel.orig/src/virtManager/createnet.py
|
||||
+++ virt-manager--devel/src/virtManager/createnet.py
|
||||
@@ -22,7 +22,6 @@ import gtk
|
||||
import gtk.gdk
|
||||
import gtk.glade
|
||||
|
@ -10,7 +10,7 @@ Index: virt-manager--devel/src/virtManager/console.py
|
||||
|
||||
topwin = self.window.get_widget("vmm-console")
|
||||
sens = (self.window.get_widget("menubar2"),
|
||||
@@ -135,6 +136,9 @@ class vmmConsole(gobject.GObject):
|
||||
@@ -134,6 +135,9 @@ class vmmConsole(gobject.GObject):
|
||||
def notify_grabbed(self, src):
|
||||
topwin = self.window.get_widget("vmm-console")
|
||||
topwin.set_title(_("Press Ctrl+Alt to release pointer.") + " " + self.title)
|
||||
|
@ -2,7 +2,7 @@ Index: virt-manager--devel/src/virtManager/connect.py
|
||||
===================================================================
|
||||
--- virt-manager--devel.orig/src/virtManager/connect.py
|
||||
+++ virt-manager--devel/src/virtManager/connect.py
|
||||
@@ -99,4 +99,3 @@ class vmmConnect(gobject.GObject):
|
||||
@@ -116,4 +116,3 @@ class vmmConnect(gobject.GObject):
|
||||
self.close()
|
||||
self.emit("completed", uri, readOnly)
|
||||
|
||||
@ -11,9 +11,9 @@ Index: virt-manager--devel/src/virtManager/connection.py
|
||||
===================================================================
|
||||
--- virt-manager--devel.orig/src/virtManager/connection.py
|
||||
+++ virt-manager--devel/src/virtManager/connection.py
|
||||
@@ -578,5 +578,4 @@ class vmmConnection(gobject.GObject):
|
||||
uuid.append('-')
|
||||
return "".join(uuid)
|
||||
@@ -641,5 +641,4 @@ class vmmConnection(gobject.GObject):
|
||||
delim = len(url)
|
||||
return url[start:delim], url[delim:]
|
||||
|
||||
-gobject.type_register(vmmConnection)
|
||||
|
||||
@ -21,7 +21,7 @@ Index: virt-manager--devel/src/virtManager/console.py
|
||||
===================================================================
|
||||
--- virt-manager--devel.orig/src/virtManager/console.py
|
||||
+++ virt-manager--devel/src/virtManager/console.py
|
||||
@@ -509,4 +509,3 @@ class vmmConsole(gobject.GObject):
|
||||
@@ -508,4 +508,3 @@ class vmmConsole(gobject.GObject):
|
||||
self.ignorePause = False
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ Index: virt-manager--devel/src/virtManager/details.py
|
||||
===================================================================
|
||||
--- virt-manager--devel.orig/src/virtManager/details.py
|
||||
+++ virt-manager--devel/src/virtManager/details.py
|
||||
@@ -581,4 +581,3 @@ class vmmDetails(gobject.GObject):
|
||||
@@ -595,4 +595,3 @@ class vmmDetails(gobject.GObject):
|
||||
self.addhw.show()
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ Index: virt-manager--devel/src/virtManager/domain.py
|
||||
===================================================================
|
||||
--- virt-manager--devel.orig/src/virtManager/domain.py
|
||||
+++ virt-manager--devel/src/virtManager/domain.py
|
||||
@@ -633,4 +633,3 @@ class vmmDomain(gobject.GObject):
|
||||
@@ -644,4 +644,3 @@ class vmmDomain(gobject.GObject):
|
||||
memory = int(memory)
|
||||
self.vm.setMaxMemory(memory)
|
||||
|
||||
@ -48,7 +48,7 @@ Index: virt-manager--devel/src/virtManager/manager.py
|
||||
===================================================================
|
||||
--- virt-manager--devel.orig/src/virtManager/manager.py
|
||||
+++ virt-manager--devel/src/virtManager/manager.py
|
||||
@@ -706,4 +706,3 @@ class vmmManager(gobject.GObject):
|
||||
@@ -718,4 +718,3 @@ class vmmManager(gobject.GObject):
|
||||
vm.resume()
|
||||
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
Index: virt-manager--devel/src/virtManager/domain.py
|
||||
===================================================================
|
||||
--- virt-manager--devel.orig/src/virtManager/domain.py
|
||||
+++ virt-manager--devel/src/virtManager/domain.py
|
||||
@@ -435,11 +435,8 @@ class vmmDomain(gobject.GObject):
|
||||
port = None
|
||||
if type == "vnc":
|
||||
port = self.get_xml_string("/domain/devices/graphics[@type='vnc']/@port")
|
||||
- if port == None:
|
||||
- port = 5900 + self.get_id()
|
||||
- else:
|
||||
- port = int(port)
|
||||
- return [type, "127.0.0.1", port]
|
||||
+ if port is not None:
|
||||
+ return [type, "127.0.0.1", int(port)]
|
||||
return [type, None, None]
|
||||
|
||||
def get_disk_devices(self):
|
Loading…
Reference in New Issue
Block a user