@@ -15,7 +15,8 @@ import (
15
15
"libvirt.org/go/libvirtxml"
16
16
)
17
17
18
- var _ = Describe ("DetachVolume" , func () {
18
+ var _ = FDescribe ("DetachVolume" , func () {
19
+ const networkName = "default"
19
20
It ("should correctly detach volume from machine" , func (ctx SpecContext ) {
20
21
By ("creating a machine with two empty disks and single ceph volume" )
21
22
createResp , err := machineClient .CreateMachine (ctx , & iri.CreateMachineRequest {
@@ -31,6 +32,12 @@ var _ = Describe("DetachVolume", func() {
31
32
Image : osImage ,
32
33
},
33
34
Class : machineClassx3xlarge ,
35
+ NetworkInterfaces : []* iri.NetworkInterface {
36
+ {
37
+ Name : "eth0" ,
38
+ NetworkId : networkName ,
39
+ },
40
+ },
34
41
Volumes : []* iri.Volume {
35
42
{
36
43
Name : "disk-1" ,
@@ -46,7 +53,7 @@ var _ = Describe("DetachVolume", func() {
46
53
},
47
54
Device : "odb" ,
48
55
},
49
- {
56
+ /* {
50
57
Name: "volume-1",
51
58
Device: "odc",
52
59
Connection: &iri.VolumeConnection{
@@ -61,7 +68,7 @@ var _ = Describe("DetachVolume", func() {
61
68
"userKey": []byte(cephUserkey),
62
69
},
63
70
},
64
- },
71
+ },*/
65
72
},
66
73
},
67
74
},
@@ -121,11 +128,11 @@ var _ = Describe("DetachVolume", func() {
121
128
Handle : "libvirt-provider.ironcore.dev/empty-disk/disk-2" ,
122
129
State : iri .VolumeState_VOLUME_ATTACHED ,
123
130
},
124
- & iri.VolumeStatus {
131
+ /* &iri.VolumeStatus{
125
132
Name: "volume-1",
126
133
Handle: "libvirt-provider.ironcore.dev/ceph/libvirt-provider.ironcore.dev/ceph^dummy",
127
134
State: iri.VolumeState_VOLUME_ATTACHED,
128
- })),
135
+ }*/ )),
129
136
HaveField ("State" , Equal (iri .MachineState_MACHINE_RUNNING )),
130
137
))
131
138
@@ -138,13 +145,21 @@ var _ = Describe("DetachVolume", func() {
138
145
Expect (domainXML .Unmarshal (domainXMLData )).Should (Succeed ())
139
146
disks = domainXML .Devices .Disks
140
147
return len (disks )
141
- }).Should (Equal (4 ))
148
+ }).Should (Equal (3 ))
142
149
Expect (disks [0 ].Serial ).To (HavePrefix ("oda" ))
143
150
Expect (disks [1 ].Serial ).To (HavePrefix ("odb" ))
144
- Expect (disks [2 ].Serial ).To (HavePrefix ("odc" ))
151
+ // Expect(disks[2].Serial).To(HavePrefix("odc"))
145
152
146
153
// wait to complete machine reconciliation
147
- time .Sleep (20 * time .Second )
154
+ Eventually (func (g Gomega ) {
155
+ domainXMLData , err := libvirtConn .DomainGetXMLDesc (domain , 0 )
156
+ g .Expect (err ).NotTo (HaveOccurred ())
157
+ domainXML := & libvirtxml.Domain {}
158
+ g .Expect (domainXML .Unmarshal (domainXMLData )).Should (Succeed ())
159
+ ip , err := getAnyDomainIPForNetwork (networkName , domainXML )
160
+ g .Expect (err ).NotTo (HaveOccurred ())
161
+ g .Expect (isSSHOpen (ip )).Should (BeTrue ())
162
+ }).WithTimeout (2 * time .Minute ).WithPolling (2 * time .Second ).Should (Succeed ())
148
163
149
164
By ("detaching empty disk disk-1 from machine" )
150
165
diskDetachResp , err := machineClient .DetachVolume (ctx , & iri.DetachVolumeRequest {
0 commit comments