All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting
@ 2014-08-04 12:46 arei.gonglei
  2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 1/8] bootindex: add modify_boot_device_path function arei.gonglei
                   ` (10 more replies)
  0 siblings, 11 replies; 20+ messages in thread
From: arei.gonglei @ 2014-08-04 12:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: chenliang88, weidong.huang, mst, aik, hutao, armbru, kraxel,
	akong, agraf, Gonglei, aliguori, gaowanlong, ehabkost,
	luonengjun, peter.huangpeng, hani, stefanha, pbonzini,
	lcapitulino, kwolf, peter.crosthwaite, imammedo, afaerber

From: Gonglei <arei.gonglei@huawei.com>

Sometimes, we want to modify boot order of a guest, but no need to
shutdown it. We can call dynamic changing bootindex of a guest, which
can be assured taking effect just after the guest rebooting.

For example, in P2V scene, we boot a guest and then attach a
new system disk, for copying some thing. We want to assign the
new disk as the booting disk, which means its bootindex=1.

Different nics can be assigen different bootindex dynamically
also make sense.

The patchsets add one qmp interface, and add an fw_cfg_machine_reset()
to achieve it.

Steps of testing:

./qemu-system-x86_64 -enable-kvm -m 4096 -smp 4 -name redhat6.2 -drive \
file=/home/redhat6.2.img,if=none,id=drive-ide0-0-0 \
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
-drive file=/home/RH-DVD1.iso,if=none,id=drive-ide0-0-1 \
-device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1,bootindex=4 \
-vnc 0.0.0.0:10 -netdev type=user,id=net0 \
-device virtio-net-pci,netdev=net0,bootindex=3,id=nic1 \
-netdev type=user,id=net1 -device e1000,netdev=net1,bootindex=2,id=nic2 \
-drive file=/home/virtio-disk.vfd,if=none,id=drive-fdc0-0-0,format=raw \
-device isa-fdc,driveA=drive-fdc0-0-0,id=floppy1,bootindexA=5 -monitor stdio
QEMU 2.0.93 monitor - type 'help' for more information
(qemu) info bootindex
id       bootindex       suffix
"floppy1"        5      "/floppy@0"
"ide0-0-1"       4      "/disk@1"
"nic1"   3      "/ethernet-phy@0"
"nic2"   2      "/ethernet-phy@0"
"ide0-0-0"       1      "/disk@0"
(qemu) set-bootindex ide0-0-1 1
The bootindex 1 has already been used
(qemu) set-bootindex ide0-0-1 6 "/disk@1"
(qemu) set-bootindex ide0-0-1 0
(qemu) system_reset
(qemu) set-bootindex ide0-0-1 1
The bootindex 1 has already been used
(qemu) set-bootindex nic1 0
The bootindex 0 has already been used
(qemu) set-bootindex ide0-0-1 -1
(qemu) set-bootindex nic1 0
(qemu) info bootindex
id       bootindex       suffix
"floppy1"        5      "/floppy@0"
"nic2"   2      "/ethernet-phy@0"
"ide0-0-0"       1      "/disk@0"
"nic1"   0      "/ethernet-phy@0"
(qemu) system_reset
(qemu)


Changes since v4:
 - using error_setg() instead of qerror_report() in patch 1/8.
 - call del_boot_device_path() from device_finalize() instead
  of placing it into each individual device in patch 4/8.

Changes since v3:
 - rework del_* and modify_* function, because of virtio devices' specialation.
   For example, virtio-net's id is NULL, and its parent virtio-net-pci's id was assigned.
   Though the global fw_boot_order stored the virtio-net device.
 - call dell_boot_device_path in each individual device avoiding waste resouce.
 - introduce qmp "query-bootindex" command
 - introcude hmp "info bootindex" command
 - Fixes by Eric's reviewing comments, thanks.

Changes since v2:
 *address Gerd's reviewing suggestion:
 - use the old entry's suffix, if the caller do not pass it in.
 - call del_boot_device_path() from device_finalize() instead
   of placing it into each individual device.

  Thanks Gerd.

Changes since v1:
 *rework by Gerd's suggestion:
 - split modify and del fw_boot_order for single function.
 - change modify bootindex's realization which simply lookup
   the device and modify the bootindex. if the new bootindex
   has already used by another device just throw an error.
 - change to del_boot_device_path(DeviceState *dev) and simply delete all
   entries belonging to the device.

Gonglei (8):
  bootindex: add modify_boot_device_path function
  bootindex: add del_boot_device_path function
  fw_cfg: add fw_cfg_machine_reset function
  bootindex: delete bootindex when device is removed
  qmp: add set-bootindex command
  qemu-monitor: HMP set-bootindex wrapper
  qmp: add query-bootindex command
  qemu-monitor: add HMP "info-bootindex" command

 hmp-commands.hx           |  17 +++++++
 hmp.c                     |  33 +++++++++++++
 hmp.h                     |   2 +
 hw/core/qdev.c            |   4 ++
 hw/nvram/fw_cfg.c         |  54 ++++++++++++++++++---
 include/hw/nvram/fw_cfg.h |   2 +
 include/sysemu/sysemu.h   |   3 ++
 monitor.c                 |   7 +++
 qapi-schema.json          |  46 ++++++++++++++++++
 qmp-commands.hx           |  66 ++++++++++++++++++++++++++
 qmp.c                     |  17 +++++++
 vl.c                      | 117 ++++++++++++++++++++++++++++++++++++++++++++++
 12 files changed, 361 insertions(+), 7 deletions(-)

-- 
1.7.12.4

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v5 1/8] bootindex: add modify_boot_device_path function
  2014-08-04 12:46 [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting arei.gonglei
@ 2014-08-04 12:46 ` arei.gonglei
  2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 2/8] bootindex: add del_boot_device_path function arei.gonglei
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: arei.gonglei @ 2014-08-04 12:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: chenliang88, weidong.huang, mst, aik, hutao, armbru, kraxel,
	akong, agraf, Gonglei, aliguori, gaowanlong, ehabkost,
	luonengjun, peter.huangpeng, hani, stefanha, pbonzini,
	lcapitulino, kwolf, peter.crosthwaite, imammedo, afaerber

From: Gonglei <arei.gonglei@huawei.com>

When we want to change one device's bootindex, we
should lookup the device and change the bootindex.
it is simply that remove it from the global boot list,
then re-add it, sorted by new bootindex.

If the new bootindex has already used by another device
just throw an error.

Allow changing the existing bootindex entry only,
not support adding new boot entries.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Chenliang <chenliang88@huawei.com>
---
 include/sysemu/sysemu.h |  2 ++
 vl.c                    | 66 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index d8539fd..06e1b72 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -209,6 +209,8 @@ void usb_info(Monitor *mon, const QDict *qdict);
 
 void add_boot_device_path(int32_t bootindex, DeviceState *dev,
                           const char *suffix);
+void modify_boot_device_path(int32_t bootindex, DeviceState *dev,
+                             const char *suffix, Error **errp);
 char *get_boot_devices_list(size_t *size, bool ignore_suffixes);
 
 DeviceState *get_boot_device(uint32_t position);
diff --git a/vl.c b/vl.c
index fe451aa..770ad67 100644
--- a/vl.c
+++ b/vl.c
@@ -1248,6 +1248,72 @@ void add_boot_device_path(int32_t bootindex, DeviceState *dev,
     QTAILQ_INSERT_TAIL(&fw_boot_order, node, link);
 }
 
