MCPcopy Create free account
hub / github.com/apache/cloudstack / create

Method create

extensions/MaaS/maas.py:159–184  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

157 succeed(result)
158
159 def create(self):
160 sysid = self.data.get("system_id")
161 if not sysid:
162 fail("system_id missing for create")
163
164 ds = self.data.get("distro_series", None)
165 os_name = self.data.get("os")
166 arch = self.data.get("architecture")
167
168 deploy_payload = {"op": "deploy"}
169
170 if os_name or arch:
171 if os_name:
172 deploy_payload["os"] = os_name
173 if arch:
174 deploy_payload["architecture"] = arch
175 if ds:
176 deploy_payload["distro_series"] = ds
177 else:
178 deploy_payload["distro_series"] = ds or "ubuntu/focal"
179
180 deploy_payload["net-setup-method"] = "curtin"
181
182 self.call_maas("POST", f"/machines/{sysid}/", deploy_payload)
183
184 succeed({"status": "success", "message": "Instance created", "requested": deploy_payload})
185
186 def delete(self):
187 sysid = self.data.get("system_id")

Callers

nothing calls this directly

Calls 4

call_maasMethod · 0.95
failFunction · 0.70
succeedFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected