mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-10 23:45:49 -06:00
Append volume name suffix depending on parent pool type.
This commit is contained in:
parent
79a2ada377
commit
ab81574de5
@ -83,8 +83,8 @@ class vmmCreateVolume(gobject.GObject):
|
||||
|
||||
def show(self):
|
||||
self.topwin.show()
|
||||
self.reset_state()
|
||||
self.topwin.present()
|
||||
self.reset_state()
|
||||
|
||||
def close(self, ignore1=None, ignore2=None):
|
||||
self.topwin.hide()
|
||||
@ -98,6 +98,7 @@ class vmmCreateVolume(gobject.GObject):
|
||||
def reset_state(self):
|
||||
self.window.get_widget("vol-name").set_text("")
|
||||
self.populate_vol_format()
|
||||
self.populate_vol_suffix()
|
||||
|
||||
if len(self.vol_class.formats):
|
||||
self.window.get_widget("vol-format").set_sensitive(True)
|
||||
@ -129,6 +130,12 @@ class vmmCreateVolume(gobject.GObject):
|
||||
for f in formats:
|
||||
model.append([f, f])
|
||||
|
||||
def populate_vol_suffix(self):
|
||||
suffix = ""
|
||||
if self.vol_class == Storage.FileVolume:
|
||||
suffix = ".img"
|
||||
self.window.get_widget("vol-name-suffix").set_text(suffix)
|
||||
|
||||
def finish(self, src):
|
||||
# validate input
|
||||
try:
|
||||
@ -192,12 +199,14 @@ class vmmCreateVolume(gobject.GObject):
|
||||
|
||||
def validate(self):
|
||||
name = self.window.get_widget("vol-name").get_text()
|
||||
suffix = self.window.get_widget("vol-name-suffix").get_text()
|
||||
volname = name + suffix
|
||||
format = self.get_config_format()
|
||||
alloc = self.window.get_widget("vol-allocation").get_value()
|
||||
cap = self.window.get_widget("vol-capacity").get_value()
|
||||
|
||||
try:
|
||||
self.vol = self.vol_class(name=name,
|
||||
self.vol = self.vol_class(name=volname,
|
||||
allocation=(alloc * 1024 * 1024),
|
||||
capacity=(cap * 1024 * 1024),
|
||||
pool=self.parent_pool.pool)
|
||||
|
@ -248,9 +248,9 @@
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label15">
|
||||
<widget class="GtkLabel" id="vol-name-suffix">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">.img</property>
|
||||
<property name="label">suffix</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
|
Loading…
Reference in New Issue
Block a user