Github user alexandrelimassantana commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1464#discussion_r58739597
  
    --- Diff: tools/marvin/marvin/lib/vcenter.py ---
    @@ -183,7 +192,157 @@ def get_clusters(self, dc, clus=None):
             """
             pass
     
    +    def create_datacenter(self, dcname=None, service_instance=None, 
folder=None):
    +        """
    +        Creates a new datacenter with the given name.
    +        Any % (percent) character used in this name parameter must be 
escaped,
    +        unless it is used to start an escape sequence. Clients may also 
escape
    +        any other characters in this name parameter.
    +
    +        An entity name must be a non-empty string of
    +        less than 80 characters. The slash (/), backslash (\) and percent 
(%)
    +        will be escaped using the URL syntax. For example, %2F
    +
    +        This can raise the following exceptions:
    +        vim.fault.DuplicateName
    +        vim.fault.InvalidName
    +        vmodl.fault.NotSupported
    +        vmodl.fault.RuntimeFault
    +        ValueError raised if the name len is > 79
    +        https://github.com/vmware/pyvmomi/blob/master/docs/vim/Folder.rst
    +
    +        Required Privileges
    +        Datacenter.Create
    +
    +        :param folder: Folder object to create DC in. If None it will 
default to
    +                       rootFolder
    +        :param dcname: Name for the new datacenter.
    +        :param service_instance: ServiceInstance connection to a given 
vCenter
    +        :return:
    +        """
    +        if len(dcname) > 79:
    +            raise ValueError("The name of the datacenter must be under "
    +                             "80 characters.")
    +
    +        if folder is None:
    +            folder = self.service_instance.content.rootFolder
    +
    +        if folder is not None and isinstance(folder, vim.Folder):
    +            dc_moref = folder.CreateDatacenter(name=dcname)
    --- End diff --
    
    got it. The code looks good, those were the only doubts I had. I would just 
use a Semaphore in line 317, but sleep an pool is not that bad also.
    
    The code seems fine, but tests are needed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to