Merge lp:~nuclearbob/utah/bug1087973 into lp:utah

Proposed by Max Brustkern
Status: Merged
Approved by: Javier Collado
Approved revision: 781
Merged at revision: 779
Proposed branch: lp:~nuclearbob/utah/bug1087973
Merge into: lp:utah
Diff against target: 157 lines (+28/-19)
6 files modified
examples/run_test_bamboo_feeder.py (+5/-3)
examples/run_test_cobbler.py (+5/-3)
examples/run_test_vm.py (+2/-2)
examples/run_utah_tests.py (+0/-1)
utah/provisioning/baremetal/cobbler.py (+1/-1)
utah/provisioning/provisioning.py (+15/-9)
To merge this branch: bzr merge lp:~nuclearbob/utah/bug1087973
Reviewer Review Type Date Requested Status
Max Brustkern (community) Needs Resubmitting
Javier Collado (community) Approve
Joe Talbott (community) Approve
Review via email: mp+139028@code.launchpad.net

Description of the change

This branch fixes a couple of bugs preventing kernel config options from being passed in when provisioning physical hardware. It also moves the setup of the boottimeout variable out of CustomInstallMixin and standardizes use of that variable in the Machine class. I have tested the changes in magners-orchestra and verified that the kernel options are correctly passed to cobbler. I am waiting for the install to finish to verify nothing has gone wrong.

To post a comment you must log in.
Revision history for this message
Joe Talbott (joetalbott) wrote :

Looks good to me.

review: Approve
Revision history for this message
Javier Collado (javier.collado) wrote :

I don't like much the loops to set keyword arguments. I know that's not
something changed in the merge request, but let me add it as a comment since
I'm seeing them in the diff.

I think that `vargs` and `dict.update` as in this example:

for arg in ['boot', 'image', 'preseed', 'rewrite']:
    value = vars(args)[arg]
    if value is not None:
        kw.update([(arg, value)])

Should be replaced with `getattr` and dict assignment as follows:

for arg in ['boot', 'image', 'preseed', 'rewrite']:
    value = getattr(args, arg)
    if value is not None:
        kw[arg] = value

Revision history for this message
Javier Collado (javier.collado) wrote :

It looks like `Machine` objects aren't getting a customized `timeout`
value at initialization time.

Is there any advantage in using this:
self.boottimeout = config.boottimeout

instead of `config.bootimeout` directly?

review: Needs Information
Revision history for this message
Javier Collado (javier.collado) wrote :

Aside from the comments above, the code looks nice, so I'm approving as we've
been doing for Critical bugs and we can fix any cosmetic issue later.

review: Approve
Revision history for this message
Max Brustkern (nuclearbob) wrote :

When libvirtvm is using qemu, it raises all timeouts because qemu is super duper slow. At this point it may make more sense to either set a different config for the qemu jobs or just raise the timeout high enough for them to all work. Then, we could just use the config file version. Let me know what you think.

lp:~nuclearbob/utah/bug1087973 updated
781. By Max Brustkern

Changed argument loops per Javier's comment

Revision history for this message
Max Brustkern (nuclearbob) wrote :

Javier's comment on the argument loops should be addressed now. I'd like to determine whether to also change the boottimeout setup to just use the config and avoid the internal multiplication done for qemu. I'd like to get all these merged to make a new stable version, so it would be good to take care of anything that's bothering us first.

review: Needs Resubmitting
Revision history for this message
Javier Collado (javier.collado) wrote :

Ok, I've seen the multiplication factor for QEMU:
self.boottimeout *= 4

This isn't bothering me because I'm not using it. However, I'm not in favor of
changing configuration values this way. I think a good alternative would be to
write warning messages if a configuration value isn't good enough to let the
user know he should consider to change it.