+static bool is_same_fw_dev_path(DeviceState *src, DeviceState *dst)
+{
+    bool ret = false;
+    char *devpath_src = qdev_get_fw_dev_path(src);
+    char *devpath_dst = qdev_get_fw_dev_path(dst);
+
+    if (!strcmp(devpath_src, devpath_dst)) {
+        ret = true;
+    }
+
+    g_free(devpath_src);
+    g_free(devpath_dst);
+    return ret;
+}
+
+void modify_boot_device_path(int32_t bootindex, DeviceState *dev,
+                             const char *suffix, Error **errp)
+{
+    FWBootEntry *i, *old_entry = NULL;
+
+    assert(dev != NULL || suffix != NULL);
+
+    if (bootindex >= 0) {
+        QTAILQ_FOREACH(i, &fw_boot_order, link) {
+            if (i->bootindex == bootindex) {
+                error_setg(errp, "The bootindex %d has already been used",
+                           bootindex);
+                return;
+            }
+        }
+    }
+
+    QTAILQ_FOREACH(i, &fw_boot_order, link) {
+        /*
+         * Delete the same original dev, if devices havn't id property,
+         * we must check they fw_dev_path to identify them.
+         */
+        if ((i->dev->id && !strcmp(i->dev->id, dev->id)) ||
+            (!i->dev->id && is_same_fw_dev_path(i->dev, dev))) {
+            if (!suffix) {
+                QTAILQ_REMOVE(&fw_boot_order, i, link);
+                old_entry = i;
+
+                break;
+            } else if (i->suffix && !strcmp(suffix, i->suffix)) {
+                QTAILQ_REMOVE(&fw_boot_order, i, link);
+                old_entry = i;
+
+                break;
+            }
+        }
+    }
+
+    if (!old_entry) {
+        error_setg(errp, "The device(%s) havn't configured bootindex property"
+                   " or suffix don't match", dev->id);
+
+        return;
+    }
+
+    add_boot_device_path(bootindex, dev, old_entry->suffix);
+
+    g_free(old_entry->suffix);
+    g_free(old_entry);
+}
+
 DeviceState *get_boot_device(uint32_t position)
 {
     uint32_t counter = 0;
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v5 2/8] bootindex: add del_boot_device_path function
  2014-08-04 12:46 [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting arei.gonglei
  2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 1/8] bootindex: add modify_boot_device_path function arei.gonglei
@ 2014-08-04 12:46 ` arei.gonglei
  2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 3/8] fw_cfg: add fw_cfg_machine_reset function arei.gonglei
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: arei.gonglei @ 2014-08-04 12:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: chenliang88, weidong.huang, mst, aik, hutao, armbru, kraxel,
	akong, agraf, Gonglei, aliguori, gaowanlong, ehabkost,
	luonengjun, peter.huangpeng, hani, stefanha, pbonzini,
	lcapitulino, kwolf, peter.crosthwaite, imammedo, afaerber

From: Gonglei <arei.gonglei@huawei.com>

Introduce del_boot_device_path() to clean up fw_cfg content when
hot-unplugging a device that refers to a bootindex.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Chenliang <chenliang88@huawei.com>
---
 include/sysemu/sysemu.h |  1 +
 vl.c                    | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 06e1b72..130f971 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -209,6 +209,7 @@ void usb_info(Monitor *mon, const QDict *qdict);
 
 void add_boot_device_path(int32_t bootindex, DeviceState *dev,
                           const char *suffix);
+void del_boot_device_path(DeviceState *dev);
 void modify_boot_device_path(int32_t bootindex, DeviceState *dev,
                              const char *suffix, Error **errp);
 char *get_boot_devices_list(size_t *size, bool ignore_suffixes);
diff --git a/vl.c b/vl.c
index 770ad67..2424135 100644
--- a/vl.c
+++ b/vl.c
@@ -1263,6 +1263,26 @@ static bool is_same_fw_dev_path(DeviceState *src, DeviceState *dst)
     return ret;
 }
 
+void del_boot_device_path(DeviceState *dev)
+{
+    FWBootEntry *i;
+
+    assert(dev != NULL);
+
+    /* remove all entries of the assigned device */
+    QTAILQ_FOREACH(i, &fw_boot_order, link) {
+        if ((i->dev->id && dev->id &&
+            !strcmp(i->dev->id, dev->id)) ||
+            (!i->dev->id && is_same_fw_dev_path(i->dev, dev))) {
+            QTAILQ_REMOVE(&fw_boot_order, i, link);
+            g_free(i->suffix);
+            g_free(i);
+
+            break;
+        }
+    }
+}
+
 void modify_boot_device_path(int32_t bootindex, DeviceState *dev,
                              const char *suffix, Error **errp)
 {
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v5 3/8] fw_cfg: add fw_cfg_machine_reset function
  2014-08-04 12:46 [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting arei.gonglei
  2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 1/8] bootindex: add modify_boot_device_path function arei.gonglei
  2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 2/8] bootindex: add del_boot_device_path function arei.gonglei
@ 2014-08-04 12:46 ` arei.gonglei
  2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 4/8] bootindex: delete bootindex when device is removed arei.gonglei
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: arei.gonglei @ 2014-08-04 12:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: chenliang88, weidong.huang, mst, aik, hutao, armbru, kraxel,
	akong, agraf, Gonglei, aliguori, gaowanlong, ehabkost,
	luonengjun, peter.huangpeng, hani, stefanha, pbonzini,
	lcapitulino, kwolf, peter.crosthwaite, imammedo, afaerber

From: Gonglei <arei.gonglei@huawei.com>

We must assure that the changed bootindex can take effect
when guest is rebooted. So we introduce fw_cfg_machine_reset(),
which change the fw_cfg file's bootindex data using the new
global fw_boot_order list.

Signed-off-by: Chenliang <chenliang88@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 hw/nvram/fw_cfg.c         | 54 +++++++++++++++++++++++++++++++++++++++++------
 include/hw/nvram/fw_cfg.h |  2 ++
 2 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index b71d251..a24a44d 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -56,7 +56,6 @@ struct FWCfgState {
     FWCfgFiles *files;
     uint16_t cur_entry;
     uint32_t cur_offset;
-    Notifier machine_ready;
 };
 
 #define JPG_FILE 0
@@ -402,6 +401,26 @@ static void fw_cfg_add_bytes_read_callback(FWCfgState *s, uint16_t key,
     s->entries[arch][key].callback_opaque = callback_opaque;
 }
 
+static void *fw_cfg_modify_bytes_read(FWCfgState *s, uint16_t key,
+                                              void *data, size_t len)
+{
+    void *ptr;
+    int arch = !!(key & FW_CFG_ARCH_LOCAL);
+
+    key &= FW_CFG_ENTRY_MASK;
+
+    assert(key < FW_CFG_MAX_ENTRY && len < UINT32_MAX);
+
+    /* return the old data to the function caller, avoid memory leak */
+    ptr = s->entries[arch][key].data;
+    s->entries[arch][key].data = data;
+    s->entries[arch][key].len = len;
+    s->entries[arch][key].callback_opaque = NULL;
+    s->entries[arch][key].callback = NULL;
+
+    return ptr;
+}
+
 void fw_cfg_add_bytes(FWCfgState *s, uint16_t key, void *data, size_t len)
 {
     fw_cfg_add_bytes_read_callback(s, key, NULL, NULL, data, len);
@@ -499,13 +518,36 @@ void fw_cfg_add_file(FWCfgState *s,  const char *filename,
     fw_cfg_add_file_callback(s, filename, NULL, NULL, data, len);
 }
 
-static void fw_cfg_machine_ready(struct Notifier *n, void *data)
+void *fw_cfg_modify_file(FWCfgState *s, const char *filename,
+                        void *data, size_t len)
+{
+    int i, index;
+
+    assert(s->files);
+
+    index = be32_to_cpu(s->files->count);
+    assert(index < FW_CFG_FILE_SLOTS);
+
+    for (i = 0; i < index; i++) {
+        if (strcmp(filename, s->files->f[i].name) == 0) {
+            return fw_cfg_modify_bytes_read(s, FW_CFG_FILE_FIRST + i,
+                                     data, len);
+        }
+    }
+    /* add new one */
+    fw_cfg_add_file_callback(s, filename, NULL, NULL, data, len);
+    return NULL;
+}
+
+static void fw_cfg_machine_reset(void *opaque)
 {
+    void *ptr;
     size_t len;
-    FWCfgState *s = container_of(n, FWCfgState, machine_ready);
+    FWCfgState *s = opaque;
     char *bootindex = get_boot_devices_list(&len, false);
 
-    fw_cfg_add_file(s, "bootorder", (uint8_t*)bootindex, len);
+    ptr = fw_cfg_modify_file(s, "bootorder", (uint8_t *)bootindex, len);
+    g_free(ptr);
 }
 
 FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
@@ -542,9 +584,7 @@ FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
     fw_cfg_bootsplash(s);
     fw_cfg_reboot(s);
 
-    s->machine_ready.notify = fw_cfg_machine_ready;
-    qemu_add_machine_init_done_notifier(&s->machine_ready);
-
+    qemu_register_reset(fw_cfg_machine_reset, s);
     return s;
 }
 
diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
index 72b1549..56e1ed7 100644
--- a/include/hw/nvram/fw_cfg.h
+++ b/include/hw/nvram/fw_cfg.h
@@ -76,6 +76,8 @@ void fw_cfg_add_file(FWCfgState *s, const char *filename, void *data,
 void fw_cfg_add_file_callback(FWCfgState *s, const char *filename,
                               FWCfgReadCallback callback, void *callback_opaque,
                               void *data, size_t len);
+void *fw_cfg_modify_file(FWCfgState *s, const char *filename, void *data,
+                         size_t len);
 FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
                         hwaddr crl_addr, hwaddr data_addr);
 
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v5 4/8] bootindex: delete bootindex when device is removed
  2014-08-04 12:46 [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting arei.gonglei
                   ` (2 preceding siblings ...)
  2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 3/8] fw_cfg: add fw_cfg_machine_reset function arei.gonglei
@ 2014-08-04 12:46 ` arei.gonglei
  2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 5/8] qmp: add set-bootindex command arei.gonglei
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: arei.gonglei @ 2014-08-04 12:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: chenliang88, weidong.huang, mst, aik, hutao, armbru, kraxel,
	akong, agraf, Gonglei, aliguori, gaowanlong, ehabkost,
	luonengjun, peter.huangpeng, hani, stefanha, pbonzini,
	lcapitulino, kwolf, peter.crosthwaite, imammedo, afaerber

From: Gonglei <arei.gonglei@huawei.com>

Device should be removed from global boot list when
it is hot-unplugged.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Chenliang <chenliang88@huawei.com>
---
 hw/core/qdev.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index da1ba48..70294ad 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -972,6 +972,10 @@ static void device_finalize(Object *obj)
     NamedGPIOList *ngl, *next;
 
     DeviceState *dev = DEVICE(obj);
+
+    /* remove device's bootindex from global boot order list */
+    del_boot_device_path(dev);
+
     if (dev->opts) {
         qemu_opts_del(dev->opts);
     }
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v5 5/8] qmp: add set-bootindex command
  2014-08-04 12:46 [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting arei.gonglei
                   ` (3 preceding siblings ...)
  2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 4/8] bootindex: delete bootindex when device is removed arei.gonglei
@ 2014-08-04 12:46 ` arei.gonglei
  2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 6/8] qemu-monitor: HMP set-bootindex wrapper arei.gonglei
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: arei.gonglei @ 2014-08-04 12:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: chenliang88, weidong.huang, mst, aik, hutao, armbru, kraxel,
	akong, agraf, Gonglei, aliguori, gaowanlong, ehabkost,
	luonengjun, peter.huangpeng, hani, stefanha, pbonzini,
	lcapitulino, kwolf, peter.crosthwaite, imammedo, afaerber

From: Gonglei <arei.gonglei@huawei.com>

Adds "set-bootindex id=xx,bootindex=xx,suffix=xx" QMP command.

Example QMP command:
-> { "execute": "set-bootindex",
     "arguments": { "id": "ide0-0-1", "bootindex": 1, "suffix": "/disk@0"}}
<- { "return": {} }

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Chenliang <chenliang88@huawei.com>
---
 qapi-schema.json | 17 +++++++++++++++++
 qmp-commands.hx  | 25 +++++++++++++++++++++++++
 qmp.c            | 17 +++++++++++++++++
 3 files changed, 59 insertions(+)

diff --git a/qapi-schema.json b/qapi-schema.json
index b11aad2..30bd6ad 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1704,6 +1704,23 @@
 { 'command': 'device_del', 'data': {'id': 'str'} }
 
 ##
+# @set-bootindex:
+#
+# set bootindex of a device
+#
+# @id: the name of the device
+# @bootindex: the bootindex of the device
+# @suffix: #optional a suffix of the device
+#
+# Returns: Nothing on success
+#          If @id is not a valid device, DeviceNotFound
+#
+# Since: 2.2
+##
+{ 'command': 'set-bootindex',
+  'data': {'id': 'str', 'bootindex': 'int', '*suffix': 'str'} }
+
+##
 # @DumpGuestMemoryFormat:
 #
 # An enumeration of guest-memory-dump's format.
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 4be4765..19cc3b8 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -330,6 +330,31 @@ Example:
 <- { "return": {} }
 
 EQMP
+    {
+        .name       = "set-bootindex",
+        .args_type  = "id:s,bootindex:l,suffix:s?",
+        .mhandler.cmd_new = qmp_marshal_input_set_bootindex,
+    },
+
+SQMP
+set-bootindex
+-------------
+
+Set bootindex of a device
+
+Arguments:
+
+- "id": the device's ID (json-string)
+- "bootindex": the device's bootindex (json-int)
+- "suffix": the device's suffix in global boot list (json-string, optional)
+
+Example:
+
+-> { "execute": "set-bootindex",
+     "arguments": { "id": "ide0-0-1", "bootindex": 1, "suffix": "/disk@0"}}
+<- { "return": {} }
+
+EQMP
 
     {
         .name       = "send-key",
diff --git a/qmp.c b/qmp.c
index 0d2553a..a375449 100644
--- a/qmp.c
+++ b/qmp.c
@@ -684,6 +684,23 @@ void qmp_object_del(const char *id, Error **errp)
     object_unparent(obj);
 }
 
+void qmp_set_bootindex(const char *id, int64_t bootindex,
+                       bool has_suffix, const char *suffix, Error **errp)
+{
+    DeviceState *dev;
+
+    dev = qdev_find_recursive(sysbus_get_default(), id);
+    if (!dev) {
+        error_set(errp, QERR_DEVICE_NOT_FOUND, id);
+        return;
+    }
+    if (has_suffix) {
+        modify_boot_device_path(bootindex, dev, suffix, errp);
+    } else {
+        modify_boot_device_path(bootindex, dev, NULL, errp);
+    }
+}
+
 MemoryDeviceInfoList *qmp_query_memory_devices(Error **errp)
 {
     MemoryDeviceInfoList *head = NULL;
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v5 6/8] qemu-monitor: HMP set-bootindex wrapper
  2014-08-04 12:46 [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting arei.gonglei
                   ` (4 preceding siblings ...)
  2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 5/8] qmp: add set-bootindex command arei.gonglei
@ 2014-08-04 12:46 ` arei.gonglei
  2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 7/8] qmp: add query-bootindex command arei.gonglei
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: arei.gonglei @ 2014-08-04 12:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: chenliang88, weidong.huang, mst, aik, hutao, armbru, kraxel,
	akong, agraf, Gonglei, aliguori, gaowanlong, ehabkost,
	luonengjun, peter.huangpeng, hani, stefanha, pbonzini,
	lcapitulino, kwolf, peter.crosthwaite, imammedo, afaerber

From: Gonglei <arei.gonglei@huawei.com>

Add HMP set-bootindex wrapper to allow setting
devcie's bootindex via monitor.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Chenliang <chenliang88@huawei.com>
---
 hmp-commands.hx | 15 +++++++++++++++
 hmp.c           | 13 +++++++++++++
 hmp.h           |  1 +
 3 files changed, 29 insertions(+)

diff --git a/hmp-commands.hx b/hmp-commands.hx
index d0943b1..31ef24e 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -688,6 +688,21 @@ Remove device @var{id}.
 ETEXI
 
     {
+        .name       = "set-bootindex",
+        .args_type  = "id:s,bootindex:l,suffix:s?",
+        .params     = "device bootindex [suffix]",
+        .help       = "set bootindex of a device(e.g. set-bootindex disk0 1 '/disk@0')",
+        .mhandler.cmd = hmp_set_bootindex,
+    },
+
+STEXI
+@item set-bootindex @var{id} @var{bootindex}
+@findex set-bootindex
+
+Set bootindex of a device.
+ETEXI
+
+    {
         .name       = "cpu",
         .args_type  = "index:i",
         .params     = "index",
diff --git a/hmp.c b/hmp.c
index 4d1838e..95f7eeb 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1714,3 +1714,16 @@ void hmp_info_memdev(Monitor *mon, const QDict *qdict)
 
     monitor_printf(mon, "\n");
 }
+
+void hmp_set_bootindex(Monitor *mon, const QDict *qdict)
+{
+    Error *err = NULL;
+
+    const char *id = qdict_get_str(qdict, "id");
+    int64_t bootindex = qdict_get_int(qdict, "bootindex");
+    bool has_suffix = qdict_haskey(qdict, "suffix");
+    const char *suffix = qdict_get_try_str(qdict, "suffix");
+
+    qmp_set_bootindex(id, bootindex, has_suffix, suffix, &err);
+    hmp_handle_error(mon, &err);
+}
diff --git a/hmp.h b/hmp.h
index 4fd3c4a..eb2641a 100644
--- a/hmp.h
+++ b/hmp.h
@@ -94,6 +94,7 @@ void hmp_cpu_add(Monitor *mon, const QDict *qdict);
 void hmp_object_add(Monitor *mon, const QDict *qdict);
 void hmp_object_del(Monitor *mon, const QDict *qdict);
 void hmp_info_memdev(Monitor *mon, const QDict *qdict);
