~ntt-pf-lab/nova/ipv6-support

« back to all changes in this revision

Viewing changes to nova/volume/driver.py

  • Committer: Koji Iida
  • Date: 2011-01-14 04:59:06 UTC
  • mfrom: (462.1.101 nova)
  • Revision ID: iida.koji@lab.ntt.co.jp-20110114045906-icl181tlvw2vw49q
Merged to rev.563

Show diffs side-by-side

added added

removed removed

Lines of Context:
371
371
    def undiscover_volume(self, volume):
372
372
        """Undiscover volume on a remote host"""
373
373
        pass
 
374
 
 
375
 
 
376
class SheepdogDriver(VolumeDriver):
 
377
    """Executes commands relating to Sheepdog Volumes"""
 
378
 
 
379
    def check_for_setup_error(self):
 
380
        """Returns an error if prerequisites aren't met"""
 
381
        try:
 
382
            (out, err) = self._execute("collie cluster info")
 
383
            if not out.startswith('running'):
 
384
                raise exception.Error(_("Sheepdog is not working: %s") % out)
 
385
        except exception.ProcessExecutionError:
 
386
            raise exception.Error(_("Sheepdog is not working"))
 
387
 
 
388
    def create_volume(self, volume):
 
389
        """Creates a sheepdog volume"""
 
390
        if int(volume['size']) == 0:
 
391
            sizestr = '100M'
 
392
        else:
 
393
            sizestr = '%sG' % volume['size']
 
394
        self._try_execute("qemu-img create sheepdog:%s %s" %
 
395
                          (volume['name'], sizestr))
 
396
 
 
397
    def delete_volume(self, volume):
 
398
        """Deletes a logical volume"""
 
399
        self._try_execute("collie vdi delete %s" % volume['name'])
 
400
 
 
401
    def local_path(self, volume):
 
402
        return "sheepdog:%s" % volume['name']
 
403
 
 
404
    def ensure_export(self, context, volume):
 
405
        """Safely and synchronously recreates an export for a logical volume"""
 
406
        pass
 
407
 
 
408
    def create_export(self, context, volume):
 
409
        """Exports the volume"""
 
410
        pass
 
411
 
 
412
    def remove_export(self, context, volume):
 
413
        """Removes an export for a logical volume"""
 
414
        pass
 
415
 
 
416
    def discover_volume(self, volume):
 
417
        """Discover volume on a remote host"""
 
418
        return "sheepdog:%s" % volume['name']
 
419
 
 
420
    def undiscover_volume(self, volume):
 
421
        """Undiscover volume on a remote host"""
 
422
        pass