Revision 56bece1f scripts/gnt-cluster
b/scripts/gnt-cluster | ||
---|---|---|
160 | 160 |
nodes - list containing the name of target nodes; if empty, all nodes |
161 | 161 |
|
162 | 162 |
""" |
163 |
# TODO: Query master |
|
164 |
cfg = ssconf.SimpleConfigReader() |
|
165 |
|
|
166 | 163 |
filename = args[0] |
167 | 164 |
if not os.path.exists(filename): |
168 | 165 |
raise errors.OpPrereqError("No such filename '%s'" % filename) |
169 | 166 |
|
167 |
cl = GetClient() |
|
168 |
|
|
170 | 169 |
myname = utils.HostInfo().name |
171 | 170 |
|
171 |
cluster_name = cl.QueryConfigValues(["cluster_name"])[0] |
|
172 |
|
|
172 | 173 |
op = opcodes.OpQueryNodes(output_fields=["name"], names=opts.nodes) |
173 |
results = [row[0] for row in SubmitOpCode(op) if row[0] != myname] |
|
174 |
results = [row[0] for row in SubmitOpCode(op, cl=cl) if row[0] != myname]
|
|
174 | 175 |
|
175 |
# TODO: Potential inconsistency between local node and master |
|
176 |
srun = ssh.SshRunner(cfg) |
|
176 |
srun = ssh.SshRunner(cluster_name=cluster_name) |
|
177 | 177 |
for node in results: |
178 | 178 |
if not srun.CopyFileToNode(node, filename): |
179 | 179 |
print >> sys.stderr, ("Copy of file %s to node %s failed" % |
... | ... | |
192 | 192 |
nodes: list containing the name of target nodes; if empty, all nodes |
193 | 193 |
|
194 | 194 |
""" |
195 |
# TODO: Query master |
|
196 |
cfg = ssconf.SimpleConfigReader() |
|
195 |
cl = GetClient() |
|
197 | 196 |
|
198 | 197 |
command = " ".join(args) |
199 | 198 |
op = opcodes.OpQueryNodes(output_fields=["name"], names=opts.nodes) |
200 |
nodes = [row[0] for row in SubmitOpCode(op)] |
|
199 |
nodes = [row[0] for row in SubmitOpCode(op, cl=cl)] |
|
200 |
|
|
201 |
cluster_name, master_node = cl.QueryConfigValues(["cluster_name", |
|
202 |
"master_node"]) |
|
201 | 203 |
|
202 |
# TODO: Potential inconsistency between local node and master |
|
203 |
master_node = cfg.GetMasterNode() |
|
204 |
srun = ssh.SshRunner(cfg) |
|
204 |
srun = ssh.SshRunner(cluster_name=cluster_name) |
|
205 | 205 |
|
206 | 206 |
# Make sure master node is at list end |
207 | 207 |
if master_node in nodes: |
Also available in: Unified diff