+void hmp_set_bootindex(Monitor *mon, const QDict *qdict);
 void object_add_completion(ReadLineState *rs, int nb_args, const char *str);
 void object_del_completion(ReadLineState *rs, int nb_args, const char *str);
 void device_add_completion(ReadLineState *rs, int nb_args, const char *str);
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v5 7/8] qmp: add query-bootindex command
  2014-08-04 12:46 [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting arei.gonglei
                   ` (5 preceding siblings ...)
  2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 6/8] qemu-monitor: HMP set-bootindex wrapper arei.gonglei
@ 2014-08-04 12:46 ` arei.gonglei
  2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 8/8] qemu-monitor: add HMP "info-bootindex" command arei.gonglei
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: arei.gonglei @ 2014-08-04 12:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: chenliang88, weidong.huang, mst, aik, hutao, armbru, kraxel,
	akong, agraf, Gonglei, aliguori, gaowanlong, ehabkost,
	luonengjun, peter.huangpeng, hani, stefanha, pbonzini,
	lcapitulino, kwolf, peter.crosthwaite, imammedo, afaerber

From: Gonglei <arei.gonglei@huawei.com>

Adds "query-bootindex" QMP command.

Example QMP command:

-> { "execute": "query-bootindex"}
<- {
      "return":[
         {
            "id":"ide0-0-0",
            "bootindex":1,
            "suffix":"/disk@0"
         },
         {
            "id":"nic1",
            "bootindex":2,
            "suffix":"/ethernet-phy@0"
         }
      ]
   }

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Chenliang <chenliang88@huawei.com>
---
 qapi-schema.json | 29 +++++++++++++++++++++++++++++
 qmp-commands.hx  | 41 +++++++++++++++++++++++++++++++++++++++++
 vl.c             | 31 +++++++++++++++++++++++++++++++
 3 files changed, 101 insertions(+)

diff --git a/qapi-schema.json b/qapi-schema.json
index 30bd6ad..680cbc5 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1704,6 +1704,33 @@
 { 'command': 'device_del', 'data': {'id': 'str'} }
 
 ##
+# @BootindexInfo:
+#
+# Information about devcie's bootindex.
+#
+# @id: the name of a device owning the bootindex
+#
+# @bootindex: the bootindex number
+#
+# @suffix: the suffix a device's bootindex
+#
+# Since: 2.2
+##
+{ 'type': 'BootindexInfo',
+  'data': {'id': 'str', 'bootindex': 'int', 'suffix': 'str'} }
+
+##
+# @query-bootindex:
+#
+# Returns information about bootindex
+#
+# Returns: a list of @BootindexInfo for existing device
+#
+# Since: 2.2
+##
+{ 'command': 'query-bootindex', 'returns': ['BootindexInfo'] }
+
+##
 # @set-bootindex:
 #
 # set bootindex of a device
@@ -1715,6 +1742,8 @@
 # Returns: Nothing on success
 #          If @id is not a valid device, DeviceNotFound
 #
+# Note: suffix can be gotten by query-bootindex command
+#
 # Since: 2.2
 ##
 { 'command': 'set-bootindex',
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 19cc3b8..6ab9325 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -337,6 +337,47 @@ EQMP
     },
 
 SQMP
+query-bootindex
+---------------
+
+Show VM bootindex information.
+
+The returned value is a json-array of all device configured
+bootindex property. Each bootindex is represented by a json-object.
+
+The bootindex json-object contains the following:
+
+- "id": the name of a device owning the bootindex (json-string)
+- "bootindex": the bootindex number (json-int)
+- "suffix": the suffix a device's bootindex (json-string)
+
+Example:
+
+-> { "execute": "query-bootindex" }
+<- {
+      "return":[
+         {
+            "id":"ide0-0-0",
+            "bootindex":1,
+            "suffix":"/disk@0"
+         },
+         {
+            "id":"nic1",
+            "bootindex":2,
+            "suffix":"/ethernet-phy@0"
+         }
+      ]
+   }
+
+EQMP
+
+    {
+        .name       = "query-bootindex",
+        .args_type  = "",
+        .mhandler.cmd_new = qmp_marshal_input_query_bootindex,
+    },
+
+SQMP
 set-bootindex
 -------------
 
diff --git a/vl.c b/vl.c
index 2424135..b1d8896 100644
--- a/vl.c
+++ b/vl.c
@@ -1219,6 +1219,37 @@ static void restore_boot_order(void *opaque)
     g_free(normal_boot_order);
 }
 
+BootindexInfoList *qmp_query_bootindex(Error **errp)
+{
+    BootindexInfoList *booindex_list = NULL;
+    BootindexInfoList *info;
+    FWBootEntry *i;
+
+    QTAILQ_FOREACH(i, &fw_boot_order, link) {
+        info = g_new0(BootindexInfoList, 1);
+        info->value = g_new0(BootindexInfo, 1);
+
+        if (i->dev->id) {
+            info->value->id = g_strdup(i->dev->id);
+        } else {
+            /* For virtio devices, we should get id from they parent */
+            if (i->dev->parent_bus) {
+                DeviceState *dev = i->dev->parent_bus->parent;
+                info->value->id = g_strdup(dev->id);
+            } else {
+                info->value->id = g_strdup("");
+            }
+        }
+        info->value->bootindex = i->bootindex;
+        info->value->suffix = g_strdup(i->suffix);
+
+        info->next = booindex_list;
+        booindex_list = info;
+    }
+
+    return booindex_list;
+}
+
 void add_boot_device_path(int32_t bootindex, DeviceState *dev,
                           const char *suffix)
 {
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v5 8/8] qemu-monitor: add HMP "info-bootindex" command
  2014-08-04 12:46 [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting arei.gonglei
                   ` (6 preceding siblings ...)
  2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 7/8] qmp: add query-bootindex command arei.gonglei
@ 2014-08-04 12:46 ` arei.gonglei
  2014-08-04 12:53 ` [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting Gonglei (Arei)
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: arei.gonglei @ 2014-08-04 12:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: chenliang88, weidong.huang, mst, aik, hutao, armbru, kraxel,
	akong, agraf, Gonglei, aliguori, gaowanlong, ehabkost,
	luonengjun, peter.huangpeng, hani, stefanha, pbonzini,
	lcapitulino, kwolf, peter.crosthwaite, imammedo, afaerber

From: Gonglei <arei.gonglei@huawei.com>

Add HMP info-bootindex command to getting
devcie's bootindex via monitor.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Chenliang <chenliang88@huawei.com>
---
 hmp-commands.hx |  2 ++
 hmp.c           | 20 ++++++++++++++++++++
 hmp.h           |  1 +
 monitor.c       |  7 +++++++
 4 files changed, 30 insertions(+)

diff --git a/hmp-commands.hx b/hmp-commands.hx
index 31ef24e..bc1b982 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1795,6 +1795,8 @@ show qdev device model list
 show roms
 @item info tpm
 show the TPM device
+@item info bootindex
+show the current VM bootindex information
 @end table
 ETEXI
 
diff --git a/hmp.c b/hmp.c
index 95f7eeb..1688e02 100644
--- a/hmp.c
+++ b/hmp.c
@@ -725,6 +725,26 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)
     qapi_free_TPMInfoList(info_list);
 }
 
+void hmp_info_bootindex(Monitor *mon, const QDict *qdict)
+{
+    BootindexInfoList *bootindex_list, *info;
+
+    bootindex_list = qmp_query_bootindex(NULL);
+    if (!bootindex_list) {
+        monitor_printf(mon, "No bootindex was configured\n");
+        return;
+    }
+
+    monitor_printf(mon, "id \t bootindex \t suffix\n");
+    for (info = bootindex_list; info; info = info->next) {
+        monitor_printf(mon, "\"%s\"\t %"PRId64"\t\"%s\"\n",
+                       info->value->id, info->value->bootindex,
+                       info->value->suffix);
+    }
+
+    qapi_free_BootindexInfoList(bootindex_list);
+}
+
 void hmp_quit(Monitor *mon, const QDict *qdict)
 {
     monitor_suspend(mon);
diff --git a/hmp.h b/hmp.h
index eb2641a..5899537 100644
--- a/hmp.h
+++ b/hmp.h
@@ -38,6 +38,7 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict);
 void hmp_info_pci(Monitor *mon, const QDict *qdict);
 void hmp_info_block_jobs(Monitor *mon, const QDict *qdict);
 void hmp_info_tpm(Monitor *mon, const QDict *qdict);
+void hmp_info_bootindex(Monitor *mon, const QDict *qdict);
 void hmp_quit(Monitor *mon, const QDict *qdict);
 void hmp_stop(Monitor *mon, const QDict *qdict);
 void hmp_system_reset(Monitor *mon, const QDict *qdict);
diff --git a/monitor.c b/monitor.c
index 5bc70a6..8158ddb 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2918,6 +2918,13 @@ static mon_cmd_t info_cmds[] = {
         .mhandler.cmd = hmp_info_memdev,
     },
     {
+        .name       = "bootindex",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show the current VM bootindex information",
+        .mhandler.cmd = hmp_info_bootindex,
+    },
+    {
         .name       = NULL,
     },
 };
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting
  2014-08-04 12:46 [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting arei.gonglei
                   ` (7 preceding siblings ...)
  2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 8/8] qemu-monitor: add HMP "info-bootindex" command arei.gonglei
