fix set migrate capability, fix resize fs catch error

This commit is contained in:
wanyaoqi
2019-05-16 15:20:28 +08:00
parent 0d6c97014b
commit 3acf8cd9a8
4 changed files with 14 additions and 30 deletions
+1 -1
View File
@@ -558,7 +558,7 @@ func (m *QmpMonitor) MigrateSetCapability(capability, state string, callback Str
}
cmd := &Command{
Execute: "query-migrate-capabilities",
Execute: "migrate-set-capabilities",
Args: map[string]interface{}{
"capabilities": []interface{}{
map[string]interface{}{
+11
View File
@@ -118,6 +118,17 @@ func (d *SBaseDisk) DeployGuestFs(diskPath string, guestDesc *jsonutils.JSONDict
return guestfs.DeployGuestFs(root, guestDesc, deployInfo)
}
func (d *SBaseDisk) ResizeFs(diskPath string) error {
disk := NewKVMGuestDisk(diskPath)
if disk.Connect() {
defer disk.Disconnect()
if err := disk.ResizePartition(); err != nil {
return err
}
}
return nil
}
func (d *SBaseDisk) GetDiskSetupScripts(diskIndex int) string {
return ""
}
+1 -14
View File
@@ -132,24 +132,11 @@ func (d *SLocalDisk) Resize(ctx context.Context, params interface{}) (jsonutils.
// d.Fallocate()
}
if err = d.ResizeFs(); err != nil {
return nil, err
}
d.ResizeFs(d.GetPath())
return d.GetDiskDesc(), nil
}
func (d *SLocalDisk) ResizeFs() error {
disk := NewKVMGuestDisk(d.GetPath())
if disk.Connect() {
defer disk.Disconnect()
if err := disk.ResizePartition(); err != nil {
return err
}
}
return nil
}
func (d *SLocalDisk) CreateFromImageFuse(ctx context.Context, url string) error {
log.Infof("Create from image fuse %s", url)
+1 -15
View File
@@ -111,24 +111,10 @@ func (d *SRBDDisk) Resize(ctx context.Context, params interface{}) (jsonutils.JS
return nil, err
}
if err := d.ResizeFs(); err != nil {
return nil, err
}
d.ResizeFs(d.GetPath())
return d.GetDiskDesc(), nil
}
func (d *SRBDDisk) ResizeFs() error {
disk := NewKVMGuestDisk(d.GetPath())
if disk.Connect() {
defer disk.Disconnect()
if err := disk.ResizePartition(); err != nil {
return err
}
}
return nil
}
func (d *SRBDDisk) PrepareSaveToGlance(ctx context.Context, params interface{}) (jsonutils.JSONObject, error) {
if err := d.Probe(); err != nil {
return nil, err