Anyway, I'm going to merge these changes to have them committed for the boot
args bug and we can think about the boot timeout in a different merge request.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/run_test_bamboo_feeder.py'
2--- examples/run_test_bamboo_feeder.py 2012-12-08 02:10:12 +0000
3+++ examples/run_test_bamboo_feeder.py 2012-12-10 19:20:24 +0000
4@@ -57,6 +57,8 @@
5 help='Image/ISO file to use for installation')
6 parser.add_argument('-p', '--preseed', type=url_argument,
7 help='Preseed file to use for installation')
8+ parser.add_argument('-b', '--boot',
9+ help='Boot arguments for initial installation')
10 parser.add_argument('-n', '--no-destroy', action='store_true',
11 help='Preserve VM after tests have run')
12 parser.add_argument('-d', '--debug', action='store_true',
13@@ -85,10 +87,10 @@
14 db=os.path.join('~', '.utah-bamboofeeder-inventory'),
15 lockfile=os.path.join('~', '.utah-bamboofeeder-lock'))
16 kw = {}
17- for arg in ['image', 'preseed']:
18- value = vars(args)[arg]
19+ for arg in ['boot', 'image', 'preseed']:
20+ value = getattr(args, arg)
21 if value is not None:
22- kw.update([(arg, value)])
23+ kw[arg] = value
24 machine = inventory.request(machinetype=BambooFeederMachine,
25 clean=(not args.no_destroy),
26 debug=args.debug, new=True,
27
28=== modified file 'examples/run_test_cobbler.py'
29--- examples/run_test_cobbler.py 2012-12-08 02:10:12 +0000
30+++ examples/run_test_cobbler.py 2012-12-10 19:20:24 +0000
31@@ -44,6 +44,8 @@
32 help='Image/ISO file to use for installation')
33 parser.add_argument('-p', '--preseed', type=url_argument,
34 help='Preseed file to use for installation')
35+ parser.add_argument('-b', '--boot',
36+ help='Boot arguments for initial installation')
37 parser.add_argument('-s', '--series', metavar='SERIES',
38 choices=config.serieschoices,
39 help='Series to use for VM creation (%(choices)s)')
40@@ -97,10 +99,10 @@
41 try:
42 inventory = ManualCobblerSQLiteInventory()
43 kw = {}
44- for arg in ['image', 'preseed', 'rewrite']:
45- value = vars(args)[arg]
46+ for arg in ['boot', 'image', 'preseed', 'rewrite']:
47+ value = getattr(args, arg)
48 if value is not None:
49- kw.update([(arg, value)])
50+ kw[arg] = value
51 machine = inventory.request(clean=(not args.no_destroy),
52 debug=args.debug, dlpercentincrement=10,
53 name=args.name, new=True, **kw)
54
55=== modified file 'examples/run_test_vm.py'
56--- examples/run_test_vm.py 2012-12-08 02:10:12 +0000
57+++ examples/run_test_vm.py 2012-12-10 19:20:24 +0000
58@@ -82,9 +82,9 @@
59 inventory = TinySQLiteInventory()
60 kw = {}
61 for arg in ['arch', 'series']:
62- value = vars(args)[arg]
63+ value = getattr(args, arg)
64 if value is not None:
65- kw.update([(arg, value)])
66+ kw[arg] = value
67 if args.type is not None:
68 kw.update([('installtype', args.type)])
69 machine = inventory.request(clean=(not args.no_destroy),
70
71=== modified file 'examples/run_utah_tests.py'
72--- examples/run_utah_tests.py 2012-12-08 02:10:12 +0000
73+++ examples/run_utah_tests.py 2012-12-10 19:20:24 +0000
74@@ -22,7 +22,6 @@
75 from utah.url import url_argument
76 from utah.group import check_user_group, print_group_error_message
77 from utah.timeout import timeout, UTAHTimeout
78-from utah import config
79 from run_install_test import run_install_test
80
81
82
83=== modified file 'utah/provisioning/baremetal/cobbler.py'
84--- utah/provisioning/baremetal/cobbler.py 2012-12-08 02:10:12 +0000
85+++ utah/provisioning/baremetal/cobbler.py 2012-12-10 19:20:24 +0000
86@@ -189,7 +189,7 @@
87 self.restart()
88
89 self.logger.info('Waiting for installation to begin')
90- time.sleep(config.boottimeout)
91+ time.sleep(self.boottimeout)
92 self._cobble(['system', 'edit', '--name=' + self.name,
93 '--netboot-enabled=N'])
94
95
96=== modified file 'utah/provisioning/provisioning.py'
97--- utah/provisioning/provisioning.py 2012-12-06 16:30:34 +0000
98+++ utah/provisioning/provisioning.py 2012-12-10 19:20:24 +0000
99@@ -121,6 +121,8 @@
100 self.prefix = prefix
101 self.template = template
102
103+ self.boottimeout = config.boottimeout
104+
105 if clean is None:
106 self.clean = True
107 else:
108@@ -330,10 +332,12 @@
109 raise UTAHProvisioningException(err, retry=True)
110
111 def pingpoll(self,
112- timeout=config.boottimeout,
113+ timeout=None,
114 checktimeout=config.checktimeout,
115 logmethod=None):
116 """Run pingcheck over and over until timeout expires."""
117+ if timeout is None:
118+ timeout = self.boottimeout
119 if logmethod is None:
120 logmethod = self.logger.debug
121 utah.timeout.timeout(timeout, retry, self.pingcheck, checktimeout,
122@@ -875,11 +879,13 @@
123 except socket.error as err:
124 raise UTAHProvisioningException(str(err), retry=True)
125
126- def sshpoll(self, timeout=config.boottimeout,
127+ def sshpoll(self, timeout=None,
128 checktimeout=config.checktimeout, logmethod=None):
129 """
130 Run sshcheck over and over until timeout expires.
131 """
132+ if timeout is None:
133+ timeout = self.boottimeout
134 if logmethod is None:
135 logmethod = self.logger.debug
136 utah.timeout.timeout(timeout, retry, self.sshcheck, checktimeout,
137@@ -1207,13 +1213,13 @@
138 """
139 Add the needed options to the command line for an automatic install.
140 """
141- if boot is None:
142- self.cmdline = self.boot
143- if boot is None:
144- self.cmdline = ''
145- else:
146- self.cmdline = boot
147- self.boottimeout = config.boottimeout
148+ # TODO: update libvirtvm to work like the hardware provisioners
149+ # or vice versa
150+ if boot is None:
151+ boot = self.boot
152+ if boot is None:
153+ boot = ''
154+ self.cmdline = boot
155 # TODO: Refactor this into lists like BambooFeederMachine
156 if self.rewrite == 'all':
157 self.logger.info('Adding needed command line options')

Subscribers

People subscribed via source and target branches