@ 2014-08-04 12:53 ` Gonglei (Arei)
  2014-08-07 11:50 ` Gonglei (Arei)
  2014-08-26  6:36 ` Gerd Hoffmann
  10 siblings, 0 replies; 20+ messages in thread
From: Gonglei (Arei) @ 2014-08-04 12:53 UTC (permalink / raw)
  To: Gonglei (Arei), qemu-devel
  Cc: chenliang (T), Huangweidong (C),
	mst, aik, hutao, armbru, kraxel, akong, agraf, aliguori,
	gaowanlong, Eduardo Habkost, Luonengjun, Huangpeng (Peter),
	hani, stefanha, pbonzini, lcapitulino, kwolf, peter.crosthwaite,
	imammedo, afaerber

Hi, 

I' am so sorry for missing cc'ed Eduardo.

Best regards,
-Gonglei

> -----Original Message-----
> From: Gonglei (Arei)
> Sent: Monday, August 04, 2014 8:46 PM
> To: qemu-devel@nongnu.org
> Subject: [PATCH v5 0/8] modify boot order of guest, and take effect after
> rebooting
> 
> From: Gonglei <arei.gonglei@huawei.com>
> 
> Sometimes, we want to modify boot order of a guest, but no need to
> shutdown it. We can call dynamic changing bootindex of a guest, which
> can be assured taking effect just after the guest rebooting.
> 
> For example, in P2V scene, we boot a guest and then attach a
> new system disk, for copying some thing. We want to assign the
> new disk as the booting disk, which means its bootindex=1.
> 
> Different nics can be assigen different bootindex dynamically
> also make sense.
> 
> The patchsets add one qmp interface, and add an fw_cfg_machine_reset()
> to achieve it.
> 
> Steps of testing:
> 
> ./qemu-system-x86_64 -enable-kvm -m 4096 -smp 4 -name redhat6.2 -drive \
> file=/home/redhat6.2.img,if=none,id=drive-ide0-0-0 \
> -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
> -drive file=/home/RH-DVD1.iso,if=none,id=drive-ide0-0-1 \
> -device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1,bootindex=4 \
> -vnc 0.0.0.0:10 -netdev type=user,id=net0 \
> -device virtio-net-pci,netdev=net0,bootindex=3,id=nic1 \
> -netdev type=user,id=net1 -device e1000,netdev=net1,bootindex=2,id=nic2 \
> -drive file=/home/virtio-disk.vfd,if=none,id=drive-fdc0-0-0,format=raw \
> -device isa-fdc,driveA=drive-fdc0-0-0,id=floppy1,bootindexA=5 -monitor stdio
> QEMU 2.0.93 monitor - type 'help' for more information
> (qemu) info bootindex
> id       bootindex       suffix
> "floppy1"        5      "/floppy@0"
> "ide0-0-1"       4      "/disk@1"
> "nic1"   3      "/ethernet-phy@0"
> "nic2"   2      "/ethernet-phy@0"
> "ide0-0-0"       1      "/disk@0"
> (qemu) set-bootindex ide0-0-1 1
> The bootindex 1 has already been used
> (qemu) set-bootindex ide0-0-1 6 "/disk@1"
> (qemu) set-bootindex ide0-0-1 0
> (qemu) system_reset
> (qemu) set-bootindex ide0-0-1 1
> The bootindex 1 has already been used
> (qemu) set-bootindex nic1 0
> The bootindex 0 has already been used
> (qemu) set-bootindex ide0-0-1 -1
> (qemu) set-bootindex nic1 0
> (qemu) info bootindex
> id       bootindex       suffix
> "floppy1"        5      "/floppy@0"
> "nic2"   2      "/ethernet-phy@0"
> "ide0-0-0"       1      "/disk@0"
> "nic1"   0      "/ethernet-phy@0"
> (qemu) system_reset
> (qemu)
> 
> 
> Changes since v4:
>  - using error_setg() instead of qerror_report() in patch 1/8.
>  - call del_boot_device_path() from device_finalize() instead
>   of placing it into each individual device in patch 4/8.
> 
> Changes since v3:
>  - rework del_* and modify_* function, because of virtio devices' specialation.
>    For example, virtio-net's id is NULL, and its parent virtio-net-pci's id was
> assigned.
>    Though the global fw_boot_order stored the virtio-net device.
>  - call dell_boot_device_path in each individual device avoiding waste resouce.
>  - introduce qmp "query-bootindex" command
>  - introcude hmp "info bootindex" command
>  - Fixes by Eric's reviewing comments, thanks.
> 
> Changes since v2:
>  *address Gerd's reviewing suggestion:
>  - use the old entry's suffix, if the caller do not pass it in.
>  - call del_boot_device_path() from device_finalize() instead
>    of placing it into each individual device.
> 
>   Thanks Gerd.
> 
> Changes since v1:
>  *rework by Gerd's suggestion:
>  - split modify and del fw_boot_order for single function.
>  - change modify bootindex's realization which simply lookup
>    the device and modify the bootindex. if the new bootindex
>    has already used by another device just throw an error.
>  - change to del_boot_device_path(DeviceState *dev) and simply delete all
>    entries belonging to the device.
> 
> Gonglei (8):
>   bootindex: add modify_boot_device_path function
>   bootindex: add del_boot_device_path function
>   fw_cfg: add fw_cfg_machine_reset function
>   bootindex: delete bootindex when device is removed
>   qmp: add set-bootindex command
>   qemu-monitor: HMP set-bootindex wrapper
>   qmp: add query-bootindex command
>   qemu-monitor: add HMP "info-bootindex" command
> 
>  hmp-commands.hx           |  17 +++++++
>  hmp.c                     |  33 +++++++++++++
>  hmp.h                     |   2 +
>  hw/core/qdev.c            |   4 ++
>  hw/nvram/fw_cfg.c         |  54 ++++++++++++++++++---
>  include/hw/nvram/fw_cfg.h |   2 +
>  include/sysemu/sysemu.h   |   3 ++
>  monitor.c                 |   7 +++
>  qapi-schema.json          |  46 ++++++++++++++++++
>  qmp-commands.hx           |  66 ++++++++++++++++++++++++++
>  qmp.c                     |  17 +++++++
>  vl.c                      | 117
> ++++++++++++++++++++++++++++++++++++++++++++++
>  12 files changed, 361 insertions(+), 7 deletions(-)
> 
> --
> 1.7.12.4
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting
  2014-08-04 12:46 [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting arei.gonglei
                   ` (8 preceding siblings ...)
  2014-08-04 12:53 ` [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting Gonglei (Arei)
@ 2014-08-07 11:50 ` Gonglei (Arei)
  2014-08-07 12:57   ` Paolo Bonzini
  2014-08-26  6:36 ` Gerd Hoffmann
  10 siblings, 1 reply; 20+ messages in thread
From: Gonglei (Arei) @ 2014-08-07 11:50 UTC (permalink / raw)
  To: Gonglei (Arei), qemu-devel
  Cc: chenliang (T), Huangweidong (C),
	mst, aik, hutao, armbru, kraxel, akong, peter.maydell, agraf,
	aliguori, gaowanlong, Eduardo Habkost, Luonengjun,
	Huangpeng (Peter),
	hani, stefanha, pbonzini, lcapitulino, kwolf, peter.crosthwaite,
	imammedo, afaerber

Hi,

Ping... please. 

TBH, I am confused which maintainer can maintain the patch serials about bootindex.

Gerd is seemingly not in maillist later two weeks.

Markus? Paolo? MST? PMM? Eduardo? Thanks for any help.

Best regards,
-Gonglei


> -----Original Message-----
> From: Gonglei (Arei)
> Sent: Monday, August 04, 2014 8:46 PM
> To: qemu-devel@nongnu.org
> Cc: aliguori@amazon.com; mst@redhat.com; pbonzini@redhat.com;
> akong@redhat.com; hutao@cn.fujitsu.com; ehabkost@redhat.com;
> gaowanlong@cn.fujitsu.com; eblake@redhat.com; afaerber@suse.de;
> armbru@redhat.com; imammedo@redhat.com; aik@ozlabs.ru;
> kraxel@redhat.com; peter.crosthwaite@xilinx.com; lcapitulino@redhat.com;
> hani@linux.com; stefanha@redhat.com; agraf@suse.de; chenliang (T);
> Huangweidong (C); Luonengjun; Huangpeng (Peter); kwolf@redhat.com;
> Gonglei (Arei)
> Subject: [PATCH v5 0/8] modify boot order of guest, and take effect after
> rebooting
> 
> From: Gonglei <arei.gonglei@huawei.com>
> 
> Sometimes, we want to modify boot order of a guest, but no need to
> shutdown it. We can call dynamic changing bootindex of a guest, which
> can be assured taking effect just after the guest rebooting.
> 
> For example, in P2V scene, we boot a guest and then attach a
> new system disk, for copying some thing. We want to assign the
> new disk as the booting disk, which means its bootindex=1.
> 
> Different nics can be assigen different bootindex dynamically
> also make sense.
> 
> The patchsets add one qmp interface, and add an fw_cfg_machine_reset()
> to achieve it.
> 
> Steps of testing:
> 
> ./qemu-system-x86_64 -enable-kvm -m 4096 -smp 4 -name redhat6.2 -drive \
> file=/home/redhat6.2.img,if=none,id=drive-ide0-0-0 \
> -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
> -drive file=/home/RH-DVD1.iso,if=none,id=drive-ide0-0-1 \
> -device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1,bootindex=4 \
> -vnc 0.0.0.0:10 -netdev type=user,id=net0 \
> -device virtio-net-pci,netdev=net0,bootindex=3,id=nic1 \
> -netdev type=user,id=net1 -device e1000,netdev=net1,bootindex=2,id=nic2 \
> -drive file=/home/virtio-disk.vfd,if=none,id=drive-fdc0-0-0,format=raw \
> -device isa-fdc,driveA=drive-fdc0-0-0,id=floppy1,bootindexA=5 -monitor stdio
> QEMU 2.0.93 monitor - type 'help' for more information
> (qemu) info bootindex
> id       bootindex       suffix
> "floppy1"        5      "/floppy@0"
> "ide0-0-1"       4      "/disk@1"
> "nic1"   3      "/ethernet-phy@0"
> "nic2"   2      "/ethernet-phy@0"
> "ide0-0-0"       1      "/disk@0"
> (qemu) set-bootindex ide0-0-1 1
> The bootindex 1 has already been used
> (qemu) set-bootindex ide0-0-1 6 "/disk@1"
> (qemu) set-bootindex ide0-0-1 0
> (qemu) system_reset
> (qemu) set-bootindex ide0-0-1 1
> The bootindex 1 has already been used
> (qemu) set-bootindex nic1 0
> The bootindex 0 has already been used
> (qemu) set-bootindex ide0-0-1 -1
> (qemu) set-bootindex nic1 0
> (qemu) info bootindex
> id       bootindex       suffix
> "floppy1"        5      "/floppy@0"
> "nic2"   2      "/ethernet-phy@0"
> "ide0-0-0"       1      "/disk@0"
> "nic1"   0      "/ethernet-phy@0"
> (qemu) system_reset
> (qemu)
> 
> 
> Changes since v4:
>  - using error_setg() instead of qerror_report() in patch 1/8.
>  - call del_boot_device_path() from device_finalize() instead
>   of placing it into each individual device in patch 4/8.
> 
> Changes since v3:
>  - rework del_* and modify_* function, because of virtio devices' specialation.
>    For example, virtio-net's id is NULL, and its parent virtio-net-pci's id was
> assigned.
>    Though the global fw_boot_order stored the virtio-net device.
>  - call dell_boot_device_path in each individual device avoiding waste resouce.
>  - introduce qmp "query-bootindex" command
>  - introcude hmp "info bootindex" command
>  - Fixes by Eric's reviewing comments, thanks.
> 
> Changes since v2:
>  *address Gerd's reviewing suggestion:
>  - use the old entry's suffix, if the caller do not pass it in.
>  - call del_boot_device_path() from device_finalize() instead
>    of placing it into each individual device.
> 
>   Thanks Gerd.
> 
> Changes since v1:
>  *rework by Gerd's suggestion:
>  - split modify and del fw_boot_order for single function.
>  - change modify bootindex's realization which simply lookup
>    the device and modify the bootindex. if the new bootindex
>    has already used by another device just throw an error.
>  - change to del_boot_device_path(DeviceState *dev) and simply delete all
>    entries belonging to the device.
> 
> Gonglei (8):
>   bootindex: add modify_boot_device_path function
>   bootindex: add del_boot_device_path function
>   fw_cfg: add fw_cfg_machine_reset function
>   bootindex: delete bootindex when device is removed
>   qmp: add set-bootindex command
>   qemu-monitor: HMP set-bootindex wrapper
>   qmp: add query-bootindex command
>   qemu-monitor: add HMP "info-bootindex" command
> 
>  hmp-commands.hx           |  17 +++++++
>  hmp.c                     |  33 +++++++++++++
>  hmp.h                     |   2 +
>  hw/core/qdev.c            |   4 ++
>  hw/nvram/fw_cfg.c         |  54 ++++++++++++++++++---
>  include/hw/nvram/fw_cfg.h |   2 +
>  include/sysemu/sysemu.h   |   3 ++
>  monitor.c                 |   7 +++
>  qapi-schema.json          |  46 ++++++++++++++++++
>  qmp-commands.hx           |  66 ++++++++++++++++++++++++++
>  qmp.c                     |  17 +++++++
>  vl.c                      | 117
> ++++++++++++++++++++++++++++++++++++++++++++++
>  12 files changed, 361 insertions(+), 7 deletions(-)
> 
> --
> 1.7.12.4
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting
  2014-08-07 11:50 ` Gonglei (Arei)
@ 2014-08-07 12:57   ` Paolo Bonzini
  2014-08-07 13:01     ` Gonglei (Arei)
  0 siblings, 1 reply; 20+ messages in thread
From: Paolo Bonzini @ 2014-08-07 12:57 UTC (permalink / raw)
  To: Gonglei (Arei), qemu-devel
  Cc: chenliang (T), Huangweidong (C),
	mst, aik, hutao, armbru, kraxel, akong, peter.maydell, agraf,
	aliguori, gaowanlong, ehabkost, Luonengjun, Huangpeng (Peter),
	hani, stefanha, lcapitulino, kwolf, peter.crosthwaite, imammedo,
	afaerber

Il 07/08/2014 13:50, Gonglei (Arei) ha scritto:
> Hi,
> 
> Ping... please. 
> 
> TBH, I am confused which maintainer can maintain the patch serials about bootindex.
> 
> Gerd is seemingly not in maillist later two weeks.
> 
> Markus? Paolo? MST? PMM? Eduardo? Thanks for any help.

Gerd is on holiday, sorry.  I've left the patch review to him so far, so
I'd rather wait for him to come back.

Paolo

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting
  2014-08-07 12:57   ` Paolo Bonzini
