On 02/25/2014 09:29 PM, Chen Hanxiao wrote: > Libvirt only allowed uid/gid_start configured as 0. > This patch will disable config uid/gid_start in UI. > > Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx> > --- > ui/details.ui | 60 +++++++++++++++++++++++--------------------------- > virtManager/details.py | 12 ++-------- > virtManager/domain.py | 8 +++---- > 3 files changed, 34 insertions(+), 46 deletions(-) > > diff --git a/ui/details.ui b/ui/details.ui > index 71e4ed8..7bd5121 100644 > --- a/ui/details.ui > +++ b/ui/details.ui > @@ -1,5 +1,5 @@ > <?xml version="1.0" encoding="UTF-8"?> > -<!-- Generated with glade 3.16.0 on Thu Feb 20 08:33:46 2014 --> > +<!-- Generated with glade 3.16.0 on Mon Feb 24 22:09:46 2014 --> > <interface> > <!-- interface-requires gtk+ 3.0 --> > <object class="GtkAccelGroup" id="accelgroup1"/> > @@ -1164,37 +1164,6 @@ > </packing> > </child> > <child> > - <object class="GtkSpinButton" id="uid-start"> > - <property name="visible">True</property> > - <property name="can_focus">True</property> > - <property name="width_chars">6</property> > - <property name="adjustment">adjustment14</property> > - <property name="climb_rate">1</property> > - <signal name="changed" handler="on_idmap_uid_start_changed" swapped="no"/> > - </object> > - <packing> > - <property name="left_attach">1</property> > - <property name="top_attach">1</property> > - <property name="width">1</property> > - <property name="height">1</property> > - </packing> > - </child> > - <child> > - <object class="GtkSpinButton" id="gid-start"> > - <property name="visible">True</property> > - <property name="can_focus">True</property> > - <property name="adjustment">adjustment15</property> > - <property name="climb_rate">1</property> > - <signal name="changed" handler="on_idmap_uid_target_changed" swapped="no"/> > - </object> > - <packing> > - <property name="left_attach">1</property> > - <property name="top_attach">2</property> > - <property name="width">1</property> > - <property name="height">1</property> > - </packing> > - </child> > - <child> > <object class="GtkSpinButton" id="uid-target"> > <property name="visible">True</property> > <property name="can_focus">True</property> > @@ -1252,6 +1221,33 @@ > <property name="height">1</property> > </packing> > </child> > + <child> > + <object class="GtkLabel" id="gid-start"> > + <property name="visible">True</property> > + <property name="can_focus">False</property> > + <property name="label" translatable="yes">0</property> > + </object> > + <packing> > + <property name="left_attach">1</property> > + <property name="top_attach">2</property> > + <property name="width">1</property> > + <property name="height">1</property> > + </packing> > + </child> > + <child> > + <object class="GtkLabel" id="uid-start"> > + <property name="visible">True</property> > + <property name="can_focus">False</property> > + <property name="label" translatable="yes">0</property> > + <property name="width_chars">10</property> > + </object> > + <packing> > + <property name="left_attach">1</property> > + <property name="top_attach">1</property> > + <property name="width">1</property> > + <property name="height">1</property> > + </packing> > + </child> > </object> > <packing> > <property name="left_attach">0</property> > diff --git a/virtManager/details.py b/virtManager/details.py > index f5330ef..00e011e 100644 > --- a/virtManager/details.py > +++ b/virtManager/details.py > @@ -580,10 +580,8 @@ class vmmDetails(vmmGObjectUI): > "on_overview_name_changed": lambda *x: self.enable_apply(x, EDIT_NAME), > "on_overview_title_changed": lambda *x: self.enable_apply(x, EDIT_TITLE), > "on_machine_type_changed": lambda *x: self.enable_apply(x, EDIT_MACHTYPE), > - "on_idmap_uid_start_changed": lambda *x: self.enable_apply(x, EDIT_IDMAP), > "on_idmap_uid_target_changed": lambda *x: self.enable_apply(x, EDIT_IDMAP), > "on_idmap_uid_count_changed": lambda *x: self.enable_apply(x, EDIT_IDMAP), > - "on_idmap_gid_start_changed": lambda *x: self.enable_apply(x, EDIT_IDMAP), > "on_idmap_gid_target_changed": lambda *x: self.enable_apply(x, EDIT_IDMAP), > "on_idmap_gid_count_changed": lambda *x: self.enable_apply(x, EDIT_IDMAP), > "on_config_idmap_check_toggled": self.config_idmap_enable, > @@ -1976,15 +1974,12 @@ class vmmDetails(vmmGObjectUI): > if self.edited(EDIT_IDMAP): > enable_idmap = self.widget("config-idmap-checkbutton").get_active() > if enable_idmap: > - uid_start = self.widget("uid-start").get_text().strip() > uid_target = self.widget("uid-target").get_text().strip() > uid_count = self.widget("uid-count").get_text().strip() > - gid_start = self.widget("gid-start").get_text().strip() > gid_target = self.widget("gid-target").get_text().strip() > gid_count = self.widget("gid-count").get_text().strip() > > - idmap_list = [uid_start, uid_target, uid_count, gid_start, > - gid_target, gid_count] > + idmap_list = [uid_target, uid_count, gid_target, gid_count] > else: > idmap_list = None > > @@ -2478,10 +2473,8 @@ class vmmDetails(vmmGObjectUI): > is_container = self.vm.is_container() > self.widget("config-idmap-expander").set_visible(is_container) > > - self.widget("uid-start").set_text('0') > self.widget("uid-target").set_text('1000') > self.widget("uid-count").set_text('10') > - self.widget("gid-start").set_text('0') > self.widget("gid-target").set_text('1000') > self.widget("gid-count").set_text('10') > > @@ -2491,8 +2484,7 @@ class vmmDetails(vmmGObjectUI): > self.widget("config-idmap-checkbutton").set_active(show_config) > self.widget("idmap-spin-grid").set_sensitive(show_config) > if show_config: > - Name = ["uid-start", "uid-target", "uid-count", > - "gid-start", "gid-target", "gid-count"] > + Name = ["uid-target", "uid-count", "gid-target", "gid-count"] > for name in Name: > IdMap_proper = getattr(IdMap, name.replace("-", "_")) > self.widget(name).set_value(int(IdMap_proper)) > diff --git a/virtManager/domain.py b/virtManager/domain.py > index db21ae4..6af08cc 100644 > --- a/virtManager/domain.py > +++ b/virtManager/domain.py > @@ -577,17 +577,17 @@ class vmmDomain(vmmLibvirtObject): > # Idmap config define methods > def define_idmap(self, idmap_list): > def change(guest): > - guest.idmap.uid_start = uid_start > + guest.idmap.uid_start = 0 > guest.idmap.uid_target = uid_target > guest.idmap.uid_count = uid_count > - guest.idmap.gid_start = gid_start > + guest.idmap.gid_start = 0 If libvirt ever supports non 0, this would overwrite any prefigured uid_start/gid_start. Will libvirt fill in 0 if it isn't specified? - Cole _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list