mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
Port from gconf to gsettings
This unfortunately has a decent amount of fallout: add a wrapper class in config.py that reduces much of the churn. Another big piece is that gsettings can't accept arbitrary paths like gconf would, everything needs to be described in the schema. Also do a bunch more RPM spec modernizing
This commit is contained in:
parent
1c51a39903
commit
7e23244096
2
.gitignore
vendored
2
.gitignore
vendored
@ -14,6 +14,8 @@ virt-installc
|
||||
/.coverage
|
||||
/MANIFEST
|
||||
|
||||
/data/gschemas.compiled
|
||||
|
||||
/man/virt-manager.1
|
||||
/man/virt-install.1
|
||||
/man/virt-clone.1
|
||||
|
286
data/org.virt-manager.virt-manager.gschema.xml
Normal file
286
data/org.virt-manager.virt-manager.gschema.xml
Normal file
@ -0,0 +1,286 @@
|
||||
<schemalist>
|
||||
|
||||
<!-- Relocatable per VM schema -->
|
||||
<schema id="org.virt-manager.virt-manager.vm">
|
||||
<key name="vm-window-size" type="(ii)">
|
||||
<default>(-1, -1)</default>
|
||||
<summary>VM window dimensions</summary>
|
||||
<description>VM window dimensions</description>
|
||||
</key>
|
||||
|
||||
<key name="scaling" type="i">
|
||||
<default>-1</default>
|
||||
<summary>When to scale the VM graphical console</summary>
|
||||
<description>When to scale the VM graphical console. -1 = global default, 0 = never, 1 = only when in full screen mode, 2 = Always</description>
|
||||
</key>
|
||||
|
||||
<key name="console-password" type="(si)">
|
||||
<default>("", -1)</default>
|
||||
<summary>Username and secrets ID for graphical password</summary>
|
||||
<description>Username and secrets ID for graphical password</description>
|
||||
</key>
|
||||
</schema>
|
||||
|
||||
<schema id="org.virt-manager.virt-manager"
|
||||
path="/org/virt-manager/virt-manager/">
|
||||
|
||||
<key name="system-tray" type="b">
|
||||
<default>false</default>
|
||||
<summary>Show system tray icon</summary>
|
||||
<description>Show system tray icon while app is running</description>
|
||||
</key>
|
||||
|
||||
<key name="manager-window-height" type="i">
|
||||
<default>0</default>
|
||||
<summary>Default manager window height</summary>
|
||||
<description>Default manager window height</description>
|
||||
</key>
|
||||
|
||||
<key name="manager-window-width" type="i">
|
||||
<default>0</default>
|
||||
<summary>Default manager window width</summary>
|
||||
<description>Default manager window width</description>
|
||||
</key>
|
||||
|
||||
<child name="connections" schema="org.virt-manager.virt-manager.connections"/>
|
||||
<child name="vmlist-fields" schema="org.virt-manager.virt-manager.vmlist-fields"/>
|
||||
<child name="stats" schema="org.virt-manager.virt-manager.stats"/>
|
||||
<child name="urls" schema="org.virt-manager.virt-manager.urls"/>
|
||||
<child name="console" schema="org.virt-manager.virt-manager.console"/>
|
||||
<child name="details" schema="org.virt-manager.virt-manager.details"/>
|
||||
<child name="new-vm" schema="org.virt-manager.virt-manager.new-vm"/>
|
||||
<child name="paths" schema="org.virt-manager.virt-manager.paths"/>
|
||||
<child name="confirm" schema="org.virt-manager.virt-manager.confirm"/>
|
||||
</schema>
|
||||
|
||||
<schema id="org.virt-manager.virt-manager.connections"
|
||||
path="/org/virt-manager/virt-manager/connections/">
|
||||
<key name="uris" type="as">
|
||||
<default>[]</default>
|
||||
<summary>Libvirt URIs listed in the manager window</summary>
|
||||
<description>Libvirt URIs listed in the manager window</description>
|
||||
</key>
|
||||
|
||||
<key name="autoconnect" type="as">
|
||||
<default>[]</default>
|
||||
<summary>Libvirt URIs to connect to on app startup</summary>
|
||||
<description>Libvirt URIs to connect to on app startup</description>
|
||||
</key>
|
||||
</schema>
|
||||
|
||||
<schema id="org.virt-manager.virt-manager.vmlist-fields" path="/org/virt-manager/virt-manager/vmlist-fields/">
|
||||
|
||||
<key name="disk-usage" type="b">
|
||||
<default>false</default>
|
||||
<summary>Show disk I/O in summary</summary>
|
||||
<description>Show the disk I/O field in the domain list summary view</description>
|
||||
</key>
|
||||
|
||||
<key name="network-traffic" type="b">
|
||||
<default>false</default>
|
||||
<summary>Show network I/O in summary</summary>
|
||||
<description>Show the network I/O field in the domain list summary view</description>
|
||||
</key>
|
||||
|
||||
<key name="cpu-usage" type="b">
|
||||
<default>true</default>
|
||||
<summary>Show guest cpu usage in summary</summary>
|
||||
<description>Show the guest cpu usage field in the domain list summary view</description>
|
||||
</key>
|
||||
|
||||
<key name="host-cpu-usage" type="b">
|
||||
<default>false</default>
|
||||
<summary>Show host cpu usage in summary</summary>
|
||||
<description>Show the host cpu usage field in the domain list summary view</description>
|
||||
</key>
|
||||
|
||||
</schema>
|
||||
|
||||
<schema id="org.virt-manager.virt-manager.stats" path="/org/virt-manager/virt-manager/stats/">
|
||||
|
||||
<key name="update-interval" type="i">
|
||||
<default>1</default>
|
||||
<summary>The statistics update interval</summary>
|
||||
<description>The statistics update interval in seconds</description>
|
||||
</key>
|
||||
|
||||
<key name="history-length" type="i">
|
||||
<default>120</default>
|
||||
<summary>The statistics history length</summary>
|
||||
<description>The number of samples to keep in the statistics history</description>
|
||||
|
||||
</key>
|
||||
<key name="enable-disk-poll" type="b">
|
||||
<default>false</default>
|
||||
<summary>Poll disk i/o stats</summary>
|
||||
<description>Whether or not the app will poll VM disk i/o statistics</description>
|
||||
|
||||
</key>
|
||||
<key name="enable-net-poll" type="b">
|
||||
<default>false</default>
|
||||
<summary>Poll net i/o stats</summary>
|
||||
<description>Whether or not the app will poll VM network i/o statistics</description>
|
||||
</key>
|
||||
|
||||
</schema>
|
||||
|
||||
<schema id="org.virt-manager.virt-manager.urls"
|
||||
path="/org/virt-manager/virt-manager/urls/">
|
||||
<key name="url-list-length" type="i">
|
||||
<default>10</default>
|
||||
<summary>The length of the list of URLs</summary>
|
||||
<description>The number of urls to keep in the history for the install media address page.</description>
|
||||
</key>
|
||||
|
||||
<key name="urls" type="as">
|
||||
<default>[]</default>
|
||||
<summary>Saved list of install URLs</summary>
|
||||
<description>Saved list of install URLs</description>
|
||||
</key>
|
||||
|
||||
<key name="isos" type="as">
|
||||
<default>[]</default>
|
||||
<summary>Saved list of install ISOs</summary>
|
||||
<description>Saved list of install ISOs</description>
|
||||
</key>
|
||||
|
||||
<key name="kickstarts" type="as">
|
||||
<default>[]</default>
|
||||
<summary>Saved list of install kickstarts</summary>
|
||||
<description>Saved list of install kickstarts</description>
|
||||
</key>
|
||||
|
||||
</schema>
|
||||
|
||||
<schema id="org.virt-manager.virt-manager.console"
|
||||
path="/org/virt-manager/virt-manager/console/">
|
||||
<key name="enable-accels" type="b">
|
||||
<default>false</default>
|
||||
<summary>Enable menu accelerators in console window</summary>
|
||||
<description>Whether to enable menu accelerators while connected to the guest graphical console.</description>
|
||||
</key>
|
||||
|
||||
<key name="scaling" type="i">
|
||||
<default>1</default>
|
||||
<summary>When to scale the VM graphical console</summary>
|
||||
<description>When to scale the VM graphical console. 0 = never, 1 = only when in full screen mode, 2 = Always</description>
|
||||
</key>
|
||||
|
||||
<key name="grab-keys" type="s">
|
||||
<default>''</default>
|
||||
<summary>Grab keyboard sequence for the graphical console</summary>
|
||||
<description>Grab keyboard sequence for the graphical console</description>
|
||||
</key>
|
||||
</schema>
|
||||
|
||||
<schema id="org.virt-manager.virt-manager.details" path="/org/virt-manager/virt-manager/details/">
|
||||
|
||||
<key name="show-toolbar" type="b">
|
||||
<default>true</default>
|
||||
<summary>Whether to show VM button toolbar in Details display</summary>
|
||||
<description>Whether to show toolbar containing Virtual Machine action buttons (such as Run, Pause, Shutdown) in the details display</description>
|
||||
</key>
|
||||
|
||||
</schema>
|
||||
|
||||
<schema id="org.virt-manager.virt-manager.new-vm" path="/org/virt-manager/virt-manager/new-vm/">
|
||||
|
||||
<key name="local-sound" type="b">
|
||||
<default>true</default>
|
||||
<summary>Install sound device for local VM</summary>
|
||||
<description>Whether to install a sound device for local VMs or not</description>
|
||||
</key>
|
||||
|
||||
<key name="remote-sound" type="b">
|
||||
<default>false</default>
|
||||
<summary>Install sound device for remote VM</summary>
|
||||
<description>Whether to install a sound device for remote VMs or not</description>
|
||||
</key>
|
||||
|
||||
<key name="graphics-type" type="s">
|
||||
<default>'system'</default>
|
||||
<summary>Install selected graphics type for new VM</summary>
|
||||
<description>Install selected graphics type for new VM. vnc or spice, system for software configured default</description>
|
||||
</key>
|
||||
|
||||
<key name="storage-format" type="s">
|
||||
<default>'default'</default>
|
||||
<summary>Use selected format for new VM storage</summary>
|
||||
<description>Use selected format when creating new disk images in new VM wizard</description>
|
||||
</key>
|
||||
</schema>
|
||||
<schema id="org.virt-manager.virt-manager.paths" path="/org/virt-manager/virt-manager/paths/">
|
||||
<key name="default-image-path" type="s">
|
||||
<default>''</default>
|
||||
<summary>Default image path</summary>
|
||||
<description>Default path for choosing VM images</description>
|
||||
</key>
|
||||
<key name="default-media-path" type="s">
|
||||
<default>''</default>
|
||||
<summary>Default media path</summary>
|
||||
<description>Default path for choosing media</description>
|
||||
</key>
|
||||
<key name="default-save-path" type="s">
|
||||
<default>''</default>
|
||||
<summary>Default save domain path</summary>
|
||||
<description>Default path for saving VM snapshots</description>
|
||||
</key>
|
||||
<key name="default-restore-path" type="s">
|
||||
<default>''</default>
|
||||
<summary>Default restore path</summary>
|
||||
<description>Default path for stored VM snapshots</description>
|
||||
</key>
|
||||
<key name="default-screenshot-path" type="s">
|
||||
<default>''</default>
|
||||
<summary>Default screenshot path</summary>
|
||||
<description>Default path for saving screenshots from VMs</description>
|
||||
</key>
|
||||
</schema>
|
||||
|
||||
<schema id="org.virt-manager.virt-manager.confirm" path="/org/virt-manager/virt-manager/confirm/">
|
||||
|
||||
<key name="forcepoweroff" type="b">
|
||||
<default>true</default>
|
||||
<summary>Confirm force poweroff request</summary>
|
||||
<description>Whether we require confirmation to forcepoweroff a VM</description>
|
||||
</key>
|
||||
|
||||
<key name="poweroff" type="b">
|
||||
<default>false</default>
|
||||
<summary>Confirm poweroff request</summary>
|
||||
<description>Whether we require confirmation to poweroff/reboot a VM</description>
|
||||
</key>
|
||||
|
||||
<key name="pause" type="b">
|
||||
<default>false</default>
|
||||
<summary>Confirm pause request</summary>
|
||||
<description>Whether we require confirmation to pause a VM</description>
|
||||
</key>
|
||||
|
||||
<key name="removedev" type="b">
|
||||
<default>true</default>
|
||||
<summary>Confirm device removal request</summary>
|
||||
<description>Whether we require confirmation to remove a virtual device</description>
|
||||
</key>
|
||||
|
||||
<key name="interface-power" type="b">
|
||||
<default>true</default>
|
||||
<summary>Confirm device interface start and stop</summary>
|
||||
<description>Whether we require confirmation to start or stop a libvirt virtual interface</description>
|
||||
</key>
|
||||
|
||||
<key name="unapplied-dev" type="b">
|
||||
<default>true</default>
|
||||
<summary>Confirm about unapplied device changes</summary>
|
||||
<description>Whether we ask the user to apply or discard unapplied device changes</description>
|
||||
</key>
|
||||
|
||||
<key name="delete-storage" type="b">
|
||||
<default>true</default>
|
||||
<summary>Confirm deleting storage</summary>
|
||||
<description>Whether we require a confirmation on deleting storage</description>
|
||||
</key>
|
||||
|
||||
</schema>
|
||||
|
||||
</schemalist>
|
@ -1,407 +0,0 @@
|
||||
<gconfschemafile>
|
||||
<schemalist>
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/vmlist-fields/disk_usage</key>
|
||||
<applyto>/apps/virt-manager/vmlist-fields/disk_usage</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>bool</type>
|
||||
<default>0</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Show disk I/O in summary</short>
|
||||
<long>Show the disk I/O field in the domain list summary view</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/vmlist-fields/network_traffic</key>
|
||||
<applyto>/apps/virt-manager/vmlist-fields/network_traffic</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>bool</type>
|
||||
<default>0</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Show network I/O in summary</short>
|
||||
<long>Show the network I/O field in the domain list summary view</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/vmlist-fields/cpu_usage</key>
|
||||
<applyto>/apps/virt-manager/vmlist-fields/cpu_usage</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>bool</type>
|
||||
<default>1</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Show guest cpu usage in summary</short>
|
||||
<long>Show the guest cpu usage field in the domain list summary view</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/vmlist-fields/host_cpu_usage</key>
|
||||
<applyto>/apps/virt-manager/vmlist-fields/host_cpu_usage</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>bool</type>
|
||||
<default>0</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Show host cpu usage in summary</short>
|
||||
<long>Show the host cpu usage field in the domain list summary view</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/stats/update-interval</key>
|
||||
<applyto>/apps/virt-manager/stats/update-interval</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>int</type>
|
||||
<default>1</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>The statistics update interval</short>
|
||||
<long>The statistics update interval in seconds</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/stats/history-length</key>
|
||||
<applyto>/apps/virt-manager/stats/history-length</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>int</type>
|
||||
<default>120</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>The statistics history length</short>
|
||||
<long>The number of samples to keep in the statistics history</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/stats/enable-disk-poll</key>
|
||||
<applyto>/apps/virt-manager/stats/enable-disk-poll</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>bool</type>
|
||||
<default>0</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Poll disk i/o stats</short>
|
||||
<long>Whether or not the app will poll VM disk i/o statistics</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/stats/enable-net-poll</key>
|
||||
<applyto>/apps/virt-manager/stats/enable-net-poll</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>bool</type>
|
||||
<default>0</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Poll net i/o stats</short>
|
||||
<long>Whether or not the app will poll VM network i/o statistics</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/urls/url-list-length</key>
|
||||
<applyto>/apps/virt-manager/urls/url-list-length</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>int</type>
|
||||
<default>10</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>The length of the list of URLs</short>
|
||||
<long>The number of urls to keep in the history for the install media address page.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/console/enable-accels</key>
|
||||
<applyto>/apps/virt-manager/console/enable-accels</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>bool</type>
|
||||
<default>false</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Enable menu accelerators in console window</short>
|
||||
<long>Whether to enable menu accelerators while connected to the guest graphical console.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/console/scaling</key>
|
||||
<applyto>/apps/virt-manager/console/scaling</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>int</type>
|
||||
<default>1</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>When to scale the VM graphical console</short>
|
||||
<long>When to scale the VM graphical console. 0 = never, 1 = only when in full screen mode, 2 = Always</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/details/show-toolbar</key>
|
||||
<applyto>/apps/virt-manager/details/show-toolbar</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>bool</type>
|
||||
<default>1</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Whether to show VM button toolbar in Details display</short>
|
||||
<long>Whether to show toolbar containing Virtual Machine action buttons (such as Run, Pause, Shutdown) in the details display</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/new-vm/local-sound</key>
|
||||
<applyto>/apps/virt-manager/new-vm/local-sound</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>bool</type>
|
||||
<default>1</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Install sound device for local VM</short>
|
||||
<long>Whether to install a sound device for local VMs or not</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/new-vm/remote-sound</key>
|
||||
<applyto>/apps/virt-manager/new-vm/remote-sound</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>bool</type>
|
||||
<default>0</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Install sound device for remote VM</short>
|
||||
<long>Whether to install a sound device for remote VMs or not</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/new-vm/graphics_type</key>
|
||||
<applyto>/apps/virt-manager/new-vm/graphics_type</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>string</type>
|
||||
<default>system</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Install selected graphics type for new VM</short>
|
||||
<long>Install selected graphics type for new VM. vnc or spice, system for software configured default</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/new-vm/storage-format</key>
|
||||
<applyto>/apps/virt-manager/new-vm/storage-format</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>string</type>
|
||||
<default>default</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Use selected format for new VM storage</short>
|
||||
<long>Use selected format when creating new disk images in new VM wizard</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/system-tray</key>
|
||||
<applyto>/apps/virt-manager/system-tray</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>bool</type>
|
||||
<default>0</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Show system tray icon</short>
|
||||
<long>Show system tray icon while app is running</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/paths/default-image-path</key>
|
||||
<applyto>/apps/virt-manager/paths/default-image-path</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>string</type>
|
||||
<default></default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Default image path</short>
|
||||
<long>Default path for choosing VM images</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/paths/default-media-path</key>
|
||||
<applyto>/apps/virt-manager/paths/default-media-path</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>string</type>
|
||||
<default></default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Default media path</short>
|
||||
<long>Default path for choosing media</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/paths/default-save-path</key>
|
||||
<applyto>/apps/virt-manager/paths/default-save-path</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>string</type>
|
||||
<default></default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Default save domain path</short>
|
||||
<long>Default path for saving VM snapshots</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/paths/default-restore-path</key>
|
||||
<applyto>/apps/virt-manager/paths/default-restore-path</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>string</type>
|
||||
<default></default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Default restore path</short>
|
||||
<long>Default path for stored VM snapshots</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/paths/default-screenshot-path</key>
|
||||
<applyto>/apps/virt-manager/paths/default-screenshot-path</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>string</type>
|
||||
<default></default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Default screenshot path</short>
|
||||
<long>Default path for saving screenshots from VMs</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/confirm/forcepoweroff</key>
|
||||
<applyto>/apps/virt-manager/confirm/forcepoweroff</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>bool</type>
|
||||
<default>1</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Confirm force poweroff request</short>
|
||||
<long>Whether we require confirmation to forcepoweroff a VM</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/confirm/poweroff</key>
|
||||
<applyto>/apps/virt-manager/confirm/poweroff</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>bool</type>
|
||||
<default>0</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Confirm poweroff request</short>
|
||||
<long>Whether we require confirmation to poweroff/reboot a VM</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/confirm/pause</key>
|
||||
<applyto>/apps/virt-manager/confirm/pause</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>bool</type>
|
||||
<default>0</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Confirm pause request</short>
|
||||
<long>Whether we require confirmation to pause a VM</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/confirm/removedev</key>
|
||||
<applyto>/apps/virt-manager/confirm/removedev</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>bool</type>
|
||||
<default>1</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Confirm device removal request</short>
|
||||
<long>Whether we require confirmation to remove a virtual device</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/confirm/interface_power</key>
|
||||
<applyto>/apps/virt-manager/confirm/interface_power</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>bool</type>
|
||||
<default>1</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Confirm device interface start and stop</short>
|
||||
<long>Whether we require confirmation to start or stop a libvirt virtual interface</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/confirm/unapplied_dev</key>
|
||||
<applyto>/apps/virt-manager/confirm/unapplied_dev</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>bool</type>
|
||||
<default>1</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Confirm about unapplied device changes</short>
|
||||
<long>Whether we ask the user to apply or discard unapplied device changes</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/confirm/delete_storage</key>
|
||||
<applyto>/apps/virt-manager/confirm/delete_storage</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>bool</type>
|
||||
<default>1</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Confirm deleting storage</short>
|
||||
<long>Whether we require a confirmation on deleting storage</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/manager_window_height</key>
|
||||
<applyto>/apps/virt-manager/manager_window_height</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Default manager window height</short>
|
||||
<long>Default manager window height</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/virt-manager/manager_window_width</key>
|
||||
<applyto>/apps/virt-manager/manager_window_width</applyto>
|
||||
<owner>virt-manager</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
|
||||
<locale name="C">
|
||||
<short>Default manager window width</short>
|
||||
<long>Default manager window width</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
</schemalist>
|
||||
</gconfschemafile>
|
3
setup.py
3
setup.py
@ -489,7 +489,8 @@ setup(
|
||||
"virt-image",
|
||||
"virt-convert",
|
||||
]),
|
||||
("/etc/gconf/schemas", ["data/virt-manager.schemas"]),
|
||||
("share/glib-2.0/schemas",
|
||||
["data/org.virt-manager.virt-manager.gschema.xml"]),
|
||||
("share/virt-manager/ui", glob.glob("ui/*.ui")),
|
||||
|
||||
("share/man/man1", [
|
||||
|
@ -27,6 +27,7 @@ import signal
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
|
||||
# pylint: disable=E0611
|
||||
from gi.repository import GObject
|
||||
from gi.repository import LibvirtGLib
|
||||
|
@ -49,16 +49,11 @@ Requires: libvirt-glib >= 0.0.9
|
||||
Requires: gnome-python2-gconf
|
||||
Requires: libxml2-python
|
||||
Requires: vte
|
||||
Requires: python-ipaddr
|
||||
|
||||
# For console widget
|
||||
Requires: gtk-vnc2
|
||||
Requires: spice-gtk3
|
||||
|
||||
# This version not strictly required: virt-manager should work with older,
|
||||
# however varying amounts of functionality will not be enabled.
|
||||
Requires: libvirt-python >= 0.7.0
|
||||
|
||||
|
||||
%if %{with_guestfs}
|
||||
Requires: python-libguestfs
|
||||
@ -73,21 +68,11 @@ Requires: virt-manager-common = %{verrel}
|
||||
%endif
|
||||
|
||||
|
||||
BuildRequires: gettext
|
||||
BuildRequires: python
|
||||
BuildRequires: python-distutils-extra
|
||||
BuildRequires: intltool
|
||||
BuildRequires: GConf2
|
||||
BuildRequires: /usr/bin/pod2man
|
||||
|
||||
|
||||
Requires(pre): GConf2
|
||||
Requires(post): GConf2
|
||||
Requires(preun): GConf2
|
||||
Requires(post): desktop-file-utils
|
||||
Requires(postun): desktop-file-utils
|
||||
|
||||
|
||||
%description
|
||||
Virtual Machine Manager provides a graphical tool for administering virtual
|
||||
machines for KVM, Xen, and QEmu. Start, stop, add or remove virtual devices,
|
||||
@ -105,6 +90,7 @@ Group: Applications/Emulators
|
||||
Requires: libvirt-python >= 0.7.0
|
||||
Requires: libxml2-python
|
||||
Requires: python-urlgrabber
|
||||
Requires: python-ipaddr
|
||||
|
||||
%description common
|
||||
Common files used by the different virt-manager interfaces, as well as
|
||||
@ -136,7 +122,6 @@ Group: Applications/Emulators
|
||||
Requires: virt-manager-common = %{verrel}
|
||||
Requires: python-newt_syrup >= 0.1.2
|
||||
Requires: libuser-python
|
||||
Requires: python-ipaddr
|
||||
|
||||
%description tui
|
||||
An interactive text user interface for Virtual Machine Manager.
|
||||
@ -199,35 +184,27 @@ python setup.py install -O1 --root=$RPM_BUILD_ROOT
|
||||
%find_lang %{name}
|
||||
|
||||
|
||||
%pre
|
||||
%gconf_schema_prepare %{name}
|
||||
|
||||
|
||||
%post
|
||||
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
|
||||
update-desktop-database -q %{_datadir}/applications
|
||||
%gconf_schema_upgrade %{name}
|
||||
/usr/bin/update-desktop-database &> /dev/null || :
|
||||
|
||||
|
||||
%postun
|
||||
if [ $1 -eq 0 ] ; then
|
||||
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
|
||||
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
|
||||
/usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
|
||||
fi
|
||||
update-desktop-database -q %{_datadir}/applications
|
||||
|
||||
|
||||
%preun
|
||||
%gconf_schema_remove %{name}
|
||||
/usr/bin/update-desktop-database &> /dev/null || :
|
||||
|
||||
|
||||
%posttrans
|
||||
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
|
||||
/usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
|
||||
|
||||
|
||||
%files
|
||||
%doc README COPYING AUTHORS NEWS
|
||||
%{_sysconfdir}/gconf/schemas/%{name}.schemas
|
||||
%{_bindir}/%{name}
|
||||
|
||||
%{_mandir}/man1/%{name}.1*
|
||||
@ -239,6 +216,7 @@ update-desktop-database -q %{_datadir}/applications
|
||||
%{_datadir}/icons/hicolor/*/apps/*
|
||||
|
||||
%{_datadir}/applications/%{name}.desktop
|
||||
%{_datadir}/glib-2.0/schemas/org.virt-manager.virt-manager.gschema.xml
|
||||
|
||||
|
||||
%files common -f %{name}.lang
|
||||
|
@ -21,19 +21,77 @@ import os
|
||||
import logging
|
||||
|
||||
# pylint: disable=E0611
|
||||
from gi.repository import Gio
|
||||
from gi.repository import GLib
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import GConf
|
||||
# pylint: enable=E0611
|
||||
|
||||
import virtinst
|
||||
from virtinst import uriutil
|
||||
|
||||
from virtManager.keyring import vmmKeyring, vmmSecret
|
||||
|
||||
|
||||
class vmmConfig(object):
|
||||
class SettingsWrapper(object):
|
||||
def __init__(self, settings_id):
|
||||
self._root = settings_id
|
||||
self._settings = Gio.Settings.new(self._root)
|
||||
|
||||
# GConf directory names for saving last used paths
|
||||
self._settingsmap = {"": self._settings}
|
||||
self._handler_map = {}
|
||||
for child in self._settings.list_children():
|
||||
childschema = self._root + "." + child
|
||||
self._settingsmap[child] = Gio.Settings.new(childschema)
|
||||
|
||||
|
||||
def _parse_key(self, key):
|
||||
value = key.strip("/")
|
||||
settingskey = ""
|
||||
if "/" in value:
|
||||
settingskey, value = value.rsplit("/", 1)
|
||||
return settingskey, value
|
||||
|
||||
def make_vm_settings(self, key):
|
||||
settingskey = self._parse_key(key)[0]
|
||||
|
||||
if settingskey in self._settingsmap:
|
||||
return True
|
||||
|
||||
schema = self._root + ".vm"
|
||||
path = "/" + self._root.replace(".", "/") + key.rsplit("/", 1)[0] + "/"
|
||||
self._settingsmap[settingskey] = Gio.Settings.new_with_path(schema,
|
||||
path)
|
||||
return True
|
||||
|
||||
def _find_settings(self, key):
|
||||
settingskey, value = self._parse_key(key)
|
||||
return self._settingsmap[settingskey], value
|
||||
|
||||
def _cmd_helper(self, cmd, key, *args, **kwargs):
|
||||
settings, key = self._find_settings(key)
|
||||
return getattr(settings, cmd)(key, *args, **kwargs)
|
||||
|
||||
def notify_add(self, key, cb, *args, **kwargs):
|
||||
settings, key = self._find_settings(key)
|
||||
def wrapcb(*ignore):
|
||||
return cb(*args, **kwargs)
|
||||
ret = settings.connect("changed::%s" % key, wrapcb, *args, **kwargs)
|
||||
self._handler_map[ret] = settings
|
||||
return ret
|
||||
def notify_remove(self, h):
|
||||
settings = self._handler_map.pop(h)
|
||||
return settings.disconnect(h)
|
||||
|
||||
def get(self, key):
|
||||
return self._cmd_helper("get_value", key).unpack()
|
||||
def set(self, key, value, *args, **kwargs):
|
||||
fmt = self._cmd_helper("get_value", key).get_type_string()
|
||||
return self._cmd_helper("set_value", key,
|
||||
GLib.Variant(fmt, value),
|
||||
*args, **kwargs)
|
||||
|
||||
|
||||
class vmmConfig(object):
|
||||
# key names for saving last used paths
|
||||
CONFIG_DIR_IMAGE = "image"
|
||||
CONFIG_DIR_ISO_MEDIA = "isomedia"
|
||||
CONFIG_DIR_FLOPPY_MEDIA = "floppymedia"
|
||||
@ -77,10 +135,6 @@ class vmmConfig(object):
|
||||
CONSOLE_SCALE_FULLSCREEN = 1
|
||||
CONSOLE_SCALE_ALWAYS = 2
|
||||
|
||||
CONSOLE_KEYGRAB_NEVER = 0
|
||||
CONSOLE_KEYGRAB_FULLSCREEN = 1
|
||||
CONSOLE_KEYGRAB_MOUSEOVER = 2
|
||||
|
||||
_PEROBJ_FUNC_SET = 0
|
||||
_PEROBJ_FUNC_GET = 1
|
||||
_PEROBJ_FUNC_LISTEN = 2
|
||||
@ -94,12 +148,11 @@ class vmmConfig(object):
|
||||
def __init__(self, appname, appversion, ui_dir, test_first_run=False):
|
||||
self.appname = appname
|
||||
self.appversion = appversion
|
||||
self.conf_dir = "/apps/" + appname
|
||||
self.conf_dir = "/org/virt-manager/%s/" % self.appname
|
||||
self.ui_dir = ui_dir
|
||||
self.test_first_run = bool(test_first_run)
|
||||
|
||||
self.conf = GConf.Client.get_default()
|
||||
self.conf.add_dir(self.conf_dir, GConf.ClientPreloadType.PRELOAD_NONE)
|
||||
self.conf = SettingsWrapper("org.virt-manager.virt-manager")
|
||||
|
||||
# We don't create it straight away, since we don't want
|
||||
# to block the app pending user authorizaation to access
|
||||
@ -124,26 +177,6 @@ class vmmConfig(object):
|
||||
|
||||
self._spice_error = None
|
||||
|
||||
def get_string_list(self, path):
|
||||
val = self.conf.get(path)
|
||||
if val is None:
|
||||
return None
|
||||
values = []
|
||||
for v in val.get_list():
|
||||
values.append(v.get_string())
|
||||
return values
|
||||
|
||||
def set_string_list(self, path, values):
|
||||
newValues = []
|
||||
for v in values:
|
||||
nv = GConf.Value.new(GConf.ValueType.STRING)
|
||||
nv.set_string(v)
|
||||
newValues.append(nv)
|
||||
ignore = path
|
||||
# XXX: set_list is not available with introspection
|
||||
# val = GConf.Value()
|
||||
# val.set_list(newValues)
|
||||
# self.conf.set(path, val)
|
||||
|
||||
def check_inspection(self, support_threading):
|
||||
if not support_threading:
|
||||
@ -199,162 +232,61 @@ class vmmConfig(object):
|
||||
def get_objects(self):
|
||||
return self._objects[:]
|
||||
|
||||
# Per-VM/Connection/Connection Host Option dealings
|
||||
def _perconn_helper(self, uri, pref_func, func_type, value=None):
|
||||
suffix = "connection_prefs/%s" % GConf.escape_key(uri, len(uri))
|
||||
return self._perobj_helper(suffix, pref_func, func_type, value)
|
||||
def _perhost_helper(self, uri, pref_func, func_type, value=None):
|
||||
host = uriutil.get_uri_hostname(uri)
|
||||
if not host:
|
||||
host = "localhost"
|
||||
suffix = "connection_prefs/hosts/%s" % host
|
||||
return self._perobj_helper(suffix, pref_func, func_type, value)
|
||||
def _pervm_helper(self, uri, uuid, pref_func, func_type, value=None):
|
||||
suffix = ("connection_prefs/%s/vms/%s" %
|
||||
(GConf.escape_key(uri, len(uri)), uuid))
|
||||
return self._perobj_helper(suffix, pref_func, func_type, value)
|
||||
def _make_pervm_key(self, uuid, key):
|
||||
return "/vms/%s%s" % (uuid.replace("-", ""), key)
|
||||
|
||||
def _perobj_helper(self, suffix, pref_func, func_type, value=None):
|
||||
# This function wraps the regular preference setting functions,
|
||||
# replacing conf_dir with a connection, host, or vm specific path. For
|
||||
# VMs, the path is:
|
||||
#
|
||||
# conf_dir/connection_prefs/{CONN_URI}/vms/{VM_UUID}
|
||||
#
|
||||
# So a per-VM pref will look like
|
||||
# .../connection_prefs/qemu:---system/vms/1234.../console/scaling
|
||||
#
|
||||
# Yeah this is evil but it's also nice and easy :)
|
||||
|
||||
oldconf = self.conf_dir
|
||||
newconf = oldconf
|
||||
|
||||
# Don't make a bogus gconf path if this is called nested.
|
||||
if not oldconf.count(suffix):
|
||||
newconf = "%s/%s" % (oldconf, suffix)
|
||||
|
||||
ret = None
|
||||
try:
|
||||
self.conf_dir = newconf
|
||||
if func_type == self._PEROBJ_FUNC_SET:
|
||||
if type(value) is not tuple:
|
||||
value = (value,)
|
||||
pref_func(*value)
|
||||
elif func_type == self._PEROBJ_FUNC_GET:
|
||||
ret = pref_func()
|
||||
elif func_type == self._PEROBJ_FUNC_LISTEN:
|
||||
ret = pref_func(value)
|
||||
finally:
|
||||
self.conf_dir = oldconf
|
||||
def listen_pervm(self, uuid, key, *args, **kwargs):
|
||||
key = self._make_pervm_key(uuid, key)
|
||||
self.conf.make_vm_settings(key)
|
||||
return self.conf.notify_add(key, *args, **kwargs)
|
||||
|
||||
def set_pervm(self, uuid, key, *args, **kwargs):
|
||||
key = self._make_pervm_key(uuid, key)
|
||||
self.conf.make_vm_settings(key)
|
||||
ret = self.conf.set(key, *args, **kwargs)
|
||||
return ret
|
||||
|
||||
def set_pervm(self, uri, uuid, pref_func, args):
|
||||
"""
|
||||
@param uri: VM connection URI
|
||||
@param uuid: VM UUID
|
||||
@param value: Set value or listener callback function
|
||||
@param pref_func: Global preference get/set/listen func that the
|
||||
pervm instance will overshadow
|
||||
"""
|
||||
self._pervm_helper(uri, uuid, pref_func, self._PEROBJ_FUNC_SET, args)
|
||||
def get_pervm(self, uri, uuid, pref_func):
|
||||
ret = self._pervm_helper(uri, uuid, pref_func, self._PEROBJ_FUNC_GET)
|
||||
if ret is None:
|
||||
# If the GConf value is unset, return the global default.
|
||||
ret = pref_func()
|
||||
return ret
|
||||
def listen_pervm(self, uri, uuid, pref_func, cb):
|
||||
return self._pervm_helper(uri, uuid, pref_func,
|
||||
self._PEROBJ_FUNC_LISTEN, cb)
|
||||
def get_pervm(self, uuid, key):
|
||||
key = self._make_pervm_key(uuid, key)
|
||||
self.conf.make_vm_settings(key)
|
||||
return self.conf.get(key)
|
||||
|
||||
def set_perconn(self, uri, pref_func, value):
|
||||
self._perconn_helper(uri, pref_func, self._PEROBJ_FUNC_SET, value)
|
||||
def get_perconn(self, uri, pref_func):
|
||||
ret = self._perconn_helper(uri, pref_func, self._PEROBJ_FUNC_GET)
|
||||
if ret is None:
|
||||
# If the GConf value is unset, return the global default.
|
||||
ret = pref_func()
|
||||
return ret
|
||||
def listen_perconn(self, uri, pref_func, cb):
|
||||
return self._perconn_helper(uri, pref_func,
|
||||
self._PEROBJ_FUNC_LISTEN, cb)
|
||||
|
||||
def set_perhost(self, uri, pref_func, value):
|
||||
self._perhost_helper(uri, pref_func, self._PEROBJ_FUNC_SET, value)
|
||||
def get_perhost(self, uri, pref_func):
|
||||
ret = self._perhost_helper(uri, pref_func, self._PEROBJ_FUNC_GET)
|
||||
if ret is None:
|
||||
# If the GConf value is unset, return the global default.
|
||||
ret = pref_func()
|
||||
return ret
|
||||
def listen_perhost(self, uri, pref_func, cb):
|
||||
return self._perhost_helper(uri, pref_func,
|
||||
self._PEROBJ_FUNC_LISTEN, cb)
|
||||
|
||||
def reconcile_vm_entries(self, uri, current_vms):
|
||||
"""
|
||||
Remove any old VM preference entries for the passed URI
|
||||
"""
|
||||
uri = GConf.escape_key(uri, len(uri))
|
||||
key = self.conf_dir + "/connection_prefs/%s/vms" % uri
|
||||
kill_vms = []
|
||||
gconf_vms = [inp.split("/")[-1] for inp in self.conf.all_dirs(key)]
|
||||
|
||||
for uuid in gconf_vms:
|
||||
if len(uuid) == 36 and not uuid in current_vms:
|
||||
kill_vms.append(uuid)
|
||||
|
||||
for uuid in kill_vms:
|
||||
self.conf.recursive_unset(key + "/%s" % uuid, 0)
|
||||
|
||||
if kill_vms:
|
||||
# Suggest gconf syncs, so that the unset dirs are fully removed
|
||||
self.conf.suggest_sync()
|
||||
|
||||
#########################
|
||||
# General GConf helpers #
|
||||
#########################
|
||||
###################
|
||||
# General helpers #
|
||||
###################
|
||||
|
||||
# Manager stats view preferences
|
||||
def is_vmlist_guest_cpu_usage_visible(self):
|
||||
return self.conf.get_bool(self.conf_dir + "/vmlist-fields/cpu_usage")
|
||||
return self.conf.get("/vmlist-fields/cpu-usage")
|
||||
def is_vmlist_host_cpu_usage_visible(self):
|
||||
return self.conf.get_bool(self.conf_dir +
|
||||
"/vmlist-fields/host_cpu_usage")
|
||||
return self.conf.get("/vmlist-fields/host-cpu-usage")
|
||||
def is_vmlist_disk_io_visible(self):
|
||||
return self.conf.get_bool(self.conf_dir + "/vmlist-fields/disk_usage")
|
||||
return self.conf.get("/vmlist-fields/disk-usage")
|
||||
def is_vmlist_network_traffic_visible(self):
|
||||
return self.conf.get_bool(self.conf_dir +
|
||||
"/vmlist-fields/network_traffic")
|
||||
return self.conf.get("/vmlist-fields/network-traffic")
|
||||
|
||||
def set_vmlist_guest_cpu_usage_visible(self, state):
|
||||
self.conf.set_bool(self.conf_dir + "/vmlist-fields/cpu_usage", state)
|
||||
self.conf.set("/vmlist-fields/cpu-usage", state)
|
||||
def set_vmlist_host_cpu_usage_visible(self, state):
|
||||
self.conf.set_bool(self.conf_dir + "/vmlist-fields/host_cpu_usage",
|
||||
state)
|
||||
self.conf.set("/vmlist-fields/host-cpu-usage", state)
|
||||
def set_vmlist_disk_io_visible(self, state):
|
||||
self.conf.set_bool(self.conf_dir + "/vmlist-fields/disk_usage", state)
|
||||
self.conf.set("/vmlist-fields/disk-usage", state)
|
||||
def set_vmlist_network_traffic_visible(self, state):
|
||||
self.conf.set_bool(self.conf_dir + "/vmlist-fields/network_traffic",
|
||||
state)
|
||||
self.conf.set("/vmlist-fields/network-traffic", state)
|
||||
|
||||
def on_vmlist_guest_cpu_usage_visible_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/vmlist-fields/cpu_usage",
|
||||
cb, userdata)
|
||||
def on_vmlist_host_cpu_usage_visible_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(self.conf_dir +
|
||||
"/vmlist-fields/host_cpu_usage", cb, userdata)
|
||||
def on_vmlist_disk_io_visible_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/vmlist-fields/disk_usage",
|
||||
cb, userdata)
|
||||
def on_vmlist_network_traffic_visible_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(
|
||||
self.conf_dir + "/vmlist-fields/network_traffic", cb, userdata)
|
||||
def on_vmlist_guest_cpu_usage_visible_changed(self, cb):
|
||||
return self.conf.notify_add("/vmlist-fields/cpu-usage", cb)
|
||||
def on_vmlist_host_cpu_usage_visible_changed(self, cb):
|
||||
return self.conf.notify_add("/vmlist-fields/host-cpu-usage", cb)
|
||||
def on_vmlist_disk_io_visible_changed(self, cb):
|
||||
return self.conf.notify_add("/vmlist-fields/disk-usage", cb)
|
||||
def on_vmlist_network_traffic_visible_changed(self, cb):
|
||||
return self.conf.notify_add("/vmlist-fields/network-traffic", cb)
|
||||
|
||||
# Keys preferences
|
||||
def get_keys_combination(self):
|
||||
ret = self.conf.get_string(self.conf_dir + "/keys/grab-keys")
|
||||
ret = self.conf.get("/console/grab-keys")
|
||||
if not ret:
|
||||
# Left Control + Left Alt
|
||||
return "65507,65513"
|
||||
@ -362,199 +294,160 @@ class vmmConfig(object):
|
||||
def set_keys_combination(self, val):
|
||||
# Val have to be a list of integers
|
||||
val = ','.join([str(v) for v in val])
|
||||
self.conf.set_string(self.conf_dir + "/keys/grab-keys", val)
|
||||
def on_keys_combination_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/keys/grab-keys", cb, userdata)
|
||||
self.conf.set("/console/grab-keys", val)
|
||||
def on_keys_combination_changed(self, cb):
|
||||
return self.conf.notify_add("/console/grab-keys", cb)
|
||||
|
||||
# Confirmation preferences
|
||||
def get_confirm_forcepoweroff(self):
|
||||
return self.conf.get_bool(self.conf_dir + "/confirm/forcepoweroff")
|
||||
return self.conf.get("/confirm/forcepoweroff")
|
||||
def get_confirm_poweroff(self):
|
||||
return self.conf.get_bool(self.conf_dir + "/confirm/poweroff")
|
||||
return self.conf.get("/confirm/poweroff")
|
||||
def get_confirm_pause(self):
|
||||
return self.conf.get_bool(self.conf_dir + "/confirm/pause")
|
||||
return self.conf.get("/confirm/pause")
|
||||
def get_confirm_removedev(self):
|
||||
return self.conf.get_bool(self.conf_dir + "/confirm/removedev")
|
||||
return self.conf.get("/confirm/removedev")
|
||||
def get_confirm_interface(self):
|
||||
return self.conf.get_bool(self.conf_dir + "/confirm/interface_power")
|
||||
return self.conf.get("/confirm/interface-power")
|
||||
def get_confirm_unapplied(self):
|
||||
return self.conf.get_bool(self.conf_dir + "/confirm/unapplied_dev")
|
||||
return self.conf.get("/confirm/unapplied-dev")
|
||||
def get_confirm_delstorage(self):
|
||||
# If no schema is installed, we _really_ want this to default to True
|
||||
path = self.conf_dir + "/confirm/delete_storage"
|
||||
ret = self.conf.get(path)
|
||||
if ret is None:
|
||||
return True
|
||||
return self.conf.get_bool(path)
|
||||
return self.conf.get("/confirm/delete-storage")
|
||||
|
||||
|
||||
def set_confirm_forcepoweroff(self, val):
|
||||
self.conf.set_bool(self.conf_dir + "/confirm/forcepoweroff", val)
|
||||
self.conf.set("/confirm/forcepoweroff", val)
|
||||
def set_confirm_poweroff(self, val):
|
||||
self.conf.set_bool(self.conf_dir + "/confirm/poweroff", val)
|
||||
self.conf.set("/confirm/poweroff", val)
|
||||
def set_confirm_pause(self, val):
|
||||
self.conf.set_bool(self.conf_dir + "/confirm/pause", val)
|
||||
self.conf.set("/confirm/pause", val)
|
||||
def set_confirm_removedev(self, val):
|
||||
self.conf.set_bool(self.conf_dir + "/confirm/removedev", val)
|
||||
self.conf.set("/confirm/removedev", val)
|
||||
def set_confirm_interface(self, val):
|
||||
self.conf.set_bool(self.conf_dir + "/confirm/interface_power", val)
|
||||
self.conf.set("/confirm/interface-power", val)
|
||||
def set_confirm_unapplied(self, val):
|
||||
self.conf.set_bool(self.conf_dir + "/confirm/unapplied_dev", val)
|
||||
self.conf.set("/confirm/unapplied-dev", val)
|
||||
def set_confirm_delstorage(self, val):
|
||||
self.conf.set_bool(self.conf_dir + "/confirm/delete_storage", val)
|
||||
|
||||
def on_confirm_forcepoweroff_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/confirm/forcepoweroff", cb, userdata)
|
||||
def on_confirm_poweroff_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/confirm/poweroff", cb, userdata)
|
||||
def on_confirm_pause_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/confirm/pause", cb, userdata)
|
||||
def on_confirm_removedev_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/confirm/removedev", cb, userdata)
|
||||
def on_confirm_interface_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/confirm/interface_power", cb, userdata)
|
||||
def on_confirm_unapplied_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/confirm/unapplied_dev", cb, userdata)
|
||||
def on_confirm_delstorage_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/confirm/delete_storage", cb, userdata)
|
||||
self.conf.set("/confirm/delete-storage", val)
|
||||
|
||||
|
||||
# System tray visibility
|
||||
def on_view_system_tray_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/system-tray", cb, userdata)
|
||||
def on_view_system_tray_changed(self, cb):
|
||||
return self.conf.notify_add("/system-tray", cb)
|
||||
def get_view_system_tray(self):
|
||||
return self.conf.get_bool(self.conf_dir + "/system-tray")
|
||||
return self.conf.get("/system-tray")
|
||||
def set_view_system_tray(self, val):
|
||||
self.conf.set_bool(self.conf_dir + "/system-tray", val)
|
||||
self.conf.set("/system-tray", val)
|
||||
|
||||
|
||||
# Stats history and interval length
|
||||
def get_stats_update_interval(self):
|
||||
interval = self.conf.get_int(self.conf_dir + "/stats/update-interval")
|
||||
interval = self.conf.get("/stats/update-interval")
|
||||
if interval < 1:
|
||||
return 1
|
||||
return interval
|
||||
def get_stats_history_length(self):
|
||||
history = self.conf.get_int(self.conf_dir + "/stats/history-length")
|
||||
history = self.conf.get("/stats/history-length")
|
||||
if history < 10:
|
||||
return 10
|
||||
return history
|
||||
|
||||
def set_stats_update_interval(self, interval):
|
||||
self.conf.set_int(self.conf_dir + "/stats/update-interval", interval)
|
||||
self.conf.set("/stats/update-interval", interval)
|
||||
def set_stats_history_length(self, length):
|
||||
self.conf.set_int(self.conf_dir + "/stats/history-length", length)
|
||||
self.conf.set("/stats/history-length", length)
|
||||
|
||||
def on_stats_update_interval_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/stats/update-interval", cb, userdata)
|
||||
def on_stats_history_length_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/stats/history-length", cb, userdata)
|
||||
def on_stats_update_interval_changed(self, cb):
|
||||
return self.conf.notify_add("/stats/update-interval", cb)
|
||||
def on_stats_history_length_changed(self, cb):
|
||||
return self.conf.notify_add("/stats/history-length", cb)
|
||||
|
||||
|
||||
# Disable/Enable different stats polling
|
||||
def get_stats_enable_disk_poll(self):
|
||||
return self.conf.get_bool(self.conf_dir + "/stats/enable-disk-poll")
|
||||
return self.conf.get("/stats/enable-disk-poll")
|
||||
def get_stats_enable_net_poll(self):
|
||||
return self.conf.get_bool(self.conf_dir + "/stats/enable-net-poll")
|
||||
return self.conf.get("/stats/enable-net-poll")
|
||||
|
||||
def set_stats_enable_disk_poll(self, val):
|
||||
self.conf.set_bool(self.conf_dir + "/stats/enable-disk-poll", val)
|
||||
self.conf.set("/stats/enable-disk-poll", val)
|
||||
def set_stats_enable_net_poll(self, val):
|
||||
self.conf.set_bool(self.conf_dir + "/stats/enable-net-poll", val)
|
||||
self.conf.set("/stats/enable-net-poll", val)
|
||||
|
||||
def on_stats_enable_disk_poll_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/stats/enable-disk-poll",
|
||||
cb, userdata)
|
||||
def on_stats_enable_net_poll_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/stats/enable-net-poll",
|
||||
cb, userdata)
|
||||
def on_stats_enable_disk_poll_changed(self, cb, row=None):
|
||||
return self.conf.notify_add("/stats/enable-disk-poll", cb, row)
|
||||
def on_stats_enable_net_poll_changed(self, cb, row=None):
|
||||
return self.conf.notify_add("/stats/enable-net-poll", cb, row)
|
||||
|
||||
# VM Console preferences
|
||||
def on_console_accels_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/console/enable-accels", cb, userdata)
|
||||
def on_console_accels_changed(self, cb):
|
||||
return self.conf.notify_add("/console/enable-accels", cb)
|
||||
def get_console_accels(self):
|
||||
console_pref = self.conf.get_bool(self.conf_dir +
|
||||
"/console/enable-accels")
|
||||
console_pref = self.conf.get("/console/enable-accels")
|
||||
if console_pref is None:
|
||||
console_pref = False
|
||||
return console_pref
|
||||
def set_console_accels(self, pref):
|
||||
self.conf.set_bool(self.conf_dir + "/console/enable-accels", pref)
|
||||
self.conf.set("/console/enable-accels", pref)
|
||||
|
||||
def on_console_scaling_changed(self, cb, userdata=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/console/scaling", cb, userdata)
|
||||
def on_console_scaling_changed(self, cb):
|
||||
return self.conf.notify_add("/console/scaling", cb)
|
||||
def get_console_scaling(self):
|
||||
ret = self.conf.get(self.conf_dir + "/console/scaling")
|
||||
if ret is not None:
|
||||
ret = ret.get_int()
|
||||
return ret
|
||||
return self.conf.get("/console/scaling")
|
||||
def set_console_scaling(self, pref):
|
||||
self.conf.set_int(self.conf_dir + "/console/scaling", pref)
|
||||
self.conf.set("/console/scaling", pref)
|
||||
|
||||
# Show VM details toolbar
|
||||
def get_details_show_toolbar(self):
|
||||
res = self.conf.get_bool(self.conf_dir + "/details/show-toolbar")
|
||||
res = self.conf.get("/details/show-toolbar")
|
||||
if res is None:
|
||||
res = True
|
||||
return res
|
||||
def set_details_show_toolbar(self, state):
|
||||
self.conf.set_bool(self.conf_dir + "/details/show-toolbar", state)
|
||||
self.conf.set("/details/show-toolbar", state)
|
||||
|
||||
# VM details default size
|
||||
def get_details_window_size(self):
|
||||
w = self.conf.get_int(self.conf_dir + "/details/window_width")
|
||||
h = self.conf.get_int(self.conf_dir + "/details/window_height")
|
||||
w = self.conf.get("/details/window_width")
|
||||
h = self.conf.get("/details/window_height")
|
||||
return (w, h)
|
||||
def set_details_window_size(self, w, h):
|
||||
self.conf.set_int(self.conf_dir + "/details/window_width", w)
|
||||
self.conf.set_int(self.conf_dir + "/details/window_height", h)
|
||||
self.conf.set("/details/window_width", w)
|
||||
self.conf.set("/details/window_height", h)
|
||||
|
||||
# Create sound device for default guest
|
||||
def get_local_sound(self):
|
||||
return self.conf.get_bool(self.conf_dir + "/new-vm/local-sound")
|
||||
return self.conf.get("/new-vm/local-sound")
|
||||
def get_remote_sound(self):
|
||||
return self.conf.get_bool(self.conf_dir + "/new-vm/remote-sound")
|
||||
return self.conf.get("/new-vm/remote-sound")
|
||||
|
||||
def set_local_sound(self, state):
|
||||
self.conf.set_bool(self.conf_dir + "/new-vm/local-sound", state)
|
||||
self.conf.set("/new-vm/local-sound", state)
|
||||
def set_remote_sound(self, state):
|
||||
self.conf.set_bool(self.conf_dir + "/new-vm/remote-sound", state)
|
||||
|
||||
def on_sound_local_changed(self, cb, data=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/new-vm/local-sound", cb, data)
|
||||
def on_sound_remote_changed(self, cb, data=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/new-vm/remote-sound", cb, data)
|
||||
self.conf.set("/new-vm/remote-sound", state)
|
||||
|
||||
def get_graphics_type(self):
|
||||
ret = self.conf.get_string(self.conf_dir + "/new-vm/graphics_type")
|
||||
ret = self.conf.get("/new-vm/graphics-type")
|
||||
if ret == "system":
|
||||
return self.default_graphics_from_config
|
||||
if ret not in ["vnc", "spice"]:
|
||||
return "vnc"
|
||||
return ret
|
||||
def set_graphics_type(self, gtype):
|
||||
self.conf.set_string(self.conf_dir + "/new-vm/graphics_type",
|
||||
gtype.lower())
|
||||
def on_graphics_type_changed(self, cb, data=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/new-vm/graphics_type",
|
||||
cb, data)
|
||||
self.conf.set("/new-vm/graphics-type", gtype.lower())
|
||||
|
||||
def get_storage_format(self):
|
||||
ret = self.conf.get_string(self.conf_dir + "/new-vm/storage-format")
|
||||
ret = self.conf.get("/new-vm/storage-format")
|
||||
if ret not in ["default", "raw", "qcow2"]:
|
||||
return "default"
|
||||
return ret
|
||||
def set_storage_format(self, typ):
|
||||
self.conf.set_string(self.conf_dir + "/new-vm/storage-format",
|
||||
typ.lower())
|
||||
def on_storage_format_changed(self, cb, data=None):
|
||||
return self.conf.notify_add(self.conf_dir + "/new-vm/storage-format",
|
||||
cb, data)
|
||||
self.conf.set("/new-vm/storage-format", typ.lower())
|
||||
|
||||
|
||||
# URL/Media path history
|
||||
def _url_add_helper(self, gconf_path, url):
|
||||
urls = self.get_string_list(gconf_path)
|
||||
urls = self.conf.get(gconf_path)
|
||||
if urls is None:
|
||||
urls = []
|
||||
|
||||
@ -564,31 +457,29 @@ class vmmConfig(object):
|
||||
length = self.get_url_list_length()
|
||||
if len(urls) > length:
|
||||
del urls[len(urls) - 1]
|
||||
self.set_string_list(gconf_path, urls)
|
||||
self.conf.set(gconf_path, urls)
|
||||
|
||||
def add_media_url(self, url):
|
||||
self._url_add_helper(self.conf_dir + "/urls/media", url)
|
||||
self._url_add_helper("/urls/media", url)
|
||||
def add_kickstart_url(self, url):
|
||||
self._url_add_helper(self.conf_dir + "/urls/kickstart", url)
|
||||
self._url_add_helper("/urls/kickstart", url)
|
||||
def add_iso_path(self, path):
|
||||
self._url_add_helper(self.conf_dir + "/urls/local_media", path)
|
||||
self._url_add_helper("/urls/isos", path)
|
||||
|
||||
def get_media_urls(self):
|
||||
return self.get_string_list(self.conf_dir + "/urls/media")
|
||||
|
||||
return self.conf.get("/urls/media")
|
||||
def get_kickstart_urls(self):
|
||||
return self.get_string_list(self.conf_dir + "/urls/kickstart")
|
||||
|
||||
return self.conf.get("/urls/kickstart")
|
||||
def get_iso_paths(self):
|
||||
return self.get_string_list(self.conf_dir + "/urls/local_media")
|
||||
return self.conf.get("/urls/isos")
|
||||
|
||||
def get_url_list_length(self):
|
||||
length = self.conf.get_int(self.conf_dir + "/urls/url-list-length")
|
||||
length = self.conf.get("/urls/url-list-length")
|
||||
if length < 5:
|
||||
return 5
|
||||
return length
|
||||
def set_url_list_length(self, length):
|
||||
self.conf.set_int(self.conf_dir + "/urls/url-list-length", length)
|
||||
self.conf.set("/urls/url-list-length", length)
|
||||
|
||||
# Whether to ask about fixing path permissions
|
||||
def add_perms_fix_ignore(self, pathlist):
|
||||
@ -597,10 +488,9 @@ class vmmConfig(object):
|
||||
if path in current_list:
|
||||
continue
|
||||
current_list.append(path)
|
||||
self.set_string_list(self.conf_dir + "/paths/perms_fix_ignore",
|
||||
current_list)
|
||||
self.conf.set("/paths/perms_fix_ignore", current_list)
|
||||
def get_perms_fix_ignore(self):
|
||||
return self.get_string_list(self.conf_dir + "/paths/perms_fix_ignore")
|
||||
return self.conf.get("/paths/perms_fix_ignore")
|
||||
|
||||
|
||||
# Manager view connection list
|
||||
@ -608,54 +498,52 @@ class vmmConfig(object):
|
||||
if self.test_first_run:
|
||||
return
|
||||
|
||||
uris = self.get_string_list(self.conf_dir + "/connections/uris")
|
||||
uris = self.conf.get("/connections/uris")
|
||||
if uris is None:
|
||||
uris = []
|
||||
|
||||
if uris.count(uri) == 0:
|
||||
uris.insert(len(uris) - 1, uri)
|
||||
self.set_string_list(self.conf_dir + "/connections/uris", uris)
|
||||
self.conf.set("/connections/uris", uris)
|
||||
def remove_conn(self, uri):
|
||||
uris = self.get_string_list(self.conf_dir + "/connections/uris")
|
||||
uris = self.conf.get("/connections/uris")
|
||||
|
||||
if uris is None:
|
||||
return
|
||||
|
||||
if uris.count(uri) != 0:
|
||||
uris.remove(uri)
|
||||
self.set_string_list(self.conf_dir + "/connections/uris", uris)
|
||||
self.conf.set("/connections/uris", uris)
|
||||
|
||||
if self.get_conn_autoconnect(uri):
|
||||
uris = self.get_string_list(self.conf_dir +
|
||||
"/connections/autoconnect")
|
||||
uris = self.conf.get("/connections/autoconnect")
|
||||
uris.remove(uri)
|
||||
self.set_string_list(self.conf_dir + "/connections/autoconnect",
|
||||
uris)
|
||||
self.conf.set("/connections/autoconnect", uris)
|
||||
|
||||
def get_conn_uris(self):
|
||||
if self.test_first_run:
|
||||
return []
|
||||
return self.get_string_list(self.conf_dir + "/connections/uris")
|
||||
return self.conf.get("/connections/uris")
|
||||
|
||||
# Manager default window size
|
||||
def get_manager_window_size(self):
|
||||
w = self.conf.get_int(self.conf_dir + "/manager_window_width")
|
||||
h = self.conf.get_int(self.conf_dir + "/manager_window_height")
|
||||
w = self.conf.get("/manager-window-width")
|
||||
h = self.conf.get("/manager-window-height")
|
||||
return (w, h)
|
||||
def set_manager_window_size(self, w, h):
|
||||
self.conf.set_int(self.conf_dir + "/manager_window_width", w)
|
||||
self.conf.set_int(self.conf_dir + "/manager_window_height", h)
|
||||
self.conf.set("/manager-window-width", w)
|
||||
self.conf.set("/manager-window-height", h)
|
||||
|
||||
# URI autoconnect
|
||||
def get_conn_autoconnect(self, uri):
|
||||
uris = self.get_string_list(self.conf_dir + "/connections/autoconnect")
|
||||
uris = self.conf.get("/connections/autoconnect")
|
||||
return ((uris is not None) and (uri in uris))
|
||||
|
||||
def set_conn_autoconnect(self, uri, val):
|
||||
if self.test_first_run:
|
||||
return
|
||||
|
||||
uris = self.get_string_list(self.conf_dir + "/connections/autoconnect")
|
||||
uris = self.conf.get("/connections/autoconnect")
|
||||
if uris is None:
|
||||
uris = []
|
||||
if not val and uri in uris:
|
||||
@ -663,8 +551,7 @@ class vmmConfig(object):
|
||||
elif val and uri not in uris:
|
||||
uris.append(uri)
|
||||
|
||||
self.set_string_list(self.conf_dir + "/connections/autoconnect",
|
||||
uris)
|
||||
self.conf.set("/connections/autoconnect", uris)
|
||||
|
||||
|
||||
# Default directory location dealings
|
||||
@ -681,8 +568,7 @@ class vmmConfig(object):
|
||||
|
||||
key = self._get_default_dir_key(_type)
|
||||
try:
|
||||
path = self.conf.get_value(self.conf_dir +
|
||||
"/paths/default-%s-path" % key)
|
||||
path = self.conf.get("/paths/default-%s-path" % key)
|
||||
except:
|
||||
path = None
|
||||
|
||||
@ -704,8 +590,7 @@ class vmmConfig(object):
|
||||
return
|
||||
|
||||
logging.debug("set_default_directory(%s): saving %s", _type, folder)
|
||||
self.conf.set_string(self.conf_dir + "/paths/default-%s-path" % _type,
|
||||
folder)
|
||||
self.conf.set("/paths/default-%s-path" % _type, folder)
|
||||
|
||||
def get_default_image_dir(self, conn):
|
||||
if conn.is_xen():
|
||||
@ -737,14 +622,13 @@ class vmmConfig(object):
|
||||
self.keyring = vmmKeyring()
|
||||
return self.keyring.is_available()
|
||||
|
||||
|
||||
def get_console_password(self, vm):
|
||||
keyid = self.conf.get_int(self.conf_dir +
|
||||
"/console/passwords/" + vm.get_uuid())
|
||||
username = self.conf.get_string(self.conf_dir +
|
||||
"/console/usernames/" + vm.get_uuid())
|
||||
if not self.has_keyring():
|
||||
return ("", "")
|
||||
|
||||
if keyid is None or not self.has_keyring():
|
||||
username, keyid = vm.get_console_password()
|
||||
|
||||
if keyid == -1:
|
||||
return ("", "")
|
||||
|
||||
secret = self.keyring.get_secret(keyid)
|
||||
@ -761,11 +645,6 @@ class vmmConfig(object):
|
||||
if not self.has_keyring():
|
||||
return
|
||||
|
||||
# Nb, we don't bother to check if there is an existing
|
||||
# secret, because gnome-keyring auto-replaces an existing
|
||||
# one if the attributes match - which they will since UUID
|
||||
# is our unique key
|
||||
|
||||
secret = vmmSecret(self.get_secret_name(vm), password,
|
||||
{"uuid" : vm.get_uuid(),
|
||||
"hvuri": vm.conn.get_uri()})
|
||||
@ -773,7 +652,4 @@ class vmmConfig(object):
|
||||
if keyid is None:
|
||||
return
|
||||
|
||||
self.conf.set_int(self.conf_dir +
|
||||
"/console/passwords/" + vm.get_uuid(), keyid)
|
||||
self.conf.set_string(self.conf_dir +
|
||||
"/console/usernames/" + vm.get_uuid(), username)
|
||||
vm.set_console_password(username, keyid)
|
||||
|
@ -1035,11 +1035,6 @@ class vmmConnection(vmmGObject):
|
||||
self.get_uri(), caps)
|
||||
|
||||
self.tick()
|
||||
# If VMs disappeared since the last time we connected to
|
||||
# this uri, remove their gconf entries so we don't pollute
|
||||
# the database
|
||||
self.config.reconcile_vm_entries(self.get_uri(),
|
||||
self.vms.keys())
|
||||
|
||||
if self.state == self.STATE_DISCONNECTED:
|
||||
if self.connectError:
|
||||
@ -1518,14 +1513,3 @@ class vmmConnection(vmmGObject):
|
||||
return self.disk_read_rate() + self.disk_write_rate()
|
||||
def disk_io_max_rate(self):
|
||||
return self._get_record_helper("diskMaxRate")
|
||||
|
||||
|
||||
####################################
|
||||
# Per-Connection gconf preferences #
|
||||
####################################
|
||||
|
||||
def config_add_iso_path(self, path):
|
||||
self.config.set_perhost(self.get_uri(), self.config.add_iso_path, path)
|
||||
def config_get_iso_paths(self):
|
||||
return self.config.get_perhost(self.get_uri(),
|
||||
self.config.get_iso_paths)
|
||||
|
@ -643,7 +643,8 @@ class vmmConsolePages(vmmGObjectUI):
|
||||
|
||||
# Signals are added by vmmDetails. Don't use connect_signals here
|
||||
# or it changes will be overwritten
|
||||
# Set console scaling
|
||||
|
||||
self.refresh_scaling()
|
||||
self.add_gconf_handle(
|
||||
self.vm.on_console_scaling_changed(self.refresh_scaling))
|
||||
|
||||
@ -790,18 +791,14 @@ class vmmConsolePages(vmmGObjectUI):
|
||||
for g in self.accel_groups:
|
||||
self.topwin.add_accel_group(g)
|
||||
|
||||
def grab_keys_changed(self,
|
||||
ignore1=None, ignore2=None,
|
||||
ignore3=None, ignore4=None):
|
||||
def grab_keys_changed(self):
|
||||
self.viewer.set_grab_keys()
|
||||
|
||||
def set_enable_accel(self, ignore=None, ignore1=None,
|
||||
ignore2=None, ignore3=None):
|
||||
def set_enable_accel(self):
|
||||
# Make sure modifiers are up to date
|
||||
self.viewer_focus_changed()
|
||||
|
||||
def refresh_scaling(self, ignore1=None, ignore2=None, ignore3=None,
|
||||
ignore4=None):
|
||||
def refresh_scaling(self):
|
||||
self.scale_type = self.vm.get_console_scaling()
|
||||
self.widget("details-menu-view-scale-always").set_active(
|
||||
self.scale_type == self.config.CONSOLE_SCALE_ALWAYS)
|
||||
|
@ -368,7 +368,7 @@ class vmmCreate(vmmGObjectUI):
|
||||
|
||||
self.widget("install-local-box").get_child().set_text("")
|
||||
iso_model = self.widget("install-local-box").get_model()
|
||||
self.populate_media_model(iso_model, self.conn.config_get_iso_paths())
|
||||
self.populate_media_model(iso_model, self.config.get_iso_paths())
|
||||
|
||||
# Install URL
|
||||
self.widget("install-urlopts-entry").set_text("")
|
||||
@ -965,7 +965,7 @@ class vmmCreate(vmmGObjectUI):
|
||||
else:
|
||||
ret = self.widget("install-local-box").get_child().get_text()
|
||||
if ret and store_media:
|
||||
self.conn.config_add_iso_path(ret)
|
||||
self.config.add_iso_path(ret)
|
||||
return ret
|
||||
|
||||
def get_config_detectable_media(self):
|
||||
|
@ -1349,8 +1349,7 @@ class vmmDomain(vmmLibvirtObject):
|
||||
|
||||
return [(x + y) / 2 for x, y in zip(data[0:end], data[end:end * 2])]
|
||||
|
||||
def toggle_sample_network_traffic(self, ignore1=None, ignore2=None,
|
||||
ignore3=None, ignore4=None):
|
||||
def toggle_sample_network_traffic(self):
|
||||
self._enable_net_poll = self.config.get_stats_enable_net_poll()
|
||||
|
||||
if self._enable_net_poll and len(self.record) > 1:
|
||||
@ -1361,8 +1360,7 @@ class vmmDomain(vmmLibvirtObject):
|
||||
self.record[0]["netRxKB"] = rxBytes / 1024
|
||||
self.record[0]["netTxKB"] = txBytes / 1024
|
||||
|
||||
def toggle_sample_disk_io(self, ignore1=None, ignore2=None,
|
||||
ignore3=None, ignore4=None):
|
||||
def toggle_sample_disk_io(self):
|
||||
self._enable_disk_poll = self.config.get_stats_enable_disk_poll()
|
||||
|
||||
if self._enable_disk_poll and len(self.record) > 1:
|
||||
@ -1560,33 +1558,38 @@ class vmmDomain(vmmLibvirtObject):
|
||||
|
||||
self.idle_emit("status-changed", oldstatus, status)
|
||||
|
||||
|
||||
#################
|
||||
# GConf helpers #
|
||||
#################
|
||||
|
||||
def set_console_scaling(self, value):
|
||||
self.config.set_pervm(self.conn.get_uri(), self.uuid,
|
||||
self.config.set_console_scaling, value)
|
||||
def get_console_scaling(self):
|
||||
return self.config.get_pervm(self.conn.get_uri(), self.uuid,
|
||||
self.config.get_console_scaling)
|
||||
def on_console_scaling_changed(self, cb):
|
||||
return self.config.listen_pervm(self.conn.get_uri(), self.uuid,
|
||||
self.config.on_console_scaling_changed,
|
||||
cb)
|
||||
|
||||
def set_details_window_size(self, w, h):
|
||||
self.config.set_pervm(self.conn.get_uri(), self.uuid,
|
||||
self.config.set_details_window_size, (w, h))
|
||||
def get_details_window_size(self):
|
||||
return self.config.get_pervm(self.conn.get_uri(), self.uuid,
|
||||
self.config.get_details_window_size)
|
||||
|
||||
def inspection_data_updated(self):
|
||||
self.idle_emit("inspection-changed")
|
||||
|
||||
|
||||
##################
|
||||
# config helpers #
|
||||
##################
|
||||
|
||||
def on_console_scaling_changed(self, *args, **kwargs):
|
||||
return self.config.listen_pervm(self.uuid, "/scaling",
|
||||
*args, **kwargs)
|
||||
def set_console_scaling(self, value):
|
||||
self.config.set_pervm(self.uuid, "/scaling", value)
|
||||
def get_console_scaling(self):
|
||||
ret = self.config.get_pervm(self.uuid, "/scaling")
|
||||
if ret == -1:
|
||||
return self.config.get_console_scaling()
|
||||
return ret
|
||||
|
||||
def set_details_window_size(self, w, h):
|
||||
self.config.set_pervm(self.uuid, "/vm-window-size", (w, h))
|
||||
def get_details_window_size(self):
|
||||
ret = self.config.get_pervm(self.uuid, "/vm-window-size")
|
||||
return ret
|
||||
|
||||
def get_console_password(self):
|
||||
return self.config.get_pervm(self.uuid, "/console-password")
|
||||
def set_console_password(self, username, keyid):
|
||||
return self.config.set_pervm(self.uuid, "/console-password",
|
||||
(username, keyid))
|
||||
|
||||
|
||||
###################
|
||||
# Polling helpers #
|
||||
###################
|
||||
|
@ -190,10 +190,8 @@ class vmmManager(vmmGObjectUI):
|
||||
|
||||
# Initialize stat polling columns based on global polling
|
||||
# preferences (we want signal handlers for this)
|
||||
for typ, init_val in [
|
||||
(COL_DISK, self.config.get_stats_enable_disk_poll()),
|
||||
(COL_NETWORK, self.config.get_stats_enable_net_poll())]:
|
||||
self.enable_polling(None, None, init_val, typ)
|
||||
self.enable_polling(COL_DISK)
|
||||
self.enable_polling(COL_NETWORK)
|
||||
|
||||
# Select first list entry
|
||||
vmlist = self.widget("vm-list")
|
||||
@ -1179,17 +1177,18 @@ class vmmManager(vmmGObjectUI):
|
||||
|
||||
return cmp(obj1.network_traffic_rate(), obj2.network_traffic_rate())
|
||||
|
||||
def enable_polling(self, ignore1, ignore2, conf_entry, userdata):
|
||||
if userdata == COL_DISK:
|
||||
def enable_polling(self, column):
|
||||
if column == COL_DISK:
|
||||
widgn = "menu_view_stats_disk"
|
||||
elif userdata == COL_NETWORK:
|
||||
do_enable = self.config.get_stats_enable_disk_poll()
|
||||
elif column == COL_NETWORK:
|
||||
widgn = "menu_view_stats_network"
|
||||
do_enable = self.config.get_stats_enable_net_poll()
|
||||
widget = self.widget(widgn)
|
||||
|
||||
tool_text = ""
|
||||
|
||||
if conf_entry and (conf_entry is True or
|
||||
conf_entry.get_value().get_bool()):
|
||||
if do_enable:
|
||||
widget.set_sensitive(True)
|
||||
else:
|
||||
if widget.get_active():
|
||||
@ -1205,22 +1204,22 @@ class vmmManager(vmmGObjectUI):
|
||||
current_text = current_text + disabled_text
|
||||
widget.set_label(current_text)
|
||||
|
||||
def toggle_network_traffic_visible_widget(self, *ignore):
|
||||
def toggle_network_traffic_visible_widget(self):
|
||||
val = self.config.is_vmlist_network_traffic_visible()
|
||||
self.netcol.set_visible(val)
|
||||
self.widget("menu_view_stats_network").set_active(val)
|
||||
|
||||
def toggle_disk_io_visible_widget(self, *ignore):
|
||||
def toggle_disk_io_visible_widget(self):
|
||||
val = self.config.is_vmlist_disk_io_visible()
|
||||
self.diskcol.set_visible(val)
|
||||
self.widget("menu_view_stats_disk").set_active(val)
|
||||
|
||||
def toggle_guest_cpu_usage_visible_widget(self, *ignore):
|
||||
def toggle_guest_cpu_usage_visible_widget(self):
|
||||
val = self.config.is_vmlist_guest_cpu_usage_visible()
|
||||
self.guestcpucol.set_visible(val)
|
||||
self.widget("menu_view_stats_guest_cpu").set_active(val)
|
||||
|
||||
def toggle_host_cpu_usage_visible_widget(self, *ignore):
|
||||
def toggle_host_cpu_usage_visible_widget(self):
|
||||
val = self.config.is_vmlist_host_cpu_usage_visible()
|
||||
self.hostcpucol.set_visible(val)
|
||||
self.widget("menu_view_stats_host_cpu").set_active(val)
|
||||
|
@ -35,26 +35,6 @@ class vmmPreferences(vmmGObjectUI):
|
||||
def __init__(self):
|
||||
vmmGObjectUI.__init__(self, "vmm-preferences.ui", "vmm-preferences")
|
||||
|
||||
self.add_gconf_handle(self.config.on_view_system_tray_changed(self.refresh_view_system_tray))
|
||||
self.add_gconf_handle(self.config.on_console_accels_changed(self.refresh_console_accels))
|
||||
self.add_gconf_handle(self.config.on_console_scaling_changed(self.refresh_console_scaling))
|
||||
self.add_gconf_handle(self.config.on_stats_update_interval_changed(self.refresh_update_interval))
|
||||
self.add_gconf_handle(self.config.on_stats_history_length_changed(self.refresh_history_length))
|
||||
self.add_gconf_handle(self.config.on_sound_local_changed(self.refresh_sound_local))
|
||||
self.add_gconf_handle(self.config.on_sound_remote_changed(self.refresh_sound_remote))
|
||||
self.add_gconf_handle(self.config.on_graphics_type_changed(self.refresh_graphics_type))
|
||||
self.add_gconf_handle(self.config.on_storage_format_changed(self.refresh_storage_format))
|
||||
self.add_gconf_handle(self.config.on_stats_enable_disk_poll_changed(self.refresh_disk_poll))
|
||||
self.add_gconf_handle(self.config.on_stats_enable_net_poll_changed(self.refresh_net_poll))
|
||||
|
||||
self.add_gconf_handle(self.config.on_confirm_forcepoweroff_changed(self.refresh_confirm_forcepoweroff))
|
||||
self.add_gconf_handle(self.config.on_confirm_poweroff_changed(self.refresh_confirm_poweroff))
|
||||
self.add_gconf_handle(self.config.on_confirm_pause_changed(self.refresh_confirm_pause))
|
||||
self.add_gconf_handle(self.config.on_confirm_removedev_changed(self.refresh_confirm_removedev))
|
||||
self.add_gconf_handle(self.config.on_confirm_interface_changed(self.refresh_confirm_interface))
|
||||
self.add_gconf_handle(self.config.on_confirm_unapplied_changed(self.refresh_confirm_unapplied))
|
||||
self.add_gconf_handle(self.config.on_confirm_delstorage_changed(self.refresh_confirm_delstorage))
|
||||
|
||||
self.refresh_view_system_tray()
|
||||
self.refresh_update_interval()
|
||||
self.refresh_history_length()
|
||||
@ -117,41 +97,33 @@ class vmmPreferences(vmmGObjectUI):
|
||||
# Config Change Options #
|
||||
#########################
|
||||
|
||||
def refresh_view_system_tray(self, ignore1=None, ignore2=None,
|
||||
ignore3=None, ignore4=None):
|
||||
def refresh_view_system_tray(self):
|
||||
val = self.config.get_view_system_tray()
|
||||
self.widget("prefs-system-tray").set_active(bool(val))
|
||||
|
||||
def refresh_update_interval(self, ignore1=None, ignore2=None,
|
||||
ignore3=None, ignore4=None):
|
||||
def refresh_update_interval(self):
|
||||
self.widget("prefs-stats-update-interval").set_value(
|
||||
self.config.get_stats_update_interval())
|
||||
def refresh_history_length(self, ignore1=None, ignore2=None,
|
||||
ignore3=None, ignore4=None):
|
||||
def refresh_history_length(self):
|
||||
self.widget("prefs-stats-history-len").set_value(
|
||||
self.config.get_stats_history_length())
|
||||
|
||||
def refresh_console_accels(self, ignore1=None, ignore2=None,
|
||||
ignore3=None, ignore4=None):
|
||||
def refresh_console_accels(self):
|
||||
self.widget("prefs-console-accels").set_active(
|
||||
self.config.get_console_accels())
|
||||
def refresh_console_scaling(self, ignore1=None, ignore2=None,
|
||||
ignore3=None, ignore4=None):
|
||||
def refresh_console_scaling(self):
|
||||
val = self.config.get_console_scaling()
|
||||
if val is None:
|
||||
val = 0
|
||||
self.widget("prefs-console-scaling").set_active(val)
|
||||
|
||||
def refresh_sound_local(self, ignore1=None, ignore2=None, ignore=None,
|
||||
ignore4=None):
|
||||
def refresh_sound_local(self):
|
||||
self.widget("prefs-sound-local").set_active(
|
||||
self.config.get_local_sound())
|
||||
def refresh_sound_remote(self, ignore1=None, ignore2=None, ignore=None,
|
||||
ignore4=None):
|
||||
def refresh_sound_remote(self):
|
||||
self.widget("prefs-sound-remote").set_active(
|
||||
self.config.get_remote_sound())
|
||||
def refresh_graphics_type(self, ignore1=None, ignore2=None, ignore=None,
|
||||
ignore4=None):
|
||||
def refresh_graphics_type(self):
|
||||
combo = self.widget("prefs-graphics-type")
|
||||
model = combo.get_model()
|
||||
gtype = self.config.get_graphics_type()
|
||||
@ -164,8 +136,7 @@ class vmmPreferences(vmmGObjectUI):
|
||||
break
|
||||
|
||||
self.widget("prefs-graphics-type").set_active(active)
|
||||
def refresh_storage_format(self, ignore1=None, ignore2=None, ignore=None,
|
||||
ignore4=None):
|
||||
def refresh_storage_format(self):
|
||||
combo = self.widget("prefs-storage-format")
|
||||
model = combo.get_model()
|
||||
gtype = self.config.get_storage_format()
|
||||
@ -179,17 +150,14 @@ class vmmPreferences(vmmGObjectUI):
|
||||
|
||||
self.widget("prefs-storage-format").set_active(active)
|
||||
|
||||
def refresh_disk_poll(self, ignore1=None, ignore2=None, ignore3=None,
|
||||
ignore4=None):
|
||||
def refresh_disk_poll(self):
|
||||
self.widget("prefs-stats-enable-disk").set_active(
|
||||
self.config.get_stats_enable_disk_poll())
|
||||
def refresh_net_poll(self, ignore1=None, ignore2=None, ignore3=None,
|
||||
ignore4=None):
|
||||
def refresh_net_poll(self):
|
||||
self.widget("prefs-stats-enable-net").set_active(
|
||||
self.config.get_stats_enable_net_poll())
|
||||
|
||||
def refresh_grabkeys_combination(self, ignore1=None, ignore2=None,
|
||||
ignore3=None, ignore4=None):
|
||||
def refresh_grabkeys_combination(self):
|
||||
val = self.config.get_keys_combination()
|
||||
|
||||
# We convert keysyms to names
|
||||
@ -212,32 +180,25 @@ class vmmPreferences(vmmGObjectUI):
|
||||
|
||||
self.widget("prefs-keys-grab-sequence").set_text(keystr)
|
||||
|
||||
def refresh_confirm_forcepoweroff(self, ignore1=None, ignore2=None,
|
||||
ignore3=None, ignore4=None):
|
||||
def refresh_confirm_forcepoweroff(self):
|
||||
self.widget("prefs-confirm-forcepoweroff").set_active(
|
||||
self.config.get_confirm_forcepoweroff())
|
||||
def refresh_confirm_poweroff(self, ignore1=None, ignore2=None,
|
||||
ignore3=None, ignore4=None):
|
||||
def refresh_confirm_poweroff(self):
|
||||
self.widget("prefs-confirm-poweroff").set_active(
|
||||
self.config.get_confirm_poweroff())
|
||||
def refresh_confirm_pause(self, ignore1=None, ignore2=None,
|
||||
ignore3=None, ignore4=None):
|
||||
def refresh_confirm_pause(self):
|
||||
self.widget("prefs-confirm-pause").set_active(
|
||||
self.config.get_confirm_pause())
|
||||
def refresh_confirm_removedev(self, ignore1=None, ignore2=None,
|
||||
ignore3=None, ignore4=None):
|
||||
def refresh_confirm_removedev(self):
|
||||
self.widget("prefs-confirm-removedev").set_active(
|
||||
self.config.get_confirm_removedev())
|
||||
def refresh_confirm_interface(self, ignore1=None, ignore2=None,
|
||||
ignore3=None, ignore4=None):
|
||||
def refresh_confirm_interface(self):
|
||||
self.widget("prefs-confirm-interface").set_active(
|
||||
self.config.get_confirm_interface())
|
||||
def refresh_confirm_unapplied(self, ignore1=None, ignore2=None,
|
||||
ignore3=None, ignore4=None):
|
||||
def refresh_confirm_unapplied(self):
|
||||
self.widget("prefs-confirm-unapplied").set_active(
|
||||
self.config.get_confirm_unapplied())
|
||||
def refresh_confirm_delstorage(self, ignore1=None, ignore2=None,
|
||||
ignore3=None, ignore4=None):
|
||||
def refresh_confirm_delstorage(self):
|
||||
self.widget("prefs-confirm-delstorage").set_active(
|
||||
self.config.get_confirm_delstorage())
|
||||
|
||||
|
@ -152,8 +152,7 @@ class vmmSystray(vmmGObject):
|
||||
self.systray_icon.connect("popup-menu", self.systray_popup)
|
||||
self.systray_icon.set_tooltip_text(_("Virtual Machine Manager"))
|
||||
|
||||
def show_systray(self, ignore1=None, ignore2=None, ignore3=None,
|
||||
ignore4=None):
|
||||
def show_systray(self):
|
||||
do_show = self.config.get_view_system_tray()
|
||||
logging.debug("Showing systray: %s", do_show)
|
||||
|
||||
|
@ -42,6 +42,18 @@ def _get_param(name, default):
|
||||
return default
|
||||
return cfg.get("config", name)
|
||||
|
||||
|
||||
def _setup_gsettings_path(schemadir):
|
||||
"""
|
||||
If running from the virt-manager.git srcdir, compile our gsettings
|
||||
schema and use it directly
|
||||
"""
|
||||
import subprocess
|
||||
|
||||
os.environ["GSETTINGS_SCHEMA_DIR"] = schemadir
|
||||
subprocess.call(["glib-compile-schemas", schemadir])
|
||||
|
||||
|
||||
__version__ = "0.9.100"
|
||||
|
||||
__snapshot__ = 0
|
||||
@ -57,6 +69,7 @@ install_asset_dir = os.path.join(prefix, "share", "virt-manager")
|
||||
if os.getcwd() == _srcdir:
|
||||
asset_dir = _srcdir
|
||||
icon_dir = os.path.join(_srcdir, "data")
|
||||
_setup_gsettings_path(icon_dir)
|
||||
else:
|
||||
asset_dir = install_asset_dir
|
||||
icon_dir = os.path.join(asset_dir, "icons")
|
||||
|
Loading…
Reference in New Issue
Block a user