Signed-off-by: Vincent Batts <vbatts@redhat.com>
| ... | ... |
@@ -307,7 +307,9 @@ func RemoveDevice(name string) error {
|
| 307 | 307 |
if err := task.SetCookie(&cookie, 0); err != nil {
|
| 308 | 308 |
return fmt.Errorf("Can not set cookie: %s", err)
|
| 309 | 309 |
} |
| 310 |
+ defer UdevWait(cookie) |
|
| 310 | 311 |
|
| 312 |
+ dmSawBusy = false // reset before the task is run |
|
| 311 | 313 |
if err = task.Run(); err != nil {
|
| 312 | 314 |
if dmSawBusy {
|
| 313 | 315 |
return ErrBusy |
| ... | ... |
@@ -315,8 +317,6 @@ func RemoveDevice(name string) error {
|
| 315 | 315 |
return fmt.Errorf("Error running RemoveDevice %s", err)
|
| 316 | 316 |
} |
| 317 | 317 |
|
| 318 |
- UdevWait(cookie) |
|
| 319 |
- |
|
| 320 | 318 |
return nil |
| 321 | 319 |
} |
| 322 | 320 |
|
| ... | ... |
@@ -543,7 +543,7 @@ func CreateDevice(poolName string, deviceId *int) error {
|
| 543 | 543 |
return fmt.Errorf("Can't set message %s", err)
|
| 544 | 544 |
} |
| 545 | 545 |
|
| 546 |
- dmSawExist = false |
|
| 546 |
+ dmSawExist = false // reset before the task is run |
|
| 547 | 547 |
if err := task.Run(); err != nil {
|
| 548 | 548 |
if dmSawExist {
|
| 549 | 549 |
// Already exists, try next id |
| ... | ... |
@@ -638,7 +638,7 @@ func CreateSnapDevice(poolName string, deviceId *int, baseName string, baseDevic |
| 638 | 638 |
return fmt.Errorf("Can't set message %s", err)
|
| 639 | 639 |
} |
| 640 | 640 |
|
| 641 |
- dmSawExist = false |
|
| 641 |
+ dmSawExist = false // reset before the task is run |
|
| 642 | 642 |
if err := task.Run(); err != nil {
|
| 643 | 643 |
if dmSawExist {
|
| 644 | 644 |
// Already exists, try next id |