Ich verwende Python-API, um Vsi zu erstellen, und bekam ein Problem, wenn ich versuchte, ein Vsi aus einer vorhandenen Bildvorlage zu erstellen. Meine Python-Version ist 3.6.3 und ich betreibe meine Python-Skripte auf Windows 7.Problem beim Erstellen eines Vsi aus einer Bildvorlage
Ihre Dokumentation (http://softlayer-python.readthedocs.io/en/latest/api/managers/vs.html) sagt:
os_code (string) – The operating system to use. Cannot be specified if image_id is specified.
image_id (int) – The ID of the image to load onto the server. Cannot be specified if os_code is specified.
Als ich image_id ohne os_code in meinem Python-Skript angeben, bekam ich die folgende Fehler:
Traceback (most recent call last):
File "C:\Users\ods\Documents\slenv\lib\site-packages\SoftLayer\transports.py", line 173, in __call__
result = utils.xmlrpc_client.loads(resp.content)[0][0]
File "c:\users\ods\appdata\local\programs\python\python36\Lib\xmlrpc\client.py", line 1021, in loads
return u.close(), u.getmethodname()
File "c:\users\ods\appdata\local\programs\python\python36\Lib\xmlrpc\client.py", line 656, in close
raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault SoftLayer_Exception_MissingCreationProperty: "The property 'operatingSystemReferenceCode' must be set to create an instance of 'SoftLayer_Virtual_Guest'.">
Während der oben genannten Ausnahmebehandlung erfolgt eine weitere Ausnahme:
Traceback (most recent call last):
File "C:\Users\ods\Documents\slenv\", line 66, in <module>
create_vsi()
File "C:\Users\ods\Documents\slenv\", line 50, in create_vsi
ssh_keys=ssh_keys)
File "C:\Users\ods\Documents\slenv\lib\site-packages\SoftLayer\managers\vs.py", line 514, in verify_create_instance
return self.guest.generateOrderTemplate(create_options)
File "C:\Users\ods\Documents\slenv\lib\site-packages\SoftLayer\API.py", line 392, in call_handler
return self(name, *args, **kwargs)
File "C:\Users\ods\Documents\slenv\lib\site-packages\SoftLayer\API.py", line 360, in call
return self.client.call(self.name, name, *args, **kwargs)
File "C:\Users\ods\Documents\slenv\lib\site-packages\SoftLayer\API.py", line 263, in call
return self.transport(request)
File "C:\Users\ods\Documents\slenv\lib\site-packages\SoftLayer\transports.py", line 195, in __call__
raise _ex(ex.faultCode, ex.faultString)
SoftLayer.exceptions.SoftLayerAPIError: SoftLayerAPIError(SoftLayer_Exception_MissingCreationProperty): The property 'operatingSystemReferenceCode' must be set to create an instance of 'SoftLayer_Virtual_Guest'.
Also habe ich mein Skript geändert, um sowohl os_code als auch image_id anzugeben, dann kann ich erfolgreich ein vsi erstellen, aber die Image-Vorlage wird nicht in das vsi geladen.
Können Sie bitte dabei helfen? Vielen Dank.
Get image_id zuerst aus der Ausgabe von ‚slcli Bildliste‘, dann bekommt seine globale ID aus der Ausgabe von ‚slcli Bild Detail‘ –
Muo