~nova-coresec/nova/bexar-translations

« back to all changes in this revision

Viewing changes to nova/compute/computenode.py

  • Committer: Vishvananda Ishaya
  • Date: 2010-07-21 19:42:22 UTC
  • mto: This revision was merged to the branch mainline in revision 178.
  • Revision ID: vishvananda@gmail.com-20100721194222-4bm87ndw25r8dlxb
refactor daemons to use common base class in preparation for network refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
from nova import exception
44
44
from nova import fakevirt
45
45
from nova import flags
 
46
from nova import node
46
47
from nova import process
47
48
from nova import utils
48
49
from nova.compute import disk
49
50
from nova.compute import model
50
51
from nova.compute import network
51
52
from nova.objectstore import image # for image_path flag
52
 
from nova.volume import storage
 
53
from nova.volume import volumenode
53
54
 
54
55
 
55
56
FLAGS = flags.FLAGS
78
79
    return "%s:%s/_images/%s" % (FLAGS.s3_host, FLAGS.s3_port, path)
79
80
 
80
81
 
81
 
class Node(object, service.Service):
 
82
class ComputeNode(node.Node):
82
83
    """
83
84
    Manages the running instances.
84
85
    """
85
86
    def __init__(self):
86
87
        """ load configuration options for this node and connect to libvirt """
87
 
        super(Node, self).__init__()
 
88
        super(ComputeNode, self).__init__()
88
89
        self._instances = {}
89
90
        self._conn = self._get_connection()
90
91
        self.instdir = model.InstanceDirectory()
221
222
    @exception.wrap_exception
222
223
    def attach_volume(self, instance_id = None,
223
224
                      volume_id = None, mountpoint = None):
224
 
        volume = storage.get_volume(volume_id)
 
225
        volume = volumenode.get_volume(volume_id)
225
226
        yield self._init_aoe()
226
227
        yield process.simple_execute(
227
228
                "sudo virsh attach-disk %s /dev/etherd/%s %s" %
242
243
        """ detach a volume from an instance """
243
244
        # despite the documentation, virsh detach-disk just wants the device
244
245
        # name without the leading /dev/
245
 
        volume = storage.get_volume(volume_id)
 
246
        volume = volumenode.get_volume(volume_id)
246
247
        target = volume['mountpoint'].rpartition('/dev/')[2]
247
248
        yield process.simple_execute(
248
249
                "sudo virsh detach-disk %s %s " % (instance_id, target))