Skip to content

Commit 988b917

Browse files
authored
Merge pull request #1681 from ioito/hotfix/qx-remove-vhd-sdk
fix(azure): remove vhd sdk
2 parents 6afb315 + ad26d54 commit 988b917

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+78
-287
lines changed

go.mod

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ require (
66
cloud.google.com/go/storage v1.39.1
77
github.com/Azure/go-autorest/autorest v0.9.6
88
github.com/Azure/go-autorest/autorest/azure/auth v0.4.2
9-
github.com/Microsoft/azure-vhd-utils v0.0.0-20181115010904-44cbada2ece3
109
github.com/aliyun/alibaba-cloud-sdk-go v1.61.684
1110
github.com/aliyun/aliyun-oss-go-sdk v2.0.4+incompatible
1211
github.com/aokoli/goutils v1.0.1
@@ -124,5 +123,3 @@ require (
124123
gopkg.in/ini.v1 v1.62.0 // indirect
125124
gopkg.in/yaml.v2 v2.4.0 // indirect
126125
)
127-
128-
replace github.com/Azure/azure-sdk-for-go => github.com/Azure/azure-sdk-for-go v36.1.0+incompatible

go.sum

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc=
99
cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI=
1010
cloud.google.com/go/storage v1.39.1 h1:MvraqHKhogCOTXTlct/9C3K3+Uy2jBmFYb3/Sp6dVtY=
1111
cloud.google.com/go/storage v1.39.1/go.mod h1:xK6xZmxZmo+fyP7+DEF6FhNc24/JAe95OLyOHCXFH1o=
12-
github.com/Azure/azure-sdk-for-go v36.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
1312
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
1413
github.com/Azure/go-autorest/autorest v0.9.3/go.mod h1:GsRuLYvwzLjjjRoWEIyMUaYq8GNUx2nRB378IPt/1p0=
1514
github.com/Azure/go-autorest/autorest v0.9.6 h1:5YWtOnckcudzIw8lPPBcWOnmIFWMtHci1ZWAZulMSx0=
@@ -35,8 +34,6 @@ github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6L
3534
github.com/Azure/go-autorest/tracing v0.5.0 h1:TRn4WjSnkcSy5AEG3pnbtFSwNtwzjr4VYyQflFE619k=
3635
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
3736
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
38-
github.com/Microsoft/azure-vhd-utils v0.0.0-20181115010904-44cbada2ece3 h1:gImoAO1xAcC1oDlYmD/X7dggsodGf2DFJOVE5m0ssms=
39-
github.com/Microsoft/azure-vhd-utils v0.0.0-20181115010904-44cbada2ece3/go.mod h1:u0H9gMieFLxkUy8RS0X8VbFWyPs2815qQAaitRbj6x0=
4037
github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM=
4138
github.com/a8m/mark v0.1.1-0.20170507133748-44f2db618845/go.mod h1:c8Mh99Cw82nrsAnPgxQSZHkswVOJF7/MqZb1ZdvriLM=
4239
github.com/aliyun/alibaba-cloud-sdk-go v1.61.684 h1:MHqPW0la4Op96JGMkpB7Kxrz0Se5nowF6rLhHTZBUn4=
@@ -199,7 +196,6 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm
199196
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
200197
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
201198
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
202-
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
203199
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
204200
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
205201
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
@@ -426,7 +422,6 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ
426422
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
427423
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
428424
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
429-
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
430425
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
431426
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
432427
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
@@ -435,7 +430,6 @@ gopkg.in/fatih/set.v0 v0.2.1/go.mod h1:5eLWEndGL4zGGemXWrKuts+wTJR0y+w+auqUJZbmy
435430
gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
436431
gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU=
437432
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
438-
gopkg.in/urfave/cli.v1 v1.19.1/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0=
439433
gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0=
440434
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
441435
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

pkg/multicloud/azure/storageaccount.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ import (
2929
"strings"
3030
"time"
3131

32-
"github.com/Microsoft/azure-vhd-utils/vhdcore/common"
33-
"github.com/Microsoft/azure-vhd-utils/vhdcore/diskstream"
32+
"yunion.io/x/cloudmux/pkg/multicloud/azure/vhdcore/common"
33+
"yunion.io/x/cloudmux/pkg/multicloud/azure/vhdcore/diskstream"
3434

3535
"yunion.io/x/jsonutils"
3636
"yunion.io/x/log"

pkg/multicloud/azure/upload.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ import (
2424
"net/url"
2525
"time"
2626

27-
"github.com/Microsoft/azure-vhd-utils/vhdcore/block/bitmap"
28-
"github.com/Microsoft/azure-vhd-utils/vhdcore/common"
29-
"github.com/Microsoft/azure-vhd-utils/vhdcore/diskstream"
30-
"github.com/Microsoft/azure-vhd-utils/vhdcore/footer"
31-
"github.com/Microsoft/azure-vhd-utils/vhdcore/validator"
27+
"yunion.io/x/cloudmux/pkg/multicloud/azure/vhdcore/block/bitmap"
28+
"yunion.io/x/cloudmux/pkg/multicloud/azure/vhdcore/common"
29+
"yunion.io/x/cloudmux/pkg/multicloud/azure/vhdcore/diskstream"
30+
"yunion.io/x/cloudmux/pkg/multicloud/azure/vhdcore/footer"
31+
"yunion.io/x/cloudmux/pkg/multicloud/azure/vhdcore/validator"
3232

3333
"yunion.io/x/cloudmux/pkg/multicloud/azure/concurrent"
3434
"yunion.io/x/cloudmux/pkg/multicloud/azure/progress"

vendor/github.com/Microsoft/azure-vhd-utils/vhdcore/bat/blockAllocationTable.go renamed to pkg/multicloud/azure/vhdcore/bat/blockAllocationTable.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package bat
33
import (
44
"math"
55

6-
"github.com/Microsoft/azure-vhd-utils/vhdcore"
6+
"yunion.io/x/cloudmux/pkg/multicloud/azure/vhdcore"
77
)
88

99
// BlockAllocationTable type represents the Block Allocation Table (BAT) of the disk, BAT served as
@@ -20,7 +20,6 @@ import (
2020
// the 'block bitmap section'. Each bit in the bitmap indicates the state of the corresponding sector
2121
// in 'data section', 1 indicates sector contains valid data, 0 indicates the sector have never been
2222
// modified.
23-
//
2423
type BlockAllocationTable struct {
2524
BATEntriesCount uint32
2625
BAT []uint32
@@ -30,7 +29,6 @@ type BlockAllocationTable struct {
3029
// NewBlockAllocationTable creates an instance of BlockAllocationTable, BAT is the block allocation table,
3130
// each entry in this table is the absolute sector offset to a block, blockSize is the size of block's
3231
// 'data section' in bytes.
33-
//
3432
func NewBlockAllocationTable(blockSize uint32, bat []uint32) *BlockAllocationTable {
3533
return &BlockAllocationTable{BATEntriesCount: uint32(len(bat)), blockSize: blockSize, BAT: bat}
3634
}
@@ -41,7 +39,6 @@ func NewBlockAllocationTable(blockSize uint32, bat []uint32) *BlockAllocationTab
4139
// required to store the bitmap.
4240
// As per vhd specification sectors per block must be power of two. The sector length is always 512 bytes.
4341
// This means the block size will be power of two as well e.g. 512 * 2^3, 512 * 2^4, 512 * 2^5 etc..
44-
//
4542
func (b *BlockAllocationTable) GetBitmapSizeInBytes() int32 {
4643
return int32(b.blockSize / uint32(vhdcore.VhdSectorLength) / 8)
4744
}
@@ -58,20 +55,17 @@ func (b *BlockAllocationTable) GetSectorPaddedBitmapSizeInBytes() int32 {
5855
// GetBitmapAddress returns the address of the 'block bitmap section' of a given block. Address is the
5956
// absolute byte offset of the 'block bitmap section'. A block consists of 'block bitmap section' and
6057
// 'data section'
61-
//
6258
func (b *BlockAllocationTable) GetBitmapAddress(blockIndex uint32) int64 {
6359
return int64(b.BAT[blockIndex]) * vhdcore.VhdSectorLength
6460
}
6561

6662
// GetBlockDataAddress returns the address of the 'data section' of a given block. Address is the absolute
6763
// byte offset of the 'data section'. A block consists of 'block bitmap section' and 'data section'
68-
//
6964
func (b *BlockAllocationTable) GetBlockDataAddress(blockIndex uint32) int64 {
7065
return b.GetBitmapAddress(blockIndex) + int64(b.GetSectorPaddedBitmapSizeInBytes())
7166
}
7267

7368
// HasData returns true if the given block has not yet expanded hence contains no data.
74-
//
7569
func (b *BlockAllocationTable) HasData(blockIndex uint32) bool {
7670
return blockIndex != vhdcore.VhdNoDataInt && b.BAT[blockIndex] != vhdcore.VhdNoDataInt
7771
}

vendor/github.com/Microsoft/azure-vhd-utils/vhdcore/bat/blockAllocationTableFactory.go renamed to pkg/multicloud/azure/vhdcore/bat/blockAllocationTableFactory.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
package bat
22

33
import (
4-
"github.com/Microsoft/azure-vhd-utils/vhdcore/header"
5-
"github.com/Microsoft/azure-vhd-utils/vhdcore/reader"
4+
"yunion.io/x/cloudmux/pkg/multicloud/azure/vhdcore/header"
5+
"yunion.io/x/cloudmux/pkg/multicloud/azure/vhdcore/reader"
66
)
77

88
// BlockAllocationTableFactory type is used to create BlockAllocationTable instance by reading BAT
99
// section of the disk which follows the header
10-
//
1110
type BlockAllocationTableFactory struct {
1211
vhdReader *reader.VhdReader
1312
vhdHeader *header.Header
@@ -17,7 +16,6 @@ type BlockAllocationTableFactory struct {
1716
// to create BlockAllocationTable instance by reading BAT section of the Vhd.
1817
// vhdReader is the reader to be used to read the entry, vhdHeader is the header structure representing
1918
// the disk header.
20-
//
2119
func NewBlockAllocationFactory(vhdReader *reader.VhdReader, vhdHeader *header.Header) *BlockAllocationTableFactory {
2220
return &BlockAllocationTableFactory{
2321
vhdReader: vhdReader,
@@ -27,7 +25,6 @@ func NewBlockAllocationFactory(vhdReader *reader.VhdReader, vhdHeader *header.He
2725

2826
// Create creates a BlockAllocationTable instance by reading the BAT section of the disk.
2927
// This function return error if any error occurs while reading or parsing the BAT entries.
30-
//
3128
func (f *BlockAllocationTableFactory) Create() (*BlockAllocationTable, error) {
3229
var err error
3330
batEntriesCount := f.vhdHeader.MaxTableEntries

vendor/github.com/Microsoft/azure-vhd-utils/vhdcore/bat/blockAllocationTableParseError.go renamed to pkg/multicloud/azure/vhdcore/bat/blockAllocationTableParseError.go

File renamed without changes.

vendor/github.com/Microsoft/azure-vhd-utils/vhdcore/block/bitmap/bitmap.go renamed to pkg/multicloud/azure/vhdcore/block/bitmap/bitmap.go

File renamed without changes.

vendor/github.com/Microsoft/azure-vhd-utils/vhdcore/block/bitmap/factory.go renamed to pkg/multicloud/azure/vhdcore/block/bitmap/factory.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
package bitmap
22

33
import (
4-
"github.com/Microsoft/azure-vhd-utils/vhdcore/bat"
5-
"github.com/Microsoft/azure-vhd-utils/vhdcore/reader"
4+
"yunion.io/x/cloudmux/pkg/multicloud/azure/vhdcore/bat"
5+
"yunion.io/x/cloudmux/pkg/multicloud/azure/vhdcore/reader"
66
)
77

88
// Factory type is used to create BitMap instance by reading 'bitmap section' of a block.
9-
//
109
type Factory struct {
1110
vhdReader *reader.VhdReader
1211
blockAllocationTable *bat.BlockAllocationTable
@@ -16,15 +15,13 @@ type Factory struct {
1615
// the 'bitmap section' of a block. vhdReader is the reader to read the disk, blockAllocationTable wraps
1716
// the disk's BAT table, which has one entry per block, this is used to retrieve the absolute offset to
1817
// the beginning of the 'bitmap section' of a block and the size of the 'bitmap section'.
19-
//
2018
func NewFactory(vhdReader *reader.VhdReader, blockAllocationTable *bat.BlockAllocationTable) *Factory {
2119
return &Factory{vhdReader: vhdReader, blockAllocationTable: blockAllocationTable}
2220
}
2321

2422
// Create creates a BitMap instance by reading block's 'bitmap section', block is the index of the
2523
// block entry in the BAT whose 'bitmap section' needs to be read.
2624
// This function return error if any error occurs while reading or parsing the block's bitmap.
27-
//
2825
func (f *Factory) Create(blockIndex uint32) (*BitMap, error) {
2926
bitmapAbsoluteByteOffset := f.blockAllocationTable.GetBitmapAddress(blockIndex)
3027
bitmapSizeInBytes := f.blockAllocationTable.GetBitmapSizeInBytes()

vendor/github.com/Microsoft/azure-vhd-utils/vhdcore/block/bitmap/parseError.go renamed to pkg/multicloud/azure/vhdcore/block/bitmap/parseError.go

File renamed without changes.

0 commit comments

Comments
 (0)