问题
I am following the IBM Cloud infrastructure (ibmcloud sl) cli documentation at https://console.bluemix.net/docs/cli/reference/softlayer/index.html#sl_vs_create to create a new virtual server. I am using the latest version 0.7.0.
I want to read userdata from file, so I tried options -F and --userfile.
Both options give me the same error
"SoftLayer_Virtual_Guest_Strategy_Behavior_Standard::setUserMetadata is not implemented. (HTTP 500)".
Below is the full input and output:
~$ ibmcloud sl vs create --hostname node --domain mydomain.com --flavor B1_4X8X100 --datacenter syd04 --os CENTOS_7_64 --billing hourly --san --network 1000 -k 1111293 -k 1111295 -k 1111119 -F /Users/user/mycluster.sh
This action will incur charges on your account. Continue?> y
name value
ID 55627589
FQDN node.mydomain.com
created 2018-06-06T05:05:15Z
guid f67ced88-77dc-45f0-84df-8e5b1cca6f6c
Failed to update the user data of virtual server instance: 55627589.
SoftLayer_Exception_NotImplemented: SoftLayer_Virtual_Guest_Strategy_Behavior_Standard::setUserMetadata is not implemented. (HTTP 500)
Has anyone got this working? Thanks.
回答1:
By default the ibmcloud sl uses the SoftLayer endpoint https://api.softlayer.com/rest/v3.1
to perform API calls, see here about this https://console.bluemix.net/docs/cli/reference/softlayer/index.html#sl_init
And it seems there is an issue in the ibmcloud sl because the service and method that is calling doesn't exists:
SoftLayer_Virtual_Guest_Strategy_Behavior_Standard::setUserMetadata
The available services and datatypes in the SoftLayer API are listed here https://softlayer.github.io/reference/softlayerapi/
As a suggestion you can try by using the CLI command provided by SoftLayer developers which is called SLCLI, you can find documentation here:
https://softlayer-python.readthedocs.io/en/latest/cli/vs.html
https://github.com/softlayer/softlayer-python
Bellow are the options you can use when creating a virtual guest:
$slcli virtual create --help
Usage: slcli virtual create [OPTIONS]
Order/create virtual servers.
Options:
-H, --hostname TEXT Host portion of the FQDN [required]
-D, --domain TEXT Domain portion of the FQDN [required]
-c, --cpu INTEGER Number of CPU cores (not available with
flavors)
-m, --memory INTEGER Memory in mebibytes (not available with
flavors)
-f, --flavor TEXT Public Virtual Server flavor key name
-d, --datacenter TEXT Datacenter shortname [required]
-o, --os TEXT OS install code. Tip: you can specify
<OS>_LATEST
--image TEXT Image ID. See: 'slcli image list' for
reference
--boot-mode TEXT Specify the mode to boot the OS in.
Supported modes are HVM and PV.
--billing [hourly|monthly] Billing rate [default: hourly]
--dedicated / --public Create a Dedicated Virtual Server
--host-id INTEGER Host Id to provision a Dedicated Host
Virtual Server onto
--san Use SAN storage instead of local disk.
--test Do not actually create the virtual server
--export PATH Exports options to a template file
-i, --postinstall TEXT Post-install script to download
-k, --key TEXT SSH keys to add to the root user (multiple
occurrence permitted)
--disk TEXT Disk sizes (multiple occurrence permitted)
--private Forces the VS to only have access the
private network
--like TEXT Use the configuration from an existing VS
-n, --network TEXT Network port speed in Mbps
-g, --tag TEXT Tags to add to the instance (multiple
occurrence permitted)
-t, --template PATH A template file that defaults the command-
line options
-u, --userdata TEXT User defined metadata string
-F, --userfile PATH Read userdata from file
--vlan-public INTEGER The ID of the public VLAN on which you want
the virtual server placed
--vlan-private INTEGER The ID of the private VLAN on which you want
the virtual server placed
-S, --public-security-group TEXT
Security group ID to associate with the
public interface (multiple occurrence
permitted)
-s, --private-security-group TEXT
Security group ID to associate with the
private interface (multiple occurrence
permitted)
--wait INTEGER Wait until VS is finished provisioning for
up to X seconds before returning
-h, --help Show this message and exit.
See 'slcli vs create-options' for valid options
来源:https://stackoverflow.com/questions/50712645/ibm-cloud-infrastructure-cli-error-setusermetadata-is-not-implemented