@ 2014-08-07 13:01     ` Gonglei (Arei)
  0 siblings, 0 replies; 20+ messages in thread
From: Gonglei (Arei) @ 2014-08-07 13:01 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel
  Cc: chenliang (T), Huangweidong (C),
	mst, aik, hutao, armbru, kraxel, akong, peter.maydell, agraf,
	aliguori, gaowanlong, ehabkost, Luonengjun, Huangpeng (Peter),
	hani, stefanha, lcapitulino, kwolf, peter.crosthwaite, imammedo,
	afaerber

> Subject: Re: [PATCH v5 0/8] modify boot order of guest, and take effect after
> rebooting
> 
> Il 07/08/2014 13:50, Gonglei (Arei) ha scritto:
> > Hi,
> >
> > Ping... please.
> >
> > TBH, I am confused which maintainer can maintain the patch serials about
> bootindex.
> >
> > Gerd is seemingly not in maillist later two weeks.
> >
> > Markus? Paolo? MST? PMM? Eduardo? Thanks for any help.
> 
> Gerd is on holiday, sorry.  I've left the patch review to him so far, so
> I'd rather wait for him to come back.
> 
> Paolo

OK, Thanks! Paolo.

Best regards,
-Gonglei

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting
  2014-08-04 12:46 [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting arei.gonglei
                   ` (9 preceding siblings ...)
  2014-08-07 11:50 ` Gonglei (Arei)
@ 2014-08-26  6:36 ` Gerd Hoffmann
  2014-08-26  9:07   ` Gonglei (Arei)
  10 siblings, 1 reply; 20+ messages in thread
From: Gerd Hoffmann @ 2014-08-26  6:36 UTC (permalink / raw)
  To: arei.gonglei
  Cc: chenliang88, weidong.huang, mst, aik, hutao, qemu-devel, armbru,
	akong, agraf, aliguori, gaowanlong, ehabkost, luonengjun,
	peter.huangpeng, hani, stefanha, pbonzini, lcapitulino, kwolf,
	peter.crosthwaite, imammedo, afaerber

> The patchsets add one qmp interface, and add an fw_cfg_machine_reset()
> to achieve it.

> (qemu) set-bootindex ide0-0-1 1
> The bootindex 1 has already been used

What happened to the idea to use qom-set instead?  I liked that
suggestion.  Solves the suffix issue in a nice way.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting
  2014-08-26  6:36 ` Gerd Hoffmann
@ 2014-08-26  9:07   ` Gonglei (Arei)
  2014-08-26 10:00     ` Gerd Hoffmann
  0 siblings, 1 reply; 20+ messages in thread
From: Gonglei (Arei) @ 2014-08-26  9:07 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: chenliang (T), Huangweidong (C),
	mst, aik, hutao, qemu-devel, armbru, akong, agraf, aliguori,
	gaowanlong, ehabkost, Luonengjun, Huangpeng (Peter),
	hani, stefanha, pbonzini, lcapitulino, kwolf, peter.crosthwaite,
	imammedo, afaerber

Hi, Gerd

 Nice to meet you again in maillist. :)

> -----Original Message-----
> From: Gerd Hoffmann [mailto:kraxel@redhat.com]
> Sent: Tuesday, August 26, 2014 2:36 PM
> Subject: Re: [PATCH v5 0/8] modify boot order of guest, and take effect after
> rebooting
> 
> > The patchsets add one qmp interface, and add an fw_cfg_machine_reset()
> > to achieve it.
> 
> > (qemu) set-bootindex ide0-0-1 1
> > The bootindex 1 has already been used
> 
> What happened to the idea to use qom-set instead?  I liked that
> suggestion.  Solves the suffix issue in a nice way.
> 
I have discussed with Makus about qom-set in pervious confabulation.
The main problem is that qom-set's function is simple, which just change
a device's property value, but not can do any other logic. In my case,
I should change global fw_boot_orde for devices's bootindex taking effect.

Please see the details as below, thanks a lot!

http://thread.gmane.org/gmane.comp.emulators.qemu/287636

Best regards,
-Gonglei

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting
  2014-08-26  9:07   ` Gonglei (Arei)
@ 2014-08-26 10:00     ` Gerd Hoffmann
  2014-08-26 11:24       ` Markus Armbruster
  0 siblings, 1 reply; 20+ messages in thread
From: Gerd Hoffmann @ 2014-08-26 10:00 UTC (permalink / raw)
  To: Gonglei (Arei)
  Cc: chenliang (T), Huangweidong (C),
	mst, aik, hutao, qemu-devel, armbru, akong, agraf, aliguori,
	gaowanlong, ehabkost, Luonengjun, Huangpeng (Peter),
	hani, stefanha, pbonzini, lcapitulino, kwolf, peter.crosthwaite,
	imammedo, afaerber

On Di, 2014-08-26 at 09:07 +0000, Gonglei (Arei) wrote:
> Hi, Gerd
> 
>  Nice to meet you again in maillist. :)
> 
> > -----Original Message-----
> > From: Gerd Hoffmann [mailto:kraxel@redhat.com]
> > Sent: Tuesday, August 26, 2014 2:36 PM
> > Subject: Re: [PATCH v5 0/8] modify boot order of guest, and take effect after
> > rebooting
> > 
> > > The patchsets add one qmp interface, and add an fw_cfg_machine_reset()
> > > to achieve it.
> > 
> > > (qemu) set-bootindex ide0-0-1 1
> > > The bootindex 1 has already been used
> > 
> > What happened to the idea to use qom-set instead?  I liked that
> > suggestion.  Solves the suffix issue in a nice way.
> > 
> I have discussed with Makus about qom-set in pervious confabulation.
> The main problem is that qom-set's function is simple, which just change
> a device's property value, but not can do any other logic. In my case,
> I should change global fw_boot_orde for devices's bootindex taking effect.

Two options (also mentioned in the thread):

  (1) Set/update bootindex on reset instead of realize/init.
  (2) Switch the property from qdev to qom, then use the set
      callback to also update the fw_cfg file.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting
  2014-08-26 10:00     ` Gerd Hoffmann
@ 2014-08-26 11:24       ` Markus Armbruster
  2014-08-27  2:11         ` Gonglei (Arei)
  0 siblings, 1 reply; 20+ messages in thread
From: Markus Armbruster @ 2014-08-26 11:24 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: chenliang (T), Huangweidong (C),
	mst, aik, hutao, qemu-devel, lcapitulino, akong, agraf,
	Gonglei (Arei),
	aliguori, gaowanlong, ehabkost, Luonengjun, Huangpeng (Peter),
	hani, stefanha, pbonzini, kwolf, peter.crosthwaite,
	afaerber@suse.de, imammedo

Gerd Hoffmann <kraxel@redhat.com> writes:

> On Di, 2014-08-26 at 09:07 +0000, Gonglei (Arei) wrote:
>> Hi, Gerd
>> 
>>  Nice to meet you again in maillist. :)
>> 
>> > -----Original Message-----
>> > From: Gerd Hoffmann [mailto:kraxel@redhat.com]
>> > Sent: Tuesday, August 26, 2014 2:36 PM
>> > Subject: Re: [PATCH v5 0/8] modify boot order of guest, and take effect after
>> > rebooting
>> > 
>> > > The patchsets add one qmp interface, and add an fw_cfg_machine_reset()
>> > > to achieve it.
>> > 
>> > > (qemu) set-bootindex ide0-0-1 1
>> > > The bootindex 1 has already been used
>> > 
>> > What happened to the idea to use qom-set instead?  I liked that
>> > suggestion.  Solves the suffix issue in a nice way.
>> > 
>> I have discussed with Makus about qom-set in pervious confabulation.
>> The main problem is that qom-set's function is simple, which just change
>> a device's property value, but not can do any other logic. In my case,
>> I should change global fw_boot_orde for devices's bootindex taking effect.
>
> Two options (also mentioned in the thread):
>
>   (1) Set/update bootindex on reset instead of realize/init.
>   (2) Switch the property from qdev to qom, then use the set
>       callback to also update the fw_cfg file.

