[
https://issues.apache.org/jira/browse/LIBCLOUD-371?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13744822#comment-13744822
]
Sengor Kusturica commented on LIBCLOUD-371:
-------------------------------------------
This is a typical case of "15 characters ought to be enough for anybody",
except not for certain use cases.
Submitter is correct, there are different Computer Name limits. These are
constrained by vCloud depending on OS type and are documented here
http://kb.vmware.com/kb/2011305 (NetBIOS limit is applicable to Windows).
In vCloud Director terminology all of the following are mutually exclusive:
- vApp Name (virtually unlimited)
- VM Name (virtually unlimited)
- Computer Name (limited as per KB, this becomes the guest OS hostname and is
what libcloud vCloud driver verifies)
API does eventually fail during calls without the libcloud verification as
follows:
For Windows VM with >15 char Computer Name:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "libcloud/compute/drivers/vcloud.py", line 1400, in create_node
self._change_vm_names(vapp_href, ex_vm_names)
File "libcloud/compute/drivers/vcloud.py", line 1664, in _change_vm_names
headers={'Content-Type':
'application/vnd.vmware.vcloud.guestCustomizationSection+xml'}
File "libcloud/compute/drivers/vcloud.py", line 316, in request
return super(VCloudConnection, self).request(*args, **kwargs)
File "libcloud/common/base.py", line 609, in request
connection=self)
File "libcloud/common/base.py", line 93, in __init__
raise Exception(self.parse_error())
Exception: <Element {http://www.vmware.com/vcloud/v1.5}Error at 1df7c20>
<?xml version="1.0" encoding="UTF-8"?>
<Error xmlns="http://www.vmware.com/vcloud/v1.5" minorErrorCode="BAD_REQUEST"
message="Invalid computer name: Computer name cannot be longer than 15
characters." majorErrorCode="400"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5
http://iad.vcloudservice.vmware.com/api/v1.5/schema/master.xsd"></Error>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Similar results for Linux hosts with >63 char Computer Name:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> l = conn.create_node(name="pytestlin", image=images[1], ex_deploy=False,
>>> ex_vm_names=["abcdefghijklmnoprstuvzxyewqrrtewtsdfgdsgdfgdfsgsdfgdfsgdfsgdfsrr"])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "libcloud/compute/drivers/vcloud.py", line 1400, in create_node
self._change_vm_names(vapp_href, ex_vm_names)
File "libcloud/compute/drivers/vcloud.py", line 1664, in _change_vm_names
headers={'Content-Type':
'application/vnd.vmware.vcloud.guestCustomizationSection+xml'}
File "libcloud/compute/drivers/vcloud.py", line 316, in request
return super(VCloudConnection, self).request(*args, **kwargs)
File "libcloud/common/base.py", line 609, in request
connection=self)
File "libcloud/common/base.py", line 93, in __init__
raise Exception(self.parse_error())
Exception: <Element {http://www.vmware.com/vcloud/v1.5}Error at 1077908>
<?xml version="1.0" encoding="UTF-8"?>
<Error xmlns="http://www.vmware.com/vcloud/v1.5" minorErrorCode="BAD_REQUEST"
message="Invalid computer name: Computer name cannot be longer than 63
characters." majorErrorCode="400"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5
http://iad.vcloudservice.vmware.com/api/v1.5/schema/master.xsd"></Error>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Now there are a few ways of going about this:
#1 In my opinion preemptive failure detection within the libcloud client side
is preferred to waiting on the web service API error. This both saves user time
as well as prevents manual cleanup of vApps (try/fail/clean/retry). The
downside of this is; more complexity kept in the libcloud vCloud driver and
longevity of such code. Hence independent char length checks depending on the
guest OS type. I suspect the char limits are unlikely to change with future
versions of vCloud Director so the code should be quite static.
#2 Remove the check entirely as Tomaz suggested and let it fall through to the
web service API. This exposes a penalty for the user to wait until web service
responds (much slower compared to #1 above).
#3 Change the current code from '15' to '63' char limit in preference of Linux
guests and assume Windows guests will have to wait for web service API errors.
Is there a convention libcloud takes given the options above?
PS: In either of the cases vCloud driver exception reporting should be enhanced
to display the 'message' field from the XML reply payload. This should be a
separate JIRA...
> vcloud.py:1414 restricts vm names to 15 chars, however, this limitation is
> windows only.
> ----------------------------------------------------------------------------------------
>
> Key: LIBCLOUD-371
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-371
> Project: Libcloud
> Issue Type: Bug
> Components: Compute, Core
> Affects Versions: 0.12.3
> Environment: LibCloud 0.13
> Reporter: Brian Mingus
> Original Estimate: 5m
> Remaining Estimate: 5m
>
> vcloud.py:1514 if len(name) > 15: raise ValueError('The VM name "' + name +
> '" is too long for the computer name (max 15 chars allowed).')
> This is only true for windows.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira