~ubuntu-branches/ubuntu/vivid/ironic/vivid-updates

« back to all changes in this revision

Viewing changes to ironic/drivers/modules/agent_client.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2015-03-30 11:14:57 UTC
  • mfrom: (1.2.6)
  • Revision ID: package-import@ubuntu.com-20150330111457-kr4ju3guf22m4vbz
Tags: 2015.1~b3-0ubuntu1
* New upstream release.
  + d/control: 
    - Align with upstream dependencies.
    - Add dh-python to build-dependencies.
    - Add psmisc as a dependency. (LP: #1358820)
  + d/p/fix-requirements.patch: Rediffed.
  + d/ironic-conductor.init.in: Fixed typos in LSB headers,
    thanks to JJ Asghar. (LP: #1429962)

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
        res = self.session.get(url, headers=headers)
82
82
        return res.json()['commands']
83
83
 
84
 
    def deploy_is_done(self, node):
85
 
        commands = self.get_commands_status(node)
86
 
        if not commands:
87
 
            return False
88
 
 
89
 
        last_command = commands[-1]
90
 
 
91
 
        if last_command['command_name'] != 'prepare_image':
92
 
            # catches race condition where prepare_image is still processing
93
 
            # so deploy hasn't started yet
94
 
            return False
95
 
 
96
 
        if last_command['command_status'] != 'RUNNING':
97
 
            return True
98
 
 
99
 
        return False
100
 
 
101
84
    def prepare_image(self, node, image_info, wait=False):
102
85
        """Call the `prepare_image` method on the node."""
103
86
        LOG.debug('Preparing image %(image)s on node %(node)s.',
114
97
                             method='standby.prepare_image',
115
98
                             params=params,
116
99
                             wait=wait)
 
100
 
 
101
    def start_iscsi_target(self, node, iqn):
 
102
        """Expose the node's disk as an ISCSI target."""
 
103
        params = {'iqn': iqn}
 
104
        return self._command(node=node,
 
105
                             method='iscsi.start_iscsi_target',
 
106
                             params=params,
 
107
                             wait=True)
 
108
 
 
109
    def install_bootloader(self, node, root_uuid, efi_system_part_uuid=None):
 
110
        """Install a boot loader on the image."""
 
111
        params = {'root_uuid': root_uuid,
 
112
                  'efi_system_part_uuid': efi_system_part_uuid}
 
113
        return self._command(node=node,
 
114
                             method='image.install_bootloader',
 
115
                             params=params,
 
116
                             wait=True)
 
117
 
 
118
    def get_clean_steps(self, node, ports):
 
119
        params = {
 
120
            'node': node.as_dict(),
 
121
            'ports': [port.as_dict() for port in ports]
 
122
        }
 
123
        return self._command(node=node,
 
124
                             method='clean.get_clean_steps',
 
125
                             params=params,
 
126
                             wait=True)
 
127
 
 
128
    def execute_clean_step(self, step, node, ports):
 
129
        params = {
 
130
            'step': step,
 
131
            'node': node.as_dict(),
 
132
            'ports': [port.as_dict() for port in ports],
 
133
            'clean_version': node.driver_internal_info.get(
 
134
                'hardware_manager_version')
 
135
        }
 
136
        return self._command(node=node,
 
137
                             method='clean.execute_clean_step',
 
138
                             params=params,
 
139
                             wait=False)