@@ -125,31 +125,42 @@ func (n *LxcNet) String() string {
125125// TODO: Add mount support
126126// mount
127127type LXCFeatures struct {
128- ForceRWSys bool
129- Fuse bool
130- KeyCTL bool
131- MKNod bool
132- Nesting bool
128+ ForceRWSys * bool
129+ Fuse * bool
130+ KeyCTL * bool
131+ MKNod * bool
132+ Nesting * bool
133133// TODO: Mount
134134}
135135
136136func (f * LXCFeatures ) String () string {
137137s := ""
138138var intbool int
139- intbool = helpers .BoolToInt (f .ForceRWSys )
140- s = fmt .Sprintf ("%s,force_rw_sys=%d" , s , intbool )
141139
142- intbool = helpers .BoolToInt (f .Fuse )
143- s = fmt .Sprintf ("%s,fuse=%d" , s , intbool )
140+ if f .ForceRWSys != nil {
141+ intbool = helpers .BoolToInt (* f .ForceRWSys )
142+ s = fmt .Sprintf ("%s,force_rw_sys=%d" , s , intbool )
143+ }
144144
145- intbool = helpers .BoolToInt (f .KeyCTL )
146- s = fmt .Sprintf ("%s,keyctl=%d" , s , intbool )
145+ if f .Fuse != nil {
146+ intbool = helpers .BoolToInt (* f .Fuse )
147+ s = fmt .Sprintf ("%s,fuse=%d" , s , intbool )
148+ }
147149
148- intbool = helpers .BoolToInt (f .MKNod )
149- s = fmt .Sprintf ("%s,mknod=%d" , s , intbool )
150+ if f .KeyCTL != nil {
151+ intbool = helpers .BoolToInt (* f .KeyCTL )
152+ s = fmt .Sprintf ("%s,keyctl=%d" , s , intbool )
153+ }
150154
151- intbool = helpers .BoolToInt (f .Nesting )
152- s = fmt .Sprintf ("%s,nesting=%d" , s , intbool )
155+ if f .MKNod != nil {
156+ intbool = helpers .BoolToInt (* f .MKNod )
157+ s = fmt .Sprintf ("%s,mknod=%d" , s , intbool )
158+ }
159+
160+ if f .Nesting != nil {
161+ intbool = helpers .BoolToInt (* f .Nesting )
162+ s = fmt .Sprintf ("%s,nesting=%d" , s , intbool )
163+ }
153164
154165return s
155166}
@@ -641,4 +652,3 @@ func (s *PVELxcService) GetInterfaceByName(node string, id int, name string) (re
641652}
642653return res , fmt .Errorf ("vmid '%d' or interface '%s' not found" , id , name )
643654}
644-
0 commit comments