Yes, please.  Even if it should make the implementation a bit more
complex.  Avoiding new ways to name things in external interfaces, such
as the suffix here, is worth some complication.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting
  2014-08-26 11:24       ` Markus Armbruster
@ 2014-08-27  2:11         ` Gonglei (Arei)
  2014-08-27 14:23           ` Gerd Hoffmann
  0 siblings, 1 reply; 20+ messages in thread
From: Gonglei (Arei) @ 2014-08-27  2:11 UTC (permalink / raw)
  To: Markus Armbruster, Gerd Hoffmann
  Cc: kwolf, chenliang (T), peter.crosthwaite, Huangweidong (C),
	ehabkost, afaerber@suse.de, mst, aik, hutao, Luonengjun,
	qemu-devel, agraf, hani, aliguori, imammedo, lcapitulino,
	pbonzini, Huangpeng (Peter),
	akong, stefanha, gaowanlong

> From: Markus Armbruster [mailto:armbru@redhat.com]
> Sent: Tuesday, August 26, 2014 7:25 PM
> Subject: Re: [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take
> effect after rebooting
> 
> Gerd Hoffmann <kraxel@redhat.com> writes:
> 
> > On Di, 2014-08-26 at 09:07 +0000, Gonglei (Arei) wrote:
> >> Hi, Gerd
> >>
> >>  Nice to meet you again in maillist. :)
> >>
> >> > -----Original Message-----
> >> > From: Gerd Hoffmann [mailto:kraxel@redhat.com]
> >> > Sent: Tuesday, August 26, 2014 2:36 PM
> >> > Subject: Re: [PATCH v5 0/8] modify boot order of guest, and take effect
> after
> >> > rebooting
> >> >
> >> > > The patchsets add one qmp interface, and add an
> fw_cfg_machine_reset()
> >> > > to achieve it.
> >> >
> >> > > (qemu) set-bootindex ide0-0-1 1
> >> > > The bootindex 1 has already been used
> >> >
> >> > What happened to the idea to use qom-set instead?  I liked that
> >> > suggestion.  Solves the suffix issue in a nice way.
> >> >
> >> I have discussed with Makus about qom-set in pervious confabulation.
> >> The main problem is that qom-set's function is simple, which just change
> >> a device's property value, but not can do any other logic. In my case,
> >> I should change global fw_boot_orde for devices's bootindex taking effect.
> >
> > Two options (also mentioned in the thread):
> >
> >   (1) Set/update bootindex on reset instead of realize/init.
> >   (2) Switch the property from qdev to qom, then use the set
> >       callback to also update the fw_cfg file.
> 
> Yes, please.  Even if it should make the implementation a bit more
> complex.  Avoiding new ways to name things in external interfaces, such
> as the suffix here, is worth some complication.

OK, thanks, guys. I will work for this. 

And I have two questions:

1. Does have ready-to-wear interface to get QOM path by qdev id,?
2. Can I make bootindex property in QDEV coexist with in QOM? I think this meathod
will be good for compatibility with previous. 

Thanks for any suggestions!

Best regards,
-Gonglei

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting
  2014-08-27  2:11         ` Gonglei (Arei)
@ 2014-08-27 14:23           ` Gerd Hoffmann
  2014-08-28  4:50             ` Gonglei (Arei)
  0 siblings, 1 reply; 20+ messages in thread
From: Gerd Hoffmann @ 2014-08-27 14:23 UTC (permalink / raw)
  To: Gonglei (Arei)
  Cc: chenliang (T), Huangweidong (C),
	mst, aik, hutao, qemu-devel, agraf, akong, Markus Armbruster,
	aliguori, gaowanlong, ehabkost, Luonengjun, Huangpeng (Peter),
	hani, stefanha, pbonzini, lcapitulino, kwolf, peter.crosthwaite,
	afaerber@suse.de, imammedo

  Hi,

> 1. Does have ready-to-wear interface to get QOM path by qdev id,?

You can simply use the id directly.  Try this:

qemu-system-x86_64 \
   -qmp unix:/tmp/qmp,server,nowait \
   -device virtio-scsi-pci,id=scsi \
   -drive if=none,id=cdrom,media=cdrom \
   -device scsi-cd,id=testcd,drive=cdrom &

export QMP_SOCKET=/tmp/qmp
scripts/qmp/qom-list testcd
scripts/qmp/qom-get testcd.bootindex

Builtin devices without ID are a bit more tricky.  But you can also
reference busses by name, which simplifies it a bit.  Floppy for example
is here:

scripts/qmp/qom-list isa.0/child[11]

[ Side note: The full path for this one is 
  "/machine/i440fx/pci.0/child[1]/isa.0/child[11]" ]

I have my doubts that "11" is guaranteed to be stable.  But you can walk
all isa.0 children and check the type this way to figure:

scripts/qmp/qom-get isa.0/child[11].type

> 2. Can I make bootindex property in QDEV coexist with in QOM? I think this meathod
> will be good for compatibility with previous. 

qdev properties are just some compatibility fluff around qom properties
these days.  You can remove the qdev property, add a qom property with
the same name and things will continue to work just fine.  And you now
can use qom features which are not supported by the qdev property
compatibility bits.

HTH,
  Gerd

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting
  2014-08-27 14:23           ` Gerd Hoffmann
@ 2014-08-28  4:50             ` Gonglei (Arei)
  0 siblings, 0 replies; 20+ messages in thread
From: Gonglei (Arei) @ 2014-08-28  4:50 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: chenliang (T), Huangweidong (C),
	mst, aik, hutao, qemu-devel, agraf, akong, Markus Armbruster,
	aliguori, gaowanlong, ehabkost, Luonengjun, Huangpeng (Peter),
	hani, stefanha, pbonzini, lcapitulino, kwolf, peter.crosthwaite,
	imammedo, afaerber

> From: Gerd Hoffmann [mailto:kraxel@redhat.com]
> Subject: Re: [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take
> effect after rebooting
> 
>   Hi,
> 
> > 1. Does have ready-to-wear interface to get QOM path by qdev id,?
> 
> You can simply use the id directly.  Try this:
> 
> qemu-system-x86_64 \
>    -qmp unix:/tmp/qmp,server,nowait \
>    -device virtio-scsi-pci,id=scsi \
>    -drive if=none,id=cdrom,media=cdrom \
>    -device scsi-cd,id=testcd,drive=cdrom &
> 
> export QMP_SOCKET=/tmp/qmp
> scripts/qmp/qom-list testcd
> scripts/qmp/qom-get testcd.bootindex
> 
> Builtin devices without ID are a bit more tricky.  But you can also
> reference busses by name, which simplifies it a bit.  Floppy for example
> is here:
> 
> scripts/qmp/qom-list isa.0/child[11]
> 
> [ Side note: The full path for this one is
>   "/machine/i440fx/pci.0/child[1]/isa.0/child[11]" ]
> 
> I have my doubts that "11" is guaranteed to be stable.  But you can walk
> all isa.0 children and check the type this way to figure:
> 
> scripts/qmp/qom-get isa.0/child[11].type
> 
OK. Thanks.

> > 2. Can I make bootindex property in QDEV coexist with in QOM? I think this
> meathod
> > will be good for compatibility with previous.
> 
> qdev properties are just some compatibility fluff around qom properties
> these days.  You can remove the qdev property, add a qom property with
> the same name and things will continue to work just fine.  And you now
> can use qom features which are not supported by the qdev property
> compatibility bits.
> 
OK, understood. This maybe a prodigious project, but I will try my best.

BTW, I found an issue that qom-set can only handle string type property:

#./qom-set nic1.realized false
Traceback (most recent call last):
  File "./qom-set", line 64, in <module>
    print srv.command('qom-set', path=path, property=prop, value=sys.argv[2])
  File "/mnt/sdb/gonglei/qemu.git/qemu/scripts/qmp/qmp.py", line 136, in command
    raise Exception(ret['error']['desc'])
Exception: Invalid parameter type for 'realized', expected: Boolean

I will post a patch fix this using Paolo's generic string parsing/printing functions.

Best regards,
-Gonglei


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2014-08-28  4:50 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-04 12:46 [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting arei.gonglei
2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 1/8] bootindex: add modify_boot_device_path function arei.gonglei
2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 2/8] bootindex: add del_boot_device_path function arei.gonglei
2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 3/8] fw_cfg: add fw_cfg_machine_reset function arei.gonglei
2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 4/8] bootindex: delete bootindex when device is removed arei.gonglei
2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 5/8] qmp: add set-bootindex command arei.gonglei
2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 6/8] qemu-monitor: HMP set-bootindex wrapper arei.gonglei
2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 7/8] qmp: add query-bootindex command arei.gonglei
2014-08-04 12:46 ` [Qemu-devel] [PATCH v5 8/8] qemu-monitor: add HMP "info-bootindex" command arei.gonglei
2014-08-04 12:53 ` [Qemu-devel] [PATCH v5 0/8] modify boot order of guest, and take effect after rebooting Gonglei (Arei)
2014-08-07 11:50 ` Gonglei (Arei)
2014-08-07 12:57   ` Paolo Bonzini
2014-08-07 13:01     ` Gonglei (Arei)
2014-08-26  6:36 ` Gerd Hoffmann
2014-08-26  9:07   ` Gonglei (Arei)
2014-08-26 10:00     ` Gerd Hoffmann
2014-08-26 11:24       ` Markus Armbruster
2014-08-27  2:11         ` Gonglei (Arei)
2014-08-27 14:23           ` Gerd Hoffmann
2014-08-28  4:50             ` Gonglei (Arei)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.