author | Drew Fisher <drew.fisher@oracle.com> |
Tue, 16 Aug 2011 10:06:20 -0600 | |
changeset 1390 | b05ba57bf117 |
parent 1355 | 7e6507b2a970 |
permissions | -rw-r--r-- |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
2 |
# |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
4 |
# |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
8 |
# |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
12 |
# and limitations under the License. |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
13 |
# |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
19 |
# |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
21 |
# |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
22 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
23 |
# |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
24 |
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
25 |
# |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
26 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
27 |
""" test_shadow_list.py - collection of unittests for testing target validation |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
28 |
through shadow list manipulation |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
29 |
""" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
30 |
import copy |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
31 |
import platform |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
32 |
import unittest |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
33 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
34 |
from nose.plugins.skip import SkipTest |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
35 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
36 |
import osol_install.errsvc as errsvc |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
37 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
38 |
from osol_install.liberrsvc import ES_DATA_EXCEPTION |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
39 |
|
1313
17a0d5349bd5
7069542 slim_install_unit tests are failing on osol-bldx due to rpool name
Drew Fisher <drew.fisher@oracle.com>
parents:
1253
diff
changeset
|
40 |
from solaris_install import Popen |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
41 |
from solaris_install.target import Target |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
42 |
from solaris_install.target.physical import Disk, DiskGeometry, DiskProp, \ |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
43 |
Slice, Partition |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
44 |
from solaris_install.target.libadm.const import MAX_EXT_PARTS, V_NUMPAR |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
45 |
from solaris_install.target.logical import BE, Logical, Vdev, Zpool |
1156
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
46 |
from solaris_install.target.shadow.physical import LOGICAL_ADJUSTMENT, \ |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
47 |
ShadowPhysical |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
48 |
from solaris_install.target.shadow.logical import ShadowLogical |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
49 |
from solaris_install.target.shadow.zpool import ShadowZpool |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
50 |
from solaris_install.target.size import Size |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
51 |
from solaris_install.target.vdevs import _get_vdev_mapping |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
52 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
53 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
54 |
GBSECTOR = long(1024 * 1024 * 1024 / 512) # 1 GB of sectors |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
55 |
BLOCKSIZE = 512 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
56 |
CYLSIZE = 16065 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
57 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
58 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
59 |
class TestZpool(unittest.TestCase): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
60 |
""" test case to test manipulation of Zpool objects via the API and shadow |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
61 |
list interfaces |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
62 |
""" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
63 |
def setUp(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
64 |
# create DOC objects |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
65 |
self.target = Target("target") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
66 |
self.logical = Logical("logical") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
67 |
self.target.insert_children(self.logical) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
68 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
69 |
# reset the errsvc |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
70 |
errsvc.clear_error_list() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
71 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
72 |
def tearDown(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
73 |
self.target.delete_children() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
74 |
self.target.delete() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
75 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
76 |
# reset the errsvc |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
77 |
errsvc.clear_error_list() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
78 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
79 |
def test_add_simple_zpool(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
80 |
# create a DOC tree |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
81 |
self.logical.add_zpool("test_zpool") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
82 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
83 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
84 |
def test_add_duplicate_zpool_names(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
85 |
self.logical.add_zpool("test_zpool") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
86 |
self.logical.add_zpool("test_zpool") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
87 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
88 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
89 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
90 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
91 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
92 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
93 |
ShadowZpool.DuplicateZpoolNameError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
94 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
95 |
def test_add_two_root_pools(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
96 |
self.logical.add_zpool("test_zpool", is_root=True) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
97 |
self.logical.add_zpool("test_zpool2", is_root=True) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
98 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
99 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
100 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
101 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
102 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
103 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
104 |
ShadowZpool.TooManyRootPoolsError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
105 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
106 |
def test_add_overlapping_mountpoints(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
107 |
self.logical.add_zpool("test_zpool", mountpoint="/foo") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
108 |
self.logical.add_zpool("test_zpool2", mountpoint="/foo/bar") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
109 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
110 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
111 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
112 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
113 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
114 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
115 |
ShadowZpool.DuplicateMountpointError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
116 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
117 |
def test_delete_zpool(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
118 |
zpool1 = self.logical.add_zpool("test_zpool") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
119 |
zpool2 = self.logical.add_zpool("test_zpool2") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
120 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
121 |
# verify there are 2 entries in the _children list |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
122 |
self.assertEqual(len(self.logical._children), 2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
123 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
124 |
# delete zpool2 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
125 |
zpool2.delete() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
126 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
127 |
# verify there is only one entry in the _children list and the proper |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
128 |
# zpool was removed |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
129 |
self.assertEqual(len(self.logical._children), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
130 |
self.assertEqual(self.logical._children[0].name, "test_zpool") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
131 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
132 |
# delete zpool1 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
133 |
zpool1.delete() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
134 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
135 |
# verify there are no entries in the _children list |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
136 |
self.assertFalse(self.logical._children) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
137 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
138 |
def test_delete_zpool_twice(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
139 |
zpool = self.logical.add_zpool("test_zpool") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
140 |
self.logical.delete_zpool(zpool) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
141 |
self.assertFalse(self.logical._children) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
142 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
143 |
# try to delete the zpool again. |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
144 |
self.logical.delete_zpool(zpool) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
145 |
self.assertFalse(self.logical._children) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
146 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
147 |
def test_delete_zpool_from_logical(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
148 |
zpool1 = self.logical.add_zpool("test_zpool") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
149 |
zpool2 = self.logical.add_zpool("test_zpool2") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
150 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
151 |
# verify there are 2 entries in the _children list |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
152 |
self.assertEqual(len(self.logical._children), 2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
153 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
154 |
# delete zpool2 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
155 |
self.logical.delete_zpool(zpool2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
156 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
157 |
# verify there is only one entry in the _children list and the proper |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
158 |
# zpool was removed |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
159 |
self.assertEqual(len(self.logical._children), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
160 |
self.assertEqual(self.logical._children[0].name, "test_zpool") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
161 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
162 |
def test_add_vdev(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
163 |
# create a zpool and a vdev |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
164 |
zpool = self.logical.add_zpool("test_zpool") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
165 |
zpool.add_vdev(label="test_vdev", redundancy="mirror") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
166 |
self.assertTrue(zpool.get_descendants(class_type=Vdev)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
167 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
168 |
def test_delete_vdev(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
169 |
# create a zpool and two vdevs |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
170 |
zpool = self.logical.add_zpool("test_zpool") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
171 |
vdev1 = zpool.add_vdev(label="test_vdev1", redundancy="mirror") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
172 |
vdev2 = zpool.add_vdev(label="test_vdev2", redundancy="raidz") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
173 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
174 |
# verify there are two vdevs |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
175 |
self.assertEqual(len(zpool.get_descendants(class_type=Vdev)), 2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
176 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
177 |
# delete vdev2 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
178 |
zpool.delete_vdev(vdev2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
179 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
180 |
# verify there is only one vdev |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
181 |
self.assertEqual(len(zpool.get_descendants(class_type=Vdev)), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
182 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
183 |
# delete vdev1 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
184 |
zpool.delete_vdev(vdev1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
185 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
186 |
# verify there are no vdevs |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
187 |
self.assertFalse(zpool.get_descendants(class_type=Vdev)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
188 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
189 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
190 |
class TestZFSFilesystem(unittest.TestCase): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
191 |
""" test case to test the manipulation of ZFS filesystems via the API and |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
192 |
shadow list interface. |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
193 |
""" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
194 |
def setUp(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
195 |
self.zpool = Zpool("zpool") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
196 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
197 |
# reset the errsvc |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
198 |
errsvc.clear_error_list() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
199 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
200 |
def tearDown(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
201 |
self.zpool.delete_children() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
202 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
203 |
# reset the errsvc |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
204 |
errsvc.clear_error_list() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
205 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
206 |
def test_add_simple_filesystem(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
207 |
self.zpool.add_filesystem("test_filesystem") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
208 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
209 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
210 |
def test_add_simple_filesystem_with_mountpoint(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
211 |
self.zpool.add_filesystem("test_filesystem", "/mountpoint") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
212 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
213 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
214 |
def test_add_duplicate_filesystem_names(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
215 |
self.zpool.add_filesystem("test_filesystem") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
216 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
217 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
218 |
self.zpool.add_filesystem("test_filesystem") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
219 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
220 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
221 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
222 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
223 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
224 |
ShadowLogical.DuplicateDatasetNameError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
225 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
226 |
def test_add_duplicate_mountpoints(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
227 |
self.zpool.add_filesystem("test_filesystem", "/a") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
228 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
229 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
230 |
self.zpool.add_filesystem("test_filesystem_2", "/a") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
231 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
232 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
233 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
234 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
235 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
236 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
237 |
ShadowLogical.DuplicateMountpointError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
238 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
239 |
def test_delete_filesystem(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
240 |
fs1 = self.zpool.add_filesystem("test_filesystem1") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
241 |
fs2 = self.zpool.add_filesystem("test_filesystem2") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
242 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
243 |
# verify there are 2 entries in _children |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
244 |
self.assertEqual(len(self.zpool._children), 2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
245 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
246 |
# delete fs2 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
247 |
fs2.delete() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
248 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
249 |
# verify there is only one entry in the _children list and the proper |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
250 |
# fs was removed |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
251 |
self.assertEqual(len(self.zpool._children), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
252 |
self.assertEqual(self.zpool._children[0].name, "test_filesystem1") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
253 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
254 |
# delete fs1 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
255 |
fs1.delete() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
256 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
257 |
# verify there are no entries in _children |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
258 |
self.assertFalse(self.zpool._children) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
259 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
260 |
def test_delete_filesystem_from_zpool(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
261 |
fs1 = self.zpool.add_filesystem("test_filesystem1") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
262 |
fs2 = self.zpool.add_filesystem("test_filesystem2") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
263 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
264 |
# verify there are 2 entries in the _children list |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
265 |
self.assertEqual(len(self.zpool._children), 2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
266 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
267 |
# delete zpool2 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
268 |
self.zpool.delete_filesystem(fs2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
269 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
270 |
# verify there is only one entry in the _children list and the proper |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
271 |
# zpool was removed |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
272 |
self.assertEqual(len(self.zpool._children), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
273 |
self.assertEqual(self.zpool._children[0].name, "test_filesystem1") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
274 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
275 |
# delete zpool2 again |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
276 |
self.zpool.delete_filesystem(fs2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
277 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
278 |
# verify there is only one entry in the _children list and the proper |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
279 |
# zpool was removed |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
280 |
self.assertEqual(len(self.zpool._children), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
281 |
self.assertEqual(self.zpool._children[0].name, "test_filesystem1") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
282 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
283 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
284 |
class TestZvol(unittest.TestCase): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
285 |
""" test case to test the manipulation of Zvols via the API and |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
286 |
shadow list interface. |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
287 |
""" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
288 |
def setUp(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
289 |
self.target = Target("target") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
290 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
291 |
# create a disk object |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
292 |
self.disk = Disk("test disk") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
293 |
self.disk.in_zpool = "zpool" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
294 |
self.disk.ctd = "c12345t0d0" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
295 |
self.disk.geometry = DiskGeometry(BLOCKSIZE, CYLSIZE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
296 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
297 |
# 250GB disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
298 |
self.disk.disk_prop = DiskProp() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
299 |
self.disk.disk_prop.dev_size = Size( |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
300 |
str(GBSECTOR * 250) + Size.sector_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
301 |
self.disk.disk_prop.blocksize = BLOCKSIZE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
302 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
303 |
self.logical = Logical("logical") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
304 |
self.zpool = Zpool("zpool") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
305 |
self.logical.insert_children(self.zpool) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
306 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
307 |
self.target.insert_children([self.disk, self.logical]) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
308 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
309 |
# reset the errsvc |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
310 |
errsvc.clear_error_list() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
311 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
312 |
def tearDown(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
313 |
self.logical.delete_children() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
314 |
self.logical.delete() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
315 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
316 |
# reset the errsvc |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
317 |
errsvc.clear_error_list() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
318 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
319 |
def test_add_simple_zvol(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
320 |
self.zpool.add_zvol("test_zvol", "10") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
321 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
322 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
323 |
def test_add_duplicate_zvol_names(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
324 |
self.zpool.add_zvol("test_zvol", "10") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
325 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
326 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
327 |
self.zpool.add_zvol("test_zvol", "10") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
328 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
329 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
330 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
331 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
332 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
333 |
ShadowLogical.DuplicateDatasetNameError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
334 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
335 |
def test_delete_zvol(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
336 |
zvol1 = self.zpool.add_zvol("zvol1", "10") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
337 |
zvol2 = self.zpool.add_zvol("zvol2", "10") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
338 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
339 |
# verify there are 2 entries in the _children list |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
340 |
self.assertEqual(len(self.zpool._children), 2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
341 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
342 |
# delete zvol2 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
343 |
zvol2.delete() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
344 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
345 |
# verify there is only one entry in the _children list and the proper |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
346 |
# zvol was removed |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
347 |
self.assertEqual(len(self.zpool._children), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
348 |
self.assertEqual(self.zpool._children[0].name, "zvol1") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
349 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
350 |
def test_delete_zvol_from_zpool(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
351 |
zvol1 = self.zpool.add_zvol("zvol1", "10") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
352 |
zvol2 = self.zpool.add_zvol("zvol2", "10") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
353 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
354 |
# verify there are 2 entries in the _children list |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
355 |
self.assertEqual(len(self.zpool._children), 2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
356 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
357 |
# delete zvol2 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
358 |
self.zpool.delete_zvol(zvol2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
359 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
360 |
# verify there is only one entry in the _children list and the proper |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
361 |
# zvol was removed |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
362 |
self.assertEqual(len(self.zpool._children), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
363 |
self.assertEqual(self.zpool._children[0].name, "zvol1") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
364 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
365 |
def test_resize_zvol(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
366 |
zvol = self.zpool.add_zvol("zvol1", "10") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
367 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
368 |
# verify the size is 10gb |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
369 |
self.assertEqual(self.zpool._children[0].size, "10g") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
370 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
371 |
# resize it to 20gb |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
372 |
zvol.resize("20", Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
373 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
374 |
# verify the size is 20gb |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
375 |
self.assertEqual(self.zpool._children[0].size, "20g") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
376 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
377 |
def test_swap_zvol_with_noswap_set(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
378 |
self.logical.noswap = True |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
379 |
zvol = self.zpool.add_zvol("swap_zvol", "10", Size.gb_units, "swap") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
380 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
381 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
382 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
383 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
384 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
385 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
386 |
ShadowLogical.NoswapMismatchError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
387 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
388 |
def test_dump_zvol_with_nodump_set(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
389 |
self.logical.nodump = True |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
390 |
zvol = self.zpool.add_zvol("dump_zvol", "10", Size.gb_units, "dump") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
391 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
392 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
393 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
394 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
395 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
396 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
397 |
ShadowLogical.NodumpMismatchError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
398 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
399 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
400 |
class TestPartition(unittest.TestCase): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
401 |
def setUp(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
402 |
self.disk = Disk("test disk") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
403 |
self.disk.ctd = "c12345t0d0" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
404 |
self.disk.geometry = DiskGeometry(BLOCKSIZE, CYLSIZE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
405 |
self.disk.label = "VTOC" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
406 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
407 |
# 100GB disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
408 |
self.disk.disk_prop = DiskProp() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
409 |
self.disk.disk_prop.dev_size = Size( |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
410 |
str(GBSECTOR * 100) + Size.sector_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
411 |
self.disk.disk_prop.blocksize = BLOCKSIZE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
412 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
413 |
# reset the errsvc |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
414 |
errsvc.clear_error_list() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
415 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
416 |
def tearDown(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
417 |
self.disk.delete_children() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
418 |
self.disk.delete() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
419 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
420 |
# reset the errsvc |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
421 |
errsvc.clear_error_list() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
422 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
423 |
def test_add_single_partition(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
424 |
self.disk.add_partition(1, 0, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
425 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
426 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
427 |
def test_duplicate_partition(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
428 |
# add 2 1GB partition with the same index but different starting sector |
1247
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
429 |
self.disk.add_partition(1, 0, 1, Size.gb_units) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
430 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
431 |
# account for the first silce moving from a start_sector of 0 to |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
432 |
# CYLSIZE |
1247
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
433 |
self.disk.add_partition(1, CYLSIZE + GBSECTOR + 1, 1, |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
434 |
Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
435 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
436 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
437 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
438 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
439 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
440 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
441 |
ShadowPhysical.DuplicatePartitionNameError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
442 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
443 |
def test_overlapping_starting_sector(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
444 |
# add a 10 GB disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
445 |
self.disk.add_partition(0, CYLSIZE, 10, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
446 |
# add an 11 GB disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
447 |
self.disk.add_partition(1, CYLSIZE, 11, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
448 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
449 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
450 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
451 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
452 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
453 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
454 |
ShadowPhysical.OverlappingPartitionError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
455 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
456 |
def test_overlapping_ending_sector(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
457 |
# add a 9 GB disk on the second cylinder boundary |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
458 |
self.disk.add_partition(0, CYLSIZE * 2, 9, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
459 |
# add a 10 GB disk on the first cylinder boundary |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
460 |
self.disk.add_partition(1, CYLSIZE, 10, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
461 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
462 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
463 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
464 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
465 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
466 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
467 |
ShadowPhysical.OverlappingPartitionError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
468 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
469 |
def test_add_two_extended_partitions(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
470 |
# add 2 1GB partitions |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
471 |
self.disk.add_partition(1, 0, 1, Size.gb_units, |
1247
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
472 |
partition_type=Partition.name_to_num("WIN95 Extended(LBA)")) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
473 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
474 |
# account for the first silce moving from a start_sector of 0 to |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
475 |
# CYLSIZE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
476 |
self.disk.add_partition(2, CYLSIZE + GBSECTOR + 1, 1, Size.gb_units, |
1247
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
477 |
partition_type=Partition.name_to_num("WIN95 Extended(LBA)")) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
478 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
479 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
480 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
481 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
482 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
483 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
484 |
ShadowPhysical.TooManyExtPartitionsError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
485 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
486 |
def test_delete_partition(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
487 |
p1 = self.disk.add_partition(1, 0, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
488 |
p2 = self.disk.add_partition(2, GBSECTOR + 1, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
489 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
490 |
# verify there are 2 entries in the _children |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
491 |
self.assertEqual(len(self.disk._children), 2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
492 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
493 |
# delete partition 2 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
494 |
p2.delete() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
495 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
496 |
# verify there is only one entry in the _children and the proper |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
497 |
# partition was removed. |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
498 |
self.assertEqual(len(self.disk._children), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
499 |
self.assertEqual(self.disk._children[0].name, 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
500 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
501 |
def test_delete_partition_with_slice_children(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
502 |
# add a 10gb partition |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
503 |
p1 = self.disk.add_partition(1, 0, 10, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
504 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
505 |
# add two slices |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
506 |
p1.add_slice(0, CYLSIZE, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
507 |
p1.add_slice(1, GBSECTOR + CYLSIZE + 1, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
508 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
509 |
# delete the partition |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
510 |
p1.delete() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
511 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
512 |
# verify there are no errors |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
513 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
514 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
515 |
# verify the _children is empty |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
516 |
self.assertFalse(self.disk._children) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
517 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
518 |
def test_delete_partition_from_disk(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
519 |
p1 = self.disk.add_partition(1, 0, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
520 |
p2 = self.disk.add_partition(2, GBSECTOR + 1, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
521 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
522 |
# verify there are 2 entries in the _children |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
523 |
self.assertEqual(len(self.disk._children), 2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
524 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
525 |
# delete partition 2 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
526 |
self.disk.delete_partition(p2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
527 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
528 |
# verify there is only one entry in the _children and the proper |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
529 |
# partition was removed. |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
530 |
self.assertEqual(len(self.disk._children), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
531 |
self.assertEqual(self.disk._children[0].name, 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
532 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
533 |
def test_resize_partition(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
534 |
# create a 1 GB partition |
1205
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
535 |
p1 = self.disk.add_partition(1, CYLSIZE, 1, Size.gb_units) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
536 |
self.disk.insert_children(p1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
537 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
538 |
# verify the size of the slice is 1 GB of sectors, rounded for CYLSIZE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
539 |
self.assertEqual(p1.size.sectors, (GBSECTOR / CYLSIZE) * CYLSIZE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
540 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
541 |
# resize it to 5 GB |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
542 |
new_p1 = p1.resize(5, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
543 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
544 |
# verify the size of the partition is 5 GB of sectors |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
545 |
self.assertEqual(new_p1.size.sectors, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
546 |
((5 * GBSECTOR) / CYLSIZE * CYLSIZE)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
547 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
548 |
def test_in_zpool_conflict_with_parent(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
549 |
# set the in_zpool attribute in the disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
550 |
self.disk.in_zpool = "tank" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
551 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
552 |
# create a 1 GB partition |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
553 |
p1 = self.disk.add_partition(1, 0, 1, Size.gb_units, in_zpool="tank") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
554 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
555 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
556 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
557 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
558 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
559 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
560 |
ShadowPhysical.OverlappingPartitionZpoolError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
561 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
562 |
def test_in_vdev_conflict_with_parent(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
563 |
# set the in_vdev attribute in the disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
564 |
self.disk.in_vdev = "a label" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
565 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
566 |
# create a 1 GB partition |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
567 |
self.disk.add_partition(1, 0, 1, Size.gb_units, in_vdev="a label") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
568 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
569 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
570 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
571 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
572 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
573 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
574 |
ShadowPhysical.OverlappingPartitionVdevError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
575 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
576 |
def test_change_type(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
577 |
p = self.disk.add_partition(1, 0, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
578 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
579 |
self.assertEqual(p.part_type, Partition.name_to_num("Solaris2")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
580 |
|
1156
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
581 |
new_p = p.change_type(Partition.name_to_num("WIN95 Extended(LBA)")) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
582 |
self.assertFalse(errsvc._ERRORS) |
1156
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
583 |
self.assertEqual(new_p.part_type, \ |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
584 |
Partition.name_to_num("WIN95 Extended(LBA)")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
585 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
586 |
def test_extended_partition_too_small(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
587 |
self.disk.add_partition(1, CYLSIZE, 10, Size.sector_units, |
1247
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
588 |
partition_type=Partition.name_to_num("WIN95 Extended(LBA)")) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
589 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
590 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
591 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
592 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
593 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
594 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
595 |
ShadowPhysical.ExtPartitionTooSmallError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
596 |
|
1176
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
597 |
def test_fat16_partition_too_large(self): |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
598 |
self.disk.add_partition(1, 0, 10, Size.gb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
599 |
partition_type=Partition.name_to_num( |
1176
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
600 |
"FAT16 (Upto 32M)")) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
601 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
602 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
603 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
604 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
605 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
606 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
1176
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
607 |
ShadowPhysical.FAT16PartitionTooLargeError)) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
608 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
609 |
def test_whole_disk_is_true(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
610 |
self.disk.whole_disk = True |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
611 |
self.disk.add_partition(1, 0, 10, Size.gb_units, |
1247
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
612 |
partition_type=Partition.name_to_num("Solaris2")) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
613 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
614 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
615 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
616 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
617 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
618 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
619 |
ShadowPhysical.WholeDiskIsTrueError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
620 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
621 |
def test_whole_disk_is_false(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
622 |
self.disk.whole_disk = False |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
623 |
self.disk.add_partition(1, 0, 10, Size.gb_units, |
1247
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
624 |
partition_type=Partition.name_to_num("Solaris2")) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
625 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
626 |
# verify that there are no errors |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
627 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
628 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
629 |
def test_holey_object_no_children(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
630 |
holey_list = self.disk.get_gaps() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
631 |
self.assertEqual(holey_list[0].size, self.disk.disk_prop.dev_size) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
632 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
633 |
# verify the logical list is empty as well |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
634 |
self.assertFalse(self.disk.get_logical_partition_gaps()) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
635 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
636 |
def test_holey_object_one_child_start_at_nonzero(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
637 |
# add a single partition, starting at start sector CYLSIZE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
638 |
p = self.disk.add_partition(1, CYLSIZE, 25, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
639 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
640 |
disksize = self.disk.disk_prop.dev_size.sectors |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
641 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
642 |
holey_list = self.disk.get_gaps() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
643 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
644 |
# verify the holey list is correct |
1205
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
645 |
self.assertEqual(len(holey_list), 1) |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
646 |
|
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
647 |
# round the expected value up to the next cylinder boundary |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
648 |
rounded_value = (((CYLSIZE + p.size.sectors + 1) / CYLSIZE) * \ |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
649 |
CYLSIZE) + CYLSIZE |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
650 |
difference = rounded_value - (p.start_sector + p.size.sectors) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
651 |
|
1205
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
652 |
rounded_size = \ |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
653 |
((disksize - CYLSIZE - p.size.sectors - difference) / CYLSIZE) * \ |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
654 |
CYLSIZE |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
655 |
|
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
656 |
self.assertEqual(holey_list[0].start_sector, rounded_value) |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
657 |
self.assertEqual(holey_list[0].size.sectors, rounded_size) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
658 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
659 |
# verify the logical list is empty as well |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
660 |
self.assertFalse(self.disk.get_logical_partition_gaps()) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
661 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
662 |
def test_holey_object_logical_partitions(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
663 |
# add a single extended partition |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
664 |
extended_part = self.disk.add_partition(1, CYLSIZE, 25, Size.gb_units, |
1156
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
665 |
partition_type=15) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
666 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
667 |
# add a single logical partition |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
668 |
logical_part = self.disk.add_partition(5, CYLSIZE, 1, Size.gb_units) |
1156
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
669 |
self.assertFalse(errsvc._ERRORS) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
670 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
671 |
disksize = self.disk.disk_prop.dev_size.sectors |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
672 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
673 |
logical_holey_list = self.disk.get_logical_partition_gaps() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
674 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
675 |
# verify the disk's holey lists are correct |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
676 |
self.assertEqual(len(logical_holey_list), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
677 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
678 |
self.assertEqual(logical_holey_list[0].start_sector, \ |
1156
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
679 |
extended_part.start_sector + LOGICAL_ADJUSTMENT + \ |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
680 |
logical_part.size.sectors + LOGICAL_ADJUSTMENT) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
681 |
self.assertEqual(logical_holey_list[0].size.sectors, |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
682 |
extended_part.size.sectors - (2 * LOGICAL_ADJUSTMENT) - \ |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
683 |
logical_part.size.sectors - 1) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
684 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
685 |
def test_add_two_active_partitions(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
686 |
self.disk.add_partition(1, 0, 5, Size.gb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
687 |
bootid=Partition.ACTIVE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
688 |
self.disk.add_partition(2, 10 * GBSECTOR, 1, Size.gb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
689 |
bootid=Partition.ACTIVE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
690 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
691 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
692 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
693 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
694 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
695 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
696 |
ShadowPhysical.MultipleActivePartitionsError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
697 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
698 |
def test_change_bootid(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
699 |
p = self.disk.add_partition(1, 0, 5, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
700 |
p.change_bootid(Partition.ACTIVE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
701 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
702 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
703 |
# change the bootid to something not allowed |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
704 |
self.assertRaises(RuntimeError, p.change_bootid, "bad value") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
705 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
706 |
def test_disk_remaining_space(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
707 |
p = self.disk.add_partition(1, 0, 5, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
708 |
self.assertEqual(self.disk.remaining_space.sectors, \ |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
709 |
self.disk.disk_prop.dev_size.sectors - p.size.sectors) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
710 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
711 |
def test_defect_17624(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
712 |
""" test case specifically designed to validate defect 17624 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
713 |
""" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
714 |
# reset the disk size to 500gb |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
715 |
self.disk.disk_prop.dev_size = Size( |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
716 |
str(GBSECTOR * 500) + Size.sector_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
717 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
718 |
# primary partitions. Extended partition is partition 3. Set the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
719 |
# sizes explictly to sector units to ensure the math is exact |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
720 |
self.disk.add_partition(1, 2048, 2054272, Size.sector_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
721 |
partition_type=Partition.name_to_num("IFS: NTFS")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
722 |
self.disk.add_partition(2, 2056320, 65802240, Size.sector_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
723 |
partition_type=Partition.name_to_num("Solaris2")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
724 |
self.disk.add_partition(3, 67858560, 908893440, Size.sector_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
725 |
partition_type=Partition.name_to_num("WIN95 Extended(LBA)")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
726 |
self.disk.add_partition(4, 976752000, 16065, Size.sector_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
727 |
partition_type=Partition.name_to_num("OS/2 Boot/Coherent swap"), |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
728 |
bootid=Partition.ACTIVE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
729 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
730 |
# verify there are no errors with the primary/extended partitions |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
731 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
732 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
733 |
# logical partitions |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
734 |
self.disk.add_partition(5, 67858623, 4016, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
735 |
partition_type=Partition.name_to_num("Linux native")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
736 |
self.disk.add_partition(6, 76083903, 2008, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
737 |
partition_type=Partition.name_to_num("Solaris/Linux swap")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
738 |
self.disk.add_partition(7, 80196543, 4016, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
739 |
partition_type=Partition.name_to_num("Linux native")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
740 |
self.disk.add_partition(8, 88421823, 4016, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
741 |
partition_type=Partition.name_to_num("Linux native")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
742 |
self.disk.add_partition(9, 96647103, 4016, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
743 |
partition_type=Partition.name_to_num("Linux native")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
744 |
self.disk.add_partition(10, 104872383, 4016, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
745 |
partition_type=Partition.name_to_num("Linux native")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
746 |
self.disk.add_partition(11, 113097663, 32129, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
747 |
partition_type=Partition.name_to_num("Linux native")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
748 |
self.disk.add_partition(12, 178899903, 1004, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
749 |
partition_type=Partition.name_to_num("WIN95 FAT16(LBA)")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
750 |
self.disk.add_partition(13, 180956223, 1004, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
751 |
partition_type=Partition.name_to_num("WIN95 FAT16(LBA)")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
752 |
self.disk.add_partition(14, 183012543, 2008, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
753 |
partition_type=Partition.name_to_num("WIN95 FAT16(LBA)")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
754 |
self.disk.add_partition(15, 187125183, 8032, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
755 |
partition_type=Partition.name_to_num("Linux native")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
756 |
self.disk.add_partition(16, 203575743, 4016, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
757 |
partition_type=Partition.name_to_num("Solaris/Linux swap")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
758 |
self.disk.add_partition(17, 211801023, 4016, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
759 |
partition_type=Partition.name_to_num("Solaris/Linux swap")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
760 |
self.disk.add_partition(18, 220026303, 2008, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
761 |
partition_type=Partition.name_to_num("Solaris/Linux swap")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
762 |
self.disk.add_partition(19, 224138943, 2008, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
763 |
partition_type=Partition.name_to_num("Solaris/Linux swap")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
764 |
self.disk.add_partition(20, 228251583, 48194, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
765 |
partition_type=Partition.name_to_num("IFS: NTFS")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
766 |
self.disk.add_partition(21, 326954943, 16064, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
767 |
partition_type=Partition.name_to_num("IFS: NTFS")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
768 |
self.disk.add_partition(22, 956188863, 2008, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
769 |
partition_type=Partition.name_to_num("Solaris/Linux swap")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
770 |
self.disk.add_partition(23, 960301503, 8032, Size.mb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
771 |
partition_type=Partition.name_to_num("IFS: NTFS")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
772 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
773 |
# verify there are no errors with the logical partitions |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
774 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
775 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
776 |
def test_invalid_start_sector(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
777 |
self.disk.add_partition(1, -16065, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
778 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
779 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
780 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
781 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
782 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
783 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
784 |
ShadowPhysical.InvalidPartitionStartSectorError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
785 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
786 |
def test_invalid_partition_id(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
787 |
# create a partition with an invalid partition id. name_to_num() of an |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
788 |
# invalid partition ID will return None |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
789 |
self.disk.add_partition(1, 1, 1, Size.gb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
790 |
partition_type=Partition.name_to_num("INVALID PARTITION ID")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
791 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
792 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
793 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
794 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
795 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
796 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
797 |
ShadowPhysical.PartitionTypeMissingError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
798 |
|
1103
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
799 |
def test_is_primary(self): |
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
800 |
p = self.disk.add_partition(1, 0, 1, Size.gb_units) |
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
801 |
self.assertFalse(errsvc._ERRORS) |
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
802 |
self.assertTrue(p.is_primary) |
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
803 |
|
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
804 |
def test_is_extended(self): |
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
805 |
p = self.disk.add_partition(1, 0, 1, Size.gb_units, partition_type=5) |
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
806 |
self.assertFalse(errsvc._ERRORS) |
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
807 |
self.assertTrue(p.is_extended) |
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
808 |
|
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
809 |
def test_is_logical(self): |
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
810 |
# add a single extended partition |
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
811 |
extended_part = self.disk.add_partition(1, CYLSIZE, 25, Size.gb_units, |
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
812 |
partition_type=15) |
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
813 |
|
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
814 |
# add a single logical partition |
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
815 |
logical_part = self.disk.add_partition(5, CYLSIZE, 1, Size.gb_units) |
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
816 |
|
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
817 |
self.assertFalse(errsvc._ERRORS) |
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
818 |
self.assertTrue(logical_part.is_logical) |
bb9177285efa
7041296 install/targets int() argument must be a string or a number, not 'NoneType'
Drew Fisher <drew.fisher@oracle.com>
parents:
1073
diff
changeset
|
819 |
|
1118
c87a271a3921
7043165 Not possible to tell if a Partition was specified in the XML without a start_sector.
Drew Fisher <drew.fisher@oracle.com>
parents:
1117
diff
changeset
|
820 |
def test_no_validate_children(self): |
c87a271a3921
7043165 Not possible to tell if a Partition was specified in the XML without a start_sector.
Drew Fisher <drew.fisher@oracle.com>
parents:
1117
diff
changeset
|
821 |
self.disk.validate_children = False |
1117
ae9a188dcfcc
7043629 Target shadow list should not adjust boundaries on discovered partitions
Drew Fisher <drew.fisher@oracle.com>
parents:
1103
diff
changeset
|
822 |
start_sector = 12345 |
ae9a188dcfcc
7043629 Target shadow list should not adjust boundaries on discovered partitions
Drew Fisher <drew.fisher@oracle.com>
parents:
1103
diff
changeset
|
823 |
p = self.disk.add_partition(1, 12345, 5, Size.gb_units) |
ae9a188dcfcc
7043629 Target shadow list should not adjust boundaries on discovered partitions
Drew Fisher <drew.fisher@oracle.com>
parents:
1103
diff
changeset
|
824 |
self.assertFalse(errsvc._ERRORS) |
ae9a188dcfcc
7043629 Target shadow list should not adjust boundaries on discovered partitions
Drew Fisher <drew.fisher@oracle.com>
parents:
1103
diff
changeset
|
825 |
self.assertEqual(start_sector, p.start_sector) |
ae9a188dcfcc
7043629 Target shadow list should not adjust boundaries on discovered partitions
Drew Fisher <drew.fisher@oracle.com>
parents:
1103
diff
changeset
|
826 |
self.assertEqual(Size("5gb"), p.size) |
ae9a188dcfcc
7043629 Target shadow list should not adjust boundaries on discovered partitions
Drew Fisher <drew.fisher@oracle.com>
parents:
1103
diff
changeset
|
827 |
|
1176
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
828 |
def test_get_next_partition_name(self): |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
829 |
self.assertEqual(self.disk.get_next_partition_name(primary=True), "1") |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
830 |
self.assertEqual(self.disk.get_next_partition_name(primary=False), "5") |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
831 |
|
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
832 |
# add an extended partition |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
833 |
extended_part = self.disk.add_partition(1, CYLSIZE, 10, Size.gb_units, |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
834 |
partition_type=15) |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
835 |
|
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
836 |
self.assertFalse(errsvc._ERRORS) |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
837 |
self.assertTrue(extended_part.is_primary) |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
838 |
self.assertTrue(extended_part.is_extended) |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
839 |
|
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
840 |
# add a logical partition |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
841 |
logical_part = self.disk.add_partition(5, CYLSIZE, 1, Size.gb_units) |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
842 |
self.assertFalse(errsvc._ERRORS) |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
843 |
self.assertTrue(logical_part.is_logical) |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
844 |
|
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
845 |
self.assertEqual(len(self.disk.primary_partitions), 1) |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
846 |
self.assertEqual(len(self.disk.logical_partitions), 1) |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
847 |
|
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
848 |
self.assertEqual(self.disk.get_next_partition_name(primary=True), "2") |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
849 |
self.assertEqual(self.disk.get_next_partition_name(primary=False), "6") |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
850 |
|
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
851 |
# ignore any insertion errors for testing get_next_partition_name |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
852 |
self.disk.add_partition(2, CYLSIZE, 1, Size.gb_units) |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
853 |
self.disk.add_partition(3, CYLSIZE, 1, Size.gb_units) |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
854 |
self.disk.add_partition(4, CYLSIZE, 1, Size.gb_units) |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
855 |
|
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
856 |
# verify get_next_partition_name returns None if there are no available |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
857 |
# primary partitions |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
858 |
self.assertEqual(self.disk.get_next_partition_name(primary=True), None) |
58ae244df661
7051114 cannot do TI install and got ValueError: Desired target doesn't pass final validation
Drew Fisher <drew.fisher@oracle.com>
parents:
1156
diff
changeset
|
859 |
|
1247
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
860 |
def test_cr_7055489(self): |
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
861 |
self.disk.add_partition("0", CYLSIZE, 10, Size.gb_units) |
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
862 |
|
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
863 |
# verify there is only one error in the errsvc list and that it is the |
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
864 |
# proper error |
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
865 |
self.assertEqual(len(errsvc._ERRORS), 1) |
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
866 |
error = errsvc._ERRORS[0] |
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
867 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
868 |
ShadowPhysical.InvalidPartitionNameError)) |
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
869 |
|
1253
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
870 |
def test_insertion_of_partition_over_deleted_partition_of_same_name(self): |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
871 |
# add a 1GB partition at start_sector CYLSIZE and set the action to |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
872 |
# delete |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
873 |
p = self.disk.add_partition(1, CYLSIZE, 1, Size.gb_units) |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
874 |
p.action = "delete" |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
875 |
|
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
876 |
# insert another partition with the same name |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
877 |
self.disk.add_partition(1, CYLSIZE, 2, Size.gb_units) |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
878 |
self.assertFalse(errsvc._ERRORS) |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
879 |
|
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
880 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
881 |
class TestSliceInDisk(unittest.TestCase): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
882 |
def setUp(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
883 |
self.disk = Disk("test disk") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
884 |
self.disk.ctd = "c12345t0d0" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
885 |
self.disk.geometry = DiskGeometry(BLOCKSIZE, CYLSIZE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
886 |
self.disk.label = "VTOC" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
887 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
888 |
# 100GB disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
889 |
self.disk.disk_prop = DiskProp() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
890 |
self.disk.disk_prop.dev_size = Size( |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
891 |
str(GBSECTOR * 100) + Size.sector_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
892 |
self.disk.disk_prop.blocksize = BLOCKSIZE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
893 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
894 |
# reset the errsvc |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
895 |
errsvc.clear_error_list() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
896 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
897 |
def tearDown(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
898 |
self.disk.delete_children() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
899 |
self.disk.delete() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
900 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
901 |
# reset the errsvc |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
902 |
errsvc.clear_error_list() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
903 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
904 |
def test_add_single_slice(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
905 |
# add a 1GB slice at start_sector CYLSIZE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
906 |
self.disk.add_slice(0, CYLSIZE, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
907 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
908 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
909 |
def test_cylinder_zero_boundary_adjustment(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
910 |
# add a 1GB slice at start_sector 0 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
911 |
self.disk.add_slice(0, 0, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
912 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
913 |
# test that it moved to the first cylinder boundary |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
914 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
915 |
self.assertEqual(self.disk._children[0].start_sector, CYLSIZE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
916 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
917 |
def test_add_too_many_slices(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
918 |
for i in range(V_NUMPAR + 2): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
919 |
start_sector = i * GBSECTOR + i |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
920 |
self.disk.add_slice(i, start_sector, 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
921 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
922 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
923 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
924 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
925 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
926 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
927 |
ShadowPhysical.TooManySlicesError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
928 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
929 |
def test_duplicate_slice(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
930 |
# add 2 1GB slices with the same index but different starting sector |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
931 |
self.disk.add_slice(0, 0, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
932 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
933 |
# account for the first silce moving from a start_sector of 0 to |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
934 |
# CYLSIZE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
935 |
self.disk.add_slice(0, CYLSIZE + GBSECTOR + 1, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
936 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
937 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
938 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
939 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
940 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
941 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
942 |
ShadowPhysical.DuplicateSliceNameError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
943 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
944 |
def test_overlapping_starting_sector(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
945 |
# add a 10 GB slice |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
946 |
self.disk.add_slice(0, CYLSIZE, 10, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
947 |
# add an 11 GB slice |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
948 |
self.disk.add_slice(1, CYLSIZE, 11, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
949 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
950 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
951 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
952 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
953 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
954 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
955 |
ShadowPhysical.OverlappingSliceError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
956 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
957 |
def test_overlapping_ending_sector(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
958 |
# add a 9 GB slice on the second cylinder boundary |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
959 |
self.disk.add_slice(0, CYLSIZE * 2, 9, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
960 |
# add a 10 GB slice on the first cylinder boundary |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
961 |
self.disk.add_slice(1, CYLSIZE, 10, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
962 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
963 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
964 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
965 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
966 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
967 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
968 |
ShadowPhysical.OverlappingSliceError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
969 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
970 |
def test_delete_slice(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
971 |
s1 = self.disk.add_slice(1, 0, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
972 |
s2 = self.disk.add_slice(2, GBSECTOR + 1, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
973 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
974 |
# verify there are 2 entries in _children |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
975 |
self.assertEqual(len(self.disk._children), 2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
976 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
977 |
# delete slice 2 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
978 |
s2.delete() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
979 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
980 |
# verify there is only one entry in the _children and the proper |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
981 |
# slice was removed. |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
982 |
self.assertEqual(len(self.disk._children), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
983 |
self.assertEqual(self.disk._children[0].name, 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
984 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
985 |
def test_delete_slice_in_disk(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
986 |
s1 = self.disk.add_slice(1, 0, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
987 |
s2 = self.disk.add_slice(2, GBSECTOR + 1, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
988 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
989 |
# verify there are 2 entries in the _children |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
990 |
self.assertEqual(len(self.disk._children), 2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
991 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
992 |
# delete slice 2 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
993 |
self.disk.delete_slice(s2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
994 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
995 |
# verify there is only one entry in the _children and the proper |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
996 |
# slice was removed. |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
997 |
self.assertEqual(len(self.disk._children), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
998 |
self.assertEqual(self.disk._children[0].name, 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
999 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1000 |
def test_resize_slice(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1001 |
# create a 1 GB slice |
1205
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1002 |
s1 = self.disk.add_slice(1, CYLSIZE, 1, Size.gb_units) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1003 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1004 |
# verify the size of the slice is 1 GB of sectors, rounded for CYLSIZE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1005 |
self.assertEqual(s1.size.sectors, (GBSECTOR / CYLSIZE) * CYLSIZE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1006 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1007 |
# resize it to 5 GB |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1008 |
new_s1 = s1.resize(5, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1009 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1010 |
# verify the size of the slice is 5 GB of sectors |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1011 |
self.assertTrue(new_s1.size.sectors, 5 * GBSECTOR - 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1012 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1013 |
def test_in_zpool_confilict_with_parent(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1014 |
# set the in_zpool attribute in the disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1015 |
self.disk.in_zpool = "tank" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1016 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1017 |
# create a 1 GB partition |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1018 |
self.disk.add_slice(1, 0, 1, Size.gb_units, in_zpool="tank") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1019 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1020 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1021 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1022 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1023 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1024 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1025 |
ShadowPhysical.OverlappingSliceZpoolError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1026 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1027 |
def test_in_vdev_confilict_with_parent(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1028 |
# set the in_vdev attribute in the disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1029 |
self.disk.in_vdev = "a label" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1030 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1031 |
# create a 1 GB partition |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1032 |
self.disk.add_slice(1, 0, 1, Size.gb_units, in_vdev="a label") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1033 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1034 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1035 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1036 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1037 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1038 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1039 |
ShadowPhysical.OverlappingSliceVdevError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1040 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1041 |
def test_whole_disk_is_true(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1042 |
self.disk.whole_disk = True |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1043 |
# add a 100 MB slice |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1044 |
self.disk.add_slice(0, 0, 100, Size.mb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1045 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1046 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1047 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1048 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1049 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1050 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1051 |
ShadowPhysical.WholeDiskIsTrueError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1052 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1053 |
def test_whole_disk_is_false(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1054 |
self.disk.whole_disk = False |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1055 |
# add a 100 MB slice |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1056 |
self.disk.add_slice(0, 0, 100, Size.mb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1057 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1058 |
# verify that there are no errors |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1059 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1060 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1061 |
def test_holey_object_no_children(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1062 |
holey_list = self.disk.get_gaps() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1063 |
self.assertTrue(holey_list[0].size, self.disk.disk_prop.dev_size) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1064 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1065 |
def test_holey_object_one_child_start_at_cylsize(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1066 |
# add a single slice, starting at start sector CLYSIZE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1067 |
s = self.disk.add_slice(1, CYLSIZE, 25, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1068 |
disksize = self.disk.disk_prop.dev_size.sectors |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1069 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1070 |
holey_list = self.disk.get_gaps() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1071 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1072 |
# verify the holey list is correct |
1205
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1073 |
self.assertEqual(len(holey_list), 1) |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1074 |
|
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1075 |
# round the expected value up to the next cylinder boundary |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1076 |
rounded_value = (((CYLSIZE + s.size.sectors + 1) / CYLSIZE) * \ |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1077 |
CYLSIZE) + CYLSIZE |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1078 |
difference = rounded_value - (s.start_sector + s.size.sectors) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1079 |
|
1205
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1080 |
rounded_size = \ |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1081 |
((disksize - CYLSIZE - s.size.sectors - difference) / \ |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1082 |
CYLSIZE) * CYLSIZE |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1083 |
|
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1084 |
self.assertEqual(holey_list[0].start_sector, rounded_value) |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1085 |
self.assertEqual(holey_list[0].size.sectors, rounded_size) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1086 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1087 |
def test_holey_object_one_child_start_at_nonzero(self): |
1205
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1088 |
# add a single slice, starting at start sector CYLSIZE * 10 |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1089 |
start = CYLSIZE * 10 |
1205
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1090 |
|
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1091 |
s = self.disk.add_slice(1, start, 25, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1092 |
disksize = self.disk.disk_prop.dev_size.sectors |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1093 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1094 |
holey_list = self.disk.get_gaps() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1095 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1096 |
# verify the holey list is correct |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1097 |
self.assertEqual(len(holey_list), 2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1098 |
|
1205
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1099 |
self.assertEqual(holey_list[0].start_sector, CYLSIZE) |
1247
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
1100 |
self.assertEqual(holey_list[0].size.sectors, |
1205
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1101 |
(((start - CYLSIZE - 1) / CYLSIZE) * CYLSIZE)) |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1102 |
|
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1103 |
# round the expected value up to the next cylinder boundary |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1104 |
rounded_value = (((CYLSIZE * 10 + s.size.sectors + 1) / CYLSIZE) * \ |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1105 |
CYLSIZE) + CYLSIZE |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1106 |
difference = rounded_value - (s.start_sector + s.size.sectors) |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1107 |
|
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1108 |
rounded_size = \ |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1109 |
((disksize - (CYLSIZE * 10) - s.size.sectors - difference) / \ |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1110 |
CYLSIZE) * CYLSIZE |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1111 |
|
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1112 |
self.assertEqual(holey_list[1].start_sector, rounded_value) |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1113 |
self.assertEqual(holey_list[1].size.sectors, rounded_size) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1114 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1115 |
def test_invalid_start_sector(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1116 |
self.disk.add_slice(0, -16065, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1117 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1118 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1119 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1120 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1121 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1122 |
ShadowPhysical.InvalidSliceStartSectorError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1123 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1124 |
def test_slice_entire_size_of_disk(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1125 |
disksize = self.disk.disk_prop.dev_size.sectors |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1126 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1127 |
# add a non V_BACKUP slice the entire size of the disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1128 |
s = self.disk.add_slice(0, CYLSIZE, disksize, Size.sector_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1129 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1130 |
# verify there are no errors |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1131 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1132 |
|
1156
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1133 |
# verify the size of the slice, rounding for cylinder size and |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1134 |
# maximum size limits |
1355
7e6507b2a970
6260 sparc AI need a way to mechanism to explicitly ask for creating label on Sparc disk
Drew Fisher <drew.fisher@oracle.com>
parents:
1313
diff
changeset
|
1135 |
if platform.processor() == "i386": |
7e6507b2a970
6260 sparc AI need a way to mechanism to explicitly ask for creating label on Sparc disk
Drew Fisher <drew.fisher@oracle.com>
parents:
1313
diff
changeset
|
1136 |
self.assertEqual(((disksize / CYLSIZE) - 4) * CYLSIZE, |
7e6507b2a970
6260 sparc AI need a way to mechanism to explicitly ask for creating label on Sparc disk
Drew Fisher <drew.fisher@oracle.com>
parents:
1313
diff
changeset
|
1137 |
s.size.sectors) |
7e6507b2a970
6260 sparc AI need a way to mechanism to explicitly ask for creating label on Sparc disk
Drew Fisher <drew.fisher@oracle.com>
parents:
1313
diff
changeset
|
1138 |
else: |
7e6507b2a970
6260 sparc AI need a way to mechanism to explicitly ask for creating label on Sparc disk
Drew Fisher <drew.fisher@oracle.com>
parents:
1313
diff
changeset
|
1139 |
self.assertEqual(((disksize / CYLSIZE)) * CYLSIZE, s.size.sectors) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1140 |
|
1118
c87a271a3921
7043165 Not possible to tell if a Partition was specified in the XML without a start_sector.
Drew Fisher <drew.fisher@oracle.com>
parents:
1117
diff
changeset
|
1141 |
def test_no_validate_children(self): |
c87a271a3921
7043165 Not possible to tell if a Partition was specified in the XML without a start_sector.
Drew Fisher <drew.fisher@oracle.com>
parents:
1117
diff
changeset
|
1142 |
self.disk.validate_children = False |
1117
ae9a188dcfcc
7043629 Target shadow list should not adjust boundaries on discovered partitions
Drew Fisher <drew.fisher@oracle.com>
parents:
1103
diff
changeset
|
1143 |
start_sector = 12345 |
ae9a188dcfcc
7043629 Target shadow list should not adjust boundaries on discovered partitions
Drew Fisher <drew.fisher@oracle.com>
parents:
1103
diff
changeset
|
1144 |
s = self.disk.add_slice(1, 12345, 5, Size.gb_units) |
ae9a188dcfcc
7043629 Target shadow list should not adjust boundaries on discovered partitions
Drew Fisher <drew.fisher@oracle.com>
parents:
1103
diff
changeset
|
1145 |
self.assertFalse(errsvc._ERRORS) |
ae9a188dcfcc
7043629 Target shadow list should not adjust boundaries on discovered partitions
Drew Fisher <drew.fisher@oracle.com>
parents:
1103
diff
changeset
|
1146 |
self.assertEqual(start_sector, s.start_sector) |
ae9a188dcfcc
7043629 Target shadow list should not adjust boundaries on discovered partitions
Drew Fisher <drew.fisher@oracle.com>
parents:
1103
diff
changeset
|
1147 |
self.assertEqual(Size("5gb"), s.size) |
ae9a188dcfcc
7043629 Target shadow list should not adjust boundaries on discovered partitions
Drew Fisher <drew.fisher@oracle.com>
parents:
1103
diff
changeset
|
1148 |
|
1253
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
1149 |
def test_insertion_of_slice_over_deleted_slice_of_same_name(self): |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
1150 |
# add a 1GB slice at start_sector CYLSIZE and set the action to delete |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
1151 |
s = self.disk.add_slice(0, CYLSIZE, 1, Size.gb_units) |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
1152 |
s.action = "delete" |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
1153 |
|
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
1154 |
# insert another slice with the same name |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
1155 |
self.disk.add_slice(0, CYLSIZE, 2, Size.gb_units) |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
1156 |
self.assertFalse(errsvc._ERRORS) |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
1157 |
|
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1158 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1159 |
class TestSliceInPartition(unittest.TestCase): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1160 |
def setUp(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1161 |
self.disk = Disk("test disk") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1162 |
self.disk.ctd = "c12345t0d0" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1163 |
self.disk.geometry = DiskGeometry(BLOCKSIZE, CYLSIZE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1164 |
self.disk.label = "VTOC" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1165 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1166 |
# 100GB disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1167 |
self.disk.disk_prop = DiskProp() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1168 |
self.disk.disk_prop.dev_size = Size( |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1169 |
str(GBSECTOR * 100) + Size.sector_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1170 |
self.disk.disk_prop.blocksize = BLOCKSIZE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1171 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1172 |
# create a single 50 GB partition inside the disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1173 |
self.partition = self.disk.add_partition(1, CYLSIZE, 50, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1174 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1175 |
# reset the errsvc |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1176 |
errsvc.clear_error_list() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1177 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1178 |
def tearDown(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1179 |
self.disk.delete_children() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1180 |
self.disk.delete() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1181 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1182 |
# reset the errsvc |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1183 |
errsvc.clear_error_list() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1184 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1185 |
def test_add_single_slice(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1186 |
# add a 1GB slice at start_sector CYLSIZE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1187 |
self.partition.add_slice(0, CYLSIZE, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1188 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1189 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1190 |
def test_cylinder_zero_boundary_adjustment(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1191 |
# add a 1GB slice at start_sector 0 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1192 |
self.partition.add_slice(0, 0, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1193 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1194 |
# test that it moved to the first cylinder boundary |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1195 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1196 |
self.assertEqual(self.partition._children[0].start_sector, CYLSIZE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1197 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1198 |
def test_add_too_many_slices(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1199 |
for i in range(V_NUMPAR + 2): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1200 |
start_sector = i * GBSECTOR + i |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1201 |
self.partition.add_slice(i, start_sector, 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1202 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1203 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1204 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1205 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1206 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1207 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1208 |
ShadowPhysical.TooManySlicesError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1209 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1210 |
def test_duplicate_slice(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1211 |
# add 2 1GB slices with the same index but different starting sector |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1212 |
self.partition.add_slice(0, 0, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1213 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1214 |
# account for the first silce moving from a start_sector of 0 to |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1215 |
# CYLSIZE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1216 |
self.partition.add_slice(0, CYLSIZE + GBSECTOR + 1, 1, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1217 |
Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1218 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1219 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1220 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1221 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1222 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1223 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1224 |
ShadowPhysical.DuplicateSliceNameError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1225 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1226 |
def test_overlapping_starting_sector(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1227 |
# add a 10 GB disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1228 |
self.partition.add_slice(0, CYLSIZE, 10, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1229 |
# add an 11 GB disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1230 |
self.partition.add_slice(1, CYLSIZE, 11, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1231 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1232 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1233 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1234 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1235 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1236 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1237 |
ShadowPhysical.OverlappingSliceError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1238 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1239 |
def test_overlapping_ending_sector(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1240 |
# add a 9 GB disk on the second cylinder boundary |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1241 |
self.partition.add_slice(0, CYLSIZE * 2, 9, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1242 |
# add a 10 GB disk on the first cylinder boundary |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1243 |
self.partition.add_slice(1, CYLSIZE, 10, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1244 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1245 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1246 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1247 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1248 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1249 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1250 |
ShadowPhysical.OverlappingSliceError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1251 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1252 |
def test_delete_slice(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1253 |
s1 = self.partition.add_slice(1, 0, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1254 |
s2 = self.partition.add_slice(2, GBSECTOR + 1, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1255 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1256 |
# verify there are 2 entries in the _children |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1257 |
self.assertEqual(len(self.partition._children), 2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1258 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1259 |
# delete slice 2 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1260 |
s2.delete() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1261 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1262 |
# verify there is only one entry in the _children and the proper |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1263 |
# slice was removed. |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1264 |
self.assertEqual(len(self.partition._children), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1265 |
self.assertEqual(self.partition._children[0].name, 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1266 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1267 |
def test_delete_slice_in_partition(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1268 |
s1 = self.partition.add_slice(1, 0, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1269 |
s2 = self.partition.add_slice(2, GBSECTOR + 1, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1270 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1271 |
# verify there are 2 entries in the _children |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1272 |
self.assertEqual(len(self.partition._children), 2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1273 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1274 |
# delete slice 2 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1275 |
self.partition.delete_slice(s2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1276 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1277 |
# verify there is only one entry in the _children and the proper |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1278 |
# slice was removed. |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1279 |
self.assertEqual(len(self.partition._children), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1280 |
self.assertEqual(self.partition._children[0].name, 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1281 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1282 |
def test_resize_slice(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1283 |
# create a 1 GB slice |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1284 |
s1 = self.partition.add_slice(0, CYLSIZE, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1285 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1286 |
# verify the size of the slice is 1 GB of sectors, rounded for CYLSIZE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1287 |
self.assertEqual(s1.size.sectors, (GBSECTOR / CYLSIZE) * CYLSIZE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1288 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1289 |
# resize it to 5 GB |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1290 |
new_s1 = s1.resize(5, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1291 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1292 |
# verify the size of the slice is 5 GB of sectors |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1293 |
self.assertTrue(new_s1.size.sectors, 5 * GBSECTOR) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1294 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1295 |
def test_a_in_zpool_confilict_with_disk(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1296 |
# set the in_zpool attribute in the disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1297 |
self.disk.in_zpool = "tank" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1298 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1299 |
# create a 1 GB partition |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1300 |
self.partition.add_slice(1, 0, 1, Size.gb_units, in_zpool="tank") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1301 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1302 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1303 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1304 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1305 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1306 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1307 |
ShadowPhysical.OverlappingSliceZpoolError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1308 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1309 |
def test_in_vdev_confilict_with_disk(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1310 |
# set the in_vdev attribute in the disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1311 |
self.disk.in_vdev = "a label" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1312 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1313 |
# create a 1 GB partition |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1314 |
self.partition.add_slice(1, 0, 1, Size.gb_units, in_vdev="a label") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1315 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1316 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1317 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1318 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1319 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1320 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1321 |
ShadowPhysical.OverlappingSliceVdevError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1322 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1323 |
def test_holey_object_no_children(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1324 |
holey_list = self.partition.get_gaps() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1325 |
self.assertEqual(holey_list[0].size, self.partition.size) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1326 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1327 |
def test_holey_object_one_child_start_at_nonzero(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1328 |
# add a single partition, starting at start sector CYLSIZE * 10 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1329 |
start = CYLSIZE * 10 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1330 |
s = self.partition.add_slice(1, start, 25, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1331 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1332 |
holey_list = self.partition.get_gaps() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1333 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1334 |
# verify the holey list is correct |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1335 |
self.assertEqual(len(holey_list), 2) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1336 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1337 |
self.assertEqual(holey_list[0].start_sector, 0) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1338 |
self.assertEqual(holey_list[0].size.sectors, start - 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1339 |
self.assertEqual(holey_list[1].start_sector, \ |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1340 |
10 * CYLSIZE + s.size.sectors + 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1341 |
self.assertEqual(holey_list[1].size.sectors, \ |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1342 |
self.partition.size.sectors - s.size.sectors - 10 * CYLSIZE - 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1343 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1344 |
def test_partition_remaining_space(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1345 |
s = self.partition.add_slice(0, CYLSIZE, 5, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1346 |
self.assertEqual(self.partition.remaining_space.sectors, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1347 |
self.partition.size.sectors - s.size.sectors) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1348 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1349 |
def test_invalid_start_sector(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1350 |
self.partition.add_slice(0, -16065, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1351 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1352 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1353 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1354 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1355 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1356 |
ShadowPhysical.InvalidSliceStartSectorError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1357 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1358 |
def test_slice_entire_size_of_partition(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1359 |
# add a non V_BACKUP slice the entire size of the partition |
1205
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1360 |
s = self.partition.add_slice(0, CYLSIZE, self.partition.size.sectors, |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1361 |
Size.sector_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1362 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1363 |
# verify there are no errors |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1364 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1365 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1366 |
# verify the size of the slice |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1367 |
self.assertEqual(self.partition.size.sectors, s.size.sectors) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1368 |
|
1118
c87a271a3921
7043165 Not possible to tell if a Partition was specified in the XML without a start_sector.
Drew Fisher <drew.fisher@oracle.com>
parents:
1117
diff
changeset
|
1369 |
def test_no_validate_children(self): |
c87a271a3921
7043165 Not possible to tell if a Partition was specified in the XML without a start_sector.
Drew Fisher <drew.fisher@oracle.com>
parents:
1117
diff
changeset
|
1370 |
self.partition.validate_children = False |
1117
ae9a188dcfcc
7043629 Target shadow list should not adjust boundaries on discovered partitions
Drew Fisher <drew.fisher@oracle.com>
parents:
1103
diff
changeset
|
1371 |
start_sector = 12345 |
ae9a188dcfcc
7043629 Target shadow list should not adjust boundaries on discovered partitions
Drew Fisher <drew.fisher@oracle.com>
parents:
1103
diff
changeset
|
1372 |
s = self.partition.add_slice(1, 12345, 5, Size.gb_units) |
ae9a188dcfcc
7043629 Target shadow list should not adjust boundaries on discovered partitions
Drew Fisher <drew.fisher@oracle.com>
parents:
1103
diff
changeset
|
1373 |
self.assertFalse(errsvc._ERRORS) |
ae9a188dcfcc
7043629 Target shadow list should not adjust boundaries on discovered partitions
Drew Fisher <drew.fisher@oracle.com>
parents:
1103
diff
changeset
|
1374 |
self.assertEqual(start_sector, s.start_sector) |
ae9a188dcfcc
7043629 Target shadow list should not adjust boundaries on discovered partitions
Drew Fisher <drew.fisher@oracle.com>
parents:
1103
diff
changeset
|
1375 |
self.assertEqual(Size("5gb"), s.size) |
ae9a188dcfcc
7043629 Target shadow list should not adjust boundaries on discovered partitions
Drew Fisher <drew.fisher@oracle.com>
parents:
1103
diff
changeset
|
1376 |
|
1253
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
1377 |
def test_insertion_of_slice_over_deleted_slice_of_same_name(self): |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
1378 |
# add a 1GB slice at start_sector CYLSIZE and set the action to delete |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
1379 |
s = self.partition.add_slice(0, CYLSIZE, 1, Size.gb_units) |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
1380 |
s.action = "delete" |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
1381 |
|
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
1382 |
# insert another slice with the same name |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
1383 |
self.partition.add_slice(0, CYLSIZE, 2, Size.gb_units) |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
1384 |
self.assertFalse(errsvc._ERRORS) |
b971c046c5d4
7063304 Attempting to delete a slice before creating it in manifest results in error
Drew Fisher <drew.fisher@oracle.com>
parents:
1247
diff
changeset
|
1385 |
|
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1386 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1387 |
class TestLogicalPartition(unittest.TestCase): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1388 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1389 |
def setUp(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1390 |
self.disk = Disk("test disk") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1391 |
self.disk.ctd = "c12345t0d0" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1392 |
self.disk.geometry = DiskGeometry(BLOCKSIZE, CYLSIZE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1393 |
self.disk.label = "VTOC" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1394 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1395 |
# 100GB disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1396 |
self.disk.disk_prop = DiskProp() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1397 |
self.disk.disk_prop.dev_size = Size( |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1398 |
str(GBSECTOR * 100) + Size.sector_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1399 |
self.disk.disk_prop.blocksize = BLOCKSIZE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1400 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1401 |
# reset the errsvc |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1402 |
errsvc.clear_error_list() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1403 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1404 |
def tearDown(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1405 |
self.disk.delete_children() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1406 |
self.disk.delete() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1407 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1408 |
# reset the errsvc |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1409 |
errsvc.clear_error_list() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1410 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1411 |
def test_add_single_logical_partition(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1412 |
# add a 10 GB extended partition (type is 0xf or "15") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1413 |
self.disk.add_partition(1, 0, 10, Size.gb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1414 |
Partition.name_to_num("WIN95 Extended(LBA)")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1415 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1416 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1417 |
# add a logical partition to the disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1418 |
self.disk.add_partition(5, 0, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1419 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1420 |
|
1156
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1421 |
def test_add_three_logical_partitions_in_order(self): |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1422 |
# add a 10 GB extended partition (type is 0xf or "15") |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1423 |
ep = self.disk.add_partition(1, CYLSIZE, 10, Size.gb_units, |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1424 |
Partition.name_to_num("WIN95 Extended(LBA)")) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1425 |
self.assertFalse(errsvc._ERRORS) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1426 |
|
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1427 |
# add a logical partition to the disk |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1428 |
l1 = self.disk.add_partition(5, CYLSIZE, 1, Size.gb_units) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1429 |
self.assertFalse(errsvc._ERRORS) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1430 |
self.assertEqual(l1.start_sector, ep.start_sector + LOGICAL_ADJUSTMENT) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1431 |
self.assertEqual(l1.size.sectors, GBSECTOR - LOGICAL_ADJUSTMENT) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1432 |
|
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1433 |
# add a second logical partition to the disk |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1434 |
l2 = self.disk.add_partition(6, CYLSIZE + GBSECTOR + 64, 1, |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1435 |
Size.gb_units) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1436 |
self.assertFalse(errsvc._ERRORS) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1437 |
self.assertEqual(l2.start_sector, \ |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1438 |
l1.start_sector + l1.size.sectors + LOGICAL_ADJUSTMENT + 1) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1439 |
self.assertEqual(l2.size.sectors, GBSECTOR) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1440 |
|
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1441 |
# add a third logical partition to the disk |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1442 |
l3 = self.disk.add_partition(8, CYLSIZE + (GBSECTOR * 2) + 128, 1, |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1443 |
Size.gb_units) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1444 |
self.assertFalse(errsvc._ERRORS) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1445 |
self.assertEqual(l3.start_sector, \ |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1446 |
l2.start_sector + l2.size.sectors + LOGICAL_ADJUSTMENT + 1) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1447 |
self.assertEqual(l3.size.sectors, GBSECTOR) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1448 |
|
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1449 |
def test_add_three_logical_partitions_out_of_order(self): |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1450 |
# add a 10 GB extended partition (type is 0xf or "15") |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1451 |
ep = self.disk.add_partition(1, CYLSIZE, 10, Size.gb_units, |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1452 |
Partition.name_to_num("WIN95 Extended(LBA)")) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1453 |
self.assertFalse(errsvc._ERRORS) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1454 |
|
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1455 |
# add a logical partition to the disk (at the 'end') |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1456 |
l1 = self.disk.add_partition(5, CYLSIZE + (GBSECTOR * 2) + 128, 1, |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1457 |
Size.gb_units) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1458 |
self.assertFalse(errsvc._ERRORS) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1459 |
self.assertEqual(l1.start_sector, CYLSIZE + (GBSECTOR * 2) + 128) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1460 |
self.assertEqual(l1.size.sectors, GBSECTOR) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1461 |
|
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1462 |
# add a second logical partition to the disk (at the 'beginning') |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1463 |
l2 = self.disk.add_partition(6, CYLSIZE, 1, Size.gb_units) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1464 |
self.assertFalse(errsvc._ERRORS) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1465 |
self.assertEqual(l2.start_sector, ep.start_sector + LOGICAL_ADJUSTMENT) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1466 |
self.assertEqual(l2.size.sectors, GBSECTOR - LOGICAL_ADJUSTMENT) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1467 |
|
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1468 |
# add a third logical partition to the disk (in the 'middle') |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1469 |
l3 = self.disk.add_partition(8, CYLSIZE + GBSECTOR + 64, 1, |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1470 |
Size.gb_units) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1471 |
self.assertFalse(errsvc._ERRORS) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1472 |
self.assertEqual(l3.start_sector, \ |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1473 |
l2.start_sector + l2.size.sectors + LOGICAL_ADJUSTMENT + 1) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1474 |
self.assertEqual(l3.size.sectors, GBSECTOR) |
a4d11fe1d64f
7048119 Create logical partition failed if there is existing logical partition
Drew Fisher <drew.fisher@oracle.com>
parents:
1142
diff
changeset
|
1475 |
|
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1476 |
def test_add_logical_without_extended(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1477 |
# add a logical partition to the disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1478 |
self.disk.add_partition(5, 0, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1479 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1480 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1481 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1482 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1483 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1484 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1485 |
ShadowPhysical.NoExtPartitionsError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1486 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1487 |
def test_add_too_many_logical_partitions(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1488 |
# add a 50 GB extended partition (type is 0xf or "15") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1489 |
self.disk.add_partition(1, 0, 50, Size.gb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1490 |
Partition.name_to_num("WIN95 Extended(LBA)")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1491 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1492 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1493 |
# add MAX_EXT_PARTS |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1494 |
for i in range(5, 5 + MAX_EXT_PARTS + 2): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1495 |
start_sector = i * GBSECTOR |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1496 |
self.disk.add_partition(i, start_sector, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1497 |
|
1247
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
1498 |
# verify there are two errors in the errsvc list. One for an invalid |
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
1499 |
# name and one for exceeding the number of logical partitions |
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
1500 |
self.assertEqual(len(errsvc._ERRORS), 2) |
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
1501 |
invalid_error = errsvc._ERRORS[0] |
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
1502 |
toomany_error = errsvc._ERRORS[1] |
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
1503 |
|
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
1504 |
self.assertTrue(isinstance(invalid_error.error_data[ES_DATA_EXCEPTION], |
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
1505 |
ShadowPhysical.InvalidPartitionNameError)) |
e93173cd968b
7059210 Spelling Error: Minimim space required is '5.00gb'. Should be Minimum
Drew Fisher <drew.fisher@oracle.com>
parents:
1205
diff
changeset
|
1506 |
self.assertTrue(isinstance(toomany_error.error_data[ES_DATA_EXCEPTION], |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1507 |
ShadowPhysical.TooManyLogicalPartitionsError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1508 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1509 |
def test_add_too_large_logical_partition(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1510 |
# add a 10 GB extended partition |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1511 |
self.disk.add_partition(1, CYLSIZE, 10, Size.gb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1512 |
Partition.name_to_num("WIN95 Extended(LBA)")) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1513 |
self.assertFalse(errsvc._ERRORS) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1514 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1515 |
# add 20 GB logical partition starting at the same place |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1516 |
self.disk.add_partition(5, CYLSIZE, 20, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1517 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1518 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1519 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1520 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1521 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1522 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1523 |
ShadowPhysical.LogicalPartitionOverlapError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1524 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1525 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1526 |
class TestFinalValidation(unittest.TestCase): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1527 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1528 |
def setUp(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1529 |
self.target = Target(Target.DESIRED) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1530 |
self.logical = Logical("logical") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1531 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1532 |
self.disk1 = Disk("disk") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1533 |
self.disk1.ctd = "c12345t0d0" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1534 |
self.disk1.geometry = DiskGeometry(BLOCKSIZE, CYLSIZE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1535 |
self.disk1.label = "VTOC" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1536 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1537 |
# 100GB disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1538 |
self.disk1.disk_prop = DiskProp() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1539 |
self.disk1.disk_prop.dev_size = Size( |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1540 |
str(GBSECTOR * 100) + Size.sector_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1541 |
self.disk1.disk_prop.blocksize = BLOCKSIZE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1542 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1543 |
# reset the errsvc |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1544 |
errsvc.clear_error_list() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1545 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1546 |
def tearDown(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1547 |
self.target.delete() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1548 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1549 |
# reset the errsvc |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1550 |
errsvc.clear_error_list() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1551 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1552 |
def test_simple(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1553 |
# insert the smallest required objects: one disk, one active solaris2 |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1554 |
# partition and one slice with in_zpool set to the root pool name, one |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1555 |
# BE under the root pool |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1556 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1557 |
# 10 gb partition, 1 gb slice |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1558 |
p = self.disk1.add_partition(1, 0, 10, Size.gb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1559 |
bootid=Partition.ACTIVE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1560 |
p.add_slice(0, 0, 1, in_zpool="rpool") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1561 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1562 |
# "rpool" boot pool with one BE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1563 |
zpool = self.logical.add_zpool("rpool", is_root=True) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1564 |
zpool.insert_children(BE()) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1565 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1566 |
self.target.insert_children([self.disk1, self.logical]) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1567 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1568 |
self.assertTrue(self.target.final_validation()) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1569 |
|
1142
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1570 |
def test_simple_with_solaris2_on_logical(self): |
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1571 |
# insert the smallest required objects: one disk, one active solaris2 |
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1572 |
# logical partition and one slice with in_zpool set to the root pool |
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1573 |
# name, one BE under the root pool |
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1574 |
|
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1575 |
# 30 gb primary partition, 10 gb logical solaris2 partition, and 1 gb |
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1576 |
# slice |
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1577 |
primary_part = self.disk1.add_partition(1, 0, 30, Size.gb_units, |
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1578 |
Partition.name_to_num("Win95 Extended(LBA)")) |
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1579 |
logical_part = self.disk1.add_partition(5, 0, 10, Size.gb_units) |
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1580 |
logical_part.add_slice(0, 0, 1, in_zpool="rpool") |
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1581 |
|
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1582 |
# "rpool" boot pool with one BE |
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1583 |
zpool = self.logical.add_zpool("rpool", is_root=True) |
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1584 |
zpool.insert_children(BE()) |
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1585 |
|
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1586 |
self.target.insert_children([self.disk1, self.logical]) |
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1587 |
|
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1588 |
self.assertTrue(self.target.final_validation()) |
47266a70ba5f
7046766 Final validation should check for all solaris partition types, not just Solaris2
Drew Fisher <drew.fisher@oracle.com>
parents:
1140
diff
changeset
|
1589 |
|
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1590 |
def test_missing_active_solaris2_partition_x86(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1591 |
if platform.processor() != "i386": |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1592 |
raise SkipTest("test not supported on sparc") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1593 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1594 |
# 10 gb partition defaults to INACTIVE, 1 gb slice |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1595 |
p = self.disk1.add_partition(1, 0, 10, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1596 |
p.add_slice(0, 0, 1, in_zpool="rpool") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1597 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1598 |
# "rpool" boot pool with one BE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1599 |
zpool = self.logical.add_zpool("rpool", is_root=True) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1600 |
zpool.insert_children(BE()) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1601 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1602 |
self.target.insert_children([self.disk1, self.logical]) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1603 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1604 |
self.assertFalse(self.target.final_validation()) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1605 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1606 |
def test_no_root_zpool(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1607 |
# 10 gb partition, 1 gb slice |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1608 |
p = self.disk1.add_partition(1, 0, 10, Size.gb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1609 |
bootid=Partition.ACTIVE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1610 |
p.add_slice(0, 0, 1, in_zpool="rpool") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1611 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1612 |
# "rpool" boot pool with one BE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1613 |
zpool = self.logical.add_zpool("rpool", is_root=False) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1614 |
zpool.insert_children(BE()) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1615 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1616 |
self.target.insert_children([self.disk1, self.logical]) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1617 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1618 |
self.assertFalse(self.target.final_validation()) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1619 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1620 |
def test_whole_disk_set(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1621 |
self.disk1.whole_disk = True |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1622 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1623 |
# 10 gb partition, 1 gb slice |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1624 |
p = self.disk1.add_partition(1, 0, 10, Size.gb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1625 |
bootid=Partition.ACTIVE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1626 |
p.add_slice(0, 0, 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1627 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1628 |
# "rpool" boot pool with one BE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1629 |
zpool = self.logical.add_zpool("rpool", is_root=False) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1630 |
zpool.insert_children(BE()) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1631 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1632 |
self.target.insert_children([self.disk1, self.logical]) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1633 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1634 |
self.assertFalse(self.target.final_validation()) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1635 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1636 |
def test_no_BE(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1637 |
# 10 gb partition, 1 gb slice |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1638 |
p = self.disk1.add_partition(1, 0, 10, Size.gb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1639 |
bootid=Partition.ACTIVE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1640 |
p.add_slice(0, 0, 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1641 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1642 |
# "rpool" boot pool with one BE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1643 |
zpool = self.logical.add_zpool("rpool", is_root=False) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1644 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1645 |
self.target.insert_children([self.disk1, self.logical]) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1646 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1647 |
self.assertFalse(self.target.final_validation()) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1648 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1649 |
def test_simple_failure_two_slices_under_partition(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1650 |
# create a single 10gb partition |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1651 |
partition = self.disk1.add_partition("1", 0, 10, Size.gb_units, |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1652 |
bootid=Partition.ACTIVE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1653 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1654 |
# create two slices that overlap |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1655 |
partition.add_slice("0", CYLSIZE, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1656 |
partition.add_slice("1", CYLSIZE, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1657 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1658 |
# "rpool" boot pool with one BE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1659 |
zpool = self.logical.add_zpool("rpool", is_root=False) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1660 |
zpool.insert_children(BE()) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1661 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1662 |
self.target.insert_children([self.disk1, self.logical]) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1663 |
self.assertFalse(self.target.final_validation()) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1664 |
|
1205
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1665 |
def test_invalid_parent_with_valid_child(self): |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1666 |
# 10 gb logical partition (with no extended partition), 1 gb slice |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1667 |
p = self.disk1.add_partition(5, 0, 10, Size.gb_units, |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1668 |
bootid=Partition.ACTIVE) |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1669 |
p.add_slice(0, 0, 1, in_zpool="rpool") |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1670 |
|
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1671 |
# "rpool" boot pool with one BE |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1672 |
zpool = self.logical.add_zpool("rpool", is_root=True) |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1673 |
zpool.insert_children(BE()) |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1674 |
|
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1675 |
self.target.insert_children([self.disk1, self.logical]) |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1676 |
|
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1677 |
self.assertFalse(self.target.final_validation()) |
53ccbd18aee3
7049761 cylinder adjustment rounds down and gaps are incorrect
Drew Fisher <drew.fisher@oracle.com>
parents:
1176
diff
changeset
|
1678 |
|
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1679 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1680 |
class TestInUse(unittest.TestCase): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1681 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1682 |
def setUp(self): |
1313
17a0d5349bd5
7069542 slim_install_unit tests are failing on osol-bldx due to rpool name
Drew Fisher <drew.fisher@oracle.com>
parents:
1253
diff
changeset
|
1683 |
# find the list of vdevs for the root pool |
17a0d5349bd5
7069542 slim_install_unit tests are failing on osol-bldx due to rpool name
Drew Fisher <drew.fisher@oracle.com>
parents:
1253
diff
changeset
|
1684 |
cmd = ["/usr/sbin/zpool", "list", "-H", "-o", "name,bootfs"] |
17a0d5349bd5
7069542 slim_install_unit tests are failing on osol-bldx due to rpool name
Drew Fisher <drew.fisher@oracle.com>
parents:
1253
diff
changeset
|
1685 |
p = Popen.check_call(cmd, stdout=Popen.STORE, stderr=Popen.STORE) |
17a0d5349bd5
7069542 slim_install_unit tests are failing on osol-bldx due to rpool name
Drew Fisher <drew.fisher@oracle.com>
parents:
1253
diff
changeset
|
1686 |
for line in p.stdout.splitlines(): |
17a0d5349bd5
7069542 slim_install_unit tests are failing on osol-bldx due to rpool name
Drew Fisher <drew.fisher@oracle.com>
parents:
1253
diff
changeset
|
1687 |
(name, bootfs) = line.split() |
17a0d5349bd5
7069542 slim_install_unit tests are failing on osol-bldx due to rpool name
Drew Fisher <drew.fisher@oracle.com>
parents:
1253
diff
changeset
|
1688 |
if bootfs != "-": |
17a0d5349bd5
7069542 slim_install_unit tests are failing on osol-bldx due to rpool name
Drew Fisher <drew.fisher@oracle.com>
parents:
1253
diff
changeset
|
1689 |
root_pool = name |
17a0d5349bd5
7069542 slim_install_unit tests are failing on osol-bldx due to rpool name
Drew Fisher <drew.fisher@oracle.com>
parents:
1253
diff
changeset
|
1690 |
break |
17a0d5349bd5
7069542 slim_install_unit tests are failing on osol-bldx due to rpool name
Drew Fisher <drew.fisher@oracle.com>
parents:
1253
diff
changeset
|
1691 |
else: |
17a0d5349bd5
7069542 slim_install_unit tests are failing on osol-bldx due to rpool name
Drew Fisher <drew.fisher@oracle.com>
parents:
1253
diff
changeset
|
1692 |
raise SkipTest("unable to find root pool name") |
17a0d5349bd5
7069542 slim_install_unit tests are failing on osol-bldx due to rpool name
Drew Fisher <drew.fisher@oracle.com>
parents:
1253
diff
changeset
|
1693 |
|
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1694 |
# find the list of vdevs that compose the 'rpool' zpool |
1313
17a0d5349bd5
7069542 slim_install_unit tests are failing on osol-bldx due to rpool name
Drew Fisher <drew.fisher@oracle.com>
parents:
1253
diff
changeset
|
1695 |
rpool_map = _get_vdev_mapping(root_pool) |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1696 |
|
1073
7ff3ee2fcf57
7036435 Additional install unit tests failures after TI/TD CUD putback
Drew Fisher <drew.fisher@oracle.com>
parents:
1070
diff
changeset
|
1697 |
# take the first key in the rpool_map and use the first slice that |
7ff3ee2fcf57
7036435 Additional install unit tests failures after TI/TD CUD putback
Drew Fisher <drew.fisher@oracle.com>
parents:
1070
diff
changeset
|
1698 |
# makes up that key's mapping |
7ff3ee2fcf57
7036435 Additional install unit tests failures after TI/TD CUD putback
Drew Fisher <drew.fisher@oracle.com>
parents:
1070
diff
changeset
|
1699 |
self.in_use_slice = rpool_map[rpool_map.keys()[0]][0] |
1070
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1700 |
(self.ctd, _none, self.index) = \ |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1701 |
self.in_use_slice.split("/")[-1].partition("s") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1702 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1703 |
# construct a disk DOC object from the in_use_slice |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1704 |
self.disk = Disk("test disk") |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1705 |
self.disk.ctd = self.ctd |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1706 |
self.disk.geometry = DiskGeometry(BLOCKSIZE, CYLSIZE) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1707 |
self.disk.label = "VTOC" |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1708 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1709 |
# 100GB disk |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1710 |
self.disk.disk_prop = DiskProp() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1711 |
self.disk.disk_prop.dev_size = Size( |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1712 |
str(GBSECTOR * 100) + Size.sector_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1713 |
self.disk.disk_prop.blocksize = BLOCKSIZE |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1714 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1715 |
def tearDown(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1716 |
self.disk.delete_children() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1717 |
self.disk.delete() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1718 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1719 |
# reset the errsvc |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1720 |
errsvc.clear_error_list() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1721 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1722 |
def test_add_slice_in_use(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1723 |
self.disk.add_slice(self.index, 0, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1724 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1725 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1726 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1727 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1728 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1729 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1730 |
ShadowPhysical.SliceInUseError)) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1731 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1732 |
def test_delete_slice_in_use(self): |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1733 |
# the add slice will set an error, but we want to test delete. |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1734 |
s = self.disk.add_slice(self.index, 0, 1, Size.gb_units) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1735 |
errsvc.clear_error_list() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1736 |
s.delete() |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1737 |
|
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1738 |
# verify there is only one error in the errsvc list and that it is the |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1739 |
# proper error |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1740 |
self.assertEqual(len(errsvc._ERRORS), 1) |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1741 |
error = errsvc._ERRORS[0] |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1742 |
self.assertTrue(isinstance(error.error_data[ES_DATA_EXCEPTION], |
ef77609251f5
7021591 provide an implementation of TI/TD based on CUD
Drew Fisher <drew.fisher@oracle.com>
parents:
diff
changeset
|
1743 |
ShadowPhysical.SliceInUseError)) |
1140
a3271aa615b8
7046207 TI throwing exception when deleting non-existant Filesystem
Drew Fisher <drew.fisher@oracle.com>
parents:
1118
diff
changeset
|
1744 |
|
a3271aa615b8
7046207 TI throwing exception when deleting non-existant Filesystem
Drew Fisher <drew.fisher@oracle.com>
parents:
1118
diff
changeset
|
1745 |
def test_force_delete_slice_in_use(self): |
a3271aa615b8
7046207 TI throwing exception when deleting non-existant Filesystem
Drew Fisher <drew.fisher@oracle.com>
parents:
1118
diff
changeset
|
1746 |
# the add slice will set an error, but we want to test delete. |
a3271aa615b8
7046207 TI throwing exception when deleting non-existant Filesystem
Drew Fisher <drew.fisher@oracle.com>
parents:
1118
diff
changeset
|
1747 |
s = self.disk.add_slice(self.index, 0, 1, Size.gb_units) |
a3271aa615b8
7046207 TI throwing exception when deleting non-existant Filesystem
Drew Fisher <drew.fisher@oracle.com>
parents:
1118
diff
changeset
|
1748 |
s.force = True |
a3271aa615b8
7046207 TI throwing exception when deleting non-existant Filesystem
Drew Fisher <drew.fisher@oracle.com>
parents:
1118
diff
changeset
|
1749 |
errsvc.clear_error_list() |
a3271aa615b8
7046207 TI throwing exception when deleting non-existant Filesystem
Drew Fisher <drew.fisher@oracle.com>
parents:
1118
diff
changeset
|
1750 |
s.delete() |
a3271aa615b8
7046207 TI throwing exception when deleting non-existant Filesystem
Drew Fisher <drew.fisher@oracle.com>
parents:
1118
diff
changeset
|
1751 |
self.assertFalse(errsvc._ERRORS) |
1390
b05ba57bf117
7079464 Add math functions to the Size class
Drew Fisher <drew.fisher@oracle.com>
parents:
1355
diff
changeset
|
1752 |
|
b05ba57bf117
7079464 Add math functions to the Size class
Drew Fisher <drew.fisher@oracle.com>
parents:
1355
diff
changeset
|
1753 |
|
b05ba57bf117
7079464 Add math functions to the Size class
Drew Fisher <drew.fisher@oracle.com>
parents:
1355
diff
changeset
|
1754 |
class TestSize(unittest.TestCase): |
b05ba57bf117
7079464 Add math functions to the Size class
Drew Fisher <drew.fisher@oracle.com>
parents:
1355
diff
changeset
|
1755 |
|
b05ba57bf117
7079464 Add math functions to the Size class
Drew Fisher <drew.fisher@oracle.com>
parents:
1355
diff
changeset
|
1756 |
def test_add_size(self): |
b05ba57bf117
7079464 Add math functions to the Size class
Drew Fisher <drew.fisher@oracle.com>
parents:
1355
diff
changeset
|
1757 |
size1 = Size("1024mb") |
b05ba57bf117
7079464 Add math functions to the Size class
Drew Fisher <drew.fisher@oracle.com>
parents:
1355
diff
changeset
|
1758 |
size2 = Size("1024mb") |
b05ba57bf117
7079464 Add math functions to the Size class
Drew Fisher <drew.fisher@oracle.com>
parents:
1355
diff
changeset
|
1759 |
self.assertEqual(size1 + size2, Size("2gb")) |
b05ba57bf117
7079464 Add math functions to the Size class
Drew Fisher <drew.fisher@oracle.com>
parents:
1355
diff
changeset
|
1760 |
size1 += Size("3gb") |
b05ba57bf117
7079464 Add math functions to the Size class
Drew Fisher <drew.fisher@oracle.com>
parents:
1355
diff
changeset
|
1761 |
self.assertEqual(size1, Size("4gb")) |
b05ba57bf117
7079464 Add math functions to the Size class
Drew Fisher <drew.fisher@oracle.com>
parents:
1355
diff
changeset
|
1762 |
|
b05ba57bf117
7079464 Add math functions to the Size class
Drew Fisher <drew.fisher@oracle.com>
parents:
1355
diff
changeset
|
1763 |
def test_sub_size(self): |
b05ba57bf117
7079464 Add math functions to the Size class
Drew Fisher <drew.fisher@oracle.com>
parents:
1355
diff
changeset
|
1764 |
size1 = Size("4096mb") |
b05ba57bf117
7079464 Add math functions to the Size class
Drew Fisher <drew.fisher@oracle.com>
parents:
1355
diff
changeset
|
1765 |
size2 = Size("2048mb") |
b05ba57bf117
7079464 Add math functions to the Size class
Drew Fisher <drew.fisher@oracle.com>
parents:
1355
diff
changeset
|
1766 |
self.assertEqual(size1 - size2, Size("2gb")) |