~ubuntu-branches/ubuntu/saucy/nova/saucy-proposed

« back to all changes in this revision

Viewing changes to nova/virt/hyperv/volumeutilsV2.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman
  • Date: 2013-02-22 09:27:29 UTC
  • mfrom: (1.1.68)
  • Revision ID: package-import@ubuntu.com-20130222092729-nn3gt8rf97uvts77
Tags: 2013.1.g3-0ubuntu1
[ Chuck Short ]
* New usptream release. 
* debian/patches/debian/patches/fix-ubuntu-tests.patch: Refreshed.
* debian/nova-baremetal.logrotate: Fix logfile path.
* debian/control, debian/nova-spiceproxy.{install, logrotate, upstart}:
  Add spice html5 proxy support.
* debian/nova-novncproxy.upstart: Start on runlevel [2345]
* debian/rules: Call testr directly since run_tests.sh -N gives weird return
  value when tests pass.
* debian/pyddist-overrides: Add websockify.
* debian/nova-common.postinst: Removed config file conversion, since
  the option is no longer available. (LP: #1110567)
* debian/control: Add python-pyasn1 as a dependency.
* debian/control: Add python-oslo-config as a dependency.
* debian/control: Suggest sysfsutils, sg3-utils, multipath-tools for fibre
  channel support.

[ Adam Gandelman ]
* debian/control: Fix typo (websocikfy -> websockify).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
 
#
3
 
# Copyright 2012 Pedro Navarro Perez
4
 
# All Rights Reserved.
5
 
#
6
 
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
7
 
#    not use this file except in compliance with the License. You may obtain
8
 
#    a copy of the License at
9
 
#
10
 
#         http://www.apache.org/licenses/LICENSE-2.0
11
 
#
12
 
#    Unless required by applicable law or agreed to in writing, software
13
 
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
 
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
 
#    License for the specific language governing permissions and limitations
16
 
#    under the License.
17
 
 
18
 
"""
19
 
Helper methods for operations related to the management of volumes,
20
 
and storage repositories for Windows 2012
21
 
"""
22
 
import time
23
 
 
24
 
from nova.openstack.common import cfg
25
 
from nova.openstack.common import log as logging
26
 
from nova.virt.hyperv import basevolumeutils
27
 
 
28
 
LOG = logging.getLogger(__name__)
29
 
CONF = cfg.CONF
30
 
 
31
 
 
32
 
class VolumeUtilsV2(basevolumeutils.BaseVolumeUtils):
33
 
 
34
 
        def __init__(self, conn_storage, conn_wmi):
35
 
            self._conn_storage = conn_storage
36
 
            self._conn_wmi = conn_wmi
37
 
 
38
 
        def login_storage_target(self, target_lun, target_iqn,
39
 
            target_portal):
40
 
            """Add target portal, list targets and logins to the target"""
41
 
            separator = target_portal.find(':')
42
 
            target_address = target_portal[:separator]
43
 
            target_port = target_portal[separator + 1:]
44
 
            #Adding target portal to iscsi initiator. Sending targets
45
 
            portal = self._conn_storage.__getattr__("MSFT_iSCSITargetPortal")
46
 
            portal.New(TargetPortalAddress=target_address,
47
 
                       TargetPortalPortNumber=target_port)
48
 
            #Connecting to the target
49
 
            target = self._conn_storage.__getattr__("MSFT_iSCSITarget")
50
 
            target.Connect(NodeAddress=target_iqn,
51
 
                           IsPersistent=True)
52
 
            #Waiting the disk to be mounted. Research this
53
 
            time.sleep(CONF.hyperv_wait_between_attach_retry)
54
 
 
55
 
        def logout_storage_target(self, target_iqn):
56
 
            """Logs out storage target through its session id """
57
 
 
58
 
            target = self._conn_storage.MSFT_iSCSITarget(
59
 
                    NodeAddress=target_iqn)[0]
60
 
            if target.IsConnected:
61
 
                session = self._conn_storage.MSFT_iSCSISession(
62
 
                        TargetNodeAddress=target_iqn)[0]
63
 
                if session.IsPersistent:
64
 
                    session.Unregister()
65
 
                target.Disconnect()
66
 
 
67
 
        def execute_log_out(self, session_id):
68
 
            session = self._conn_wmi.MSiSCSIInitiator_SessionClass(
69
 
                    SessionId=session_id)[0]
70
 
            self.logout_storage_target(session.TargetName)