Beispiel #1
0
 def detach_disk_from_vm(self, disk_href, disk_type, disk_name, vm_name):
     """
     Detach the independent disk from the VM with the given name in the vApp within a Virtual Data Center.
     :param disk_href: (str): The href of the disk resource.
     :param vm_name: (str): The name of the VM.
     :return: (vmType)  A :class:`lxml.objectify.StringElement` object describing the requested VM.
     """  # NOQA
     if self.resource is None:
         self.resource = self.client.get_resource(self.href)
     disk_attach_or_detach_params = E.DiskAttachOrDetachParams(
         E.Disk(type=disk_type, href=disk_href))
     vm = self.get_vm(vm_name)
     return self.client.post_linked_resource(
         vm, RelationType.DISK_DETACH,
         EntityType.DISK_ATTACH_DETACH_PARAMS.value,
         disk_attach_or_detach_params)
Beispiel #2
0
    def detach_disk_from_vm(self, disk_href, vm_name):
        """Detach the independent disk from the VM with the given name.

        :param disk_href: (str): The href of the disk to be detached.
        :param vm_name: (str): The name of the VM to which the disk
            will be detached.

        :return:  A :class:`lxml.objectify.StringElement` object describing
            the asynchronous Task of detaching the disk.

        :raises: Exception: If the named VM cannot be located or another error
            occurs.
        """
        disk_attach_or_detach_params = E.DiskAttachOrDetachParams(
            E.Disk(type=EntityType.DISK.value, href=disk_href))
        vm = self.get_vm(vm_name)
        return self.client.post_linked_resource(
            vm, RelationType.DISK_DETACH,
            EntityType.DISK_ATTACH_DETACH_PARAMS.value,
            disk_attach_or_detach_params)
Beispiel #3
0
    def detach_disk_from_vm(self, disk_href, vm_name):
        """Detach the independent disk from the vm with the given name.

        :param str disk_href: href of the disk to be detached.
        :param str vm_name: name of the vm to which the disk will be detached.

        :return: an object containing EntityType.TASK XML data which represents
            the asynchronous task of dettaching the disk.

        :rtype: lxml.objectify.ObjectifiedElement

        :raises: EntityNotFoundException: if the named vm or disk cannot be
            located.
        """
        disk_attach_or_detach_params = E.DiskAttachOrDetachParams(
            E.Disk(type=EntityType.DISK.value, href=disk_href))
        vm = self.get_vm(vm_name)
        return self.client.post_linked_resource(
            vm, RelationType.DISK_DETACH,
            EntityType.DISK_ATTACH_DETACH_PARAMS.value,
            disk_attach_or_detach_params)